Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1853: Fix the style of dialogs in the app #1857

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/assets/koblenz/l10n/override_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"limitReached": "Ihr Passlimit wurde erreicht. Bitte entfernen Sie vorher einen Pass, damit Sie einen neuen aktivieren können.",
"buttonText": "Pass aktivieren",
"invalidCode": "Ihr Aktivierungscode ist ungültig.",
"alreadyExists": "Dieser Pass wurde bereits auf dem Gerät aktiviert.",
"alreadyExists": "Dieser Pass wurde bereits auf diesem Gerät aktiviert.",
seluianova marked this conversation as resolved.
Show resolved Hide resolved
"activationSuccessful": "Die Aktivierung war erfolgreich.",
"activationInvalid": "Die Aktivierung befindet sich in einem ungültigen Zustand."
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/assets/l10n/app_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"limitReached": "Ihr Kartenlimit wurde erreicht. Bitte entfernen Sie vorher eine Karte, damit Sie eine neue aktivieren können.",
"buttonText": "Karte aktivieren",
"invalidCode": "Ihr Aktivierungscode ist ungültig.",
"alreadyExists": "Diese Karte wurde bereits auf dem Gerät aktiviert.",
"alreadyExists": "Diese Karte wurde bereits auf diesem Gerät aktiviert.",
"activationSuccessful": "Die Aktivierung war erfolgreich.",
"activationInvalid": "Die Aktivierung befindet sich in einem ungültigen Zustand."
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/assets/nuernberg/l10n/override_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"limitReached": "Ihr Passlimit wurde erreicht. Bitte entfernen Sie vorher einen Pass, damit Sie einen neuen aktivieren können.",
"buttonText": "Pass aktivieren",
"invalidCode": "Ihr Aktivierungscode ist ungültig.",
"alreadyExists": "Dieser Pass wurde bereits auf dem Gerät aktiviert.",
"alreadyExists": "Dieser Pass wurde bereits auf diesem Gerät aktiviert.",
"activationSuccessful": "Die Aktivierung war erfolgreich.",
"activationInvalid": "Die Aktivierung befindet sich in einem ungültigen Zustand."
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:ehrenamtskarte/widgets/custom_alert_dialog.dart';
import 'package:flutter/material.dart';

import 'package:ehrenamtskarte/l10n/translations.g.dart';
Expand All @@ -9,26 +10,8 @@ class ActivationErrorDialog extends StatelessWidget {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final t = context.t;
return AlertDialog(
title: Text(t.identification.activationError),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(message, style: theme.textTheme.bodyMedium),
],
),
),
actions: <Widget>[
TextButton(
child: Text(t.common.ok),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop();
},
),
],
);
return CustomAlertDialog(title: t.identification.activationError, message: message);
}

static Future<void> showErrorDialog(BuildContext context, String message) async {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:ehrenamtskarte/widgets/custom_alert_dialog.dart';
import 'package:flutter/material.dart';

import 'package:ehrenamtskarte/l10n/translations.g.dart';
Expand All @@ -8,15 +9,9 @@ class ActivationOverwriteExistingDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
final t = context.t;
return AlertDialog(
title: Text(t.identification.activateCurrentDeviceTitle),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(t.identification.activateCurrentDeviceDescription),
],
),
),
return CustomAlertDialog(
title: t.identification.activateCurrentDeviceTitle,
message: t.identification.activateCurrentDeviceDescription,
actions: <Widget>[
TextButton(
child: Text(t.common.cancel),
Expand Down
6 changes: 3 additions & 3 deletions frontend/lib/identification/connection_failed_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:ehrenamtskarte/identification/info_dialog.dart';
import 'package:ehrenamtskarte/widgets/custom_alert_dialog.dart';
import 'package:flutter/material.dart';

import 'package:ehrenamtskarte/l10n/translations.g.dart';
Expand All @@ -11,11 +11,11 @@ class ConnectionFailedDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
final t = context.t;
return InfoDialog(
return CustomAlertDialog(
title: t.common.connectionFailed,
icon: Icons.signal_cellular_connected_no_internet_4_bar,
iconColor: Theme.of(context).colorScheme.onSurface,
child: Text(reason, style: Theme.of(context).textTheme.bodyMedium),
message: reason,
);
}

Expand Down
37 changes: 0 additions & 37 deletions frontend/lib/identification/info_dialog.dart

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:ehrenamtskarte/widgets/custom_alert_dialog.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';

Expand All @@ -8,17 +9,11 @@ class QrCodeCameraPermissionDialog extends StatelessWidget {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final t = context.t;
return AlertDialog(
title: Text(t.identification.cameraAccessRequired),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(t.identification.cameraAccessRequiredSettings, style: theme.textTheme.bodyMedium),
],
),
),

return CustomAlertDialog(
title: t.identification.cameraAccessRequired,
message: t.identification.cameraAccessRequiredSettings,
actions: <Widget>[
TextButton(
child: Text(t.common.cancel),
Expand Down
3 changes: 1 addition & 2 deletions frontend/lib/identification/util/activate_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:ehrenamtskarte/configuration/configuration.dart';
import 'package:ehrenamtskarte/graphql_gen/schema.graphql.dart';
import 'package:ehrenamtskarte/identification/activation_workflow/activate_code.dart';
import 'package:ehrenamtskarte/identification/activation_workflow/activation_exception.dart';
import 'package:ehrenamtskarte/identification/activation_workflow/activation_existing_card_dialog.dart';
import 'package:ehrenamtskarte/identification/activation_workflow/activation_overwrite_existing_dialog.dart';
import 'package:ehrenamtskarte/identification/activation_workflow/activation_error_dialog.dart';
import 'package:ehrenamtskarte/identification/user_code_model.dart';
Expand Down Expand Up @@ -88,7 +87,7 @@ Future<bool> activateCard(
}
if (isAlreadyInList(userCodesModel.userCodes, activationCode.info, activationCode.pepper)) {
if (context.mounted) {
await ActivationExistingCardDialog.showExistingCardDialog(context);
await ActivationErrorDialog.showErrorDialog(context, t.deeplinkActivation.alreadyExists);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:ehrenamtskarte/identification/info_dialog.dart';
import 'package:flutter/material.dart';

import 'package:ehrenamtskarte/l10n/translations.g.dart';

import 'package:ehrenamtskarte/widgets/custom_alert_dialog.dart';

class NegativeVerificationResultDialog extends StatelessWidget {
final String reason;

Expand All @@ -11,11 +12,11 @@ class NegativeVerificationResultDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
final t = context.t;
return InfoDialog(
return CustomAlertDialog(
title: t.identification.notVerified,
icon: Icons.error,
iconColor: Colors.red,
child: Text(reason, style: Theme.of(context).textTheme.bodyMedium),
message: reason,
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:ehrenamtskarte/identification/id_card/id_card_with_region_query.dart';
import 'package:ehrenamtskarte/identification/info_dialog.dart';
import 'package:ehrenamtskarte/proto/card.pb.dart';
import 'package:ehrenamtskarte/widgets/custom_alert_dialog.dart';
import 'package:flutter/material.dart';

import 'package:ehrenamtskarte/l10n/translations.g.dart';
Expand Down Expand Up @@ -41,11 +41,12 @@ class PositiveVerificationResultDialogState extends State<PositiveVerificationRe
final theme = Theme.of(context);

final bool isUncheckedStaticQrCode = !isChecked && widget.isStaticVerificationCode;
return InfoDialog(

return CustomAlertDialog(
title: isUncheckedStaticQrCode ? t.identification.checkRequired : t.identification.verificationSuccessful,
icon: isUncheckedStaticQrCode ? Icons.report : Icons.verified_user,
iconColor: isUncheckedStaticQrCode ? theme.colorScheme.onSurface : Colors.green,
child: Column(
customContent: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Flexible(
Expand All @@ -59,10 +60,12 @@ class PositiveVerificationResultDialogState extends State<PositiveVerificationRe
if (widget.isStaticVerificationCode)
Flexible(
child: Padding(
padding: const EdgeInsets.only(top: 16.0),
padding: const EdgeInsets.only(top: 8.0),
child: CheckboxListTile(
title: Text(t.identification.comparedWithID, style: theme.textTheme.bodyLarge),
title: Text(t.identification.comparedWithID, style: theme.textTheme.bodySmall),
controlAffinity: ListTileControlAffinity.leading,
contentPadding: EdgeInsets.zero,
visualDensity: VisualDensity.compact,
seluianova marked this conversation as resolved.
Show resolved Hide resolved
value: isChecked,
onChanged: (bool? value) {
setState(() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:ehrenamtskarte/identification/id_card/id_card_with_region_query.
import 'package:ehrenamtskarte/identification/user_code_model.dart';
import 'package:ehrenamtskarte/l10n/translations.g.dart';
import 'package:ehrenamtskarte/proto/card.pb.dart';
import 'package:ehrenamtskarte/widgets/custom_alert_dialog.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -42,31 +43,17 @@ class RemoveCardConfirmationDialogState extends State<RemoveCardConfirmationDial
Widget build(BuildContext context) {
final t = context.t;

final theme = Theme.of(context);
return AlertDialog(
titlePadding: EdgeInsets.all(4),
contentPadding: EdgeInsets.only(left: 20, right: 20),
actionsPadding: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10),
title: ListTile(
leading: Icon(Icons.warning, color: theme.colorScheme.primaryContainer, size: 30),
title: Text(t.identification.removeTitle, style: theme.textTheme.titleMedium),
return CustomAlertDialog(
icon: Icons.warning,
title: t.identification.removeTitle,
message: t.identification.removeDescription,
customContent: IdCardWithRegionQuery(
cardInfo: widget.userCode.info,
// We trust the backend to have checked for expiration.
isExpired: false,
isNotYetValid: false,
),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Padding(
padding: EdgeInsets.only(bottom: 20),
child: Text(t.identification.removeDescription, style: TextStyle(fontSize: 14))),
IdCardWithRegionQuery(
cardInfo: widget.userCode.info,
// We trust the backend to have checked for expiration.
isExpired: false,
isNotYetValid: false,
),
],
),
),
actions: <Widget>[
actions: [
TextButton(
child: const Text('Abbrechen'),
onPressed: () => Navigator.of(context).pop(false),
Expand Down
Loading