mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
Work editor: Initialize from WorkInfo
This commit is contained in:
parent
97c4359ad9
commit
ea0f7f86aa
3 changed files with 36 additions and 77 deletions
|
|
@ -16,7 +16,7 @@ class PersonScreen extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final backend = Backend.of(context);
|
||||
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('${person.firstName} ${person.lastName}'),
|
||||
|
|
@ -47,14 +47,18 @@ class PersonScreen extends StatelessWidget {
|
|||
final work = snapshot.data[index];
|
||||
return ListTile(
|
||||
title: Text(work.title),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => WorkScreen(
|
||||
work: work,
|
||||
onTap: () async {
|
||||
final workInfo = await backend.db.getWorkInfo(work);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => WorkScreen(
|
||||
workInfo: workInfo,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import '../editors/work.dart';
|
|||
import '../widgets/texts.dart';
|
||||
|
||||
class WorkScreen extends StatelessWidget {
|
||||
final Work work;
|
||||
final WorkInfo workInfo;
|
||||
|
||||
WorkScreen({
|
||||
this.work,
|
||||
this.workInfo,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -18,7 +18,7 @@ class WorkScreen extends StatelessWidget {
|
|||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(work.title),
|
||||
title: Text(workInfo.work.title),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit),
|
||||
|
|
@ -27,7 +27,7 @@ class WorkScreen extends StatelessWidget {
|
|||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => WorkEditor(
|
||||
work: work,
|
||||
workInfo: workInfo,
|
||||
),
|
||||
fullscreenDialog: true,
|
||||
),
|
||||
|
|
@ -37,7 +37,7 @@ class WorkScreen extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
body: StreamBuilder<List<Recording>>(
|
||||
stream: backend.db.recordingsByWork(work.id).watch(),
|
||||
stream: backend.db.recordingsByWork(workInfo.work.id).watch(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return ListView.builder(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue