diff --git a/frontend/lib/identification/verification_workflow/dialogs/positive_verification_result_dialog.dart b/frontend/lib/identification/verification_workflow/dialogs/positive_verification_result_dialog.dart index 8f122093c..a508ca141 100644 --- a/frontend/lib/identification/verification_workflow/dialogs/positive_verification_result_dialog.dart +++ b/frontend/lib/identification/verification_workflow/dialogs/positive_verification_result_dialog.dart @@ -7,10 +7,35 @@ import 'package:ehrenamtskarte/proto/card.pb.dart'; import 'package:flutter/material.dart'; import 'package:graphql_flutter/graphql_flutter.dart'; -class PositiveVerificationResultDialog extends StatelessWidget { +class PositiveVerificationResultDialog extends StatefulWidget { final CardInfo cardInfo; + final bool isStaticVerificationCode; - const PositiveVerificationResultDialog({super.key, required this.cardInfo}); + const PositiveVerificationResultDialog({ + super.key, + required this.cardInfo, + required this.isStaticVerificationCode, + }); + + static Future show({ + required BuildContext context, + required CardInfo cardInfo, + required bool isStaticVerificationCode, + }) => + showDialog( + context: context, + builder: (_) => PositiveVerificationResultDialog( + cardInfo: cardInfo, + isStaticVerificationCode: isStaticVerificationCode, + ), + ); + + @override + PositiveVerificationResultDialogState createState() => PositiveVerificationResultDialogState(); +} + +class PositiveVerificationResultDialogState extends State { + bool isChecked = false; @override Widget build(BuildContext context) { @@ -19,7 +44,7 @@ class PositiveVerificationResultDialog extends StatelessWidget { final regionsQuery = GetRegionsByIdQuery( variables: GetRegionsByIdArguments( project: projectId, - ids: [cardInfo.extensions.extensionRegion.regionId], + ids: [widget.cardInfo.extensions.extensionRegion.regionId], ), ); @@ -28,19 +53,40 @@ class PositiveVerificationResultDialog extends StatelessWidget { builder: (result, {refetch, fetchMore}) { final data = result.data; final region = result.isConcrete && data != null ? regionsQuery.parse(data).regionsByIdInProject[0] : null; + final bool isUncheckedStaticQrCode = !isChecked && widget.isStaticVerificationCode; return InfoDialog( - title: localization.positiveVerificationDialogTitle, - icon: Icons.verified_user, - iconColor: Colors.green, - child: IdCard( - cardInfo: cardInfo, - region: region != null ? Region(region.prefix, region.name) : null, + title: isUncheckedStaticQrCode ? "Prüfung nötig" : localization.positiveVerificationDialogTitle, + icon: isUncheckedStaticQrCode ? Icons.report : Icons.verified_user, + iconColor: isUncheckedStaticQrCode ? Theme.of(context).colorScheme.onBackground : Colors.green, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Flexible( + child: IdCard( + cardInfo: widget.cardInfo, + region: region != null ? Region(region.prefix, region.name) : null, + ), + ), + if (widget.isStaticVerificationCode) + Flexible( + child: Padding( + padding: const EdgeInsets.only(top: 16.0), + child: CheckboxListTile( + title: const Text('Ich habe die Daten mit einem amtlichen Lichtbildausweis abgeglichen.'), + controlAffinity: ListTileControlAffinity.leading, + value: isChecked, + onChanged: (bool? value) { + setState(() { + isChecked = value ?? false; + }); + }, + ), + ), + ) + ], ), ); }, ); } - - static Future show(BuildContext context, CardInfo cardInfo) => - showDialog(context: context, builder: (_) => PositiveVerificationResultDialog(cardInfo: cardInfo)); } diff --git a/frontend/lib/identification/verification_workflow/verification_qr_scanner_page.dart b/frontend/lib/identification/verification_workflow/verification_qr_scanner_page.dart index 5f4bdaa96..7f34b3650 100644 --- a/frontend/lib/identification/verification_workflow/verification_qr_scanner_page.dart +++ b/frontend/lib/identification/verification_workflow/verification_qr_scanner_page.dart @@ -82,7 +82,7 @@ class VerificationQrScannerPage extends StatelessWidget { "Der eingescannte Code konnte vom Server nicht verifiziert werden!", ); } else { - await _onSuccess(context, cardInfo); + await _onSuccess(context, cardInfo, qrcode.hasStaticVerificationCode()); } } on ServerVerificationException catch (e) { await _onConnectionError( @@ -144,9 +144,13 @@ class VerificationQrScannerPage extends StatelessWidget { await ConnectionFailedDialog.show(context, message); } - Future _onSuccess(BuildContext context, CardInfo cardInfo) async { + Future _onSuccess(BuildContext context, CardInfo cardInfo, bool isStaticVerificationCode) async { _closeWaitingDialog(context); - await PositiveVerificationResultDialog.show(context, cardInfo); + await PositiveVerificationResultDialog.show( + context: context, + cardInfo: cardInfo, + isStaticVerificationCode: isStaticVerificationCode, + ); } void _openWaitingDialog(BuildContext context) { diff --git a/frontend/lib/themes.dart b/frontend/lib/themes.dart index 8d812182b..822b25f70 100644 --- a/frontend/lib/themes.dart +++ b/frontend/lib/themes.dart @@ -35,6 +35,10 @@ ThemeData get lightTheme { outlinedButtonTheme: OutlinedButtonThemeData( style: ButtonStyle(side: MaterialStatePropertyAll(BorderSide(color: primaryColor, width: 1))), ), + checkboxTheme: CheckboxThemeData( + checkColor: const MaterialStatePropertyAll(Colors.black), + fillColor: MaterialStatePropertyAll(primaryColor), + ), ); } @@ -66,5 +70,9 @@ ThemeData get darkTheme { outlinedButtonTheme: OutlinedButtonThemeData( style: ButtonStyle(side: MaterialStatePropertyAll(BorderSide(color: primaryColor, width: 1))), ), + checkboxTheme: CheckboxThemeData( + checkColor: const MaterialStatePropertyAll(Colors.white), + fillColor: MaterialStatePropertyAll(primaryColor), + ), ); }