mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 17:27:39 +00:00
desktop mnemonic length dropdown
This commit is contained in:
parent
79cc82f379
commit
250fba3985
3 changed files with 148 additions and 84 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart';
|
import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart';
|
||||||
|
@ -199,6 +200,8 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint("BUILD: $runtimeType with ${coin.name} $walletName");
|
debugPrint("BUILD: $runtimeType with ${coin.name} $walletName");
|
||||||
|
|
||||||
|
final lengths = Constants.possibleLengthsForCoin(coin).toList();
|
||||||
|
|
||||||
return DesktopScaffold(
|
return DesktopScaffold(
|
||||||
appBar: isDesktop
|
appBar: isDesktop
|
||||||
? const DesktopAppBar(
|
? const DesktopAppBar(
|
||||||
|
@ -220,6 +223,10 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
),
|
),
|
||||||
body: PlatformRestoreOptionsLayout(
|
body: PlatformRestoreOptionsLayout(
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: isDesktop ? 480 : double.infinity,
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
|
@ -304,6 +311,54 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 16 : 8,
|
height: isDesktop ? 16 : 8,
|
||||||
),
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton2<int>(
|
||||||
|
value:
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state,
|
||||||
|
items: [
|
||||||
|
...lengths.map(
|
||||||
|
(e) => DropdownMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text(
|
||||||
|
"$e words",
|
||||||
|
style: STextStyles.desktopTextMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value is int) {
|
||||||
|
ref.read(mnemonicWordCountStateProvider.state).state =
|
||||||
|
value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isExpanded: true,
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.chevronDown,
|
||||||
|
width: 12,
|
||||||
|
height: 6,
|
||||||
|
color: CFColors.textFieldActiveSearchIconRight,
|
||||||
|
),
|
||||||
|
buttonPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
buttonDecoration: BoxDecoration(
|
||||||
|
color: CFColors.fieldGray,
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dropdownDecoration: BoxDecoration(
|
||||||
|
color: CFColors.fieldGray,
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
MobileMnemonicLengthSelector(
|
MobileMnemonicLengthSelector(
|
||||||
chooseMnemonicLength: chooseMnemonicLength,
|
chooseMnemonicLength: chooseMnemonicLength,
|
||||||
),
|
),
|
||||||
|
@ -322,6 +377,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +395,7 @@ class PlatformRestoreOptionsLayout extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
return Container();
|
return child;
|
||||||
} else {
|
} else {
|
||||||
return Container(
|
return Container(
|
||||||
color: CFColors.background,
|
color: CFColors.background,
|
||||||
|
|
|
@ -355,6 +355,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.2"
|
version: "0.5.2"
|
||||||
|
dropdown_button2:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dropdown_button2
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.7.2"
|
||||||
emojis:
|
emojis:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -121,6 +121,7 @@ dependencies:
|
||||||
# document_file_save_plus: ^1.0.5
|
# document_file_save_plus: ^1.0.5
|
||||||
isar: 3.0.0-dev.10
|
isar: 3.0.0-dev.10
|
||||||
isar_flutter_libs: 3.0.0-dev.10 # contains the binaries
|
isar_flutter_libs: 3.0.0-dev.10 # contains the binaries
|
||||||
|
dropdown_button2: 1.7.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Reference in a new issue