Maps, optimization, testing, code cleanup
This commit is contained in:
parent
c6e69b037b
commit
a512549778
29 changed files with 257 additions and 176 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
<meta-data android:name="com.google.android.geo.API_KEY"
|
||||
android:value="AIzaSyDfCRFolRWvgfgSK0UCl5n5rNb5CS7O7KI"/>
|
||||
android:value="AIzaSyD0vsoT6Omnn01hbUiCjAhiS47uFYWnEHE"/>
|
||||
<!-- Please don't be stupid with the above key-->
|
||||
|
||||
<activity
|
||||
|
|
BIN
assets/Consolas.ttf
Normal file
BIN
assets/Consolas.ttf
Normal file
Binary file not shown.
BIN
assets/images/cat.png
Normal file
BIN
assets/images/cat.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 90 KiB |
BIN
assets/images/shadowcat-long.png
Normal file
BIN
assets/images/shadowcat-long.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
BIN
assets/images/text.png
Normal file
BIN
assets/images/text.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 169 KiB |
|
@ -14,7 +14,7 @@ PODS:
|
|||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `.symlinks/flutter/ios-profile`)
|
||||
- Flutter (from `.symlinks/flutter/ios`)
|
||||
- google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`)
|
||||
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
||||
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
|
||||
|
@ -25,7 +25,7 @@ SPEC REPOS:
|
|||
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: ".symlinks/flutter/ios-profile"
|
||||
:path: ".symlinks/flutter/ios"
|
||||
google_maps_flutter:
|
||||
:path: ".symlinks/plugins/google_maps_flutter/ios"
|
||||
shared_preferences:
|
||||
|
|
|
@ -282,7 +282,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 = (
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
[GMSServices provideAPIKey:@"AIzaSyDfCRFolRWvgfgSK0UCl5n5rNb5CS7O7KI"];
|
||||
[GMSServices provideAPIKey:@"AIzaSyBkVgDYRQoKjCWlGMyl3V6ROzmLEsa5a0w"];
|
||||
[GeneratedPluginRegistrant registerWithRegistry:self];
|
||||
// Override point for customization after application launch.
|
||||
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>io.flutter.embedded_views_preview</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
|
@ -47,7 +49,5 @@
|
|||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>io.flutter.embedded_views_preview</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -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<charts.Series<TimeSeriesCustomersOrSales, DateTime>> 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<dynamic> labels = responseJson['graph']['labels'];
|
||||
final List<dynamic> data = responseJson['graph']['data'];
|
||||
|
||||
List<TimeSeriesCustomersOrSales> graphDataList = new List<
|
||||
TimeSeriesCustomersOrSales>();
|
||||
List<TimeSeriesCustomersOrSales> graphDataList =
|
||||
new List<TimeSeriesCustomersOrSales>();
|
||||
|
||||
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);
|
||||
|
|
92
lib/common/apifunctions/get_map_data.dart
Normal file
92
lib/common/apifunctions/get_map_data.dart
Normal file
|
@ -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<Location> locations;
|
||||
final List<Region> regions;
|
||||
}
|
||||
|
||||
Future<Locations> 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<String, String> body;
|
||||
|
||||
body = {
|
||||
'session_key': preferences.get('LastToken'),
|
||||
};
|
||||
|
||||
Map<String, Map<String, double>> 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,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -264,10 +264,7 @@ class AboutDialog extends StatelessWidget {
|
|||
List<Widget> body = <Widget>[];
|
||||
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: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Text(name, style: Theme.of(context).textTheme.title),
|
||||
),
|
||||
Text(version, style: Theme.of(context).textTheme.body1),
|
||||
|
|
|
@ -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((_) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<GraphWithTitle>();
|
||||
// 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: <String, WidgetBuilder>{
|
||||
"/HomePage": (BuildContext context) => HomePage(),
|
||||
"/LoginPage": (BuildContext context) => LoginPage(),
|
||||
'/MapPage': (BuildContext context) => MapSample(),
|
||||
'/MapPage': (BuildContext context) => MapPage(),
|
||||
"/ReceiptPage": (BuildContext context) => ReceiptPage2(),
|
||||
"/MorePage": (BuildContext context) => MorePage(),
|
||||
},
|
||||
|
|
|
@ -76,10 +76,10 @@ class _CustomerGraphsState extends State<CustomerGraphs> {
|
|||
child: totalLastWeekGraph.graph != null
|
||||
? new charts.TimeSeriesChart(totalLastWeekGraph.graph)
|
||||
: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.orange),
|
||||
)
|
||||
), //List<Series<dynamic, DateTime>>es<dynamic, DateTime>>
|
||||
child: CircularProgressIndicator(
|
||||
valueColor:
|
||||
new AlwaysStoppedAnimation<Color>(Colors.orange),
|
||||
)), //List<Series<dynamic, DateTime>>es<dynamic, DateTime>>
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
@ -103,9 +103,8 @@ class _CustomerGraphsState extends State<CustomerGraphs> {
|
|||
? new charts.TimeSeriesChart(avgSpendLastWeekGraph.graph)
|
||||
: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.blue),
|
||||
)
|
||||
), //List<Series<dynamic, DateTime>>es<dynamic, DateTime>>
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.blue),
|
||||
)), //List<Series<dynamic, DateTime>>es<dynamic, DateTime>>
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
@ -128,10 +127,9 @@ class _CustomerGraphsState extends State<CustomerGraphs> {
|
|||
child: totalLastMonthGraph.graph != null
|
||||
? new charts.TimeSeriesChart(totalLastMonthGraph.graph)
|
||||
: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.green),
|
||||
)
|
||||
), //List<Series<dynamic, DateTime>>es<dynamic, DateTime>>
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.green),
|
||||
)), //List<Series<dynamic, DateTime>>es<dynamic, DateTime>>
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
@ -154,10 +152,9 @@ class _CustomerGraphsState extends State<CustomerGraphs> {
|
|||
child: avgSpendLastMonth.graph != null
|
||||
? new charts.TimeSeriesChart(avgSpendLastMonth.graph)
|
||||
: Center(
|
||||
child: CircularProgressIndicator(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
|
||||
)
|
||||
), //List<Series<dynamic, DateTime>>es<dynamic, DateTime>>
|
||||
)), //List<Series<dynamic, DateTime>>es<dynamic, DateTime>>
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -31,7 +31,7 @@ class _HomePageState extends State<HomePageWidget> {
|
|||
static List<Widget> _widgetOptions = <Widget>[
|
||||
ReceiptPage2(),
|
||||
StatsPage(),
|
||||
MapSample(),
|
||||
MapPage(),
|
||||
MorePage()
|
||||
];
|
||||
|
||||
|
@ -43,7 +43,6 @@ class _HomePageState extends State<HomePageWidget> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: _widgetOptions.elementAt(_selectedIndex),
|
||||
|
|
|
@ -20,10 +20,8 @@ class LoginPage extends StatefulWidget {
|
|||
|
||||
class LoginPageState extends State<LoginPage> {
|
||||
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
|
||||
|
|
|
@ -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<MapPage> {
|
||||
final Map<String, gmaps.Marker> _markers = {};
|
||||
Future<void> _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<MapPage> {
|
|||
centerTitle: true,
|
||||
iconTheme: IconThemeData(color: Colors.black),
|
||||
),
|
||||
body: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MapSample extends StatefulWidget {
|
||||
@override
|
||||
State<MapSample> createState() => MapSampleState();
|
||||
}
|
||||
|
||||
class MapSampleState extends State<MapSample> {
|
||||
Completer<GoogleMapController> _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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ class MorePageState extends State<MorePage> {
|
|||
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<MorePage> {
|
|||
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<MorePage> {
|
|||
),
|
||||
),
|
||||
|
||||
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(
|
||||
|
|
|
@ -12,7 +12,6 @@ class OrgGraphs extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _OrgGraphsState extends State<OrgGraphs> {
|
||||
|
||||
/// 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<OrgGraphs> {
|
|||
/// {"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<OrgGraphs> {
|
|||
child: customersLastMonth.graph != null
|
||||
? new charts.TimeSeriesChart(customersLastMonth.graph)
|
||||
: Center(
|
||||
child: CircularProgressIndicator()), //List<Series<dynamic, DateTime>>
|
||||
child:
|
||||
CircularProgressIndicator()), //List<Series<dynamic, DateTime>>
|
||||
),
|
||||
),
|
||||
|
||||
|
@ -138,9 +141,9 @@ class _OrgGraphsState extends State<OrgGraphs> {
|
|||
child: salesLastMonth.graph != null
|
||||
? new charts.TimeSeriesChart(salesLastMonth.graph)
|
||||
: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.green),
|
||||
)), //List<Series<dynamic, DateTime>>
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.green),
|
||||
)), //List<Series<dynamic, DateTime>>
|
||||
),
|
||||
),
|
||||
|
||||
|
@ -164,13 +167,11 @@ class _OrgGraphsState extends State<OrgGraphs> {
|
|||
child: purchasesLastMonth.graph != null
|
||||
? new charts.TimeSeriesChart(purchasesLastMonth.graph)
|
||||
: Center(
|
||||
child: CircularProgressIndicator(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
|
||||
)
|
||||
), //List<Series<dynamic, DateTime>>
|
||||
)), //List<Series<dynamic, DateTime>>
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
submitReceiptAPI(context, receipt);
|
||||
}
|
||||
|
||||
List<String> _sampleRecurringOptions = new List<String>(7);
|
||||
List<String> _recurringOptions = new List<String>(7);
|
||||
List<String> _categories = new List<String>();
|
||||
|
||||
@override
|
||||
|
@ -100,13 +100,15 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
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<List<String>> _futureCats = getCats();
|
||||
_categories.add("Fetching categories...");
|
||||
|
@ -117,13 +119,13 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
});
|
||||
}
|
||||
|
||||
_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<ReceiptPage2> {
|
|||
child: Text(
|
||||
"Date/Time",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontSize: _fontSize,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
@ -233,7 +235,8 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
: '${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<ReceiptPage2> {
|
|||
child: Text(
|
||||
"Payee",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontSize: _fontSize,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
@ -291,7 +294,8 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
.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<ReceiptPage2> {
|
|||
child: Text(
|
||||
"Recurring",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontSize: _fontSize,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
@ -328,7 +332,7 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
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<ReceiptPage2> {
|
|||
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<ReceiptPage2> {
|
|||
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<ReceiptPage2> {
|
|||
child: Text(
|
||||
"Category",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontSize: _fontSize,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
@ -407,7 +412,8 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
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<ReceiptPage2> {
|
|||
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<ReceiptPage2> {
|
|||
child: Text(
|
||||
"Essential",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontSize: _fontSize,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
@ -492,7 +499,7 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
child: Text(
|
||||
"Amount",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontSize: _fontSize,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
@ -505,7 +512,7 @@ class ReceiptPage2State extends State<ReceiptPage2> {
|
|||
width: MediaQuery.of(context).size.width * 0.6,
|
||||
child: TextField(
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontSize: _fontSize,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
controller: transaction.amount,
|
||||
|
|
|
@ -27,10 +27,7 @@ class _SplashScreenState extends State<SplashScreen> {
|
|||
|
||||
@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<SplashScreen> {
|
|||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(15),
|
||||
alignment: FractionalOffset(0.5, 0.3),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/images/launch_image.png'),
|
||||
|
|
|
@ -10,8 +10,10 @@ const demonstration = false;
|
|||
class StatsPage extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> 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<GraphData> 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<GraphData> in instantiated MyApp() and pass that or load it from this class' child with (graphs = super.graphList) or something.");
|
||||
return new StatsPageState();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Reference in a new issue