2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Stack Wallet.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Cypher Stack
|
|
|
|
* All Rights Reserved.
|
|
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-01-06 22:31:21 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
2023-05-09 21:57:40 +00:00
|
|
|
import 'package:stackwallet/themes/stack_colors.dart';
|
2023-04-06 21:24:56 +00:00
|
|
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
2023-01-06 22:31:21 +00:00
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
|
|
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
2023-01-09 20:11:26 +00:00
|
|
|
import 'package:stackwallet/utilities/text_styles.dart';
|
|
|
|
import 'package:stackwallet/utilities/util.dart';
|
|
|
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
|
|
|
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
2023-01-06 22:31:21 +00:00
|
|
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
|
|
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
|
|
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
|
|
|
|
|
|
|
class ConfirmPaynymConnectDialog extends StatelessWidget {
|
|
|
|
const ConfirmPaynymConnectDialog({
|
|
|
|
Key? key,
|
|
|
|
required this.nymName,
|
2023-04-05 22:06:31 +00:00
|
|
|
required this.locale,
|
2023-01-06 22:31:21 +00:00
|
|
|
required this.onConfirmPressed,
|
|
|
|
required this.amount,
|
|
|
|
required this.coin,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final String nymName;
|
2023-04-05 22:06:31 +00:00
|
|
|
final String locale;
|
2023-01-06 22:31:21 +00:00
|
|
|
final VoidCallback onConfirmPressed;
|
2023-04-05 22:06:31 +00:00
|
|
|
final Amount amount;
|
2023-01-06 22:31:21 +00:00
|
|
|
final Coin coin;
|
|
|
|
|
2023-01-09 20:11:26 +00:00
|
|
|
String get title => "Connect to $nymName";
|
|
|
|
|
|
|
|
String get message => "A one-time connection fee of "
|
2023-04-05 22:06:31 +00:00
|
|
|
"${amount.localizedStringAsFixed(locale: locale)} ${coin.ticker} "
|
2023-01-09 20:11:26 +00:00
|
|
|
"will be charged to connect to this PayNym.\n\nThis fee "
|
|
|
|
"covers the cost of creating a one-time transaction to create a "
|
|
|
|
"record on the blockchain. This keeps PayNyms decentralized.";
|
|
|
|
|
2023-01-06 22:31:21 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-01-09 20:11:26 +00:00
|
|
|
if (Util.isDesktop) {
|
|
|
|
return DesktopDialog(
|
|
|
|
maxHeight: double.infinity,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 40),
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
Assets.svg.userPlus,
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
width: 32,
|
|
|
|
height: 32,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const DesktopDialogCloseButton(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
left: 40,
|
|
|
|
bottom: 32,
|
|
|
|
right: 40,
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: STextStyles.desktopH3(context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
left: 40,
|
|
|
|
right: 40,
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
message,
|
|
|
|
style: STextStyles.desktopTextMedium(context).copyWith(
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
left: 40,
|
|
|
|
bottom: 40,
|
|
|
|
right: 40,
|
|
|
|
top: 32,
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SecondaryButton(
|
|
|
|
buttonHeight: ButtonHeight.l,
|
|
|
|
label: "Cancel",
|
|
|
|
onPressed: Navigator.of(context).pop,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
width: 16,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: PrimaryButton(
|
|
|
|
buttonHeight: ButtonHeight.l,
|
|
|
|
label: "Connect",
|
|
|
|
onPressed: onConfirmPressed,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return StackDialog(
|
|
|
|
title: title,
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
Assets.svg.userPlus,
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
),
|
|
|
|
message: message,
|
|
|
|
leftButton: SecondaryButton(
|
|
|
|
buttonHeight: ButtonHeight.xl,
|
|
|
|
label: "Cancel",
|
|
|
|
onPressed: Navigator.of(context).pop,
|
|
|
|
),
|
|
|
|
rightButton: PrimaryButton(
|
|
|
|
buttonHeight: ButtonHeight.xl,
|
|
|
|
label: "Connect",
|
|
|
|
onPressed: onConfirmPressed,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2023-01-06 22:31:21 +00:00
|
|
|
}
|
|
|
|
}
|