route update

This commit is contained in:
ryleedavis 2022-10-28 17:04:48 -06:00
parent ccdfa8db44
commit 300b1fa001
7 changed files with 631 additions and 5 deletions

View file

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/advanced_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/appearance_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore/backup_and_restore_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/currency_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/language_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/nodes_settings.dart';

View file

@ -0,0 +1,311 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore/restore_backup_dialog.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 'package:url_launcher/url_launcher.dart';
import 'enable_backup_dialog.dart';
class BackupRestoreSettings extends ConsumerStatefulWidget {
const BackupRestoreSettings({Key? key}) : super(key: key);
static const String routeName = "/settingsMenuBackupRestore";
@override
ConsumerState<BackupRestoreSettings> createState() =>
_BackupRestoreSettings();
}
class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
return ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: [
Padding(
padding: const EdgeInsets.only(
right: 30,
),
child: RoundedWhiteContainer(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.asset(
Assets.svg.backupAuto,
width: 48,
height: 48,
),
Center(
child: Padding(
padding: const EdgeInsets.all(10),
child: RichText(
textAlign: TextAlign.start,
text: TextSpan(
children: [
TextSpan(
text: "Auto Backup",
style: STextStyles.desktopTextSmall(context),
),
TextSpan(
text:
"\n\nAuto backup is a custom Stack Wallet feature that offers a convenient backup of your data."
"To ensure maximum security, we recommend using a unique password that you haven't used anywhere "
"else on the internet before. Your password is not stored.",
style:
STextStyles.desktopTextExtraExtraSmall(context),
),
TextSpan(
text:
"\n\nFor more information, please see our website ",
style:
STextStyles.desktopTextExtraExtraSmall(context),
),
TextSpan(
text: "stackwallet.com",
style: STextStyles.richLink(context)
.copyWith(fontSize: 14),
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(
Uri.parse("https://stackwallet.com/"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Padding(
padding: EdgeInsets.all(
10,
),
child: AutoBackupButton(),
),
],
),
],
),
),
),
const SizedBox(
height: 25,
),
Padding(
padding: const EdgeInsets.only(
right: 30,
),
child: RoundedWhiteContainer(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.asset(
Assets.svg.backupAdd,
width: 48,
height: 48,
alignment: Alignment.topLeft,
),
Center(
child: Padding(
padding: const EdgeInsets.all(10),
child: RichText(
textAlign: TextAlign.start,
text: TextSpan(
children: [
TextSpan(
text: "Manual Backup",
style: STextStyles.desktopTextSmall(context),
),
TextSpan(
text:
"\n\nCreate manual backup to easily transfer your data between devices. "
"You will create a backup file that can be later used in the Restore option. "
"Use a strong password to encrypt your data.",
style:
STextStyles.desktopTextExtraExtraSmall(context),
),
],
),
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Padding(
padding: EdgeInsets.all(
10,
),
child: ManualBackupButton(),
),
],
),
],
),
),
),
const SizedBox(
height: 25,
),
Padding(
padding: const EdgeInsets.only(
right: 30,
),
child: RoundedWhiteContainer(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.asset(
Assets.svg.backupRestore,
width: 48,
height: 48,
alignment: Alignment.topLeft,
),
Center(
child: Padding(
padding: const EdgeInsets.all(10),
child: RichText(
textAlign: TextAlign.start,
text: TextSpan(
children: [
TextSpan(
text: "Restore Backup",
style: STextStyles.desktopTextSmall(context),
),
TextSpan(
text:
"\n\nUse your Stack Wallet backup file to restore your wallets, address book "
"and wallet preferences.",
style:
STextStyles.desktopTextExtraExtraSmall(context),
),
],
),
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Padding(
padding: EdgeInsets.all(
10,
),
child: RestoreBackupButton(),
),
],
),
],
),
),
),
],
);
}
}
class AutoBackupButton extends ConsumerWidget {
const AutoBackupButton({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
Future<void> enableAutoBackup() async {
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return const EnableBackupDialog();
},
);
}
return SizedBox(
width: 200,
height: 48,
child: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {
enableAutoBackup();
},
child: Text(
"Enable auto backup",
style: STextStyles.button(context),
),
),
);
}
}
class ManualBackupButton extends ConsumerWidget {
const ManualBackupButton({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
return SizedBox(
width: 200,
height: 48,
child: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {},
child: Text(
"Create manual backup",
style: STextStyles.button(context),
),
),
);
}
}
class RestoreBackupButton extends ConsumerWidget {
const RestoreBackupButton({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
Future<void> restoreBackup() async {
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return const RestoreBackupDialog();
},
);
}
return SizedBox(
width: 200,
height: 48,
child: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {
restoreBackup();
},
child: Text(
"Restore",
style: STextStyles.button(context),
),
),
);
}
}

