frost initiate tx signing screen ui polish

This commit is contained in:
julian 2024-05-02 11:32:02 -06:00
parent 4b4647e02c
commit 1be51a666b
3 changed files with 168 additions and 86 deletions

View file

@ -10,6 +10,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/checkbox_text_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';
@ -34,6 +35,9 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
"Check the box and press “Attempt sign”.",
];
late final int _threshold;
bool _userVerifyContinue = false;
bool _attemptSignLock = false;
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
Widget build(BuildContext context) {
final double qrImageSize =
Util.isDesktop ? 360 : MediaQuery.of(context).size.width - 32;
Util.isDesktop ? 360 : MediaQuery.of(context).size.width / 1.67;
return Padding(
padding: const EdgeInsets.all(16),
@ -120,7 +134,9 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
],
),
for (int i = 0; i < steps2to4.length; i++)
Row(
Padding(
padding: const EdgeInsets.only(top: 4),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
@ -138,6 +154,7 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
),
],
),
),
],
),
),
@ -161,12 +178,11 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
],
),
),
if (!Util.isDesktop)
const SizedBox(
height: 32,
SizedBox(
height: Util.isDesktop ? 20 : 16,
),
DetailItem(
title: "Encoded config",
title: "Encoded transaction config",
detail: ref.watch(pFrostTxData.state).state!.frostMSConfig!,
button: Util.isDesktop
? IconCopyButton(
@ -179,12 +195,33 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
SizedBox(
height: Util.isDesktop ? 20 : 16,
),
DetailItem(
title: "Threshold",
detail: "$_threshold signatures",
horizontal: true,
),
SizedBox(
height: Util.isDesktop ? 20 : 16,
),
if (!Util.isDesktop)
const Spacer(
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(
label: "Attempt sign",
enabled: _userVerifyContinue,
onPressed: () {
_attemptSign();
},

View file

@ -7,22 +7,35 @@ import 'package:stackwallet/widgets/rounded_white_container.dart';
class DetailItem extends StatelessWidget {
const DetailItem({
Key? key,
super.key,
required this.title,
required this.detail,
this.button,
this.overrideDetailTextColor,
this.showEmptyDetail = true,
this.horizontal = false,
this.disableSelectableText = false,
}) : super(key: key);
});
final String title;
final String detail;
final Widget? button;
final bool showEmptyDetail;
final bool horizontal;
final bool disableSelectableText;
final Color? overrideDetailTextColor;
@override
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(
condition: !Util.isDesktop,
builder: (child) => RoundedWhiteContainer(
@ -34,7 +47,31 @@ class DetailItem extends StatelessWidget {
padding: const EdgeInsets.all(16),
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,
children: [
Row(
@ -76,11 +113,11 @@ class DetailItem extends StatelessWidget {
: disableSelectableText
? Text(
detail,
style: STextStyles.w500_14(context),
style: detailStyle,
)
: SelectableText(
detail,
style: STextStyles.w500_14(context),
style: detailStyle,
),
],
),

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
class FrostStepUserSteps extends StatelessWidget {
@ -13,7 +14,13 @@ class FrostStepUserSteps extends StatelessWidget {
child: Column(
children: [
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,
children: [
Text(
@ -31,6 +38,7 @@ class FrostStepUserSteps extends StatelessWidget {
),
],
),
),
],
),
);