fix: resolve 2 remaining strict analysis errors
- introPage.dart: Convert fireItems to proper static function closure - mainDrawer.dart: Convert unreadCount int to String for Text widget
This commit is contained in:
parent
1864e5b105
commit
7a4c9fb3bc
61 changed files with 1386 additions and 1202 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:badges/badges.dart' as badges_pkg;
|
||||
import 'package:comunes_flutter/comunes_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/src/store.dart';
|
||||
|
||||
import 'activeFires.dart';
|
||||
import 'colors.dart';
|
||||
|
|
@ -17,11 +17,10 @@ import 'supportPage.dart';
|
|||
|
||||
@immutable
|
||||
class _ViewModel {
|
||||
final int unreadCount;
|
||||
|
||||
_ViewModel({
|
||||
const _ViewModel({
|
||||
required this.unreadCount,
|
||||
});
|
||||
final int unreadCount;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
|
|
@ -36,65 +35,65 @@ class _ViewModel {
|
|||
}
|
||||
|
||||
class MainDrawer extends Drawer {
|
||||
MainDrawer(BuildContext context, String currentRoute, {Key? key})
|
||||
: super(key: key, child: mainDrawer(context, currentRoute));
|
||||
MainDrawer(BuildContext context, String currentRoute, {super.key})
|
||||
: super(child: mainDrawer(context, currentRoute));
|
||||
}
|
||||
|
||||
Widget mainDrawer(BuildContext context, String currentRoute) {
|
||||
return new StoreConnector<AppState, _ViewModel>(
|
||||
return StoreConnector<AppState, _ViewModel>(
|
||||
distinct: true,
|
||||
converter: (store) {
|
||||
return new _ViewModel(unreadCount: store.state.fireNotificationsUnread);
|
||||
converter: (Store<AppState> store) {
|
||||
return _ViewModel(unreadCount: store.state.fireNotificationsUnread);
|
||||
},
|
||||
builder: (context, view) {
|
||||
final bottomTextStyle =
|
||||
new TextStyle(fontSize: 12.0, color: Colors.grey);
|
||||
return new ListView(
|
||||
builder: (BuildContext context, _ViewModel view) {
|
||||
const TextStyle bottomTextStyle =
|
||||
TextStyle(fontSize: 12.0, color: Colors.grey);
|
||||
return ListView(
|
||||
// Important: Remove any padding from the ListView.
|
||||
padding: EdgeInsets.zero,
|
||||
children: (<Widget?>[
|
||||
new GestureDetector(
|
||||
children: <Widget?>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/');
|
||||
},
|
||||
child: new DrawerHeader(
|
||||
child: new Column(
|
||||
child: DrawerHeader(
|
||||
decoration: const BoxDecoration(
|
||||
color: fires300,
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
new Image.asset(
|
||||
Image.asset(
|
||||
'images/logo-200.png',
|
||||
fit: BoxFit.scaleDown,
|
||||
height: 80.0,
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
new Text(S.of(context).appName,
|
||||
style: new TextStyle(
|
||||
Text(S.of(context).appName,
|
||||
style: const TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.white,
|
||||
)),
|
||||
],
|
||||
),
|
||||
decoration: new BoxDecoration(
|
||||
color: fires300,
|
||||
),
|
||||
),
|
||||
),
|
||||
new ListTile(
|
||||
ListTile(
|
||||
leading: const Icon(Icons.whatshot),
|
||||
title: new Text(S.of(context).activeFires),
|
||||
title: Text(S.of(context).activeFires),
|
||||
selected: currentRoute == ActiveFiresPage.routeName,
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, ActiveFiresPage.routeName);
|
||||
},
|
||||
),
|
||||
new ListTile(
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications_active),
|
||||
selected: currentRoute == FireAlert.routeName,
|
||||
title: new Text(S.of(context).notifyAFire),
|
||||
title: Text(S.of(context).notifyAFire),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, FireAlert.routeName);
|
||||
},
|
||||
),
|
||||
new ListTile(
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications),
|
||||
selected: currentRoute == FireNotificationList.routeName,
|
||||
title: Text(S.of(context).fireNotificationsTitleShort),
|
||||
|
|
@ -107,10 +106,10 @@ Widget mainDrawer(BuildContext context, String currentRoute) {
|
|||
position: badges_pkg.BadgePosition.topEnd(
|
||||
top: -10, end: -12),
|
||||
badgeContent: Text(
|
||||
'${view.unreadCount.toString()}',
|
||||
style: TextStyle(color: Colors.white),
|
||||
view.unreadCount.toString(),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
child: Icon(Icons.notifications))
|
||||
child: const Icon(Icons.notifications))
|
||||
])),
|
||||
|
||||
// Text(S.of(context).fireNotificationsTitleShort),
|
||||
|
|
@ -119,43 +118,44 @@ Widget mainDrawer(BuildContext context, String currentRoute) {
|
|||
context, FireNotificationList.routeName);
|
||||
},
|
||||
),
|
||||
new ListTile(
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map),
|
||||
selected: currentRoute == MonitoredAreasPage.routeName,
|
||||
title: new Text(S.of(context).monitoredAreasTitle),
|
||||
title: Text(S.of(context).monitoredAreasTitle),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(
|
||||
context, MonitoredAreasPage.routeName);
|
||||
},
|
||||
),
|
||||
new Divider(),
|
||||
new ListTile(
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.favorite),
|
||||
selected: currentRoute == SupportPage.routeName,
|
||||
title: new Text(S.of(context).supportThisInitiative),
|
||||
title: Text(S.of(context).supportThisInitiative),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, SupportPage.routeName);
|
||||
},
|
||||
),
|
||||
new ListTile(
|
||||
ListTile(
|
||||
leading: const Icon(Icons.lock),
|
||||
selected: currentRoute == PrivacyPage.routeName,
|
||||
title: new Text(S.of(context).privacyPolicy),
|
||||
title: Text(S.of(context).privacyPolicy),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, PrivacyPage.routeName);
|
||||
},
|
||||
),
|
||||
globals.isDevelopment
|
||||
? new ListTile(
|
||||
leading: const Icon(Icons.bug_report),
|
||||
title: new Text('Sandbox'),
|
||||
selected: currentRoute == Sandbox.routeName,
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, Sandbox.routeName);
|
||||
},
|
||||
)
|
||||
: null,
|
||||
new AboutListTile(
|
||||
if (globals.isDevelopment)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.bug_report),
|
||||
title: const Text('Sandbox'),
|
||||
selected: currentRoute == Sandbox.routeName,
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, Sandbox.routeName);
|
||||
},
|
||||
)
|
||||
else
|
||||
null,
|
||||
AboutListTile(
|
||||
icon: globals.appIcon,
|
||||
applicationName: S.of(context).appName,
|
||||
applicationVersion: globals.appVersion,
|
||||
|
|
@ -163,13 +163,13 @@ Widget mainDrawer(BuildContext context, String currentRoute) {
|
|||
applicationLegalese:
|
||||
S.of(context).appLicense(DateTime.now().year.toString()),
|
||||
aboutBoxChildren: <Widget>[
|
||||
new SizedBox(height: 10.0),
|
||||
new Text(S.of(context).appMoto),
|
||||
const SizedBox(height: 10.0),
|
||||
Text(S.of(context).appMoto),
|
||||
// , style: new TextStyle(fontStyle: FontStyle.italic)),
|
||||
new SizedBox(height: 10.0),
|
||||
new Text(S.of(context).NASAAck, style: bottomTextStyle),
|
||||
const SizedBox(height: 10.0),
|
||||
Text(S.of(context).NASAAck, style: bottomTextStyle),
|
||||
// More ?
|
||||
])
|
||||
]).where((w) => w != null).cast<Widget>().toList());
|
||||
].where((Widget? w) => w != null).cast<Widget>().toList());
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue