desktop edit auto backup and enabled/disabled button

This commit is contained in:
ryleedavis 2022-11-10 15:11:17 -07:00
parent b635f1663b
commit 5f106efa4b
5 changed files with 59 additions and 17 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:intl/intl.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/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/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/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/locale_provider.dart';
import 'package:stackwallet/providers/global/prefs_provider.dart'; import 'package:stackwallet/providers/global/prefs_provider.dart';
@ -36,7 +37,6 @@ class BackupRestoreSettings extends ConsumerStatefulWidget {
class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> { class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
late bool createBackup = false; late bool createBackup = false;
late bool restoreBackup = false; late bool restoreBackup = false;
// late bool isEnabledAutoBackup;
final toggleController = DSBController(); final toggleController = DSBController();
@ -91,6 +91,17 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
); );
} }
Future<void> createAutoBackup() async {
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return CreateAutoBackup();
},
);
}
Future<void> attemptDisable() async { Future<void> attemptDisable() async {
final result = await showDialog<bool?>( final result = await showDialog<bool?>(
context: context, context: context,
@ -208,10 +219,25 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SvgPicture.asset( Padding(
Assets.svg.backupAuto, padding: const EdgeInsets.all(8.0),
width: 48, child: Row(
height: 48, 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( Center(
child: Row( child: Row(
@ -338,7 +364,9 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
desktopMed: true, desktopMed: true,
width: 190, width: 190,
label: "Edit auto backup", label: "Edit auto backup",
onPressed: () {}, onPressed: () {
createAutoBackup();
},
), ),
], ],
) )
@ -362,11 +390,14 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SvgPicture.asset( Padding(
Assets.svg.backupAdd, padding: const EdgeInsets.all(8.0),
width: 48, child: SvgPicture.asset(
height: 48, Assets.svg.backupAdd,
alignment: Alignment.topLeft, width: 48,
height: 48,
alignment: Alignment.topLeft,
),
), ),
Center( Center(
child: Row( child: Row(
@ -441,11 +472,14 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SvgPicture.asset( Padding(
Assets.svg.backupRestore, padding: const EdgeInsets.all(8.0),
width: 48, child: SvgPicture.asset(
height: 48, Assets.svg.backupRestore,
alignment: Alignment.topLeft, width: 48,
height: 48,
alignment: Alignment.topLeft,
),
), ),
Center( Center(
child: Row( child: Row(

View file

@ -578,7 +578,9 @@ class _CreateAutoBackup extends ConsumerState<CreateAutoBackup> {
label: "Cancel", label: "Cancel",
onPressed: () { onPressed: () {
int count = 0; int count = 0;
Navigator.of(context).popUntil((_) => count++ >= 2); !isEnabledAutoBackup
? Navigator.of(context).popUntil((_) => count++ >= 2)
: Navigator.of(context).pop();
}, },
), ),
), ),

View file

@ -69,6 +69,7 @@ class _SVG {
String get circleLanguage => "assets/svg/language-circle.svg"; String get circleLanguage => "assets/svg/language-circle.svg";
String get circleDollarSign => "assets/svg/dollar-sign-circle.svg"; String get circleDollarSign => "assets/svg/dollar-sign-circle.svg";
String get circleLock => "assets/svg/lock-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 disableButton => "assets/svg/Button.svg";
String get polygon => "assets/svg/Polygon.svg"; String get polygon => "assets/svg/Polygon.svg";
String get personaIncognito => "assets/svg/persona-incognito-1.svg"; String get personaIncognito => "assets/svg/persona-incognito-1.svg";

View file

@ -298,6 +298,7 @@ flutter:
- assets/svg/persona-easy-1.svg - assets/svg/persona-easy-1.svg
- assets/svg/persona-incognito-1.svg - assets/svg/persona-incognito-1.svg
- assets/svg/Button.svg - assets/svg/Button.svg
- assets/svg/enabled-button.svg
- assets/svg/lock-circle.svg - assets/svg/lock-circle.svg
- assets/svg/dollar-sign-circle.svg - assets/svg/dollar-sign-circle.svg
- assets/svg/language-circle.svg - assets/svg/language-circle.svg