diff --git a/lib/activeFires.dart b/lib/activeFires.dart index f162556..020df11 100644 --- a/lib/activeFires.dart +++ b/lib/activeFires.dart @@ -37,34 +37,20 @@ class _ViewModel { identical(this, other) || other is _ViewModel && runtimeType == other.runtimeType && - yourLocations == other.yourLocations && - onAdd == other.onAdd && - onDelete == other.onDelete && - onToggleSubs == other.onToggleSubs && - onTap == other.onTap; + yourLocations == other.yourLocations ; @override int get hashCode => - yourLocations.hashCode ^ - onAdd.hashCode ^ - onDelete.hashCode ^ - onToggleSubs.hashCode ^ - onTap.hashCode; + yourLocations.hashCode; } -class ActiveFiresPage extends StatefulWidget { +class ActiveFiresPage extends StatelessWidget { static const String routeName = '/fires'; - ActiveFiresPage(); - - @override - _ActiveFiresPageState createState() => _ActiveFiresPageState(); -} - -class _ActiveFiresPageState extends State { final GlobalKey _scaffoldKey = new GlobalKey(); - List _fabMiniMenuItemList(AddYourLocationFunction onAdd) { + List _fabMiniMenuItemList( + BuildContext context, AddYourLocationFunction onAdd) { return [ new FabMiniMenuItem.withText( new Icon(Icons.location_searching), @@ -85,9 +71,7 @@ class _ActiveFiresPageState extends State { ]; } - _ActiveFiresPageState(); - - Widget _buildRow(YourLocation loc, onToggle, onTap) { + Widget _buildRow(BuildContext context, YourLocation loc, onToggle, onTap) { return new ListTile( dense: true, leading: const Icon(Icons.location_on), @@ -115,16 +99,18 @@ class _ActiveFiresPageState extends State { } Widget _buildSavedLocations( - List yl, onDeleted, onToggle, onTap) { + BuildContext context, List yl, onDeleted, onToggle, onTap) { return new ListView.builder( padding: const EdgeInsets.all(16.0), itemCount: yl.length, itemBuilder: (BuildContext _context, int i) { - return _buildItem(yl.elementAt(i), onDeleted, onToggle, onTap); + return _buildItem( + context, yl.elementAt(i), onDeleted, onToggle, onTap); }); } - Widget _buildItem(YourLocation item, onDelete, onToggle, onTap) { + Widget _buildItem( + BuildContext context, YourLocation item, onDelete, onToggle, onTap) { final ThemeData theme = Theme.of(context); return new Dismissible( key: new ObjectKey(item), @@ -147,13 +133,13 @@ class _ActiveFiresPageState extends State { color: theme.canvasColor, border: new Border( bottom: new BorderSide(color: theme.dividerColor))), - child: _buildRow(item, onToggle, onTap))); + child: _buildRow(context, item, onToggle, onTap))); } @override Widget build(BuildContext context) { return new StoreConnector( - distinct: false, // FIXME + distinct: true, converter: (store) { return new _ViewModel( onAdd: (loc) { @@ -211,10 +197,10 @@ class _ActiveFiresPageState extends State { bottomNavigationBar: new GlobalFiresBottomStats(), body: hasLocations ? new Stack(children: [ - _buildSavedLocations(view.yourLocations, view.onDelete, - view.onToggleSubs, view.onTap), - new FabDialer(_fabMiniMenuItemList(view.onAdd), fires600, - new Icon(Icons.add)) + _buildSavedLocations(context, view.yourLocations, + view.onDelete, view.onToggleSubs, view.onTap), + new FabDialer(_fabMiniMenuItemList(context, view.onAdd), + fires600, new Icon(Icons.add)) ]) : new Center( child: new CenteredColumn(children: [ diff --git a/lib/mainDev.dart b/lib/mainDev.dart index 68c8506..a1d08a7 100644 --- a/lib/mainDev.dart +++ b/lib/mainDev.dart @@ -6,7 +6,7 @@ import 'package:redux/redux.dart'; void main() { globals.isDevelopment = true; - var logRedux = true; + var logRedux = false; List devMiddlewares = logRedux ? [ LoggingMiddleware.printer(formatter: LoggingMiddleware.multiLineFormatter) diff --git a/lib/yourLocationMap.dart b/lib/yourLocationMap.dart index 479861d..5485c47 100644 --- a/lib/yourLocationMap.dart +++ b/lib/yourLocationMap.dart @@ -43,39 +43,20 @@ class _ViewModel { identical(this, other) || other is _ViewModel && runtimeType == other.runtimeType && - mapState == other.mapState && - onSubs == other.onSubs && - onSubsConfirmed == other.onSubsConfirmed && - onUnSubs == other.onUnSubs && - onSlide == other.onSlide; + mapState == other.mapState; @override - int get hashCode => - mapState.hashCode ^ - onSubs.hashCode ^ - onSubsConfirmed.hashCode ^ - onUnSubs.hashCode ^ - onSlide.hashCode; + int get hashCode => mapState.hashCode; } -class YourLocationMap extends StatefulWidget { - YourLocationMap(); - - @override - _YourLocationMapState createState() => _YourLocationMapState(); -} - -class _YourLocationMapState extends State { +class YourLocationMap extends StatelessWidget { final GlobalKey _scaffoldKey = new GlobalKey(); final FirebaseMessaging _firebaseMessaging = new FirebaseMessaging(); - _YourLocationMapState(); - @override Widget build(BuildContext context) { - return new StoreConnector( - distinct: false, // FIXME + distinct: true, converter: (store) { return new _ViewModel( onSubs: (loc) {