View file

@ -0,0 +1,136 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.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/primary_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import '../../../../utilities/assets.dart';
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../../widgets/stack_text_field.dart';
class CreateAutoBackup extends StatelessWidget {
// const CreateAutoBackup({Key? key, required this.chooseFileLocation})
// : super(key: key);
late final TextEditingController fileLocationController;
late final FocusNode chooseFileLocation;
@override
void initState() {
fileLocationController = TextEditingController();
// passwordRepeatController = TextEditingController();
chooseFileLocation = FocusNode();
// passwordRepeatFocusNode = FocusNode();
super.initState();
}
@override
void dispose() {
fileLocationController.dispose();
// passwordRepeatController.dispose();
chooseFileLocation.dispose();
// passwordRepeatFocusNode.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return DesktopDialog(
maxHeight: 600,
maxWidth: 600,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(32),
child: Text(
"Create auto backup",
style: STextStyles.desktopH3(context),
textAlign: TextAlign.center,
),
),
Padding(
padding: const EdgeInsets.all(20.0),
child: AppBarIconButton(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
size: 40,
icon: SvgPicture.asset(
Assets.svg.x,
color: Theme.of(context).extension<StackColors>()!.textDark,
width: 22,
height: 22,
),
onPressed: () {
int count = 0;
Navigator.of(context).popUntil((_) => count++ >= 2);
},
),
),
],
),
const SizedBox(
height: 30,
),
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 32),
child: Text(
"Choose file location",
style: STextStyles.desktopTextExtraSmall(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark3,
),
textAlign: TextAlign.left,
),
),
TextField(
key: const Key("backupChooseFileLocation"),
style: STextStyles.desktopTextMedium(context).copyWith(
height: 2,
),
enableSuggestions: false,
autocorrect: false,
decoration: standardInputDecoration(
"Save to...", chooseFileLocation, context),
),
const Spacer(),
Padding(
padding: const EdgeInsets.all(32),
child: Row(
children: [
Expanded(
child: SecondaryButton(
label: "Cancel",
onPressed: () {
int count = 0;
Navigator.of(context).popUntil((_) => count++ >= 2);
},
),
),
const SizedBox(
width: 16,
),
Expanded(
child: PrimaryButton(
label: "Enable Auto Backup",
onPressed: () {},
),
)
],
),
),
],
),
);
}
}

View file

@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore/create_auto_backup.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) {
Future<void> createAutoBackup() async {
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return CreateAutoBackup();
},
);
}
return DesktopDialog(
maxHeight: 300,
maxWidth: 570,
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: () {
int count = 0;
Navigator.of(context).popUntil((_) => count++ >= 2);
},
),
),
const SizedBox(
width: 16,
),
Expanded(
child: PrimaryButton(
label: "Continue",
onPressed: () {
createAutoBackup();
},
),
)
],
),
),
],
),
);
}
}

View file

@ -0,0 +1,93 @@
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 RestoreBackupDialog extends StatelessWidget {
const RestoreBackupDialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return DesktopDialog(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(32),
child: Text(
"Restoring Stack Wallet",
style: STextStyles.desktopH3(context),
textAlign: TextAlign.center,
),
),
const DesktopDialogCloseButton(),
],
),
const SizedBox(
height: 30,
),
Padding(
padding: const EdgeInsets.only(
left: 32,
right: 32,
),
child: Row(
children: [
Text(
"Settings",
style: STextStyles.desktopTextExtraSmall(context).copyWith(
color:
Theme.of(context).extension<StackColors>()!.textDark3,
),
textAlign: TextAlign.left,
),
],
),
),
// RoundedWhiteContainer(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(),
// ],
// ),
// ),
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

@ -2,16 +2,15 @@ import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart';
import 'package:stackwallet/providers/global/node_service_provider.dart';
import 'package:stackwallet/providers/global/prefs_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import '../../../pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart';
import '../../../utilities/constants.dart';
class NodesSettings extends ConsumerStatefulWidget {
const NodesSettings({Key? key}) : super(key: key);

View file

@ -89,7 +89,7 @@ import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/my_stack_v
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/wallet_view/desktop_wallet_view.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/advanced_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/appearance_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore/backup_and_restore_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/currency_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/language_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/nodes_settings.dart';