From 9e4267148808c577358c113815352c4ec27eafe7 Mon Sep 17 00:00:00 2001 From: Felix Date: Wed, 17 Jul 2019 12:54:31 +0100 Subject: [PATCH 1/3] side bar added, ran into weird problem --- ios/Podfile.lock | 4 +- ios/Runner.xcodeproj/project.pbxproj | 2 +- .../apifunctions/request_login_api.dart | 2 +- lib/pages/login_page.dart | 4 +- lib/pages/receipt_page.dart | 46 ++++++++++--------- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 81f2036..f5bffe1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -6,13 +6,13 @@ PODS: - Flutter DEPENDENCIES: - - Flutter (from `.symlinks/flutter/ios-profile`) + - Flutter (from `.symlinks/flutter/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) EXTERNAL SOURCES: Flutter: - :path: ".symlinks/flutter/ios-profile" + :path: ".symlinks/flutter/ios" shared_preferences: :path: ".symlinks/plugins/shared_preferences/ios" url_launcher: diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index dff0209..a83a4d3 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -281,7 +281,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../.symlinks/flutter/ios-profile/Flutter.framework", + "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( diff --git a/lib/common/apifunctions/request_login_api.dart b/lib/common/apifunctions/request_login_api.dart index 2361c67..f5c4173 100644 --- a/lib/common/apifunctions/request_login_api.dart +++ b/lib/common/apifunctions/request_login_api.dart @@ -31,7 +31,7 @@ Future requestLoginAPI( var user = new LoginModel.fromJson(responseJson); saveCurrentLogin(responseJson, body["email"]); - Navigator.of(context).pushReplacementNamed('/HomePage'); + Navigator.of(context).pushReplacementNamed('/ReceiptPage'); return LoginModel.fromJson(responseJson); } else { diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 74f7b95..62ba02a 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -92,9 +92,9 @@ class LoginPageState extends State { onWillPop: () { if (Navigator.canPop(context)) { Navigator.of(context).pushNamedAndRemoveUntil( - '/HomePage', (Route route) => false); + '/ReceiptPage', (Route route) => false); } else { - Navigator.of(context).pushReplacementNamed('/HomePage'); + Navigator.of(context).pushReplacementNamed('/ReceiptPage'); } }, child: PlatformScaffold( diff --git a/lib/pages/receipt_page.dart b/lib/pages/receipt_page.dart index 343072e..5ec1668 100644 --- a/lib/pages/receipt_page.dart +++ b/lib/pages/receipt_page.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -143,7 +144,7 @@ class ReceiptPageState extends State { child: new Text("OK"), onPressed: () { Navigator.of(context).pop(); - Navigator.of(context).pushReplacementNamed("/HomePage"); + Navigator.of(context).pushReplacementNamed("/ReceiptPage"); }, ), ], @@ -169,7 +170,7 @@ class ReceiptPageState extends State { receipt.essential = essential; submitReceiptAPI(context, receipt); - Navigator.of(context).pushReplacementNamed("/HomePage"); + Navigator.of(context).pushReplacementNamed("/ReceiptPage"); } } } @@ -300,8 +301,10 @@ class ReceiptPageState extends State { @override Widget build(BuildContext context) { return PlatformScaffold( - + drawer: Drawer(), appBar: AppBar( + automaticallyImplyLeading: !Platform.isIOS, // done to remove UI glitch, now works on both platforms +// leading: Drawer(), backgroundColor: Colors.blue[400], title: Text( "Submit Receipt", @@ -310,9 +313,8 @@ class ReceiptPageState extends State { color: Colors.white, ), ), -// leading: BackButton(), centerTitle: true, - iconTheme: IconThemeData(color: Colors.black), +// iconTheme: IconThemeData(color: Colors.black), ), body: Container( @@ -542,23 +544,23 @@ class ReceiptPageState extends State { ), ), - Container( - padding: const EdgeInsets.fromLTRB(29, 0, 0, 0), - child: DropdownButton( - value: _categoryController.text, - onChanged: (String newValue) { - setState(() { - _categoryController.text = newValue; - }); - }, - items: _categoryDropDownItems.map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ) - ), +// Container( +// padding: const EdgeInsets.fromLTRB(29, 0, 0, 0), +// child: DropdownButton( +// value: _categoryController.text, +// onChanged: (String newValue) { +// setState(() { +// _categoryController.text = newValue; +// }); +// }, +// items: _categoryDropDownItems.map>((String value) { +// return DropdownMenuItem( +// value: value, +// child: Text(value), +// ); +// }).toList(), +// ) +// ), ], ), ), From 157d485e3c86231be7815cb199e59f577423fb9f Mon Sep 17 00:00:00 2001 From: Felix Date: Wed, 17 Jul 2019 14:15:10 +0100 Subject: [PATCH 2/3] 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( From 248d5f698331025a7327a3793e57c55963d788aa Mon Sep 17 00:00:00 2001 From: Felix Date: Wed, 17 Jul 2019 16:45:37 +0100 Subject: [PATCH 3/3] names appropriated, pages updated --- lib/common/widgets/awesome_drawer.dart | 12 ++++++------ lib/pages/more_page.dart | 20 +++++++------------- lib/pages/stats_page.dart | 26 -------------------------- 3 files changed, 13 insertions(+), 45 deletions(-) diff --git a/lib/common/widgets/awesome_drawer.dart b/lib/common/widgets/awesome_drawer.dart index a3bf610..4cbe7ca 100644 --- a/lib/common/widgets/awesome_drawer.dart +++ b/lib/common/widgets/awesome_drawer.dart @@ -14,9 +14,9 @@ class AwesomeDrawer { Container( padding: const EdgeInsets.fromLTRB(0, 15, 0, 0), child : - FlatButton(onPressed: () => Navigator.of(context).pushReplacementNamed("/StatsPage"), + FlatButton(onPressed: () => Navigator.of(context).pushReplacementNamed("/ReceiptPage"), child: - Text("yeehaw", + Text("Submit Receipt", textAlign: Platform.isIOS ? TextAlign.right : TextAlign.left, style: new TextStyle( fontSize: 32.0, @@ -29,8 +29,8 @@ class AwesomeDrawer { Container( padding: const EdgeInsets.fromLTRB(0, 15, 0, 0), child : - FlatButton(onPressed: () => Navigator.of(context).pushReplacementNamed("/MorePage"), child: - Text("clickity clack", + FlatButton(onPressed: () => Navigator.of(context).pushReplacementNamed("/StatsPage"), child: + Text("Statistics", textAlign: Platform.isIOS ? TextAlign.right : TextAlign.left, style: new TextStyle( fontSize: 32.0, @@ -42,8 +42,8 @@ class AwesomeDrawer { Container( padding: const EdgeInsets.fromLTRB(0, 15, 0, 0), child : - FlatButton(onPressed: () => debugPrint("pressed"), child: - Text("scoot scoot", + FlatButton(onPressed: () => Navigator.of(context).pushReplacementNamed("/MorePage"), child: + Text("More", style: new TextStyle( fontSize: 32.0, color: Colors.black, diff --git a/lib/pages/more_page.dart b/lib/pages/more_page.dart index 21814de..b4cc6b1 100644 --- a/lib/pages/more_page.dart +++ b/lib/pages/more_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:local_spend/common/platform/platform_scaffold.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -6,6 +5,7 @@ import 'package:local_spend/common/functions/logout.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:local_spend/common/functions/customAbout.dart' as custom; import 'package:local_spend/common/functions/showDialogTwoButtons.dart'; +import 'package:local_spend/common/widgets/awesome_drawer.dart'; const URL = "https://flutter.io/"; const demonstration = false; @@ -44,18 +44,13 @@ class MorePageState extends State { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () { - if (Navigator.canPop(context)) { - Navigator.of(context).pushNamedAndRemoveUntil( - '/LoginPage', (Route route) => false); - } else { - Navigator.of(context).pushReplacementNamed('/LoginPage'); - } - }, - child: PlatformScaffold( + var drawer = new AwesomeDrawer(); + + return new PlatformScaffold( + drawer: drawer.getDrawer(context), appBar: AppBar( + backgroundColor: Colors.blue[400], title: Text( "More", @@ -173,7 +168,6 @@ class MorePageState extends State { ], ), ), - ), - ); + ); } } diff --git a/lib/pages/stats_page.dart b/lib/pages/stats_page.dart index 68a7171..6ae8207 100644 --- a/lib/pages/stats_page.dart +++ b/lib/pages/stats_page.dart @@ -58,7 +58,6 @@ class StatsPageState extends State { color: Colors.white, ), ), -// leading: BackButton(), centerTitle: true, iconTheme: IconThemeData(color: Colors.black), ), @@ -68,25 +67,6 @@ class StatsPageState extends State { padding: EdgeInsets.fromLTRB(0, 0, 0, 0), child: ListView( children: [ - // some graphs and charts here etc -// Container( -// padding: EdgeInsets.fromLTRB(0.0,17,0.0,0.0), -// child : Text( -// "Really Cool Chart", -// textAlign: TextAlign.center, -// style: TextStyle( -// fontSize: 22.0, -// color: Colors.black, -// fontWeight: FontWeight.bold, -// ), -// ), -// ), -// -// Container( -// height: 250, -//// width: 250, -// child: new DonutPieChart.withSampleData() -// ), Container( padding: EdgeInsets.fromLTRB(0.0,17,0.0,0.0), @@ -104,7 +84,6 @@ class StatsPageState extends State { Container( padding: EdgeInsets.symmetric(horizontal: 10), height: 200, -// width: 250, child: new GroupedBarChart.withSampleData() ), @@ -124,7 +103,6 @@ class StatsPageState extends State { Container( padding: EdgeInsets.symmetric(horizontal: 10), height: 200, -// width: 250, child: new BucketingAxisScatterPlotChart.withSampleData() ), @@ -164,7 +142,6 @@ class StatsPageState extends State { Container( padding: EdgeInsets.symmetric(horizontal: 10), height: 200, -// width: 250, child: new DonutAutoLabelChart.withSampleData() ), @@ -184,7 +161,6 @@ class StatsPageState extends State { Container( padding: EdgeInsets.symmetric(horizontal: 10), height: 200, -// width: 250, child: new DonutPieChart.withSampleData() ), @@ -204,7 +180,6 @@ class StatsPageState extends State { Container( padding: EdgeInsets.symmetric(horizontal: 10), height: 200, -// width: 250, child: new NumericComboLineBarChart.withSampleData() ), @@ -224,7 +199,6 @@ class StatsPageState extends State { Container( padding: EdgeInsets.symmetric(horizontal: 10), height: 200, -// width: 250, child: new LegendWithMeasures.withSampleData() ),