desktop dialog for disable auto backup

This commit is contained in:
ryleedavis 2022-11-10 22:14:08 -07:00
parent dac1337a71
commit de896d30bc

View file

@ -14,7 +14,9 @@ import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
import 'package:stackwallet/utilities/format.dart'; import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart'; import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart'; import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart'; import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -108,42 +110,103 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
useSafeArea: false, useSafeArea: false,
barrierDismissible: true, barrierDismissible: true,
builder: (context) { builder: (context) {
return StackDialog( return !Util.isDesktop
title: "Disable Auto Backup", ? StackDialog(
message: title: "Disable Auto Backup",
"You are turning off Auto Backup. You can turn it back on at any time. Your previous Auto Backup file will not be deleted. Remember to backup your wallets manually so you don't lose important information.", message:
leftButton: TextButton( "You are turning off Auto Backup. You can turn it back on at any time. Your previous Auto Backup file will not be deleted. Remember to backup your wallets manually so you don't lose important information.",
style: Theme.of(context) leftButton: TextButton(
.extension<StackColors>()! style: Theme.of(context)
.getSecondaryEnabledButtonColor(context), .extension<StackColors>()!
child: Text( .getSecondaryEnabledButtonColor(context),
"Back", child: Text(
style: STextStyles.button(context).copyWith( "Back",
color: style: STextStyles.button(context).copyWith(
Theme.of(context).extension<StackColors>()!.accentColorDark, color: Theme.of(context)
), .extension<StackColors>()!
), .accentColorDark,
onPressed: () { ),
Navigator.of(context).pop(); ),
}, onPressed: () {
), Navigator.of(context).pop();
rightButton: TextButton( },
style: Theme.of(context) ),
.extension<StackColors>()! rightButton: TextButton(
.getPrimaryEnabledButtonColor(context), style: Theme.of(context)
child: Text( .extension<StackColors>()!
"Disable", .getPrimaryEnabledButtonColor(context),
style: STextStyles.button(context), child: Text(
), "Disable",
onPressed: () { style: STextStyles.button(context),
Navigator.of(context).pop(); ),
setState(() { onPressed: () {
ref.watch(prefsChangeNotifierProvider).isAutoBackupEnabled = Navigator.of(context).pop();
false; setState(() {
}); ref
}, .watch(prefsChangeNotifierProvider)
), .isAutoBackupEnabled = false;
); });
},
),
)
: DesktopDialog(
maxHeight: 270,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 20, horizontal: 32),
child: Column(
children: [
Text(
"Disable Auto Backup",
style: STextStyles.desktopH3(context),
),
const SizedBox(height: 24),
SizedBox(
width: 600,
child: Text(
"You are turning off Auto Backup. You can turn it back on at any time. "
"Your previous Auto Backup file will not be deleted. Remember to backup your wallets "
"manually so you don't lose important information.",
style: STextStyles.desktopTextSmall(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark3,
),
),
),
const Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SecondaryButton(
width: 248,
desktopMed: true,
enabled: true,
label: "Back",
onPressed: () {
Navigator.of(context).pop();
},
),
const SizedBox(width: 20),
PrimaryButton(
width: 248,
desktopMed: true,
enabled: true,
label: "Disable",
onPressed: () {
Navigator.of(context).pop();
setState(() {
ref
.watch(prefsChangeNotifierProvider)
.isAutoBackupEnabled = false;
});
},
)
],
),
],
),
),
);
}, },
); );
if (mounted) { if (mounted) {