backup and restore page

This commit is contained in:
ryleedavis 2022-10-17 09:07:17 -06:00
parent 038df82800
commit b09ee79865
3 changed files with 127 additions and 6 deletions

View file

@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/backup_and_restore.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/settings_menu.dart';
import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
class DesktopSettingsView extends ConsumerStatefulWidget {
@ -16,8 +18,9 @@ class DesktopSettingsView extends ConsumerStatefulWidget {
class _DesktopSettingsViewState extends ConsumerState<DesktopSettingsView> {
int currentViewIndex = 0;
final List<Widget> contentViews = [
Container(
color: Colors.lime,
const Navigator(
onGenerateRoute: RouteGenerator.generateRoute,
initialRoute: BackupRestore.routeName,
), //b+r
Container(
color: Colors.green,
@ -48,7 +51,6 @@ class _DesktopSettingsViewState extends ConsumerState<DesktopSettingsView> {
});
}
// will have a row with two items: SettingsMenu and settings contentxd
@override
Widget build(BuildContext context) {
return Material(

View file

@ -88,7 +88,7 @@ class _BackupRestore extends ConsumerState<BackupRestore> {
padding: EdgeInsets.all(
10,
),
child: EnableBackupButton(),
child: AutoBackupButton(),
),
],
),
@ -137,6 +137,72 @@ class _BackupRestore extends ConsumerState<BackupRestore> {
),
),
),
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: ManualBackupButton(),
),
],
),
],
),
),
@ -146,8 +212,8 @@ class _BackupRestore extends ConsumerState<BackupRestore> {
}
}
class EnableBackupButton extends ConsumerWidget {
const EnableBackupButton({
class AutoBackupButton extends ConsumerWidget {
const AutoBackupButton({
Key? key,
}) : super(key: key);
@override
@ -168,3 +234,49 @@ class EnableBackupButton extends ConsumerWidget {
);
}
}
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) {
return SizedBox(
width: 200,
height: 48,
child: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {},
child: Text(
"Restore Backup",
style: STextStyles.button(context),
),
),
);
}
}

View file

@ -87,6 +87,7 @@ import 'package:stackwallet/pages_desktop_specific/home/desktop_home_view.dart';
import 'package:stackwallet/pages_desktop_specific/home/desktop_settings_view.dart';
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/my_stack_view.dart';
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/backup_and_restore.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/settings_menu.dart';
import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
@ -992,6 +993,12 @@ class RouteGenerator {
),
settings: RouteSettings(name: settings.name));
case BackupRestore.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const BackupRestore(),
settings: RouteSettings(name: settings.name));
// == End of desktop specific routes =====================================
default: