fix: resolve all warnings (59 warnings → 0)
- Fix bloc_lint include_file_not_found by removing unneeded include - Add explicit type annotations to callback parameters in activeFires.dart - Add explicit type parameters to MaterialPageRoute<void> constructors - Add explicit type parameters to Future<void>.delayed() calls - Fix error handler signatures: (Object err, StackTrace stack) - Remove 'const' from genericMap() widget construction (StatefulWidget) All strict analysis errors and warnings now resolved (0 errors, 0 warnings). Remaining 339 issues are info-level linting suggestions.
This commit is contained in:
parent
7a4c9fb3bc
commit
a5e0335f72
8 changed files with 71 additions and 42 deletions
File diff suppressed because one or more lines are too long
|
|
@ -174,8 +174,4 @@ linter:
|
||||||
- use_test_throws_matchers
|
- use_test_throws_matchers
|
||||||
- valid_regexps
|
- valid_regexps
|
||||||
- void_checks
|
- void_checks
|
||||||
|
|
||||||
include: package:bloc_lint/recommended.yaml
|
|
||||||
bloc:
|
|
||||||
rules:
|
|
||||||
- avoid_flutter_imports
|
- avoid_flutter_imports
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,20 @@ if (flutterRoot == null) {
|
||||||
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
plugins {
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
id 'com.android.application'
|
||||||
|
id 'kotlin-android'
|
||||||
|
}
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||||
def keystoreProperties = new Properties()
|
def keystoreProperties = new Properties()
|
||||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||||
|
|
||||||
|
// Load Flutter's Gradle plugin
|
||||||
|
if (flutterRoot != null) {
|
||||||
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 34
|
compileSdkVersion 34
|
||||||
namespace "org.comunes.fires"
|
namespace "org.comunes.fires"
|
||||||
|
|
@ -85,3 +92,5 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
include ':app'
|
include ':app'
|
||||||
|
|
||||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import 'redux/actions.dart';
|
||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class _ViewModel {
|
class _ViewModel {
|
||||||
|
|
||||||
const _ViewModel(
|
const _ViewModel(
|
||||||
{required this.onAdd,
|
{required this.onAdd,
|
||||||
required this.onDelete,
|
required this.onDelete,
|
||||||
|
|
@ -93,7 +92,8 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRow(BuildContext context, YourLocation loc, onToggle, onTap) {
|
Widget _buildRow(BuildContext context, YourLocation loc,
|
||||||
|
ToggleSubscriptionFunction onToggle, OnLocationTapFunction onTap) {
|
||||||
const TextStyle fireStatsStyle = TextStyle(color: fires600);
|
const TextStyle fireStatsStyle = TextStyle(color: fires600);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
|
|
@ -144,7 +144,11 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSavedLocations(
|
Widget _buildSavedLocations(
|
||||||
BuildContext context, List<YourLocation> yl, onDeleted, onToggle, onTap) {
|
BuildContext context,
|
||||||
|
List<YourLocation> yl,
|
||||||
|
DeleteYourLocationFunction onDeleted,
|
||||||
|
ToggleSubscriptionFunction onToggle,
|
||||||
|
OnLocationTapFunction onTap) {
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
itemCount: yl.length,
|
itemCount: yl.length,
|
||||||
|
|
@ -158,13 +162,13 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
background: Container(
|
background: Container(
|
||||||
color: theme.primaryColor,
|
color: theme.primaryColor,
|
||||||
child: const ListTile(
|
child: const ListTile(
|
||||||
leading: Icon(Icons.delete,
|
leading:
|
||||||
color: Colors.white, size: 36.0))),
|
Icon(Icons.delete, color: Colors.white, size: 36.0))),
|
||||||
secondaryBackground: Container(
|
secondaryBackground: Container(
|
||||||
color: theme.primaryColor,
|
color: theme.primaryColor,
|
||||||
child: const ListTile(
|
child: const ListTile(
|
||||||
trailing: Icon(Icons.delete,
|
trailing:
|
||||||
color: Colors.white, size: 36.0))),
|
Icon(Icons.delete, color: Colors.white, size: 36.0))),
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: theme.canvasColor,
|
color: theme.canvasColor,
|
||||||
|
|
@ -182,8 +186,8 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
print('New ViewModel of Active Fires');
|
print('New ViewModel of Active Fires');
|
||||||
return _ViewModel(
|
return _ViewModel(
|
||||||
onAdd: (YourLocation loc) {
|
onAdd: (YourLocation loc) {
|
||||||
if (store.state.yourLocations
|
if (store.state.yourLocations.any(
|
||||||
.any((YourLocation l) => loc.lat == l.lat && loc.lon == l.lon)) {
|
(YourLocation l) => loc.lat == l.lat && loc.lon == l.lon)) {
|
||||||
// Already added
|
// Already added
|
||||||
showSnackMsg(S.of(context).addedThisLocation);
|
showSnackMsg(S.of(context).addedThisLocation);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -283,7 +287,9 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
Store<AppState> store, YourLocation loc, BuildContext context) {
|
Store<AppState> store, YourLocation loc, BuildContext context) {
|
||||||
store.dispatch(ShowYourLocationMapAction(loc));
|
store.dispatch(ShowYourLocationMapAction(loc));
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context, MaterialPageRoute(builder: (BuildContext context) => const genericMap()));
|
context,
|
||||||
|
MaterialPageRoute<void>(
|
||||||
|
builder: (BuildContext context) => genericMap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onAddYourLocation(AddYourLocationFunction onAdd) {
|
void onAddYourLocation(AddYourLocationFunction onAdd) {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,10 @@ Future<String> getFileNameOfLang(
|
||||||
// https://github.com/flutter/flutter/issues/15325
|
// https://github.com/flutter/flutter/issues/15325
|
||||||
Future<bool> assetNotExists(String asset) {
|
Future<bool> assetNotExists(String asset) {
|
||||||
print('Does not exists $asset ?');
|
print('Does not exists $asset ?');
|
||||||
return rootBundle.load(asset).then((_) => false).catchError((err, stack) {
|
return rootBundle
|
||||||
|
.load(asset)
|
||||||
|
.then((_) => false)
|
||||||
|
.catchError((Object err, StackTrace stack) {
|
||||||
print(err);
|
print(err);
|
||||||
print(stack);
|
print(stack);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import 'redux/actions.dart';
|
||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class _ViewModel {
|
class _ViewModel {
|
||||||
|
|
||||||
const _ViewModel(
|
const _ViewModel(
|
||||||
{required this.isLoaded,
|
{required this.isLoaded,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
|
|
@ -69,7 +68,8 @@ class _FireNotificationListState extends State<FireNotificationList> {
|
||||||
String prefix = '';
|
String prefix = '';
|
||||||
|
|
||||||
// FIXME (this can fails if you don't have a location for this notif, for instance during tests)
|
// FIXME (this can fails if you don't have a location for this notif, for instance during tests)
|
||||||
final YourLocation yl = yourLocations.singleWhere((YourLocation yl) => yl.id == notif.subsId);
|
final YourLocation yl =
|
||||||
|
yourLocations.singleWhere((YourLocation yl) => yl.id == notif.subsId);
|
||||||
prefix = '${yl.description}. ';
|
prefix = '${yl.description}. ';
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
|
|
@ -127,15 +127,14 @@ class _FireNotificationListState extends State<FireNotificationList> {
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: theme.canvasColor,
|
color: theme.canvasColor,
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom:
|
bottom: BorderSide(color: theme.dividerColor))),
|
||||||
BorderSide(color: theme.dividerColor))),
|
|
||||||
child: _buildRow(context, yourLocations,
|
child: _buildRow(context, yourLocations,
|
||||||
notifList.elementAt(i), onDeleted, onTap)));
|
notifList.elementAt(i), onDeleted, onTap)));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleRefresh() async {
|
Future<void> _handleRefresh() async {
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
|
|
@ -166,8 +165,8 @@ class _FireNotificationListState extends State<FireNotificationList> {
|
||||||
},
|
},
|
||||||
onTap: (FireNotification notif) {
|
onTap: (FireNotification notif) {
|
||||||
if (!notif.read) {
|
if (!notif.read) {
|
||||||
store.dispatch(ReadFireNotificationAction(
|
store.dispatch(
|
||||||
notif.copyWith(read: true)));
|
ReadFireNotificationAction(notif.copyWith(read: true)));
|
||||||
}
|
}
|
||||||
Timer(const Duration(milliseconds: 500), () {
|
Timer(const Duration(milliseconds: 500), () {
|
||||||
gotoMap(store, notif, context);
|
gotoMap(store, notif, context);
|
||||||
|
|
@ -194,9 +193,12 @@ class _FireNotificationListState extends State<FireNotificationList> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: <Widget?>[
|
actions: <Widget?>[
|
||||||
if (hasFireNotifications) IconButton(
|
if (hasFireNotifications)
|
||||||
|
IconButton(
|
||||||
icon: const Icon(Icons.delete),
|
icon: const Icon(Icons.delete),
|
||||||
onPressed: () => _showConfirmDialog(view)) else null
|
onPressed: () => _showConfirmDialog(view))
|
||||||
|
else
|
||||||
|
null
|
||||||
].where((Widget? w) => w != null).cast<Widget>().toList()),
|
].where((Widget? w) => w != null).cast<Widget>().toList()),
|
||||||
body: !view.isLoaded
|
body: !view.isLoaded
|
||||||
? const FiresSpinner()
|
? const FiresSpinner()
|
||||||
|
|
@ -232,7 +234,9 @@ class _FireNotificationListState extends State<FireNotificationList> {
|
||||||
Store<AppState> store, FireNotification notif, BuildContext context) {
|
Store<AppState> store, FireNotification notif, BuildContext context) {
|
||||||
store.dispatch(ShowFireNotificationMapAction(notif));
|
store.dispatch(ShowFireNotificationMapAction(notif));
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context, MaterialPageRoute(builder: (BuildContext context) => const genericMap()));
|
context,
|
||||||
|
MaterialPageRoute<void>(
|
||||||
|
builder: (BuildContext context) => genericMap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showConfirmDialog(_ViewModel view) {
|
Future<void> _showConfirmDialog(_ViewModel view) {
|
||||||
|
|
@ -245,8 +249,7 @@ class _FireNotificationListState extends State<FireNotificationList> {
|
||||||
content: SingleChildScrollView(
|
content: SingleChildScrollView(
|
||||||
child: ListBody(
|
child: ListBody(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(S.of(context).deleteAllFireNotificationsAlertDescription)
|
||||||
S.of(context).deleteAllFireNotificationsAlertDescription)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,13 @@ import 'models/yourLocation.dart';
|
||||||
|
|
||||||
typedef OnSave = void Function();
|
typedef OnSave = void Function();
|
||||||
typedef OnCancel = void Function();
|
typedef OnCancel = void Function();
|
||||||
typedef OnFalsePositive = void Function(FireNotification notif, FalsePositiveType type);
|
typedef OnFalsePositive = void Function(
|
||||||
|
FireNotification notif, FalsePositiveType type);
|
||||||
|
|
||||||
class GenericMapBottom extends StatelessWidget {
|
class GenericMapBottom extends StatelessWidget {
|
||||||
|
|
||||||
const GenericMapBottom(
|
const GenericMapBottom(
|
||||||
{super.key, required this.onSave,
|
{super.key,
|
||||||
|
required this.onSave,
|
||||||
required this.onCancel,
|
required this.onCancel,
|
||||||
required this.onFalsePositive,
|
required this.onFalsePositive,
|
||||||
required this.state,
|
required this.state,
|
||||||
|
|
@ -80,11 +81,14 @@ class GenericMapBottom extends StatelessWidget {
|
||||||
Text(Moment.now().from(context, notif.when)),
|
Text(Moment.now().from(context, notif.when)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (state.industries.isNotEmpty || state.falsePos.isNotEmpty) Padding(
|
if (state.industries.isNotEmpty ||
|
||||||
|
state.falsePos.isNotEmpty)
|
||||||
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 10.0),
|
padding: const EdgeInsets.only(top: 10.0),
|
||||||
child: Text(
|
child: Text(S.of(context).itSeemsNotAtForesFire,
|
||||||
S.of(context).itSeemsNotAtForesFire,
|
style: const TextStyle(color: fires600)))
|
||||||
style: const TextStyle(color: fires600))) else null,
|
else
|
||||||
|
null,
|
||||||
DropdownButton<FalsePositiveType>(
|
DropdownButton<FalsePositiveType>(
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
|
|
@ -112,12 +116,12 @@ class GenericMapBottom extends StatelessWidget {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
onFalsePositive(notif, value);
|
onFalsePositive(notif, value);
|
||||||
}
|
}
|
||||||
await Future.delayed(
|
await Future<void>.delayed(
|
||||||
const Duration(milliseconds: 500));
|
const Duration(milliseconds: 500));
|
||||||
ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context)
|
||||||
.showSnackBar(SnackBar(
|
.showSnackBar(SnackBar(
|
||||||
content: Text(
|
content:
|
||||||
S.of(context).thanksForParticipating),
|
Text(S.of(context).thanksForParticipating),
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
] as List<Widget>)))));
|
] as List<Widget>)))));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue