mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
mobile: Access editors from context menu
This commit is contained in:
parent
7b63cc7aaf
commit
3af7c23bbc
3 changed files with 88 additions and 43 deletions
|
|
@ -85,6 +85,31 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
onLongPress: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
title: Text('Edit person'),
|
||||||
|
onTap: () async {
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => PersonEditor(
|
||||||
|
person: person,
|
||||||
|
),
|
||||||
|
fullscreenDialog: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -36,22 +36,6 @@ class _PersonScreenState extends State<PersonScreen> {
|
||||||
'Works by ${widget.person.firstName} ${widget.person.lastName}',
|
'Works by ${widget.person.firstName} ${widget.person.lastName}',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.edit),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => PersonEditor(
|
|
||||||
person: widget.person,
|
|
||||||
),
|
|
||||||
fullscreenDialog: true,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
body: PagedListView<WorkInfo>(
|
body: PagedListView<WorkInfo>(
|
||||||
search: _search,
|
search: _search,
|
||||||
|
|
@ -68,6 +52,31 @@ class _PersonScreenState extends State<PersonScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
onLongPress: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
title: Text('Edit work'),
|
||||||
|
onTap: () async {
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => WorkEditor(
|
||||||
|
workInfo: workInfo,
|
||||||
|
),
|
||||||
|
fullscreenDialog: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,37 @@ class WorkScreen extends StatelessWidget {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(workInfo.work.title),
|
title: Text(workInfo.work.title),
|
||||||
actions: <Widget>[
|
),
|
||||||
IconButton(
|
body: PagedListView<RecordingInfo>(
|
||||||
icon: const Icon(Icons.edit),
|
fetch: (page, _) async {
|
||||||
onPressed: () {
|
return await backend.db.getRecordings(workInfo.work.id, page);
|
||||||
Navigator.push(
|
},
|
||||||
|
builder: (context, recordingInfo) {
|
||||||
|
final recordingId = recordingInfo.recording.id;
|
||||||
|
|
||||||
|
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,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => WorkEditor(
|
builder: (context) => RecordingEditor(
|
||||||
workInfo: workInfo,
|
recordingInfo: recordingInfo,
|
||||||
),
|
),
|
||||||
fullscreenDialog: true,
|
fullscreenDialog: true,
|
||||||
),
|
),
|
||||||
|
|
@ -32,23 +54,12 @@ class WorkScreen extends StatelessWidget {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
body: PagedListView<RecordingInfo>(
|
|
||||||
fetch: (page, _) async {
|
|
||||||
return await backend.db.getRecordings(workInfo.work.id, page);
|
|
||||||
},
|
},
|
||||||
builder: (context, recordingInfo) => ListTile(
|
);
|
||||||
title: PerformancesText(
|
},
|
||||||
performanceInfos: recordingInfo.performances,
|
);
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
final tracks = backend.library.tracks[recordingInfo.recording.id];
|
|
||||||
tracks.sort((t1, t2) => t1.track.index.compareTo(t2.track.index));
|
|
||||||
|
|
||||||
backend.playback
|
|
||||||
.addTracks(backend.library.tracks[recordingInfo.recording.id]);
|
|
||||||
},
|
},
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue