Added new alerts to scanner page

main
Kai Mannweiler 2023-02-27 20:30:24 +01:00
parent f0e3a1ff6b
commit bb96aaeef9
2 changed files with 20 additions and 17 deletions

View File

@ -1,3 +1,4 @@
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:smoke_cess_app/models/mood.dart'; import 'package:smoke_cess_app/models/mood.dart';
@ -32,6 +33,12 @@ class ScannerPage extends StatelessWidget {
await loadSettingsFromLocalJSON(); await loadSettingsFromLocalJSON();
settingsModel.initSettings(); settingsModel.initSettings();
NotificationService().setAllNotifications(); NotificationService().setAllNotifications();
AwesomeDialog(
context: context,
dialogType: DialogType.success,
title: 'Geschafft',
desc: 'Die Einstellung wurden erfolgreich gespeichert',
).show();
} }
@override @override

View File

@ -1,3 +1,4 @@
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -21,15 +22,12 @@ class MyScannerState extends State<MyScanner> {
void handleError() { void handleError() {
setState(() { setState(() {
scanning = false; scanning = false;
showDialog( AwesomeDialog(
context: context, context: context,
builder: (BuildContext context) { dialogType: DialogType.error,
return const MissingConfigPopup( title: 'Upss',
title: 'Scanfehler', desc: 'Da muss etwas schiefgelaufen sein!',
text: ).show();
'Beim Scanen gab es wohl einen Fehler. Bitte erneut versuchen',
);
});
}); });
} }
@ -43,14 +41,12 @@ class MyScannerState extends State<MyScanner> {
NotificationService().setAllNotifications(); NotificationService().setAllNotifications();
setState(() { setState(() {
scanning = false; scanning = false;
showDialog( AwesomeDialog(
context: context, context: context,
builder: (BuildContext context) { dialogType: DialogType.success,
return MissingConfigPopup( title: 'Geschafft',
title: 'Konfiguration erfolgreich', desc: 'Der Code wurde erfolgreich gescannt!',
text: 'Du gehörst zu Gruppe ${settings.group}', ).show();
);
});
}); });
} }