Drawer for the app with 2 pages/views (?)
This commit is contained in:
parent
ee2b55de42
commit
74f09d84cd
4 changed files with 59 additions and 1 deletions
32
lib/AppDrawer.dart
Normal file
32
lib/AppDrawer.dart
Normal file
|
@ -0,0 +1,32 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppDrawer extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
DrawerHeader(
|
||||
child: Text("Oh That's A ..."),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Month values"),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, "/monthValues");
|
||||
}
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Years"),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, "/years");
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'AppDrawer.dart';
|
||||
|
||||
class MonthValuesPage extends StatelessWidget {
|
||||
final Map<String, int> monthValues = {
|
||||
"January": 0,
|
||||
|
@ -42,6 +44,7 @@ class MonthValuesPage extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
drawer: AppDrawer(),
|
||||
appBar: AppBar(
|
||||
title: Text("Month Values")
|
||||
),
|
||||
|
|
18
lib/YearsPage.dart
Normal file
18
lib/YearsPage.dart
Normal file
|
@ -0,0 +1,18 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'AppDrawer.dart';
|
||||
|
||||
class YearsPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context){
|
||||
return Scaffold(
|
||||
drawer: AppDrawer(),
|
||||
appBar: AppBar(
|
||||
title: Text("Overview"),
|
||||
),
|
||||
body: Center(
|
||||
child: Text("Years page")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:ohthatsa/YearsPage.dart';
|
||||
|
||||
import 'MonthValuesPage.dart';
|
||||
|
||||
|
@ -12,7 +13,11 @@ class OhThatsA extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: "OhThatsA",
|
||||
home: MonthValuesPage()
|
||||
initialRoute: '/monthValues',
|
||||
routes: {
|
||||
'/monthValues': (context) => MonthValuesPage(),
|
||||
'/years': (context) => YearsPage(),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue