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>[
// For debugging purposes PopupMenuButton(
body: ListView( icon: const Icon(Icons.more_vert),
children: <Widget>[ itemBuilder: (context) => [
ListTile( PopupMenuItem(
title: Text('Start player'), value: 0,
onTap: backend.startPlayer, child: Text('Start player'),
), ),
ListTile( PopupMenuItem(
title: Text('Play/Pause'), value: 1,
onTap: backend.playPause, child: Text('Add work'),
), ),
ListTile( ],
title: Text('Add work'), onSelected: (selected) {
onTap: () => Navigator.push( if (selected == 0) {
context, backend.startPlayer();
MaterialPageRoute( } else if (selected == 1) {
builder: (context) => WorkEditor(), Navigator.push(
fullscreenDialog: true, context,
)), MaterialPageRoute(
builder: (context) => WorkEditor(),
fullscreenDialog: true,
),
);
}
},
), ),
], ],
), ),
// For debugging purposes
body: Container(),
); );
} }
} }