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:
vjrj 2026-03-06 11:21:06 +01:00
parent 1864e5b105
commit 7a4c9fb3bc
61 changed files with 1386 additions and 1202 deletions

View file

@ -7,9 +7,12 @@ import 'package:url_launcher/url_launcher.dart';
import 'customStepper.dart';
import 'generated/i18n.dart';
import 'mainDrawer.dart';
import 'models/yourLocation.dart';
import 'placesAutocompleteUtils.dart';
class FireAlert extends StatefulWidget {
const FireAlert({super.key});
static const String routeName = '/fireAlert';
@override
@ -17,31 +20,31 @@ class FireAlert extends StatefulWidget {
}
class _FireAlertState extends State<FireAlert> {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
int _currentStep = 0;
Widget buildCallButton() {
return new Align(
return Align(
alignment: const Alignment(0.0, -0.2),
child: new FloatingActionButton(
child: FloatingActionButton(
heroTag: 'callAction',
child: const Icon(Icons.call),
onPressed: () {
launch("tel://112");
launch('tel://112');
},
),
);
}
Widget buildNotifyNeighboursButton() {
return new Align(
return Align(
alignment: const Alignment(0.0, -0.2),
child: new FloatingActionButton(
child: FloatingActionButton(
heroTag: 'neighAction',
child: const Icon(CommunityMaterialIcons.bullhorn),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
content: new Text(S.of(context).inDevelopment),
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(S.of(context).inDevelopment),
));
},
),
@ -49,26 +52,26 @@ class _FireAlertState extends State<FireAlert> {
}
Widget buildTweetButton() {
return new Align(
return Align(
alignment: const Alignment(0.0, -0.2),
child: new FloatingActionButton(
child: FloatingActionButton(
heroTag: 'tweetAction',
child: const Icon(CommunityMaterialIcons.twitter),
onPressed: () {
// In Android you can choose with app to use with setPackage but seems it's not implemented here
// https://stackoverflow.com/questions/6814268/android-share-on-facebook-twitter-mail-ecc
openPlacesDialog(_scaffoldKey).then((yourLocation) {
String where =
openPlacesDialog(_scaffoldKey).then((YourLocation yourLocation) {
final String where =
yourLocation.description.replaceAll(' ', '').split(',')[0];
print(where);
Share.shareWithResult(S
.of(context)
.tweetAboutSelf(yourLocation.description, '#IF$where'));
}).catchError((onError) {
final ctx = _scaffoldKey.currentContext;
final BuildContext? ctx = _scaffoldKey.currentContext;
if (ctx != null) {
ScaffoldMessenger.of(ctx).showSnackBar(new SnackBar(
content: new Text(S.of(ctx).errorFirePlaceDialog)));
ScaffoldMessenger.of(ctx).showSnackBar(SnackBar(
content: Text(S.of(ctx).errorFirePlaceDialog)));
}
});
},
@ -81,40 +84,40 @@ class _FireAlertState extends State<FireAlert> {
@override
Widget build(BuildContext context) {
List<CustomStep> fireSteps = listWithoutNulls(<CustomStep>[
new CustomStep(
title: new Text(S.of(context).callEmergencyServicesTitle),
content: new Column(children: <Widget>[
new Text(S.of(context).callEmergencyServicesDescription),
new SizedBox(height: 20.0),
final List<CustomStep> fireSteps = listWithoutNulls(<CustomStep>[
CustomStep(
title: Text(S.of(context).callEmergencyServicesTitle),
content: Column(children: <Widget>[
Text(S.of(context).callEmergencyServicesDescription),
const SizedBox(height: 20.0),
buildCallButton()
])),
new CustomStep(
title: new Text(S.of(context).notifyNeighbours),
CustomStep(
title: Text(S.of(context).notifyNeighbours),
// state: CustomStepState.disabled,
content: new Column(children: <Widget>[
new Text(S.of(context).notifyNeighboursDescription),
new SizedBox(height: 20.0),
content: Column(children: <Widget>[
Text(S.of(context).notifyNeighboursDescription),
const SizedBox(height: 20.0),
buildNotifyNeighboursButton()
])),
// TODO conditional: this only in Spain
new CustomStep(
title: new Text(S.of(context).tweetAboutAFireTitle),
// TODOconditional: this only in Spain
CustomStep(
title: Text(S.of(context).tweetAboutAFireTitle),
// subtitle: new Text(S.of(context).tweetAboutAFireDescription),
content: new Column(children: <Widget>[
new Text(S.of(context).tweetAboutAFireDescription),
new SizedBox(height: 20.0),
content: Column(children: <Widget>[
Text(S.of(context).tweetAboutAFireDescription),
const SizedBox(height: 20.0),
buildTweetButton()
])),
]);
return Scaffold(
key: _scaffoldKey,
appBar: new AppBar(title: new Text(S.of(context).notifyAFire)),
drawer: new MainDrawer(context, FireAlert.routeName),
body: new CustomStepper(
appBar: AppBar(title: Text(S.of(context).notifyAFire)),
drawer: MainDrawer(context, FireAlert.routeName),
body: CustomStepper(
currentCustomStep: _currentStep,
// type: StepperType.horizontal,
onCustomStepTapped: (num) => setState(() {
onCustomStepTapped: (int num) => setState(() {
_currentStep = num;
}),
steps: fireSteps));