From bb96aaeef9544f78a354bcad9b927703dbc89423 Mon Sep 17 00:00:00 2001 From: "k.mannweiler" <2012491@stud.hs-mannheim.de> Date: Mon, 27 Feb 2023 20:30:24 +0100 Subject: [PATCH] Added new alerts to scanner page --- lib/pages/scanner_page.dart | 7 +++++++ lib/widgets/scanner.dart | 30 +++++++++++++----------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/lib/pages/scanner_page.dart b/lib/pages/scanner_page.dart index 7e9df8f..29cf8a7 100644 --- a/lib/pages/scanner_page.dart +++ b/lib/pages/scanner_page.dart @@ -1,3 +1,4 @@ +import 'package:awesome_dialog/awesome_dialog.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:smoke_cess_app/models/mood.dart'; @@ -32,6 +33,12 @@ class ScannerPage extends StatelessWidget { await loadSettingsFromLocalJSON(); settingsModel.initSettings(); NotificationService().setAllNotifications(); + AwesomeDialog( + context: context, + dialogType: DialogType.success, + title: 'Geschafft', + desc: 'Die Einstellung wurden erfolgreich gespeichert', + ).show(); } @override diff --git a/lib/widgets/scanner.dart b/lib/widgets/scanner.dart index a97e14d..0f65b74 100644 --- a/lib/widgets/scanner.dart +++ b/lib/widgets/scanner.dart @@ -1,3 +1,4 @@ +import 'package:awesome_dialog/awesome_dialog.dart'; import 'package:flutter/material.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:provider/provider.dart'; @@ -21,15 +22,12 @@ class MyScannerState extends State { void handleError() { setState(() { scanning = false; - showDialog( - context: context, - builder: (BuildContext context) { - return const MissingConfigPopup( - title: 'Scanfehler', - text: - 'Beim Scanen gab es wohl einen Fehler. Bitte erneut versuchen', - ); - }); + AwesomeDialog( + context: context, + dialogType: DialogType.error, + title: 'Upss', + desc: 'Da muss etwas schiefgelaufen sein!', + ).show(); }); } @@ -43,14 +41,12 @@ class MyScannerState extends State { NotificationService().setAllNotifications(); setState(() { scanning = false; - showDialog( - context: context, - builder: (BuildContext context) { - return MissingConfigPopup( - title: 'Konfiguration erfolgreich', - text: 'Du gehörst zu Gruppe ${settings.group}', - ); - }); + AwesomeDialog( + context: context, + dialogType: DialogType.success, + title: 'Geschafft', + desc: 'Der Code wurde erfolgreich gescannt!', + ).show(); }); }