backup_and_restore page

This commit is contained in:
ryleedavis 2022-10-14 17:08:24 -06:00
parent d00c15de26
commit 038df82800
2 changed files with 174 additions and 20 deletions

View file

@ -0,0 +1,170 @@
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/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';
class BackupRestore extends ConsumerStatefulWidget {
const BackupRestore({Key? key}) : super(key: key);
static const String routeName = "/backupRestore";
@override
ConsumerState<BackupRestore> createState() => _BackupRestore();
}
class _BackupRestore extends ConsumerState<BackupRestore> {
@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,
alignment: Alignment.topLeft,
),
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: EnableBackupButton(),
),
],
),
],
),
),
),
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),
),
],
),
),
),
),
],
),
),
),
],
);
}
}
class EnableBackupButton extends ConsumerWidget {
const EnableBackupButton({
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(
"Enable Auto Backup",
style: STextStyles.button(context),
),
),
);
}
}

View file

@ -1,12 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu_item.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import '../../../utilities/assets.dart';
import '../settings_menu_item.dart';
class SettingsMenu extends ConsumerStatefulWidget {
const SettingsMenu({
@ -54,7 +52,8 @@ class _SettingsMenuState extends ConsumerState<SettingsMenu> {
],
),
),
Row(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 15),
@ -173,21 +172,6 @@ class _SettingsMenuState extends ConsumerState<SettingsMenu> {
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(
left: 10,
right: 40,
),
child: RoundedWhiteContainer(
child: SvgPicture.asset(
Assets.svg.backupAuto,
width: 48,
height: 48,
),
),
),
)
],
),
],