Merge remote-tracking branch 'origin/desktop' into desktop

This commit is contained in:
julian 2022-10-29 08:50:04 -06:00
commit 8fb3404a57
8 changed files with 306 additions and 33 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

@ -2,12 +2,15 @@ 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);
@ -199,7 +202,7 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
padding: EdgeInsets.all(
10,
),
child: ManualBackupButton(),
child: RestoreBackupButton(),
),
],
),
@ -218,6 +221,17 @@ class AutoBackupButton extends ConsumerWidget {
}) : 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,
@ -225,7 +239,9 @@ class AutoBackupButton extends ConsumerWidget {
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {},
onPressed: () {
enableAutoBackup();
},
child: Text(
"Enable auto backup",
style: STextStyles.button(context),
@ -264,6 +280,17 @@ class RestoreBackupButton extends ConsumerWidget {
}) : 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,
@ -271,9 +298,11 @@ class RestoreBackupButton extends ConsumerWidget {
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {},
onPressed: () {
restoreBackup();
},
child: Text(
"Restore backup",
"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

@ -1,4 +1,5 @@
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';
@ -11,7 +12,20 @@ class EnableBackupDialog extends StatelessWidget {
@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(
@ -47,7 +61,8 @@ class EnableBackupDialog extends StatelessWidget {
child: SecondaryButton(
label: "Cancel",
onPressed: () {
Navigator.of(context).pop();
int count = 0;
Navigator.of(context).popUntil((_) => count++ >= 2);
},
),
),
@ -58,8 +73,7 @@ class EnableBackupDialog extends StatelessWidget {
child: PrimaryButton(
label: "Continue",
onPressed: () {
// Navigator.of(context).pop();
// onConfirm.call();
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

@ -2,13 +2,12 @@ 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_desktop_specific/home/settings_menu/backup_and_restore/enable_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 '../../../utilities/theme/stack_colors.dart';
import 'enable_backup_dialog.dart';
class SecuritySettings extends ConsumerStatefulWidget {
const SecuritySettings({Key? key}) : super(key: key);
@ -104,23 +103,6 @@ class NewPasswordButton extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
Future<void> enableAutoBackup() async {
// wait for keyboard to disappear
FocusScope.of(context).unfocus();
await Future<void>.delayed(
const Duration(milliseconds: 100),
);
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return EnableBackupDialog();
},
);
}
return SizedBox(
width: 200,
height: 48,
@ -129,7 +111,27 @@ class NewPasswordButton extends ConsumerWidget {
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {
enableAutoBackup();
// Expandable(
// header: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// NewPasswordButton(),
// ],
// ),
// body: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Text(
// "Current Password",
// style: STextStyles.desktopTextExtraSmall(context).copyWith(
// color:
// Theme.of(context).extension<StackColors>()!.textDark3,
// ),
// textAlign: TextAlign.left,
// ),
// ],
// ),
// );
},
child: Text(
"Set up new password",

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';