fixed flutter analyze issues introduced with new flutter version

main
Julian Gegner 2023-03-04 10:29:35 +01:00
parent 7cc60b180a
commit cd07acc3b5
4 changed files with 48 additions and 40 deletions

View File

@ -20,6 +20,7 @@ class ScannerPage extends StatelessWidget {
await loadSettingsFromLocalJSON(); await loadSettingsFromLocalJSON();
settingsModel.initSettings(); settingsModel.initSettings();
NotificationService().setAllNotifications(); NotificationService().setAllNotifications();
if (context.mounted) {
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.success, dialogType: DialogType.success,
@ -27,6 +28,7 @@ class ScannerPage extends StatelessWidget {
desc: 'Die Einstellung wurden erfolgreich gespeichert', desc: 'Die Einstellung wurden erfolgreich gespeichert',
).show(); ).show();
} }
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -7,6 +7,7 @@ import '../services/pages_service.dart';
void showTaskDonePopup(BuildContext context, Pages page) async { void showTaskDonePopup(BuildContext context, Pages page) async {
Duration duration = await getTimeTill(page); Duration duration = await getTimeTill(page);
if (context.mounted) {
await showDialog( await showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
@ -18,6 +19,7 @@ void showTaskDonePopup(BuildContext context, Pages page) async {
); );
}, },
); );
}
} }
class TaskDonePopup extends StatelessWidget { class TaskDonePopup extends StatelessWidget {

View File

@ -17,6 +17,7 @@ class SubmitFormButton extends StatelessWidget {
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: () async {
int success = await submitCallback(); int success = await submitCallback();
if (context.mounted) {
if (success != 0) { if (success != 0) {
await AwesomeDialog( await AwesomeDialog(
context: context, context: context,
@ -34,6 +35,7 @@ class SubmitFormButton extends StatelessWidget {
desc: 'Der Eintrag konnte nicht gespeichert werden', desc: 'Der Eintrag konnte nicht gespeichert werden',
).show(); ).show();
} }
}
}, },
child: const Text('Speichern'), child: const Text('Speichern'),
), ),

View File

@ -28,6 +28,7 @@ class WorkoutTimerWidget extends StatelessWidget {
workoutProvider.saveWorkout(); workoutProvider.saveWorkout();
tasksProvider.setTaskDone(Pages.timer); tasksProvider.setTaskDone(Pages.timer);
}, 'Motivation nach dem Training'); }, 'Motivation nach dem Training');
if (context.mounted) {
await AwesomeDialog( await AwesomeDialog(
context: context, context: context,
dialogType: DialogType.success, dialogType: DialogType.success,
@ -36,6 +37,7 @@ class WorkoutTimerWidget extends StatelessWidget {
).show(); ).show();
pageProvider.swap(); pageProvider.swap();
} }
}
if (workoutProvider.isPhaseComplete && !workoutProvider.isWorkoutComplete) { if (workoutProvider.isPhaseComplete && !workoutProvider.isWorkoutComplete) {
Timer(const Duration(milliseconds: 1), () => workoutProvider.nextPhase()); Timer(const Duration(milliseconds: 1), () => workoutProvider.nextPhase());