mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 18:57:25 +01:00
This just displays a list of the persons works for now. It can be reached from the home screens list of persons.
41 lines
992 B
Dart
41 lines
992 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../backend.dart';
|
|
import '../database.dart';
|
|
|
|
class PersonScreen extends StatelessWidget {
|
|
final Person person;
|
|
|
|
PersonScreen({
|
|
this.person,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final backend = Backend.of(context);
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('${person.firstName} ${person.lastName}'),
|
|
),
|
|
body: StreamBuilder<List<Work>>(
|
|
stream: backend.db.worksByComposer(person.id).watch(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.hasData) {
|
|
return ListView.builder(
|
|
itemCount: snapshot.data.length,
|
|
itemBuilder: (context, index) {
|
|
final work = snapshot.data[index];
|
|
return ListTile(
|
|
title: Text(work.title),
|
|
);
|
|
},
|
|
);
|
|
} else {
|
|
return Container();
|
|
}
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|