Navigation improvements
This commit is contained in:
parent
ff854b2a06
commit
0b56a02a0b
9 changed files with 151 additions and 160 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:comunes_flutter/comunes_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
|
|
@ -18,10 +17,10 @@ class _ViewModel {
|
|||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
identical(this, other) ||
|
||||
other is _ViewModel &&
|
||||
runtimeType == other.runtimeType &&
|
||||
monitoredAreas == other.monitoredAreas;
|
||||
runtimeType == other.runtimeType &&
|
||||
monitoredAreas == other.monitoredAreas;
|
||||
|
||||
@override
|
||||
int get hashCode => monitoredAreas.hashCode;
|
||||
|
|
@ -33,70 +32,66 @@ class MonitoredAreasPage extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new StoreConnector<AppState, _ViewModel>(
|
||||
distinct: true,
|
||||
converter: (store) {
|
||||
return new _ViewModel(store.state.monitoredAreas);
|
||||
},
|
||||
builder: (context, view) {
|
||||
return new Scaffold(
|
||||
appBar:
|
||||
new AppBar(title: new Text(S
|
||||
.of(context)
|
||||
.monitoredAreasTitle)),
|
||||
drawer: MainDrawer.getDrawer(context),
|
||||
bottomNavigationBar: new CustomBottomAppBar(
|
||||
fabLocation: FloatingActionButtonLocation.centerDocked,
|
||||
showNotch: true,
|
||||
color: fires100,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
actions: <Widget>[new Flexible(child:
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(left: 10.0, right: 10.0), child:
|
||||
new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
new Text(S
|
||||
.of(context)
|
||||
.mapPrivacy,
|
||||
style: new TextStyle(
|
||||
fontStyle: FontStyle.italic, color: Colors.black38))
|
||||
])))
|
||||
]),
|
||||
body: !(view.monitoredAreas is List)
|
||||
? new SpinKitPulse(color: fires600)
|
||||
: new Padding(
|
||||
padding: new EdgeInsets.all(10.0),
|
||||
child: new Column(
|
||||
children: [
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(
|
||||
top: 8.0, bottom: 8.0, left: 0.0, right: 0.0),
|
||||
child: new Text(S
|
||||
.of(context)
|
||||
.inGreenMonitoredAreas),
|
||||
),
|
||||
new Flexible(
|
||||
child: new FlutterMap(
|
||||
options: new MapOptions(
|
||||
center: new LatLng(53.5775, 3.106111),
|
||||
zoom: 1.0,
|
||||
distinct: true,
|
||||
converter: (store) {
|
||||
return new _ViewModel(store.state.monitoredAreas);
|
||||
},
|
||||
builder: (context, view) {
|
||||
return new Scaffold(
|
||||
appBar:
|
||||
new AppBar(title: new Text(S.of(context).monitoredAreasTitle)),
|
||||
drawer: new MainDrawer(context, MonitoredAreasPage.routeName),
|
||||
bottomNavigationBar: new CustomBottomAppBar(
|
||||
fabLocation: FloatingActionButtonLocation.centerDocked,
|
||||
showNotch: true,
|
||||
color: fires100,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
actions: <Widget>[
|
||||
new Flexible(
|
||||
child: new Padding(
|
||||
padding: new EdgeInsets.only(left: 10.0, right: 10.0),
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
new Text(S.of(context).mapPrivacy,
|
||||
style: new TextStyle(
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Colors.black38))
|
||||
])))
|
||||
]),
|
||||
body: !(view.monitoredAreas is List)
|
||||
? new SpinKitPulse(color: fires600)
|
||||
: new Padding(
|
||||
padding: new EdgeInsets.all(10.0),
|
||||
child: new Column(
|
||||
children: [
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(
|
||||
top: 8.0, bottom: 8.0, left: 0.0, right: 0.0),
|
||||
child: new Text(S.of(context).inGreenMonitoredAreas),
|
||||
),
|
||||
new Flexible(
|
||||
child: new FlutterMap(
|
||||
options: new MapOptions(
|
||||
center: new LatLng(53.5775, 3.106111),
|
||||
zoom: 1.0,
|
||||
),
|
||||
layers: [
|
||||
new TileLayerOptions(
|
||||
urlTemplate:
|
||||
"https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png",
|
||||
subdomains: ['a', 'b', 'c']),
|
||||
new PolylineLayerOptions(
|
||||
polylines: view.monitoredAreas,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
layers: [
|
||||
new TileLayerOptions(
|
||||
urlTemplate:
|
||||
"https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png",
|
||||
subdomains: ['a', 'b', 'c']),
|
||||
new PolylineLayerOptions(
|
||||
polylines: view.monitoredAreas,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue