mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 02:37:25 +01:00
common, mobile: Adapt to new work part API
This commit is contained in:
parent
9bd0348f35
commit
813fa2e47a
5 changed files with 83 additions and 76 deletions
|
|
@ -156,8 +156,8 @@ class _TracksEditorState extends State<TracksEditor> {
|
|||
trackModels[i].workPartIndex = null;
|
||||
trackModels[i].workPartTitle = null;
|
||||
} else {
|
||||
trackModels[i].workPartIndex = workInfo.parts[i].work.partIndex;
|
||||
trackModels[i].workPartTitle = workInfo.parts[i].work.title;
|
||||
trackModels[i].workPartIndex = workInfo.parts[i].part.partIndex;
|
||||
trackModels[i].workPartTitle = workInfo.parts[i].part.title;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ class _WorkEditorState extends State<WorkEditor> {
|
|||
|
||||
for (final partInfo in widget.workInfo.parts) {
|
||||
parts.add(PartData(
|
||||
title: partInfo.work.title,
|
||||
title: partInfo.part.title,
|
||||
composer: partInfo.composer,
|
||||
instruments: List.from(partInfo.instruments),
|
||||
));
|
||||
|
|
@ -276,7 +276,7 @@ class _WorkEditorState extends State<WorkEditor> {
|
|||
for (var i = 0; i < parts.length; i++) {
|
||||
final part = parts[i];
|
||||
partInfos.add(PartInfo(
|
||||
work: Work(
|
||||
part: WorkPart(
|
||||
id: generateId(),
|
||||
title: part.titleController.text,
|
||||
composer: part.composer?.id,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:musicus_database/musicus_database.dart';
|
||||
|
||||
import '../backend.dart';
|
||||
|
||||
/// A widget showing information on a list of performances.
|
||||
class PerformancesText extends StatelessWidget {
|
||||
/// The information to show.
|
||||
|
|
@ -38,36 +36,3 @@ class PerformancesText extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
|
||||
class WorkText extends StatelessWidget {
|
||||
final int workId;
|
||||
|
||||
WorkText(this.workId);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final backend = MusicusBackend.of(context);
|
||||
|
||||
return StreamBuilder<Work>(
|
||||
stream: backend.db.workById(workId).watchSingle(),
|
||||
builder: (context, snapshot) => Text(snapshot.data?.title ?? '...'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ComposersText extends StatelessWidget {
|
||||
final int workId;
|
||||
|
||||
ComposersText(this.workId);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final backend = MusicusBackend.of(context);
|
||||
|
||||
return StreamBuilder<List<Person>>(
|
||||
stream: backend.db.composersByWork(workId).watch(),
|
||||
builder: (context, snapshot) => Text(snapshot.hasData
|
||||
? snapshot.data.map((p) => '${p.firstName} ${p.lastName}').join(', ')
|
||||
: '...'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue