musicus_mobile/lib/screens/home.dart

48 lines
1.2 KiB
Dart
Raw Normal View History

2019-12-02 21:05:49 +01:00
import 'package:flutter/material.dart';
import '../backend.dart';
import '../editors/work.dart';
2019-12-02 21:05:49 +01:00
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final backend = Backend.of(context);
return Scaffold(
appBar: AppBar(
title: Text('Musicus'),
2019-12-15 12:11:40 +01:00
actions: <Widget>[
PopupMenuButton(
icon: const Icon(Icons.more_vert),
itemBuilder: (context) => [
PopupMenuItem(
value: 0,
child: Text('Start player'),
),
PopupMenuItem(
value: 1,
child: Text('Add work'),
),
],
onSelected: (selected) {
if (selected == 0) {
backend.startPlayer();
} else if (selected == 1) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WorkEditor(),
fullscreenDialog: true,
),
);
}
},
),
2019-12-02 21:05:49 +01:00
],
),
2019-12-15 12:11:40 +01:00
// For debugging purposes
body: Container(),
2019-12-02 21:05:49 +01:00
);
}
}