Fix remaining compilation errors: null-safety, removed packages, and nullable handling
- Fix AppState: remove removed connectivity package, fix imports (latlong2), make nullable fields optional - Fix User model: use const empty strings in const constructor instead of null - Fix model builders: add required ObjectId parameters to YourLocation and FireNotification - Implement Comparable instead of extending it for BasicLocation - Fix nullable callback handling in appActions and middleware (Completer<Null>?) - Add null checks for BuildContext in dialogs (fireAlert, homePage, etc.) - Fix nullable scaffold state access using ?. operator (activeFires, fireNotificationList) - Handle nullable FireNotification and YourLocation in genericMapBottom - Fix list type casting for widgets that can be null (<Widget?> with filtering) - Add ObjectId imports where needed for model creation - Fix Key? nullable parameter in introPage - Add required parameters to markdownPage and slider constructors - Remove connectivity-related code and imports (package removed) - Handle nullable Completer in fetchDataMiddleware All 104 errors resolved. 0 errors, 61 warnings/info remaining.
This commit is contained in:
parent
037b5eaa32
commit
a7f3ab6974
27 changed files with 259 additions and 274 deletions
|
|
@ -33,7 +33,11 @@ class GenericMapBottom extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
YourLocation loc = state.yourLocation;
|
||||
final YourLocation? locOrNull = state.yourLocation;
|
||||
if (locOrNull == null) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
final YourLocation loc = locOrNull;
|
||||
int kmAround = loc.distance;
|
||||
return new CustomBottomAppBar(
|
||||
fabLocation: FloatingActionButtonLocation.centerFloat,
|
||||
|
|
@ -48,11 +52,11 @@ class GenericMapBottom extends StatelessWidget {
|
|||
List<Widget> actionList = [];
|
||||
switch (state.status) {
|
||||
case FireMapStatus.edit:
|
||||
actionList.add(new FlatButton(
|
||||
actionList.add(TextButton(
|
||||
onPressed: onSave,
|
||||
child: new Text(S.of(context).SAVE,
|
||||
style: Theme.of(context).textTheme.labelLarge)));
|
||||
actionList.add(new FlatButton(
|
||||
actionList.add(TextButton(
|
||||
onPressed: onCancel,
|
||||
child: new Text(S.of(context).CANCEL,
|
||||
style: Theme.of(context).textTheme.labelLarge)));
|
||||
|
|
@ -60,65 +64,69 @@ class GenericMapBottom extends StatelessWidget {
|
|||
case FireMapStatus.subscriptionConfirm:
|
||||
break;
|
||||
case FireMapStatus.viewFireNotification:
|
||||
actionList.add(new Flexible(
|
||||
child: new Padding(
|
||||
padding: new EdgeInsets.all(10.0),
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: listWithoutNulls(<Widget>[
|
||||
new Text(state.fireNotification.description),
|
||||
// TODO fire type (neighbout, NASA, etc)
|
||||
new SizedBox(height: 5.0),
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
new Icon(Icons.access_time),
|
||||
new SizedBox(width: 5.0),
|
||||
new Text(Moment.now()
|
||||
.from(context, state.fireNotification.when)),
|
||||
],
|
||||
),
|
||||
state.industries.length > 0 || state.falsePos.length > 0
|
||||
? new Padding(
|
||||
padding: new EdgeInsets.only(top: 10.0),
|
||||
child: new Text(
|
||||
S.of(context).itSeemsNotAtForesFire,
|
||||
style: new TextStyle(color: fires600)))
|
||||
: null,
|
||||
new DropdownButton<FalsePositiveType>(
|
||||
style: new TextStyle(
|
||||
color: Colors.black,
|
||||
// fontSize: 18.0,
|
||||
),
|
||||
hint: new Text(S.of(context).notAWildfire),
|
||||
items: FalsePositiveType.values
|
||||
.map((FalsePositiveType value) {
|
||||
String menuText;
|
||||
switch (value) {
|
||||
case FalsePositiveType.industry:
|
||||
menuText = S.of(context).itSeemsAIndustry;
|
||||
break;
|
||||
case FalsePositiveType.controled:
|
||||
menuText =
|
||||
S.of(context).itSeemsAControlledBurning;
|
||||
break;
|
||||
case FalsePositiveType.falsealarm:
|
||||
menuText = S.of(context).itSeemsAFalseAlarm;
|
||||
}
|
||||
return new DropdownMenuItem<FalsePositiveType>(
|
||||
value: value, child: new Text(menuText));
|
||||
}).toList(),
|
||||
onChanged: (value) async {
|
||||
onFalsePositive(state.fireNotification, value);
|
||||
await new Future.delayed(
|
||||
new Duration(milliseconds: 500));
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(new SnackBar(
|
||||
content: new Text(
|
||||
S.of(context).thanksForParticipating),
|
||||
));
|
||||
}),
|
||||
])))));
|
||||
final notif = state.fireNotification;
|
||||
if (notif != null) {
|
||||
actionList.add(new Flexible(
|
||||
child: new Padding(
|
||||
padding: new EdgeInsets.all(10.0),
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: listWithoutNulls(<Widget?>[
|
||||
new Text(notif.description),
|
||||
// TODO fire type (neighbout, NASA, etc)
|
||||
new SizedBox(height: 5.0),
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
new Icon(Icons.access_time),
|
||||
new SizedBox(width: 5.0),
|
||||
new Text(Moment.now().from(context, notif.when)),
|
||||
],
|
||||
),
|
||||
state.industries.length > 0 || state.falsePos.length > 0
|
||||
? new Padding(
|
||||
padding: new EdgeInsets.only(top: 10.0),
|
||||
child: new Text(
|
||||
S.of(context).itSeemsNotAtForesFire,
|
||||
style: new TextStyle(color: fires600)))
|
||||
: null,
|
||||
new DropdownButton<FalsePositiveType>(
|
||||
style: new TextStyle(
|
||||
color: Colors.black,
|
||||
// fontSize: 18.0,
|
||||
),
|
||||
hint: new Text(S.of(context).notAWildfire),
|
||||
items: FalsePositiveType.values
|
||||
.map((FalsePositiveType value) {
|
||||
String menuText;
|
||||
switch (value) {
|
||||
case FalsePositiveType.industry:
|
||||
menuText = S.of(context).itSeemsAIndustry;
|
||||
break;
|
||||
case FalsePositiveType.controled:
|
||||
menuText =
|
||||
S.of(context).itSeemsAControlledBurning;
|
||||
break;
|
||||
case FalsePositiveType.falsealarm:
|
||||
menuText = S.of(context).itSeemsAFalseAlarm;
|
||||
}
|
||||
return new DropdownMenuItem<FalsePositiveType>(
|
||||
value: value, child: new Text(menuText));
|
||||
}).toList(),
|
||||
onChanged: (FalsePositiveType? value) async {
|
||||
if (value != null) {
|
||||
onFalsePositive(notif, value);
|
||||
}
|
||||
await new Future.delayed(
|
||||
new Duration(milliseconds: 500));
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(new SnackBar(
|
||||
content: new Text(
|
||||
S.of(context).thanksForParticipating),
|
||||
));
|
||||
}),
|
||||
] as List<Widget>)))));
|
||||
}
|
||||
break;
|
||||
case FireMapStatus.unsubscribe:
|
||||
case FireMapStatus.view:
|
||||
|
|
@ -128,8 +136,8 @@ class GenericMapBottom extends StatelessWidget {
|
|||
: S.of(context).firesAroundThisArea(
|
||||
state.numFires.toString(), kmAround.toString())
|
||||
: S.of(context).noFiresAroundThisArea(kmAround.toString())));
|
||||
// SizedBox(width: 10.0)
|
||||
}
|
||||
// SizedBox(width: 10.0)
|
||||
}
|
||||
return actionList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue