Move actions to app bar on home screen

This commit is contained in:
Elias Projahn 2019-12-15 12:11:40 +01:00
parent 047ed8b7c8
commit 7bccfeaec7

View file

@ -11,29 +11,37 @@ class HomeScreen extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Musicus'), title: Text('Musicus'),
actions: <Widget>[
PopupMenuButton(
icon: const Icon(Icons.more_vert),
itemBuilder: (context) => [
PopupMenuItem(
value: 0,
child: Text('Start player'),
), ),
// For debugging purposes PopupMenuItem(
body: ListView( value: 1,
children: <Widget>[ child: Text('Add work'),
ListTile(
title: Text('Start player'),
onTap: backend.startPlayer,
), ),
ListTile( ],
title: Text('Play/Pause'), onSelected: (selected) {
onTap: backend.playPause, if (selected == 0) {
), backend.startPlayer();
ListTile( } else if (selected == 1) {
title: Text('Add work'), Navigator.push(
onTap: () => Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => WorkEditor(), builder: (context) => WorkEditor(),
fullscreenDialog: true, fullscreenDialog: true,
)),
),
],
), ),
); );
} }
},
),
],
),
// For debugging purposes
body: Container(),
);
}
} }