simplify showing the frost flow steps qr code data

This commit is contained in:
julian 2024-05-01 17:36:07 -06:00
parent 72069bd070
commit 969e7f2dcd
9 changed files with 84 additions and 187 deletions

View file

@ -1,20 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/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';
import 'package:stackwallet/services/frost.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.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/frost/frost_step_qr_dialog.dart';
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
@ -47,17 +43,6 @@ class _FrostCreateStep2State extends ConsumerState<FrostCreateStep2> {
final List<bool> fieldIsEmptyFlags = [];
bool _userVerifyContinue = false;
Future<void> _showQrCodeDialog() async {
await showDialog<void>(
context: context,
builder: (_) => FrostStepQrDialog(
myName: ref.read(pFrostMyName)!,
title: "Step 2 of 5 - ${FrostCreateStep2.title}",
data: myCommitment,
),
);
}
@override
void initState() {
participants = Frost.getParticipants(
@ -115,16 +100,8 @@ class _FrostCreateStep2State extends ConsumerState<FrostCreateStep2> {
),
),
const SizedBox(height: 12),
SecondaryButton(
label: "View QR code",
icon: SvgPicture.asset(
Assets.svg.qrcode,
colorFilter: ColorFilter.mode(
Theme.of(context).extension<StackColors>()!.buttonTextSecondary,
BlendMode.srcIn,
),
),
onPressed: _showQrCodeDialog,
FrostQrDialogPopupButton(
data: myCommitment,
),
const SizedBox(height: 12),
for (int i = 0; i < participants.length; i++)

View file

@ -1,20 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/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';
import 'package:stackwallet/services/frost.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.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/frost/frost_step_qr_dialog.dart';
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
@ -46,17 +42,6 @@ class _FrostCreateStep3State extends ConsumerState<FrostCreateStep3> {
final List<bool> fieldIsEmptyFlags = [];
Future<void> _showQrCodeDialog() async {
await showDialog<void>(
context: context,
builder: (_) => FrostStepQrDialog(
myName: ref.read(pFrostMyName)!,
title: "Step 3 of 5 - ${FrostCreateStep3.title}",
data: myShare,
),
);
}
@override
void initState() {
participants = Frost.getParticipants(
@ -114,16 +99,8 @@ class _FrostCreateStep3State extends ConsumerState<FrostCreateStep3> {
),
),
const SizedBox(height: 12),
SecondaryButton(
label: "View QR code",
icon: SvgPicture.asset(
Assets.svg.qrcode,
colorFilter: ColorFilter.mode(
Theme.of(context).extension<StackColors>()!.buttonTextSecondary,
BlendMode.srcIn,
),
),
onPressed: _showQrCodeDialog,
FrostQrDialogPopupButton(
data: myShare,
),
const SizedBox(height: 12),
for (int i = 0; i < participants.length; i++)

View file

@ -2,17 +2,16 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:stackwallet/frost_route_generator.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
import 'package:stackwallet/providers/db/main_db_provider.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/logger.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/isar/models/frost_wallet_info.dart';
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/detail_item.dart';
@ -151,26 +150,6 @@ class _FrostReshareStep2abdState extends ConsumerState<FrostReshareStep2abd> {
padding: const EdgeInsets.all(16),
child: Column(
children: [
SizedBox(
height: 220,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
QrImageView(
data: myResharerStart,
size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
],
),
),
const SizedBox(
height: 12,
),
DetailItem(
title: "My resharer",
detail: myResharerStart,
@ -182,6 +161,10 @@ class _FrostReshareStep2abdState extends ConsumerState<FrostReshareStep2abd> {
data: myResharerStart,
),
),
const SizedBox(height: 12),
FrostQrDialogPopupButton(
data: myResharerStart,
),
const SizedBox(
height: 12,
),

View file

@ -2,15 +2,14 @@ import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:stackwallet/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/logger.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/detail_item.dart';
@ -134,28 +133,6 @@ class _FrostReshareStep3abdState extends ConsumerState<FrostReshareStep3abd> {
padding: const EdgeInsets.all(16),
child: Column(
children: [
if (!amOutgoingParticipant)
SizedBox(
height: 220,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
QrImageView(
data: myEncryptionKey!,
size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
],
),
),
if (!amOutgoingParticipant)
const SizedBox(
height: 12,
),
if (!amOutgoingParticipant)
DetailItem(
title: "My encryption key",
@ -168,6 +145,11 @@ class _FrostReshareStep3abdState extends ConsumerState<FrostReshareStep3abd> {
data: myEncryptionKey!,
),
),
if (!amOutgoingParticipant) const SizedBox(height: 12),
if (!amOutgoingParticipant)
FrostQrDialogPopupButton(
data: myEncryptionKey!,
),
if (!amOutgoingParticipant)
const SizedBox(
height: 12,

View file

@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:stackwallet/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/themes/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/detail_item.dart';
@ -30,29 +29,6 @@ class _FrostReshareStep3cState extends ConsumerState<FrostReshareStep3c> {
padding: const EdgeInsets.all(16),
child: Column(
children: [
SizedBox(
height: 220,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
QrImageView(
data: ref
.watch(pFrostResharingData)
.startResharedData!
.resharedStart,
size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
],
),
),
const SizedBox(
height: 16,
),
DetailItem(
title: "My encryption key",
detail:
@ -71,6 +47,11 @@ class _FrostReshareStep3cState extends ConsumerState<FrostReshareStep3c> {
.resharedStart,
),
),
const SizedBox(height: 12),
FrostQrDialogPopupButton(
data:
ref.watch(pFrostResharingData).startResharedData!.resharedStart,
),
if (!Util.isDesktop) const Spacer(),
const SizedBox(
height: 16,

View file

@ -2,7 +2,6 @@ import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:stackwallet/frost_route_generator.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
@ -10,11 +9,11 @@ import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/des
import 'package:stackwallet/providers/db/main_db_provider.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/logger.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/isar/models/frost_wallet_info.dart';
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/detail_item.dart';
@ -168,28 +167,6 @@ class _FrostReshareStep4State extends ConsumerState<FrostReshareStep4> {
padding: const EdgeInsets.all(16),
child: Column(
children: [
if (myResharerComplete != null)
SizedBox(
height: 220,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
QrImageView(
data: myResharerComplete!,
size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
],
),
),
if (myResharerComplete != null)
const SizedBox(
height: 16,
),
if (myResharerComplete != null)
DetailItem(
title: "My resharer complete",
@ -202,6 +179,11 @@ class _FrostReshareStep4State extends ConsumerState<FrostReshareStep4> {
data: myResharerComplete!,
),
),
if (myResharerComplete != null) const SizedBox(height: 12),
if (myResharerComplete != null)
FrostQrDialogPopupButton(
data: myResharerComplete!,
),
if (!amOutgoingParticipant)
const SizedBox(
height: 16,

View file

@ -2,7 +2,6 @@ import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:stackwallet/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';
@ -14,6 +13,7 @@ import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/wallet/impl/bitcoin_frost_wallet.dart';
import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/detail_item.dart';
@ -161,23 +161,6 @@ class _FrostSendStep2State extends ConsumerState<FrostSendStep2> {
],
),
),
SizedBox(
height: 220,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
QrImageView(
data: myPreprocess,
size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
],
),
),
const SizedBox(
height: 12,
),
@ -199,6 +182,10 @@ class _FrostSendStep2State extends ConsumerState<FrostSendStep2> {
data: myPreprocess,
),
),
const SizedBox(height: 12),
FrostQrDialogPopupButton(
data: myPreprocess,
),
const SizedBox(
height: 12,
),

View file

@ -2,18 +2,17 @@ import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:stackwallet/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/providers/global/wallets_provider.dart';
import 'package:stackwallet/services/frost.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/wallet/impl/bitcoin_frost_wallet.dart';
import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/detail_item.dart';
@ -94,26 +93,6 @@ class _FrostSendStep3State extends ConsumerState<FrostSendStep3> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SizedBox(
height: 220,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
QrImageView(
data: myShare,
size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
],
),
),
const SizedBox(
height: 12,
),
DetailItem(
title: "My name",
detail: myName,
@ -135,6 +114,12 @@ class _FrostSendStep3State extends ConsumerState<FrostSendStep3> {
const SizedBox(
height: 12,
),
FrostQrDialogPopupButton(
data: myShare,
),
const SizedBox(
height: 12,
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,

View file

@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/frost_route_generator.dart';
import 'package:stackwallet/providers/frost_wallet/frost_wallet_providers.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/dialogs/frost/frost_step_qr_dialog.dart';
class FrostQrDialogPopupButton extends ConsumerWidget {
const FrostQrDialogPopupButton({super.key, required this.data});
final String data;
@override
Widget build(BuildContext context, WidgetRef ref) {
return SecondaryButton(
label: "View QR code",
icon: SvgPicture.asset(
Assets.svg.qrcode,
colorFilter: ColorFilter.mode(
Theme.of(context).extension<StackColors>()!.buttonTextSecondary,
BlendMode.srcIn,
),
),
onPressed: () async {
await showDialog<void>(
context: context,
builder: (_) => FrostStepQrDialog(
myName: ref.read(pFrostMyName)!,
title: "Step "
"${ref.read(pFrostCreateCurrentStep)}"
" of "
"${ref.read(pFrostScaffoldArgs)!.stepRoutes.length}"
" - ${ref.read(pFrostScaffoldArgs)!.stepRoutes[ref.watch(pFrostCreateCurrentStep) - 1].title}",
data: data,
),
);
},
);
}
}