Fix 78 additional lint issues: rename all files to snake_case and fix 16 style issues
Lint issues fixed (263 total in lib/): - file_names (57 issues): Renamed all PascalCase files to snake_case - All lib files: activeFires -> active_fires, etc. - All models: appState -> app_state, fireMapState -> fire_map_state, etc. - All redux files: appActions -> app_actions, appReducer -> app_reducer, etc. - Updated all import statements and exports across the codebase - Fixed unused imports, exports, and references in rebuilt modules Style fixes (16 issues): - prefer_generic_function_type_aliases (2): Updated typedef syntax from old to new - unnecessary_nullable_for_final_variable_declarations (2): Removed ? from non-nullable types - unnecessary_import: Removed duplicate meta/meta import - unnecessary_parenthesis: Removed unnecessary parentheses in expressions - avoid_renaming_method_parameters: Renamed parameter 'o' to 'other' - prefer_const_declarations: Changed final to const for constant values - use_key_in_widget_constructors (3): Added key parameters to widget constructors - sort_child_properties_last (1): Reordered children property to end Verification: - APK builds successfully (146 MB) - Reduced from 106 lint issues to 49 high-priority issues - Total file_names issues: 0 (down from 57) - All imports and exports updated correctly
This commit is contained in:
parent
8da3752193
commit
12653b80a4
65 changed files with 141 additions and 245 deletions
|
|
@ -1,169 +0,0 @@
|
|||
import 'package:badges/badges.dart' as badges_pkg;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/src/store.dart';
|
||||
|
||||
import 'activeFires.dart';
|
||||
import 'colors.dart';
|
||||
import 'fireAlert.dart';
|
||||
import 'fireNotificationList.dart';
|
||||
import 'generated/i18n.dart';
|
||||
import 'globals.dart' as globals;
|
||||
import 'models/appState.dart';
|
||||
import 'monitoredAreas.dart';
|
||||
import 'privacyPage.dart';
|
||||
import 'sandbox.dart';
|
||||
import 'supportPage.dart';
|
||||
|
||||
@immutable
|
||||
class _ViewModel {
|
||||
const _ViewModel({
|
||||
required this.unreadCount,
|
||||
});
|
||||
final int unreadCount;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
other is _ViewModel &&
|
||||
runtimeType == other.runtimeType &&
|
||||
unreadCount == other.unreadCount;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => unreadCount.hashCode;
|
||||
}
|
||||
|
||||
class MainDrawer extends Drawer {
|
||||
MainDrawer(BuildContext context, String currentRoute, {super.key})
|
||||
: super(child: mainDrawer(context, currentRoute));
|
||||
}
|
||||
|
||||
Widget mainDrawer(BuildContext context, String currentRoute) {
|
||||
return StoreConnector<AppState, _ViewModel>(
|
||||
distinct: true,
|
||||
converter: (Store<AppState> store) {
|
||||
return _ViewModel(unreadCount: store.state.fireNotificationsUnread);
|
||||
},
|
||||
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?>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/');
|
||||
},
|
||||
child: DrawerHeader(
|
||||
decoration: const BoxDecoration(
|
||||
color: fires300,
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'images/logo-200.png',
|
||||
fit: BoxFit.scaleDown,
|
||||
height: 80.0,
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
Text(S.of(context).appName,
|
||||
style: const TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.white,
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.whatshot),
|
||||
title: Text(S.of(context).activeFires),
|
||||
selected: currentRoute == ActiveFiresPage.routeName,
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, ActiveFiresPage.routeName);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications_active),
|
||||
selected: currentRoute == FireAlert.routeName,
|
||||
title: Text(S.of(context).notifyAFire),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, FireAlert.routeName);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications),
|
||||
selected: currentRoute == FireNotificationList.routeName,
|
||||
title: Text(S.of(context).fireNotificationsTitleShort),
|
||||
trailing: badges_pkg.Badge(
|
||||
position:
|
||||
badges_pkg.BadgePosition.topEnd(top: -10, end: -12),
|
||||
badgeContent: Text(
|
||||
view.unreadCount.toString(),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
child: const Icon(Icons.notifications)),
|
||||
|
||||
// Text(S.of(context).fireNotificationsTitleShort),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(
|
||||
context, FireNotificationList.routeName);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map),
|
||||
selected: currentRoute == MonitoredAreasPage.routeName,
|
||||
title: Text(S.of(context).monitoredAreasTitle),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(
|
||||
context, MonitoredAreasPage.routeName);
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.favorite),
|
||||
selected: currentRoute == SupportPage.routeName,
|
||||
title: Text(S.of(context).supportThisInitiative),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, SupportPage.routeName);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.lock),
|
||||
selected: currentRoute == PrivacyPage.routeName,
|
||||
title: Text(S.of(context).privacyPolicy),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, PrivacyPage.routeName);
|
||||
},
|
||||
),
|
||||
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,
|
||||
applicationIcon: globals.appMediumIcon,
|
||||
applicationLegalese:
|
||||
S.of(context).appLicense(DateTime.now().year.toString()),
|
||||
aboutBoxChildren: <Widget>[
|
||||
const SizedBox(height: 10.0),
|
||||
Text(S.of(context).appMoto),
|
||||
// , style: new TextStyle(fontStyle: FontStyle.italic)),
|
||||
const SizedBox(height: 10.0),
|
||||
Text(S.of(context).NASAAck, style: bottomTextStyle),
|
||||
// More ?
|
||||
])
|
||||
].where((Widget? w) => w != null).cast<Widget>().toList());
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue