From 157d485e3c86231be7815cb199e59f577423fb9f Mon Sep 17 00:00:00 2001 From: Felix Date: Wed, 17 Jul 2019 14:15:10 +0100 Subject: [PATCH] drawer added, trying to fix text alignment --- lib/common/widgets/awesome_drawer.dart | 71 ++++++++++++++++++++++++++ lib/main.dart | 2 + lib/pages/receipt_page.dart | 5 +- lib/pages/stats_page.dart | 5 ++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 lib/common/widgets/awesome_drawer.dart diff --git a/lib/common/widgets/awesome_drawer.dart b/lib/common/widgets/awesome_drawer.dart new file mode 100644 index 0000000..a3bf610 --- /dev/null +++ b/lib/common/widgets/awesome_drawer.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; +import 'dart:io' show Platform; + +class AwesomeDrawer { + + Widget getDrawer(BuildContext context) { + return new Container( + width: 250, + color: Colors.white, +// padding: EdgeInsets.fromLTRB(32, 25, 32, 0), + child: ListView( + children: [ + + Container( + padding: const EdgeInsets.fromLTRB(0, 15, 0, 0), + child : + FlatButton(onPressed: () => Navigator.of(context).pushReplacementNamed("/StatsPage"), + child: + Text("yeehaw", + textAlign: Platform.isIOS ? TextAlign.right : TextAlign.left, + style: new TextStyle( + fontSize: 32.0, + color: Colors.black, + ), + ), + ), + ), + + Container( + padding: const EdgeInsets.fromLTRB(0, 15, 0, 0), + child : + FlatButton(onPressed: () => Navigator.of(context).pushReplacementNamed("/MorePage"), child: + Text("clickity clack", + textAlign: Platform.isIOS ? TextAlign.right : TextAlign.left, + style: new TextStyle( + fontSize: 32.0, + color: Colors.black, + ), + ), + ), + ), + Container( + padding: const EdgeInsets.fromLTRB(0, 15, 0, 0), + child : + FlatButton(onPressed: () => debugPrint("pressed"), child: + Text("scoot scoot", + style: new TextStyle( + fontSize: 32.0, + color: Colors.black, + ), + ), + ), + ), + + Container( + padding: const EdgeInsets.fromLTRB(0, 15, 0, 0), + child : + FlatButton(onPressed: () => debugPrint("pressed"), child: + Text("reeeeeeeeee", + style: new TextStyle( + fontSize: 32.0, + color: Colors.black, + ), + ), + ), + ), + ] + ), + ); +} +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index a4a84be..4f725d6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,6 +5,7 @@ import 'package:local_spend/pages/receipt_page.dart'; import 'package:local_spend/pages/spash_screen.dart'; import 'package:local_spend/pages/more_page.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:local_spend/pages/stats_page.dart'; void main() { runApp(MyApp()); @@ -33,6 +34,7 @@ class MyApp extends StatelessWidget { "/LoginPage": (BuildContext context) => LoginPage(), "/ReceiptPage": (BuildContext context) => ReceiptPage(), "/MorePage": (BuildContext context) => MorePage(), + "/StatsPage" : (BuildContext context) => StatsPage(), }, home: SplashScreen(), ); diff --git a/lib/pages/receipt_page.dart b/lib/pages/receipt_page.dart index 5ec1668..71a188d 100644 --- a/lib/pages/receipt_page.dart +++ b/lib/pages/receipt_page.dart @@ -13,6 +13,7 @@ import 'package:datetime_picker_formfield/datetime_picker_formfield.dart'; import 'package:local_spend/common/apifunctions/find_organisations.dart'; import 'package:local_spend/common/widgets/popupListView.dart'; import 'package:local_spend/common/apifunctions/categories.dart'; +import 'package:local_spend/common/widgets/awesome_drawer.dart'; const URL = "https://flutter.io/"; const demonstration = false; @@ -300,8 +301,10 @@ class ReceiptPageState extends State { @override Widget build(BuildContext context) { + var drawer = new AwesomeDrawer(); return PlatformScaffold( - drawer: Drawer(), + drawer: drawer.getDrawer(context), + appBar: AppBar( automaticallyImplyLeading: !Platform.isIOS, // done to remove UI glitch, now works on both platforms // leading: Drawer(), diff --git a/lib/pages/stats_page.dart b/lib/pages/stats_page.dart index aefe483..68a7171 100644 --- a/lib/pages/stats_page.dart +++ b/lib/pages/stats_page.dart @@ -12,6 +12,7 @@ import 'package:local_spend/common/widgets/charts/grouped_bar_chart.dart'; import 'package:local_spend/common/widgets/charts/scatter_bucketingAxis_legend.dart'; import 'package:local_spend/common/widgets/charts/numeric_line_bar_combo.dart'; import 'package:local_spend/common/widgets/charts/series_legend_with_measures.dart'; +import 'package:local_spend/common/widgets/awesome_drawer.dart'; const URL = "https://flutter.io/"; const demonstration = false; @@ -43,7 +44,11 @@ class StatsPageState extends State { @override Widget build(BuildContext context) { + var drawer = new AwesomeDrawer(); + return PlatformScaffold( + drawer: drawer.getDrawer(context), + appBar: AppBar( backgroundColor: Colors.blue[400], title: Text(