mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 18:57:25 +01:00
PerformerSelector: Allow changing the person
This commit is contained in:
parent
9cc0b9020d
commit
02e283b8cc
1 changed files with 27 additions and 8 deletions
|
|
@ -14,6 +14,7 @@ class PerformerSelector extends StatefulWidget {
|
||||||
|
|
||||||
class _PerformerSelectorState extends State<PerformerSelector> {
|
class _PerformerSelectorState extends State<PerformerSelector> {
|
||||||
Role role;
|
Role role;
|
||||||
|
Person person;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -22,6 +23,18 @@ class _PerformerSelectorState extends State<PerformerSelector> {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Select performer'),
|
title: Text('Select performer'),
|
||||||
|
actions: <Widget>[
|
||||||
|
FlatButton(
|
||||||
|
child: Text('DONE'),
|
||||||
|
onPressed: () => Navigator.pop(
|
||||||
|
context,
|
||||||
|
PerformanceModel(
|
||||||
|
person: person,
|
||||||
|
role: role,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|
@ -65,13 +78,17 @@ class _PerformerSelectorState extends State<PerformerSelector> {
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final person = snapshot.data[index];
|
final person = snapshot.data[index];
|
||||||
|
|
||||||
return ListTile(
|
return RadioListTile<Person>(
|
||||||
title: Text('${person.lastName}, ${person.firstName}'),
|
controlAffinity: ListTileControlAffinity.trailing,
|
||||||
onTap: () => Navigator.pop(context, PerformanceModel(
|
title:
|
||||||
person: person,
|
Text('${person.lastName}, ${person.firstName}'),
|
||||||
role: role,
|
value: person,
|
||||||
)),
|
groupValue: this.person,
|
||||||
);
|
onChanged: (newPerson) {
|
||||||
|
setState(() {
|
||||||
|
this.person = newPerson;
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -93,7 +110,9 @@ class _PerformerSelectorState extends State<PerformerSelector> {
|
||||||
));
|
));
|
||||||
|
|
||||||
if (person != null) {
|
if (person != null) {
|
||||||
Navigator.pop(context, person);
|
setState(() {
|
||||||
|
this.person = person;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue