deactivationConfirmationDialog function

void deactivationConfirmationDialog(
  1. dynamic context,
  2. dynamic ref
)

Implementation

void deactivationConfirmationDialog(BuildContext context, WidgetRef ref) {
  TextEditingController passwordController = TextEditingController();
  final theme = Theme.of(context).colorScheme;
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return AlertDialog(
        backgroundColor: Theme.of(context).colorScheme.surface,
        title: Text(
          L10n.of(context).deactivateAccount,
          style: TextStyle(
            color: theme.error,
            fontSize: 26,
          ),
        ),
        content: ConstrainedBox(
          constraints: const BoxConstraints(maxWidth: 650),
          child: Column(
            children: [
              Expanded(
                child: SingleChildScrollView(
                  child: Container(
                    padding: const EdgeInsets.symmetric(
                      horizontal: 10,
                      vertical: 5,
                    ),
                    color: Theme.of(context).colorScheme.surface,
                    child: Column(
                      children: [
                        Text(
                          L10n.of(context).deactivateAccountTitle,
                          style: TextStyle(
                            color: theme.error,
                            fontSize: 20,
                          ),
                        ),
                        Text(L10n.of(context).deactivateAccountDescription),
                      ],
                    ),
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.only(top: 10, bottom: 10),
                child: Text(
                  L10n.of(context).deactivateAccountPasswordTitle,
                  style: TextStyle(
                    color: theme.error,
                    fontSize: 20,
                  ),
                ),
              ),
              ConstrainedBox(
                constraints: const BoxConstraints(maxWidth: 250),
                child: TextField(
                  key: deactivatePasswordField,
                  controller: passwordController,
                  obscureText: true,
                  decoration: InputDecoration(
                    hintText: L10n.of(context).password,
                  ),
                ),
              ),
            ],
          ),
        ),
        actions: <Widget>[
          OutlinedButton(
            key: deactivateCancelBtn,
            onPressed: () => Navigator.pop(context),
            child: Text(L10n.of(context).cancel),
          ),
          ActerDangerActionButton(
            key: deactivateConfirmBtn,
            onPressed: () async => _onConfirm(
              context,
              ref,
              passwordController.text,
            ),
            child: Text(L10n.of(context).deactivate),
          ),
        ],
      );
    },
  );
}