mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-27 09:38:45 +00:00
insert step 1a (create new ms config)
This commit is contained in:
parent
9481475f45
commit
56b18a6c93
9 changed files with 362 additions and 477 deletions
|
@ -1,10 +1,17 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/share_new_multisig_config_view.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/frost_scaffold.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_route_generator.dart';
|
||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_home_view.dart';
|
||||
import 'package:stackwallet/providers/frost_wallet/frost_wallet_providers.dart';
|
||||
import 'package:stackwallet/services/frost.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/intermediate/frost_currency.dart';
|
||||
|
@ -401,12 +408,47 @@ class _NewFrostMsWalletViewState
|
|||
controllers.first.text.trim();
|
||||
ref.read(pFrostMultisigConfig.notifier).state = config;
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
ShareNewMultisigConfigView.routeName,
|
||||
arguments: (
|
||||
ref.read(pFrostCreateNewArgs.state).state = (
|
||||
(
|
||||
walletName: widget.walletName,
|
||||
frostCurrency: widget.frostCurrency,
|
||||
),
|
||||
FrostRouteGenerator.createNewConfigStepRoutes,
|
||||
() {
|
||||
// successful completion of steps
|
||||
if (Util.isDesktop) {
|
||||
Navigator.of(context).popUntil(
|
||||
ModalRoute.withName(
|
||||
DesktopHomeView.routeName,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
unawaited(
|
||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||
HomeView.routeName,
|
||||
(route) => false,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ref.read(pFrostMultisigConfig.state).state = null;
|
||||
ref.read(pFrostStartKeyGenData.state).state = null;
|
||||
ref.read(pFrostSecretSharesData.state).state = null;
|
||||
ref.read(pFrostCreateNewArgs.state).state = null;
|
||||
|
||||
unawaited(
|
||||
showFloatingFlushBar(
|
||||
type: FlushBarType.success,
|
||||
message: "Your wallet is set up.",
|
||||
iconAsset: Assets.svg.check,
|
||||
context: context,
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
FrostStepScaffold.routeName,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -1,419 +0,0 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/frost_scaffold.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_route_generator.dart';
|
||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_home_view.dart';
|
||||
import 'package:stackwallet/providers/frost_wallet/frost_wallet_providers.dart';
|
||||
import 'package:stackwallet/services/frost.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/intermediate/frost_currency.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/simple_mobile_dialog.dart';
|
||||
import 'package:stackwallet/widgets/frost_mascot.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
class ShareNewMultisigConfigView extends ConsumerStatefulWidget {
|
||||
const ShareNewMultisigConfigView({
|
||||
super.key,
|
||||
required this.walletName,
|
||||
required this.frostCurrency,
|
||||
});
|
||||
|
||||
static const String routeName = "/shareNewMultisigConfigView";
|
||||
|
||||
final String walletName;
|
||||
final FrostCurrency frostCurrency;
|
||||
|
||||
@override
|
||||
ConsumerState<ShareNewMultisigConfigView> createState() =>
|
||||
_ShareNewMultisigConfigViewState();
|
||||
}
|
||||
|
||||
class _ShareNewMultisigConfigViewState
|
||||
extends ConsumerState<ShareNewMultisigConfigView> {
|
||||
bool _userVerifyContinue = false;
|
||||
|
||||
void _showParticipantsDialog() {
|
||||
final participants = Frost.getParticipants(
|
||||
multisigConfig: ref.read(pFrostMultisigConfig.state).state!,
|
||||
);
|
||||
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => SimpleMobileDialog(
|
||||
showCloseButton: false,
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Text(
|
||||
"Group participants",
|
||||
style: STextStyles.w600_20(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Text(
|
||||
"The names are case-sensitive and must be entered exactly.",
|
||||
style: STextStyles.w400_16(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
for (final participant in participants)
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.5,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 26,
|
||||
height: 26,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFieldActiveBG,
|
||||
borderRadius: BorderRadius.circular(
|
||||
200,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.user,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
participant,
|
||||
style: STextStyles.w500_14(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
IconCopyButton(
|
||||
data: participant,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ConditionalParent(
|
||||
condition: Util.isDesktop,
|
||||
builder: (child) => DesktopScaffold(
|
||||
background: Theme.of(context).extension<StackColors>()!.background,
|
||||
appBar: const DesktopAppBar(
|
||||
isCompactHeight: false,
|
||||
leading: AppBarBackButton(),
|
||||
// TODO: [prio=high] get rid of placeholder text??
|
||||
trailing: FrostMascot(
|
||||
title: 'Lorem ipsum',
|
||||
body:
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam est justo, ',
|
||||
),
|
||||
),
|
||||
body: SizedBox(
|
||||
width: 480,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
child: ConditionalParent(
|
||||
condition: !Util.isDesktop,
|
||||
builder: (child) => Background(
|
||||
child: Scaffold(
|
||||
backgroundColor:
|
||||
Theme.of(context).extension<StackColors>()!.background,
|
||||
appBar: AppBar(
|
||||
leading: AppBarBackButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
"Share multisig group info",
|
||||
style: STextStyles.navBarTitle(context),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const _SharingStepsInfo(),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
height: 220,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
QrImageView(
|
||||
data:
|
||||
ref.watch(pFrostMultisigConfig.state).state ?? "Error",
|
||||
size: 220,
|
||||
backgroundColor:
|
||||
Theme.of(context).extension<StackColors>()!.background,
|
||||
foregroundColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
DetailItem(
|
||||
title: "Encoded config",
|
||||
detail: ref.watch(pFrostMultisigConfig.state).state ?? "Error",
|
||||
button: Util.isDesktop
|
||||
? IconCopyButton(
|
||||
data: ref.watch(pFrostMultisigConfig.state).state ??
|
||||
"Error",
|
||||
)
|
||||
: SimpleCopyButton(
|
||||
data: ref.watch(pFrostMultisigConfig.state).state ??
|
||||
"Error",
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Util.isDesktop ? 64 : 16,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SecondaryButton(
|
||||
label: "Show group participants",
|
||||
onPressed: _showParticipantsDialog,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!Util.isDesktop)
|
||||
const Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_userVerifyContinue = !_userVerifyContinue;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 26,
|
||||
child: Checkbox(
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
value: _userVerifyContinue,
|
||||
onChanged: (value) => setState(
|
||||
() => _userVerifyContinue = value == true,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
"I have verified that everyone has joined the group",
|
||||
style: STextStyles.w500_14(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
PrimaryButton(
|
||||
label: "Start key generation",
|
||||
enabled: _userVerifyContinue,
|
||||
onPressed: () async {
|
||||
ref.read(pFrostStartKeyGenData.notifier).state =
|
||||
Frost.startKeyGeneration(
|
||||
multisigConfig: ref.watch(pFrostMultisigConfig.state).state!,
|
||||
myName: ref.read(pFrostMyName.state).state!,
|
||||
);
|
||||
|
||||
ref.read(pFrostCreateNewArgs.state).state = (
|
||||
(
|
||||
walletName: widget.walletName,
|
||||
frostCurrency: widget.frostCurrency,
|
||||
),
|
||||
FrostRouteGenerator.createNewConfigStepRoutes,
|
||||
() {
|
||||
// successful completion of steps
|
||||
if (Util.isDesktop) {
|
||||
Navigator.of(context).popUntil(
|
||||
ModalRoute.withName(
|
||||
DesktopHomeView.routeName,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
unawaited(
|
||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||
HomeView.routeName,
|
||||
(route) => false,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ref.read(pFrostMultisigConfig.state).state = null;
|
||||
ref.read(pFrostStartKeyGenData.state).state = null;
|
||||
ref.read(pFrostSecretSharesData.state).state = null;
|
||||
ref.read(pFrostCreateNewArgs.state).state = null;
|
||||
|
||||
unawaited(
|
||||
showFloatingFlushBar(
|
||||
type: FlushBarType.success,
|
||||
message: "Your wallet is set up.",
|
||||
iconAsset: Assets.svg.check,
|
||||
context: context,
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
FrostStepScaffold.routeName,
|
||||
// FrostShareCommitmentsView.routeName,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SharingStepsInfo extends StatelessWidget {
|
||||
const _SharingStepsInfo({super.key});
|
||||
|
||||
static const steps = [
|
||||
"Share this config with the group participants.",
|
||||
"Wait for them to join the group.",
|
||||
"Verify that everyone has filled out their forms before continuing. If you "
|
||||
"try to continue before everyone is ready, the process will be canceled.",
|
||||
"Check the box and press “Generate keys”.",
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final style = STextStyles.w500_12(context);
|
||||
return RoundedWhiteContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
for (int i = 0; i < steps.length; i++)
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${i + 1}.",
|
||||
style: style,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
steps[i],
|
||||
style: style,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,272 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_2.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_route_generator.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
|
||||
import 'package:stackwallet/providers/frost_wallet/frost_wallet_providers.dart';
|
||||
import 'package:stackwallet/services/frost.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/simple_mobile_dialog.dart';
|
||||
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
||||
|
||||
class FrostCreateStep1a extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep1a({super.key});
|
||||
|
||||
static const String routeName = "/frostCreateStep1";
|
||||
static const String title = "Multisig group info";
|
||||
|
||||
@override
|
||||
ConsumerState<FrostCreateStep1a> createState() => _FrostCreateStep1aState();
|
||||
}
|
||||
|
||||
class _FrostCreateStep1aState extends ConsumerState<FrostCreateStep1a> {
|
||||
static const info = [
|
||||
"Share this config with the group participants.",
|
||||
"Wait for them to join the group.",
|
||||
"Verify that everyone has filled out their forms before continuing. If you "
|
||||
"try to continue before everyone is ready, the process will be canceled.",
|
||||
"Check the box and press “Generate keys”.",
|
||||
];
|
||||
|
||||
bool _userVerifyContinue = false;
|
||||
|
||||
void _showParticipantsDialog() {
|
||||
final participants = Frost.getParticipants(
|
||||
multisigConfig: ref.read(pFrostMultisigConfig.state).state!,
|
||||
);
|
||||
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => SimpleMobileDialog(
|
||||
showCloseButton: false,
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Text(
|
||||
"Group participants",
|
||||
style: STextStyles.w600_20(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Text(
|
||||
"The names are case-sensitive and must be entered exactly.",
|
||||
style: STextStyles.w400_16(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
for (final participant in participants)
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.5,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 26,
|
||||
height: 26,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFieldActiveBG,
|
||||
borderRadius: BorderRadius.circular(
|
||||
200,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.user,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
participant,
|
||||
style: STextStyles.w500_14(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
IconCopyButton(
|
||||
data: participant,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
const FrostStepUserSteps(
|
||||
userSteps: info,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
height: 220,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
QrImageView(
|
||||
data: ref.watch(pFrostMultisigConfig.state).state ?? "Error",
|
||||
size: 220,
|
||||
backgroundColor:
|
||||
Theme.of(context).extension<StackColors>()!.background,
|
||||
foregroundColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
DetailItem(
|
||||
title: "Encoded config",
|
||||
detail: ref.watch(pFrostMultisigConfig.state).state ?? "Error",
|
||||
button: Util.isDesktop
|
||||
? IconCopyButton(
|
||||
data:
|
||||
ref.watch(pFrostMultisigConfig.state).state ?? "Error",
|
||||
)
|
||||
: SimpleCopyButton(
|
||||
data:
|
||||
ref.watch(pFrostMultisigConfig.state).state ?? "Error",
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Util.isDesktop ? 64 : 16,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SecondaryButton(
|
||||
label: "Show group participants",
|
||||
onPressed: _showParticipantsDialog,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!Util.isDesktop)
|
||||
const Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_userVerifyContinue = !_userVerifyContinue;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 26,
|
||||
child: Checkbox(
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
value: _userVerifyContinue,
|
||||
onChanged: (value) => setState(
|
||||
() => _userVerifyContinue = value == true,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
"I have verified that everyone has joined the group",
|
||||
style: STextStyles.w500_14(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
PrimaryButton(
|
||||
label: "Start key generation",
|
||||
enabled: _userVerifyContinue,
|
||||
onPressed: () async {
|
||||
ref.read(pFrostStartKeyGenData.notifier).state =
|
||||
Frost.startKeyGeneration(
|
||||
multisigConfig: ref.watch(pFrostMultisigConfig.state).state!,
|
||||
myName: ref.read(pFrostMyName.state).state!,
|
||||
);
|
||||
|
||||
ref.read(pFrostCreateCurrentStep.state).state = 2;
|
||||
await Navigator.of(context).pushNamed(
|
||||
FrostCreateStep2.routeName,
|
||||
// FrostShareCommitmentsView.routeName,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_22.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_3.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_route_generator.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart';
|
||||
import 'package:stackwallet/providers/frost_wallet/frost_wallet_providers.dart';
|
||||
|
@ -27,19 +27,19 @@ import 'package:stackwallet/widgets/stack_dialog.dart';
|
|||
import 'package:stackwallet/widgets/stack_text_field.dart';
|
||||
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
||||
|
||||
class FrostCreateStep1 extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep1({
|
||||
class FrostCreateStep2 extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep2({
|
||||
super.key,
|
||||
});
|
||||
|
||||
static const String routeName = "/frostCreateStep1";
|
||||
static const String routeName = "/frostCreateStep2";
|
||||
static const String title = "Commitments";
|
||||
|
||||
@override
|
||||
ConsumerState<FrostCreateStep1> createState() => _FrostCreateStep1State();
|
||||
ConsumerState<FrostCreateStep2> createState() => _FrostCreateStep2State();
|
||||
}
|
||||
|
||||
class _FrostCreateStep1State extends ConsumerState<FrostCreateStep1> {
|
||||
class _FrostCreateStep2State extends ConsumerState<FrostCreateStep2> {
|
||||
static const info = [
|
||||
"Share your commitment with other group members.",
|
||||
"Enter their commitments into the corresponding fields.",
|
||||
|
@ -60,7 +60,7 @@ class _FrostCreateStep1State extends ConsumerState<FrostCreateStep1> {
|
|||
context: context,
|
||||
builder: (_) => FrostStepQrDialog(
|
||||
myName: ref.read(pFrostMyName)!,
|
||||
title: "Step 1 of 4 - ${FrostCreateStep1.title}",
|
||||
title: "Step 2 of 5 - ${FrostCreateStep2.title}",
|
||||
data: myCommitment,
|
||||
),
|
||||
);
|
||||
|
@ -341,9 +341,9 @@ class _FrostCreateStep1State extends ConsumerState<FrostCreateStep1> {
|
|||
commitments: commitments,
|
||||
);
|
||||
|
||||
ref.read(pFrostCreateCurrentStep.state).state = 2;
|
||||
ref.read(pFrostCreateCurrentStep.state).state = 3;
|
||||
await Navigator.of(context).pushNamed(
|
||||
FrostCreateStep2.routeName,
|
||||
FrostCreateStep3.routeName,
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log(
|
||||
|
|
|
@ -27,17 +27,17 @@ import 'package:stackwallet/widgets/stack_dialog.dart';
|
|||
import 'package:stackwallet/widgets/stack_text_field.dart';
|
||||
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
||||
|
||||
class FrostCreateStep2 extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep2({super.key});
|
||||
class FrostCreateStep3 extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep3({super.key});
|
||||
|
||||
static const String routeName = "/frostCreateStep2";
|
||||
static const String routeName = "/frostCreateStep3";
|
||||
static const String title = "Shares";
|
||||
|
||||
@override
|
||||
ConsumerState<FrostCreateStep2> createState() => _FrostCreateStep2State();
|
||||
ConsumerState<FrostCreateStep3> createState() => _FrostCreateStep3State();
|
||||
}
|
||||
|
||||
class _FrostCreateStep2State extends ConsumerState<FrostCreateStep2> {
|
||||
class _FrostCreateStep3State extends ConsumerState<FrostCreateStep3> {
|
||||
static const info = [
|
||||
"Send your share to other group members.",
|
||||
"Enter their shares into the corresponding fields.",
|
||||
|
@ -57,7 +57,7 @@ class _FrostCreateStep2State extends ConsumerState<FrostCreateStep2> {
|
|||
context: context,
|
||||
builder: (_) => FrostStepQrDialog(
|
||||
myName: ref.read(pFrostMyName)!,
|
||||
title: "Step 2 of 4 - ${FrostCreateStep2.title}",
|
||||
title: "Step 3 of 5 - ${FrostCreateStep3.title}",
|
||||
data: myShare,
|
||||
),
|
||||
);
|
||||
|
@ -291,9 +291,9 @@ class _FrostCreateStep2State extends ConsumerState<FrostCreateStep2> {
|
|||
shares: shares,
|
||||
);
|
||||
|
||||
ref.read(pFrostCreateCurrentStep.state).state = 3;
|
||||
ref.read(pFrostCreateCurrentStep.state).state = 4;
|
||||
await Navigator.of(context).pushNamed(
|
||||
FrostCreateStep3.routeName,
|
||||
FrostCreateStep4.routeName,
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log(
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_55.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_5.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_route_generator.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart';
|
||||
import 'package:stackwallet/providers/frost_wallet/frost_wallet_providers.dart';
|
||||
|
@ -12,17 +12,17 @@ import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
|||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
||||
|
||||
class FrostCreateStep3 extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep3({super.key});
|
||||
class FrostCreateStep4 extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep4({super.key});
|
||||
|
||||
static const String routeName = "/frostCreateStep3";
|
||||
static const String routeName = "/frostCreateStep4";
|
||||
static const String title = "Verify multisig ID";
|
||||
|
||||
@override
|
||||
ConsumerState<FrostCreateStep3> createState() => _FrostCreateStep3State();
|
||||
ConsumerState<FrostCreateStep4> createState() => _FrostCreateStep4State();
|
||||
}
|
||||
|
||||
class _FrostCreateStep3State extends ConsumerState<FrostCreateStep3> {
|
||||
class _FrostCreateStep4State extends ConsumerState<FrostCreateStep4> {
|
||||
static const info = [
|
||||
"Ensure your multisig ID matches that of each other participant.",
|
||||
];
|
||||
|
@ -64,7 +64,7 @@ class _FrostCreateStep3State extends ConsumerState<FrostCreateStep3> {
|
|||
onPressed: () {
|
||||
ref.read(pFrostCreateCurrentStep.state).state = 4;
|
||||
Navigator.of(context).pushNamed(
|
||||
FrostCreateStep4.routeName,
|
||||
FrostCreateStep5.routeName,
|
||||
);
|
||||
},
|
||||
)
|
||||
|
|
|
@ -25,17 +25,17 @@ import 'package:stackwallet/widgets/detail_item.dart';
|
|||
import 'package:stackwallet/widgets/loading_indicator.dart';
|
||||
import 'package:stackwallet/widgets/rounded_container.dart';
|
||||
|
||||
class FrostCreateStep4 extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep4({super.key});
|
||||
class FrostCreateStep5 extends ConsumerStatefulWidget {
|
||||
const FrostCreateStep5({super.key});
|
||||
|
||||
static const String routeName = "/frostCreateStep4";
|
||||
static const String routeName = "/frostCreateStep5";
|
||||
static const String title = "Back up your keys";
|
||||
|
||||
@override
|
||||
ConsumerState<FrostCreateStep4> createState() => _FrostCreateStep4State();
|
||||
ConsumerState<FrostCreateStep5> createState() => _FrostCreateStep5State();
|
||||
}
|
||||
|
||||
class _FrostCreateStep4State extends ConsumerState<FrostCreateStep4> {
|
||||
class _FrostCreateStep5State extends ConsumerState<FrostCreateStep5> {
|
||||
static const _warning = "These are your private keys. Please back them up, "
|
||||
"keep them safe and never share it with anyone. Your private keys are the"
|
||||
" only way you can access your funds if you forget PIN, lose your phone, "
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_11.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_22.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_33.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_1.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_2.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_3.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_4.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_5.dart';
|
||||
import 'package:stackwallet/route_generator.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/intermediate/frost_currency.dart';
|
||||
|
@ -22,20 +23,21 @@ abstract class FrostRouteGenerator {
|
|||
static const bool useMaterialPageRoute = true;
|
||||
|
||||
static const List<FrostStepRoute> createNewConfigStepRoutes = [
|
||||
(routeName: FrostCreateStep1.routeName, title: FrostCreateStep1.title),
|
||||
(routeName: FrostCreateStep1a.routeName, title: FrostCreateStep1a.title),
|
||||
(routeName: FrostCreateStep2.routeName, title: FrostCreateStep2.title),
|
||||
(routeName: FrostCreateStep3.routeName, title: FrostCreateStep3.title),
|
||||
(routeName: FrostCreateStep4.routeName, title: FrostCreateStep4.title),
|
||||
(routeName: FrostCreateStep5.routeName, title: FrostCreateStep5.title),
|
||||
];
|
||||
|
||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||
final args = settings.arguments;
|
||||
|
||||
switch (settings.name) {
|
||||
case FrostCreateStep1.routeName:
|
||||
case FrostCreateStep1a.routeName:
|
||||
return RouteGenerator.getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => const FrostCreateStep1(),
|
||||
builder: (_) => const FrostCreateStep1a(),
|
||||
settings: settings,
|
||||
);
|
||||
|
||||
|
@ -60,6 +62,13 @@ abstract class FrostRouteGenerator {
|
|||
settings: settings,
|
||||
);
|
||||
|
||||
case FrostCreateStep5.routeName:
|
||||
return RouteGenerator.getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => const FrostCreateStep5(),
|
||||
settings: settings,
|
||||
);
|
||||
|
||||
default:
|
||||
return _routeError("");
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import 'package:stackwallet/pages/add_wallet_views/frost_ms/frost_scaffold.dart'
|
|||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/create_new_frost_ms_wallet_view.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/import_new_frost_ms_wallet_view.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/select_new_frost_import_type_view.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/new/share_new_multisig_config_view.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/frost_ms/restore/restore_frost_ms_wallet_view.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/new_wallet_options/new_wallet_options_view.dart';
|
||||
|
@ -483,24 +482,6 @@ class RouteGenerator {
|
|||
}
|
||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
case ShareNewMultisigConfigView.routeName:
|
||||
if (args is ({
|
||||
String walletName,
|
||||
FrostCurrency frostCurrency,
|
||||
})) {
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => ShareNewMultisigConfigView(
|
||||
walletName: args.walletName,
|
||||
frostCurrency: args.frostCurrency,
|
||||
),
|
||||
settings: RouteSettings(
|
||||
name: settings.name,
|
||||
),
|
||||
);
|
||||
}
|
||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
case SelectNewFrostImportTypeView.routeName:
|
||||
if (args is ({
|
||||
String walletName,
|
||||
|
|
Loading…
Reference in a new issue