drawer added, trying to fix text alignment

This commit is contained in:
Felix 2019-07-17 14:15:10 +01:00
parent 9e42671488
commit 157d485e3c
No known key found for this signature in database
GPG key ID: 130EF6DC43E4DD07
4 changed files with 82 additions and 1 deletions

View file

@ -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: <Widget> [
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,
),
),
),
),
]
),
);
}
}

View file

@ -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/spash_screen.dart';
import 'package:local_spend/pages/more_page.dart'; import 'package:local_spend/pages/more_page.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:local_spend/pages/stats_page.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
@ -33,6 +34,7 @@ class MyApp extends StatelessWidget {
"/LoginPage": (BuildContext context) => LoginPage(), "/LoginPage": (BuildContext context) => LoginPage(),
"/ReceiptPage": (BuildContext context) => ReceiptPage(), "/ReceiptPage": (BuildContext context) => ReceiptPage(),
"/MorePage": (BuildContext context) => MorePage(), "/MorePage": (BuildContext context) => MorePage(),
"/StatsPage" : (BuildContext context) => StatsPage(),
}, },
home: SplashScreen(), home: SplashScreen(),
); );

View file

@ -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/apifunctions/find_organisations.dart';
import 'package:local_spend/common/widgets/popupListView.dart'; import 'package:local_spend/common/widgets/popupListView.dart';
import 'package:local_spend/common/apifunctions/categories.dart'; import 'package:local_spend/common/apifunctions/categories.dart';
import 'package:local_spend/common/widgets/awesome_drawer.dart';
const URL = "https://flutter.io/"; const URL = "https://flutter.io/";
const demonstration = false; const demonstration = false;
@ -300,8 +301,10 @@ class ReceiptPageState extends State<ReceiptPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var drawer = new AwesomeDrawer();
return PlatformScaffold( return PlatformScaffold(
drawer: Drawer(), drawer: drawer.getDrawer(context),
appBar: AppBar( appBar: AppBar(
automaticallyImplyLeading: !Platform.isIOS, // done to remove UI glitch, now works on both platforms automaticallyImplyLeading: !Platform.isIOS, // done to remove UI glitch, now works on both platforms
// leading: Drawer(), // leading: Drawer(),

View file

@ -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/scatter_bucketingAxis_legend.dart';
import 'package:local_spend/common/widgets/charts/numeric_line_bar_combo.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/charts/series_legend_with_measures.dart';
import 'package:local_spend/common/widgets/awesome_drawer.dart';
const URL = "https://flutter.io/"; const URL = "https://flutter.io/";
const demonstration = false; const demonstration = false;
@ -43,7 +44,11 @@ class StatsPageState extends State<StatsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var drawer = new AwesomeDrawer();
return PlatformScaffold( return PlatformScaffold(
drawer: drawer.getDrawer(context),
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.blue[400], backgroundColor: Colors.blue[400],
title: Text( title: Text(