auto backup dialog started

This commit is contained in:
ryleedavis 2022-10-26 16:17:39 -06:00
parent b4e7e219a4
commit da40886012
2 changed files with 114 additions and 2 deletions

View file

@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
class EnableBackupDialog extends StatelessWidget {
const EnableBackupDialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return DesktopDialog(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(32),
child: Text(
"Enable Auto Backup",
style: STextStyles.desktopH3(context),
textAlign: TextAlign.center,
),
),
const DesktopDialogCloseButton(),
],
),
const SizedBox(
height: 30,
),
Text(
"To enable Auto Backup, you need to create a backup file.",
style: STextStyles.desktopTextSmall(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark3,
),
textAlign: TextAlign.center,
),
const Spacer(),
Padding(
padding: const EdgeInsets.all(32),
child: Row(
children: [
Expanded(
child: SecondaryButton(
label: "Cancel",
onPressed: () {
Navigator.of(context).pop();
},
),
),
const SizedBox(
width: 16,
),
Expanded(
child: PrimaryButton(
label: "Continue",
onPressed: () {
// Navigator.of(context).pop();
// onConfirm.call();
},
),
)
],
),
),
],
),
);
}
}

View file

@ -4,9 +4,11 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import '../../../utilities/theme/stack_colors.dart';
import 'enable_backup_dialog.dart';
class SecuritySettings extends ConsumerStatefulWidget {
const SecuritySettings({Key? key}) : super(key: key);
@ -17,6 +19,23 @@ class SecuritySettings extends ConsumerStatefulWidget {
}
class _SecuritySettings extends ConsumerState<SecuritySettings> {
Future<void> enableAutoBackup() async {
// wait for keyboard to disappear
FocusScope.of(context).unfocus();
await Future<void>.delayed(
const Duration(milliseconds: 100),
);
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return EnableBackupDialog();
},
);
}
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
@ -82,8 +101,26 @@ class NewPasswordButton extends ConsumerWidget {
const NewPasswordButton({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
Future<void> enableAutoBackup() async {
// wait for keyboard to disappear
FocusScope.of(context).unfocus();
await Future<void>.delayed(
const Duration(milliseconds: 100),
);
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return EnableBackupDialog();
},
);
}
return SizedBox(
width: 200,
height: 48,
@ -91,7 +128,9 @@ class NewPasswordButton extends ConsumerWidget {
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {},
onPressed: () {
enableAutoBackup();
},
child: Text(
"Set up new password",
style: STextStyles.button(context),