2020-03-21 15:01:51 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2020-06-02 16:47:46 +02:00
|
|
|
import 'package:musicus_client/musicus_client.dart';
|
2020-05-04 21:49:44 +02:00
|
|
|
import 'package:musicus_common/musicus_common.dart';
|
2020-03-21 15:01:51 +01:00
|
|
|
|
|
|
|
|
class WorkScreen extends StatelessWidget {
|
2020-04-26 17:26:19 +02:00
|
|
|
final WorkInfo workInfo;
|
2020-03-21 15:01:51 +01:00
|
|
|
|
|
|
|
|
WorkScreen({
|
2020-04-26 17:26:19 +02:00
|
|
|
this.workInfo,
|
2020-03-21 15:01:51 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-05-04 21:49:44 +02:00
|
|
|
final backend = MusicusBackend.of(context);
|
2020-03-21 15:01:51 +01:00
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
2020-04-26 17:26:19 +02:00
|
|
|
title: Text(workInfo.work.title),
|
2020-03-21 15:01:51 +01:00
|
|
|
),
|
2020-05-03 23:01:16 +02:00
|
|
|
body: PagedListView<RecordingInfo>(
|
|
|
|
|
fetch: (page, _) async {
|
2020-05-04 09:17:27 +02:00
|
|
|
return await backend.db.getRecordings(workInfo.work.id, page);
|
2020-03-21 15:01:51 +01:00
|
|
|
},
|
2020-05-13 21:46:53 +02:00
|
|
|
builder: (context, recordingInfo) {
|
|
|
|
|
final recordingId = recordingInfo.recording.id;
|
2020-05-03 23:01:16 +02:00
|
|
|
|
2020-05-13 21:46:53 +02:00
|
|
|
return ListTile(
|
|
|
|
|
title: PerformancesText(
|
|
|
|
|
performanceInfos: recordingInfo.performances,
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
final tracks = backend.library.tracks[recordingId];
|
|
|
|
|
tracks.sort((t1, t2) => t1.track.index.compareTo(t2.track.index));
|
|
|
|
|
backend.playback.addTracks(tracks);
|
|
|
|
|
},
|
|
|
|
|
onLongPress: () {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) {
|
|
|
|
|
return SimpleDialog(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text('Edit recording'),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pushReplacement(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => RecordingEditor(
|
|
|
|
|
recordingInfo: recordingInfo,
|
|
|
|
|
),
|
|
|
|
|
fullscreenDialog: true,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
2020-03-21 15:01:51 +01:00
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|