diff --git a/assets/svg/enabled-button.svg b/assets/svg/enabled-button.svg new file mode 100644 index 000000000..a26359e81 --- /dev/null +++ b/assets/svg/enabled-button.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/pages_desktop_specific/home/settings_menu/backup_and_restore/backup_and_restore_settings.dart b/lib/pages_desktop_specific/home/settings_menu/backup_and_restore/backup_and_restore_settings.dart index a444f4b51..3ea6cea6c 100644 --- a/lib/pages_desktop_specific/home/settings_menu/backup_and_restore/backup_and_restore_settings.dart +++ b/lib/pages_desktop_specific/home/settings_menu/backup_and_restore/backup_and_restore_settings.dart @@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:intl/intl.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/create_backup_view.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart'; +import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore/create_auto_backup.dart'; import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore/enable_backup_dialog.dart'; import 'package:stackwallet/providers/global/locale_provider.dart'; import 'package:stackwallet/providers/global/prefs_provider.dart'; @@ -36,7 +37,6 @@ class BackupRestoreSettings extends ConsumerStatefulWidget { class _BackupRestoreSettings extends ConsumerState { late bool createBackup = false; late bool restoreBackup = false; - // late bool isEnabledAutoBackup; final toggleController = DSBController(); @@ -91,6 +91,17 @@ class _BackupRestoreSettings extends ConsumerState { ); } + Future createAutoBackup() async { + await showDialog( + context: context, + useSafeArea: false, + barrierDismissible: true, + builder: (context) { + return CreateAutoBackup(); + }, + ); + } + Future attemptDisable() async { final result = await showDialog( context: context, @@ -208,10 +219,25 @@ class _BackupRestoreSettings extends ConsumerState { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SvgPicture.asset( - Assets.svg.backupAuto, - width: 48, - height: 48, + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + Assets.svg.backupAuto, + width: 48, + height: 48, + ), + isEnabledAutoBackup + ? SvgPicture.asset( + Assets.svg.enableButton, + ) + : SvgPicture.asset( + Assets.svg.disableButton, + ), + ], + ), ), Center( child: Row( @@ -338,7 +364,9 @@ class _BackupRestoreSettings extends ConsumerState { desktopMed: true, width: 190, label: "Edit auto backup", - onPressed: () {}, + onPressed: () { + createAutoBackup(); + }, ), ], ) @@ -362,11 +390,14 @@ class _BackupRestoreSettings extends ConsumerState { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SvgPicture.asset( - Assets.svg.backupAdd, - width: 48, - height: 48, - alignment: Alignment.topLeft, + Padding( + padding: const EdgeInsets.all(8.0), + child: SvgPicture.asset( + Assets.svg.backupAdd, + width: 48, + height: 48, + alignment: Alignment.topLeft, + ), ), Center( child: Row( @@ -441,11 +472,14 @@ class _BackupRestoreSettings extends ConsumerState { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SvgPicture.asset( - Assets.svg.backupRestore, - width: 48, - height: 48, - alignment: Alignment.topLeft, + Padding( + padding: const EdgeInsets.all(8.0), + child: SvgPicture.asset( + Assets.svg.backupRestore, + width: 48, + height: 48, + alignment: Alignment.topLeft, + ), ), Center( child: Row( diff --git a/lib/pages_desktop_specific/home/settings_menu/backup_and_restore/create_auto_backup.dart b/lib/pages_desktop_specific/home/settings_menu/backup_and_restore/create_auto_backup.dart index e804071cc..acd0e689c 100644 --- a/lib/pages_desktop_specific/home/settings_menu/backup_and_restore/create_auto_backup.dart +++ b/lib/pages_desktop_specific/home/settings_menu/backup_and_restore/create_auto_backup.dart @@ -578,7 +578,9 @@ class _CreateAutoBackup extends ConsumerState { label: "Cancel", onPressed: () { int count = 0; - Navigator.of(context).popUntil((_) => count++ >= 2); + !isEnabledAutoBackup + ? Navigator.of(context).popUntil((_) => count++ >= 2) + : Navigator.of(context).pop(); }, ), ), diff --git a/lib/utilities/assets.dart b/lib/utilities/assets.dart index b0c6b3bf9..f853a00d8 100644 --- a/lib/utilities/assets.dart +++ b/lib/utilities/assets.dart @@ -69,6 +69,7 @@ class _SVG { String get circleLanguage => "assets/svg/language-circle.svg"; String get circleDollarSign => "assets/svg/dollar-sign-circle.svg"; String get circleLock => "assets/svg/lock-circle.svg"; + String get enableButton => "assets/svg/enabled-button.svg"; String get disableButton => "assets/svg/Button.svg"; String get polygon => "assets/svg/Polygon.svg"; String get personaIncognito => "assets/svg/persona-incognito-1.svg"; diff --git a/pubspec.yaml b/pubspec.yaml index 19d38ca4f..8b03cd57e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -298,6 +298,7 @@ flutter: - assets/svg/persona-easy-1.svg - assets/svg/persona-incognito-1.svg - assets/svg/Button.svg + - assets/svg/enabled-button.svg - assets/svg/lock-circle.svg - assets/svg/dollar-sign-circle.svg - assets/svg/language-circle.svg