mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 03:06:29 +00:00
frost initiate tx signing screen ui polish
This commit is contained in:
parent
4b4647e02c
commit
1be51a666b
3 changed files with 168 additions and 86 deletions
|
@ -10,6 +10,7 @@ import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/wallets/wallet/impl/bitcoin_frost_wallet.dart';
|
import 'package:stackwallet/wallets/wallet/impl/bitcoin_frost_wallet.dart';
|
||||||
|
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_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/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.dart';
|
import 'package:stackwallet/widgets/detail_item.dart';
|
||||||
|
@ -34,6 +35,9 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
|
||||||
"Check the box and press “Attempt sign”.",
|
"Check the box and press “Attempt sign”.",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
late final int _threshold;
|
||||||
|
|
||||||
|
bool _userVerifyContinue = false;
|
||||||
bool _attemptSignLock = false;
|
bool _attemptSignLock = false;
|
||||||
|
|
||||||
Future<void> _attemptSign() async {
|
Future<void> _attemptSign() async {
|
||||||
|
@ -71,10 +75,20 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
final wallet = ref.read(pWallets).getWallet(
|
||||||
|
ref.read(pFrostScaffoldArgs)!.walletId!,
|
||||||
|
) as BitcoinFrostWallet;
|
||||||
|
|
||||||
|
_threshold = wallet.frostInfo.threshold;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final double qrImageSize =
|
final double qrImageSize =
|
||||||
Util.isDesktop ? 360 : MediaQuery.of(context).size.width - 32;
|
Util.isDesktop ? 360 : MediaQuery.of(context).size.width / 1.67;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
|
@ -120,7 +134,9 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
for (int i = 0; i < steps2to4.length; i++)
|
for (int i = 0; i < steps2to4.length; i++)
|
||||||
Row(
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 4),
|
||||||
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
|
@ -138,6 +154,7 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -161,12 +178,11 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!Util.isDesktop)
|
SizedBox(
|
||||||
const SizedBox(
|
height: Util.isDesktop ? 20 : 16,
|
||||||
height: 32,
|
|
||||||
),
|
),
|
||||||
DetailItem(
|
DetailItem(
|
||||||
title: "Encoded config",
|
title: "Encoded transaction config",
|
||||||
detail: ref.watch(pFrostTxData.state).state!.frostMSConfig!,
|
detail: ref.watch(pFrostTxData.state).state!.frostMSConfig!,
|
||||||
button: Util.isDesktop
|
button: Util.isDesktop
|
||||||
? IconCopyButton(
|
? IconCopyButton(
|
||||||
|
@ -179,12 +195,33 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Util.isDesktop ? 20 : 16,
|
height: Util.isDesktop ? 20 : 16,
|
||||||
),
|
),
|
||||||
|
DetailItem(
|
||||||
|
title: "Threshold",
|
||||||
|
detail: "$_threshold signatures",
|
||||||
|
horizontal: true,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: Util.isDesktop ? 20 : 16,
|
||||||
|
),
|
||||||
if (!Util.isDesktop)
|
if (!Util.isDesktop)
|
||||||
const Spacer(
|
const Spacer(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
),
|
),
|
||||||
|
CheckboxTextButton(
|
||||||
|
label: "I have verified that everyone has imported the config and "
|
||||||
|
"is ready to sign",
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_userVerifyContinue = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: Util.isDesktop ? 20 : 16,
|
||||||
|
),
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
label: "Attempt sign",
|
label: "Attempt sign",
|
||||||
|
enabled: _userVerifyContinue,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_attemptSign();
|
_attemptSign();
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,22 +7,35 @@ import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
|
||||||
class DetailItem extends StatelessWidget {
|
class DetailItem extends StatelessWidget {
|
||||||
const DetailItem({
|
const DetailItem({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.detail,
|
required this.detail,
|
||||||
this.button,
|
this.button,
|
||||||
|
this.overrideDetailTextColor,
|
||||||
this.showEmptyDetail = true,
|
this.showEmptyDetail = true,
|
||||||
|
this.horizontal = false,
|
||||||
this.disableSelectableText = false,
|
this.disableSelectableText = false,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final String detail;
|
final String detail;
|
||||||
final Widget? button;
|
final Widget? button;
|
||||||
final bool showEmptyDetail;
|
final bool showEmptyDetail;
|
||||||
|
final bool horizontal;
|
||||||
final bool disableSelectableText;
|
final bool disableSelectableText;
|
||||||
|
final Color? overrideDetailTextColor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final TextStyle detailStyle;
|
||||||
|
if (overrideDetailTextColor != null) {
|
||||||
|
detailStyle = STextStyles.w500_14(context).copyWith(
|
||||||
|
color: overrideDetailTextColor,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
detailStyle = STextStyles.w500_14(context);
|
||||||
|
}
|
||||||
|
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
condition: !Util.isDesktop,
|
condition: !Util.isDesktop,
|
||||||
builder: (child) => RoundedWhiteContainer(
|
builder: (child) => RoundedWhiteContainer(
|
||||||
|
@ -34,7 +47,31 @@ class DetailItem extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
child: Column(
|
child: horizontal
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
disableSelectableText
|
||||||
|
? Text(
|
||||||
|
title,
|
||||||
|
style: STextStyles.itemSubtitle(context),
|
||||||
|
)
|
||||||
|
: SelectableText(
|
||||||
|
title,
|
||||||
|
style: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
|
disableSelectableText
|
||||||
|
? Text(
|
||||||
|
detail,
|
||||||
|
style: detailStyle,
|
||||||
|
)
|
||||||
|
: SelectableText(
|
||||||
|
detail,
|
||||||
|
style: detailStyle,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
|
@ -76,11 +113,11 @@ class DetailItem extends StatelessWidget {
|
||||||
: disableSelectableText
|
: disableSelectableText
|
||||||
? Text(
|
? Text(
|
||||||
detail,
|
detail,
|
||||||
style: STextStyles.w500_14(context),
|
style: detailStyle,
|
||||||
)
|
)
|
||||||
: SelectableText(
|
: SelectableText(
|
||||||
detail,
|
detail,
|
||||||
style: STextStyles.w500_14(context),
|
style: detailStyle,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
|
||||||
class FrostStepUserSteps extends StatelessWidget {
|
class FrostStepUserSteps extends StatelessWidget {
|
||||||
|
@ -13,7 +14,13 @@ class FrostStepUserSteps extends StatelessWidget {
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
for (int i = 0; i < userSteps.length; i++)
|
for (int i = 0; i < userSteps.length; i++)
|
||||||
Row(
|
ConditionalParent(
|
||||||
|
condition: i > 0,
|
||||||
|
builder: (child) => Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 4),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
|
@ -31,6 +38,7 @@ class FrostStepUserSteps extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue