diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index be8cc8c..184c9d7 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -19,7 +19,7 @@ + android:value="AIzaSyD0vsoT6Omnn01hbUiCjAhiS47uFYWnEHE"/> + io.flutter.embedded_views_preview + CFBundleDevelopmentRegion en CFBundleDisplayName @@ -47,7 +49,5 @@ UIViewControllerBasedStatusBarAppearance - io.flutter.embedded_views_preview - diff --git a/lib/common/apifunctions/get_graph_data.dart b/lib/common/apifunctions/get_graph_data.dart index 6513fb4..f1fbedd 100644 --- a/lib/common/apifunctions/get_graph_data.dart +++ b/lib/common/apifunctions/get_graph_data.dart @@ -4,14 +4,12 @@ import 'package:http/http.dart' as http; import 'package:shared_preferences/shared_preferences.dart'; import 'package:charts_flutter/flutter.dart' as charts; - /// Customer graph types: https://dev.localspend.co.uk/api/v1/customer/graphs /// - total_last_week /// - avg_spend_last_week /// - total_last_month /// - avg_spend_last_month - /// Organisations' graphs types: to fetch, POST to https://dev.localspend.co.uk/api/stats/[name] as {"session_key":"[boop beep]"} /// - organisations_all : organisation /// - pies : organisation/pies @@ -28,16 +26,13 @@ import 'package:charts_flutter/flutter.dart' as charts; /// HTTP POST request sample: /// {"graph":"total_last_week","session_key":"blahblahblah"} - - class OrganisationGraph { - OrganisationGraph( - this.chartType, - {this.graphsType = ""} - ); + OrganisationGraph(this.chartType, {this.graphsType = ""}); - String graphsType = ""; // type of graph, eg customers_last_7_days, sales_last_30_days, purchases_last_30_days etc - String chartType; // type of chart, eg organisations_all, pies, snippets or graphs + String graphsType = + ""; // type of graph, eg customers_last_7_days, sales_last_30_days, purchases_last_30_days etc + String + chartType; // type of chart, eg organisations_all, pies, snippets or graphs List> graph; @@ -53,7 +48,7 @@ class OrganisationGraph { colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, domainFn: (TimeSeriesCustomersOrSales spend, _) => spend.time, measureFn: (TimeSeriesCustomersOrSales spend, _) => - spend.numberOfStuff, + spend.numberOfStuff, data: cachedData, ) ]; @@ -94,13 +89,12 @@ class OrganisationGraph { final List labels = responseJson['graph']['labels']; final List data = responseJson['graph']['data']; - List graphDataList = new List< - TimeSeriesCustomersOrSales>(); + List graphDataList = + new List(); for (int i = 0; i < labels.length; i++) { - graphDataList.add( - new TimeSeriesCustomersOrSales( - data[i] * 1.00, DateTime.parse(labels[i]))); + graphDataList.add(new TimeSeriesCustomersOrSales( + data[i] * 1.00, DateTime.parse(labels[i]))); } this.cachedData = graphDataList; @@ -112,7 +106,7 @@ class OrganisationGraph { colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, domainFn: (TimeSeriesCustomersOrSales spend, _) => spend.time, measureFn: (TimeSeriesCustomersOrSales spend, _) => - spend.numberOfStuff, + spend.numberOfStuff, data: graphDataList, ) ]; @@ -125,9 +119,7 @@ class OrganisationGraph { } catch (error) { print(error.toString()); } - } - } class GraphData { @@ -194,7 +186,6 @@ class GraphData { ) ]; return this.graph; - } else { final errorMessage = json.decode(response.body)['message']; print("Error: " + errorMessage); @@ -276,4 +267,4 @@ class TimeSeriesCustomersOrSales { final DateTime time; final double numberOfStuff; -} \ No newline at end of file +} diff --git a/lib/common/apifunctions/get_map_data.dart b/lib/common/apifunctions/get_map_data.dart new file mode 100644 index 0000000..d9779ac --- /dev/null +++ b/lib/common/apifunctions/get_map_data.dart @@ -0,0 +1,92 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:http/http.dart' as http; +import 'package:json_annotation/json_annotation.dart'; +import 'package:local_spend/common/apifunctions/find_organisations.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart' as gmaps; + +// /v1/supplier/location + +@JsonSerializable() +class LatLng { + LatLng({ + this.lat, + this.lng + }); + + final double lat, lng; +} + +@JsonSerializable() +class Region { + Region({ + this.coords, + this.id, + this.name, + this.zoom + }); + + final LatLng coords; + final String id, name; + final double zoom; +} + +@JsonSerializable() +class Location { + Location({ + this.organisation, + this.lat, + this.lng + }); + + final Organisation organisation; + final double lat, lng; +} + +@JsonSerializable() +class Locations { + Locations({ + this.locations, + this.regions + }); + + final List locations; + final List regions; +} + +Future getLocations(gmaps.LatLng ne, gmaps.LatLng sw) async { + const pearLocationsURL = 'https://dev.localspend.co.uk/api/v1/supplier/location'; + SharedPreferences preferences = await SharedPreferences.getInstance(); + + Map body; + + body = { + 'session_key': preferences.get('LastToken'), + }; + + Map> mapData = { + 'north_east': { + 'latitude': ne.latitude, + 'longitude': ne.longitude + }, + 'south_west': { + 'latitude': sw.latitude, + 'longitude': sw.longitude + }, + }; + + final response = await http.post( + pearLocationsURL, + body: json.encode(body), + ); + + if (response.statusCode == 200) { + print(response.body.toString()); + } else { + print(response.body.toString()); + throw HttpException( + 'Error - ' + response.reasonPhrase, + ); + } +} \ No newline at end of file diff --git a/lib/common/functions/customAbout.dart b/lib/common/functions/customAbout.dart index 8f923c2..ba6168d 100644 --- a/lib/common/functions/customAbout.dart +++ b/lib/common/functions/customAbout.dart @@ -264,10 +264,7 @@ class AboutDialog extends StatelessWidget { List body = []; if (icon != null) { body.add( - IconTheme( - data: const IconThemeData(size: 45.0), - child: icon - ), + IconTheme(data: const IconThemeData(size: 45.0), child: icon), ); } @@ -277,7 +274,6 @@ class AboutDialog extends StatelessWidget { child: ListBody( children: [ Container( - padding: EdgeInsets.only(top: 10), child: Text(name, style: Theme.of(context).textTheme.title), ), Text(version, style: Theme.of(context).textTheme.body1), diff --git a/lib/common/functions/logout.dart b/lib/common/functions/logout.dart index 1b14d6b..128eab8 100644 --- a/lib/common/functions/logout.dart +++ b/lib/common/functions/logout.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:local_spend/common/apifunctions/request_logout_api.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:local_spend/common/functions/save_logout.dart'; void logout(context) { _clearLoginDetails().then((_) { diff --git a/lib/common/platform/platform_scaffold.dart b/lib/common/platform/platform_scaffold.dart index e3dbff9..2b2b0e6 100644 --- a/lib/common/platform/platform_scaffold.dart +++ b/lib/common/platform/platform_scaffold.dart @@ -4,21 +4,20 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class PlatformScaffold extends StatelessWidget { - PlatformScaffold( {this.key, - this.appBar, - this.body, - this.floatingActionButton, - this.floatingActionButtonLocation, - this.floatingActionButtonAnimator, - this.persistentFooterButtons, - this.drawer, - this.endDrawer, - this.bottomNavigationBar, - this.backgroundColor, - this.resizeToAvoidBottomPadding = true, - this.primary = true}) + this.appBar, + this.body, + this.floatingActionButton, + this.floatingActionButtonLocation, + this.floatingActionButtonAnimator, + this.persistentFooterButtons, + this.drawer, + this.endDrawer, + this.bottomNavigationBar, + this.backgroundColor, + this.resizeToAvoidBottomPadding = true, + this.primary = true}) : assert(primary != null), super(key: key); diff --git a/lib/common/widgets/animatedGradientButton.dart b/lib/common/widgets/animatedGradientButton.dart index fb6853c..aca5789 100644 --- a/lib/common/widgets/animatedGradientButton.dart +++ b/lib/common/widgets/animatedGradientButton.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:simple_animations/simple_animations.dart'; class AnimatedBackground extends StatelessWidget { - AnimatedBackground( this.animateColors, this.lastColor, diff --git a/lib/common/widgets/charts/numeric_line_bar_combo.dart b/lib/common/widgets/charts/numeric_line_bar_combo.dart index c6b38dd..a0e71b4 100644 --- a/lib/common/widgets/charts/numeric_line_bar_combo.dart +++ b/lib/common/widgets/charts/numeric_line_bar_combo.dart @@ -4,7 +4,6 @@ import 'package:charts_flutter/flutter.dart' as charts; import 'package:flutter/material.dart'; class NumericComboLineBarChart extends StatelessWidget { - NumericComboLineBarChart(this.seriesList, {this.animate}); /// Creates a [LineChart] with sample data and no transition. diff --git a/lib/common/widgets/charts/scatter_bucketingAxis_legend.dart b/lib/common/widgets/charts/scatter_bucketingAxis_legend.dart index ef3dad6..f59ea0a 100644 --- a/lib/common/widgets/charts/scatter_bucketingAxis_legend.dart +++ b/lib/common/widgets/charts/scatter_bucketingAxis_legend.dart @@ -8,7 +8,6 @@ import 'package:charts_flutter/flutter.dart' as charts; import 'package:flutter/material.dart'; class BucketingAxisScatterPlotChart extends StatelessWidget { - BucketingAxisScatterPlotChart(this.seriesList, {this.animate}); /// Creates a [ScatterPlotChart] with sample data and no transition. diff --git a/lib/common/widgets/custom_checkbox.dart b/lib/common/widgets/custom_checkbox.dart index f011c3a..27645d5 100644 --- a/lib/common/widgets/custom_checkbox.dart +++ b/lib/common/widgets/custom_checkbox.dart @@ -372,8 +372,7 @@ class _RenderCheckbox extends RenderToggleable { final double tShrink = (t - 0.5) * 2.0; if (_oldValue == null || value == null) { _drawDash(canvas, origin, tShrink, paint); - } - else { + } else { _drawCheck(canvas, origin, tShrink, paint); } } @@ -388,16 +387,14 @@ class _RenderCheckbox extends RenderToggleable { final double tShrink = 1.0 - tNormalized * 2.0; if (_oldValue == true) { _drawCheck(canvas, origin, tShrink, paint); - } - else { + } else { _drawDash(canvas, origin, tShrink, paint); } } else { final double tExpand = (tNormalized - 0.5) * 2.0; if (value == true) { _drawCheck(canvas, origin, tExpand, paint); - } - else { + } else { _drawDash(canvas, origin, tExpand, paint); } } diff --git a/lib/main.dart b/lib/main.dart index 3f9987c..309d5ea 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,15 +12,10 @@ void main() { runApp(MyApp()); } -void loadGraphs() { - -} +void loadGraphs() {} class GraphWithTitle { - GraphWithTitle({ - this.graph, - this.title - }); + GraphWithTitle({this.graph, this.title}); GraphData graph; String title; @@ -29,7 +24,7 @@ class GraphWithTitle { class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - var graphList = List(); + // TODO: load graphs on app login and send to graph widgets return new MaterialApp( debugShowCheckedModeBanner: false, @@ -45,7 +40,7 @@ class MyApp extends StatelessWidget { routes: { "/HomePage": (BuildContext context) => HomePage(), "/LoginPage": (BuildContext context) => LoginPage(), - '/MapPage': (BuildContext context) => MapSample(), + '/MapPage': (BuildContext context) => MapPage(), "/ReceiptPage": (BuildContext context) => ReceiptPage2(), "/MorePage": (BuildContext context) => MorePage(), }, diff --git a/lib/pages/customerGraphs.dart b/lib/pages/customerGraphs.dart index efdd7eb..341b399 100644 --- a/lib/pages/customerGraphs.dart +++ b/lib/pages/customerGraphs.dart @@ -76,10 +76,10 @@ class _CustomerGraphsState extends State { child: totalLastWeekGraph.graph != null ? new charts.TimeSeriesChart(totalLastWeekGraph.graph) : Center( - child: CircularProgressIndicator( - valueColor: new AlwaysStoppedAnimation(Colors.orange), - ) - ), //List>es> + child: CircularProgressIndicator( + valueColor: + new AlwaysStoppedAnimation(Colors.orange), + )), //List>es> ), ), Container( @@ -103,9 +103,8 @@ class _CustomerGraphsState extends State { ? new charts.TimeSeriesChart(avgSpendLastWeekGraph.graph) : Center( child: CircularProgressIndicator( - valueColor: new AlwaysStoppedAnimation(Colors.blue), - ) - ), //List>es> + valueColor: new AlwaysStoppedAnimation(Colors.blue), + )), //List>es> ), ), Container( @@ -128,10 +127,9 @@ class _CustomerGraphsState extends State { child: totalLastMonthGraph.graph != null ? new charts.TimeSeriesChart(totalLastMonthGraph.graph) : Center( - child: CircularProgressIndicator( - valueColor: new AlwaysStoppedAnimation(Colors.green), - ) - ), //List>es> + child: CircularProgressIndicator( + valueColor: new AlwaysStoppedAnimation(Colors.green), + )), //List>es> ), ), Container( @@ -154,10 +152,9 @@ class _CustomerGraphsState extends State { child: avgSpendLastMonth.graph != null ? new charts.TimeSeriesChart(avgSpendLastMonth.graph) : Center( - child: CircularProgressIndicator( + child: CircularProgressIndicator( valueColor: new AlwaysStoppedAnimation(Colors.red), - ) - ), //List>es> + )), //List>es> ), ), ], diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index b4a7c3b..4e5ad30 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -31,7 +31,7 @@ class _HomePageState extends State { static List _widgetOptions = [ ReceiptPage2(), StatsPage(), - MapSample(), + MapPage(), MorePage() ]; @@ -43,7 +43,6 @@ class _HomePageState extends State { @override Widget build(BuildContext context) { - return Scaffold( body: Center( child: _widgetOptions.elementAt(_selectedIndex), diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index f77d0e5..a4ebd90 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -20,10 +20,8 @@ class LoginPage extends StatefulWidget { class LoginPageState extends State { bool _isLoggingIn = false; - final TextEditingController _emailController = - TextEditingController(); - final TextEditingController _passwordController = - TextEditingController(); + final TextEditingController _emailController = TextEditingController(); + final TextEditingController _passwordController = TextEditingController(); bool _saveLoginDetails = true; FocusNode focusNode; // added so focus can move automatically diff --git a/lib/pages/map_page.dart b/lib/pages/map_page.dart index 2b05ef5..f2c36ba 100644 --- a/lib/pages/map_page.dart +++ b/lib/pages/map_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'dart:async'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart' as gmaps; +import 'package:local_spend/common/apifunctions/get_map_data.dart' as mapData; import 'package:local_spend/common/platform/platform_scaffold.dart'; class MapPage extends StatefulWidget { @@ -13,13 +14,32 @@ class MapPage extends StatefulWidget { } class _MapPageState extends State { + final Map _markers = {}; + Future _onMapCreated(gmaps.GoogleMapController controller) async { + final region = await controller.getVisibleRegion(); + final locations = await mapData.getLocations(region.northeast, region.southwest); + setState(() { + _markers.clear(); + for (final location in locations.locations) { + final marker = gmaps.Marker( + markerId: gmaps.MarkerId(location.organisation.name), + position: gmaps.LatLng(location.lat, location.lng), + infoWindow: gmaps.InfoWindow( + title: location.organisation.name, + snippet: location.organisation.postcode, + ), + ); + _markers[location.organisation.name] = marker; + } + }); + } @override Widget build(BuildContext context) { return PlatformScaffold( appBar: AppBar( backgroundColor: Colors.blue[400], title: Text( - "Submit Receipt", + "Map", style: TextStyle( fontSize: 20, color: Colors.white, @@ -28,34 +48,15 @@ class _MapPageState extends State { centerTitle: true, iconTheme: IconThemeData(color: Colors.black), ), - body: null, - ); - } -} - -class MapSample extends StatefulWidget { - @override - State createState() => MapSampleState(); -} - -class MapSampleState extends State { - Completer _controller = Completer(); - - static final CameraPosition _kGooglePlex = CameraPosition( - target: LatLng(37.42796133580664, -122.085749655962), - zoom: 14.4746, - ); - - @override - Widget build(BuildContext context) { - return new Scaffold( -// body: GoogleMap( -// mapType: MapType.hybrid, -// initialCameraPosition: _kGooglePlex, -// onMapCreated: (GoogleMapController controller) { -// _controller.complete(controller); -// }, -// ), + body: gmaps.GoogleMap( + myLocationButtonEnabled: false, + mapType: gmaps.MapType.hybrid, + onMapCreated: _onMapCreated, + initialCameraPosition: gmaps.CameraPosition( + target: gmaps.LatLng(54.0411301, -2.8104042), + zoom: 15, + ), + ), ); } } diff --git a/lib/pages/more_page.dart b/lib/pages/more_page.dart index 6c7b45a..b1d3531 100644 --- a/lib/pages/more_page.dart +++ b/lib/pages/more_page.dart @@ -101,6 +101,7 @@ class MorePageState extends State { height: 35, child: RaisedButton( onPressed: () => {}, +// launch(- something -), child: Text("Contact us", style: TextStyle( color: Colors.white, fontSize: 18.0)), @@ -120,25 +121,6 @@ class MorePageState extends State { onPressed: () => launch('http://www.peartrade.org')), ), - Container( - height: 35, - margin: EdgeInsets.fromLTRB(10, 20, 10, 0), - child: Material( - child: OutlineButton( - child: Text( - 'Shadowcat Systems', - style: TextStyle( - color: Colors.black, fontSize: 18.0 - - /// I don't know what to do with this button - ), - ), - onPressed: () => launch('https://shadow.cat/'), - ), - color: Colors.lightGreenAccent, - shadowColor: Colors.transparent, - ), - ), ], ); }, @@ -170,6 +152,33 @@ class MorePageState extends State { ), ), + Padding( + padding: EdgeInsets.fromLTRB(30.0, 20.0, 30.0, 0.0), + child: Container( + height: 75.0, + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: BorderRadius.circular(3), + onTap: () => launch('https://shadow.cat'), + child: Column( + children: [ + Align( + child: Text("Developed by"), + alignment: Alignment.centerLeft), + FittedBox( + fit: BoxFit.fitHeight, + child: Image( + image: ExactAssetImage('assets/images/text.png'), + ), + ), + ], + ), + ), + ), + ), + ), + // Padding( // padding: EdgeInsets.fromLTRB(30.0, 20.0, 30.0, 0.0), // child: Container( diff --git a/lib/pages/orgGraphs.dart b/lib/pages/orgGraphs.dart index 82ef593..444f3ce 100644 --- a/lib/pages/orgGraphs.dart +++ b/lib/pages/orgGraphs.dart @@ -12,7 +12,6 @@ class OrgGraphs extends StatefulWidget { } class _OrgGraphsState extends State { - /// Organisations' graphs types: to fetch, POST to https://dev.localspend.co.uk/api/stats/[graph_type] as {"session_key":"[boop beep]"} /// - organisations_all : organisation /// - pies : organisation/pies @@ -30,9 +29,12 @@ class _OrgGraphsState extends State { /// {"graph":"total_last_week","session_key":"blahblahblah"} // OrganisationGraph customersLastWeek = new OrganisationGraph("graphs", graphsType: "customers_last_7_days"); - OrganisationGraph customersLastMonth = new OrganisationGraph("graphs", graphsType: "customers_last_30_days"); - OrganisationGraph salesLastMonth = new OrganisationGraph("graphs", graphsType: "sales_last_30_days"); - OrganisationGraph purchasesLastMonth = new OrganisationGraph("graphs", graphsType: "purchases_last_30_days"); //purchases_last_30_days + OrganisationGraph customersLastMonth = + new OrganisationGraph("graphs", graphsType: "customers_last_30_days"); + OrganisationGraph salesLastMonth = + new OrganisationGraph("graphs", graphsType: "sales_last_30_days"); + OrganisationGraph purchasesLastMonth = new OrganisationGraph("graphs", + graphsType: "purchases_last_30_days"); //purchases_last_30_days @override void initState() { @@ -114,7 +116,8 @@ class _OrgGraphsState extends State { child: customersLastMonth.graph != null ? new charts.TimeSeriesChart(customersLastMonth.graph) : Center( - child: CircularProgressIndicator()), //List> + child: + CircularProgressIndicator()), //List> ), ), @@ -138,9 +141,9 @@ class _OrgGraphsState extends State { child: salesLastMonth.graph != null ? new charts.TimeSeriesChart(salesLastMonth.graph) : Center( - child: CircularProgressIndicator( - valueColor: new AlwaysStoppedAnimation(Colors.green), - )), //List> + child: CircularProgressIndicator( + valueColor: new AlwaysStoppedAnimation(Colors.green), + )), //List> ), ), @@ -164,13 +167,11 @@ class _OrgGraphsState extends State { child: purchasesLastMonth.graph != null ? new charts.TimeSeriesChart(purchasesLastMonth.graph) : Center( - child: CircularProgressIndicator( + child: CircularProgressIndicator( valueColor: new AlwaysStoppedAnimation(Colors.red), - ) - ), //List> + )), //List> ), ), - ], ); } diff --git a/lib/pages/receipt_page_2.dart b/lib/pages/receipt_page_2.dart index 4ef3c00..4456016 100644 --- a/lib/pages/receipt_page_2.dart +++ b/lib/pages/receipt_page_2.dart @@ -92,7 +92,7 @@ class ReceiptPage2State extends State { submitReceiptAPI(context, receipt); } - List _sampleRecurringOptions = new List(7); + List _recurringOptions = new List(7); List _categories = new List(); @override @@ -100,13 +100,15 @@ class ReceiptPage2State extends State { super.initState(); } - @override Widget build(BuildContext context) { var _widgetHeight = MediaQuery.of(context).size.height * 0.06 < 40.0 ? 40.0 : MediaQuery.of(context).size.height * 0.06; + var _fontSize = _widgetHeight * 0.45; + var _fontSizeButton = _widgetHeight * 0.5; + if (_categories.isEmpty) { Future> _futureCats = getCats(); _categories.add("Fetching categories..."); @@ -117,13 +119,13 @@ class ReceiptPage2State extends State { }); } - _sampleRecurringOptions[0] = "None"; - _sampleRecurringOptions[1] = "Daily"; - _sampleRecurringOptions[2] = "Weekly"; - _sampleRecurringOptions[3] = "Fortnightly"; - _sampleRecurringOptions[4] = "Monthly"; - _sampleRecurringOptions[5] = "Quarterly"; - _sampleRecurringOptions[6] = "Yearly"; + _recurringOptions[0] = "None"; + _recurringOptions[1] = "Daily"; + _recurringOptions[2] = "Weekly"; + _recurringOptions[3] = "Fortnightly"; + _recurringOptions[4] = "Monthly"; + _recurringOptions[5] = "Quarterly"; + _recurringOptions[6] = "Yearly"; // these will be difficult to fetch from server as they are coded into the site's HTML rather than fetched return PlatformScaffold( @@ -175,7 +177,7 @@ class ReceiptPage2State extends State { child: Text( "Date/Time", style: TextStyle( - fontSize: 22, + fontSize: _fontSize, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -233,7 +235,8 @@ class ReceiptPage2State extends State { : '${new DateFormat.MMMd().format(transaction.date)}' + " at " + '${new DateFormat.Hm().format(transaction.date)}', - style: TextStyle(color: Colors.white, fontSize: 22.0), + style: TextStyle( + color: Colors.white, fontSize: _fontSizeButton), ), color: Colors.blue, ), @@ -257,7 +260,7 @@ class ReceiptPage2State extends State { child: Text( "Payee", style: TextStyle( - fontSize: 22, + fontSize: _fontSize, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -291,7 +294,8 @@ class ReceiptPage2State extends State { .substring(0, 12) + "..." : transaction.organisation.name, - style: TextStyle(color: Colors.white, fontSize: 22.0), + style: TextStyle( + color: Colors.white, fontSize: _fontSizeButton), ), color: Colors.blue, ), @@ -315,7 +319,7 @@ class ReceiptPage2State extends State { child: Text( "Recurring", style: TextStyle( - fontSize: 22, + fontSize: _fontSize, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -328,7 +332,7 @@ class ReceiptPage2State extends State { width: MediaQuery.of(context).size.width * 0.6, child: RaisedButton( onPressed: () { - transaction.recurring = _sampleRecurringOptions[0]; + transaction.recurring = _recurringOptions[0]; setState(() {}); showModalBottomSheet( context: context, @@ -341,13 +345,13 @@ class ReceiptPage2State extends State { 3, child: CupertinoPicker( backgroundColor: Colors.white, - children: _sampleRecurringOptions + children: _recurringOptions .map((thisOption) => Text(thisOption, style: TextStyle(fontSize: 30))) .toList(), onSelectedItemChanged: ((newValue) { transaction.recurring = - _sampleRecurringOptions[newValue]; + _recurringOptions[newValue]; setState(() {}); }), magnification: 1.1, @@ -361,7 +365,8 @@ class ReceiptPage2State extends State { transaction.recurring == null ? 'None' : transaction.recurring, - style: TextStyle(color: Colors.white, fontSize: 22.0), + style: TextStyle( + color: Colors.white, fontSize: _fontSizeButton), ), color: Colors.blue, ), @@ -383,7 +388,7 @@ class ReceiptPage2State extends State { child: Text( "Category", style: TextStyle( - fontSize: 22, + fontSize: _fontSize, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -407,7 +412,8 @@ class ReceiptPage2State extends State { height: MediaQuery.of(context) .copyWith() .size - .height / 3, + .height / + 3, child: CupertinoPicker( backgroundColor: Colors.white, children: _categories @@ -432,7 +438,8 @@ class ReceiptPage2State extends State { transaction.category == null ? 'None' : transaction.category, - style: TextStyle(color: Colors.white, fontSize: 22.0), + style: TextStyle( + color: Colors.white, fontSize: _fontSizeButton), ), color: Colors.blue, ), @@ -456,7 +463,7 @@ class ReceiptPage2State extends State { child: Text( "Essential", style: TextStyle( - fontSize: 22, + fontSize: _fontSize, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -492,7 +499,7 @@ class ReceiptPage2State extends State { child: Text( "Amount", style: TextStyle( - fontSize: 22, + fontSize: _fontSize, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -505,7 +512,7 @@ class ReceiptPage2State extends State { width: MediaQuery.of(context).size.width * 0.6, child: TextField( style: TextStyle( - fontSize: 20, + fontSize: _fontSize, ), textAlign: TextAlign.center, controller: transaction.amount, diff --git a/lib/pages/spash_screen.dart b/lib/pages/spash_screen.dart index bcfe751..26df3db 100644 --- a/lib/pages/spash_screen.dart +++ b/lib/pages/spash_screen.dart @@ -27,10 +27,7 @@ class _SplashScreenState extends State { @override Widget build(BuildContext context) { - var drawer = Drawer(); - return PlatformScaffold( - drawer: drawer, body: Container( decoration: BoxDecoration(color: Colors.white), child: Column( @@ -38,7 +35,6 @@ class _SplashScreenState extends State { Expanded( child: Container( margin: EdgeInsets.all(15), - alignment: FractionalOffset(0.5, 0.3), decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/launch_image.png'), diff --git a/lib/pages/stats_page.dart b/lib/pages/stats_page.dart index f3f1e06..2446884 100644 --- a/lib/pages/stats_page.dart +++ b/lib/pages/stats_page.dart @@ -10,8 +10,10 @@ const demonstration = false; class StatsPage extends StatefulWidget { @override State createState() { - print("TODO: The 'stats' page should be loaded on login and cached rather than reloading on every opening of the page."); - print("Create new List in instantiated MyApp() and pass that or load it from this class' child with (graphs = super.graphList) or something."); + print( + "TODO: The 'stats' page should be loaded on login and cached rather than reloading on every opening of the page."); + print( + "Create new List in instantiated MyApp() and pass that or load it from this class' child with (graphs = super.graphList) or something."); return new StatsPageState(); } } diff --git a/pubspec.yaml b/pubspec.yaml index 6e3259c..aab7c52 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,6 +57,11 @@ flutter: - assets/ - assets/images/ - assets/images/launch_image.png + + fonts: + - family: Consolas + fonts: + - asset: assets/Consolas.ttf # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.io/assets-and-images/#resolution-aware.