mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 18:57:25 +01:00
mobile: Integrate with server
This commit is contained in:
parent
60a474ea56
commit
c93ebf17a0
20 changed files with 751 additions and 740 deletions
119
mobile/lib/editors/performance.dart
Normal file
119
mobile/lib/editors/performance.dart
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:musicus_database/musicus_database.dart';
|
||||
|
||||
import '../selectors/ensemble.dart';
|
||||
import '../selectors/instruments.dart';
|
||||
import '../selectors/person.dart';
|
||||
|
||||
class PerformanceEditor extends StatefulWidget {
|
||||
final PerformanceInfo performanceInfo;
|
||||
|
||||
PerformanceEditor({
|
||||
this.performanceInfo,
|
||||
});
|
||||
|
||||
@override
|
||||
_PerformanceEditorState createState() => _PerformanceEditorState();
|
||||
}
|
||||
|
||||
class _PerformanceEditorState extends State<PerformanceEditor> {
|
||||
Person person;
|
||||
Ensemble ensemble;
|
||||
Instrument role;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (widget.performanceInfo != null) {
|
||||
person = widget.performanceInfo.person;
|
||||
ensemble = widget.performanceInfo.ensemble;
|
||||
role = widget.performanceInfo.role;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Edit performer'),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text('DONE'),
|
||||
onPressed: () => Navigator.pop(
|
||||
context,
|
||||
PerformanceInfo(
|
||||
person: person,
|
||||
ensemble: ensemble,
|
||||
role: role,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
title: Text('Person'),
|
||||
subtitle: Text(person != null
|
||||
? '${person.firstName} ${person.lastName}'
|
||||
: 'Select person'),
|
||||
onTap: () async {
|
||||
final Person newPerson = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PersonsSelector(),
|
||||
fullscreenDialog: true,
|
||||
),
|
||||
);
|
||||
|
||||
if (newPerson != null) {
|
||||
setState(() {
|
||||
person = newPerson;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('Ensemble'),
|
||||
subtitle: Text(ensemble?.name ?? 'Select ensemble'),
|
||||
onTap: () async {
|
||||
final Ensemble newEnsemble = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => EnsembleSelector(),
|
||||
fullscreenDialog: true,
|
||||
),
|
||||
);
|
||||
|
||||
if (newEnsemble != null) {
|
||||
setState(() {
|
||||
ensemble = newEnsemble;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('Role'),
|
||||
subtitle: Text(role?.name ?? 'Select instrument/role'),
|
||||
onTap: () async {
|
||||
final Instrument newRole = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => InstrumentsSelector(),
|
||||
fullscreenDialog: true,
|
||||
),
|
||||
);
|
||||
|
||||
if (newRole != null) {
|
||||
setState(() {
|
||||
role = newRole;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue