2023-07-26 22:07:39 +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-09-18 20:43:36 +00:00
|
|
|
import 'dart:async';
|
|
|
|
|
2023-09-18 21:40:52 +00:00
|
|
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
2023-09-18 20:43:36 +00:00
|
|
|
import 'package:flutter/gestures.dart';
|
2023-07-26 22:07:39 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-10-16 20:01:26 +00:00
|
|
|
import 'package:flutter/services.dart';
|
2023-09-18 20:43:36 +00:00
|
|
|
import 'package:flutter_native_splash/cli_commands.dart';
|
2023-07-26 22:07:39 +00:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
2023-10-16 20:15:55 +00:00
|
|
|
import 'package:stackwallet/pages/cashfusion/fusion_rounds_selection_sheet.dart';
|
2023-09-19 20:14:15 +00:00
|
|
|
import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart';
|
2023-09-28 20:16:48 +00:00
|
|
|
import 'package:stackwallet/providers/cash_fusion/fusion_progress_ui_state_provider.dart';
|
2023-10-16 21:04:27 +00:00
|
|
|
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
2023-09-28 16:22:56 +00:00
|
|
|
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
2023-07-26 22:07:39 +00:00
|
|
|
import 'package:stackwallet/themes/stack_colors.dart';
|
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
2023-09-15 22:38:35 +00:00
|
|
|
import 'package:stackwallet/utilities/constants.dart';
|
2023-11-14 22:33:54 +00:00
|
|
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
2023-07-26 22:07:39 +00:00
|
|
|
import 'package:stackwallet/utilities/text_styles.dart';
|
2023-11-14 21:49:37 +00:00
|
|
|
import 'package:stackwallet/wallets/wallet/mixins/cash_fusion.dart';
|
2023-07-26 22:07:39 +00:00
|
|
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
2023-10-17 22:24:13 +00:00
|
|
|
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
2023-07-26 22:07:39 +00:00
|
|
|
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
2023-09-18 20:43:36 +00:00
|
|
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
|
|
|
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
2023-07-26 22:07:39 +00:00
|
|
|
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
2023-09-15 22:38:35 +00:00
|
|
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
2023-09-15 18:57:01 +00:00
|
|
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
2023-09-15 22:38:35 +00:00
|
|
|
import 'package:stackwallet/widgets/stack_text_field.dart';
|
2023-07-26 22:07:39 +00:00
|
|
|
|
|
|
|
class DesktopCashFusionView extends ConsumerStatefulWidget {
|
|
|
|
const DesktopCashFusionView({
|
|
|
|
super.key,
|
|
|
|
required this.walletId,
|
|
|
|
});
|
|
|
|
|
|
|
|
static const String routeName = "/desktopCashFusionView";
|
|
|
|
|
|
|
|
final String walletId;
|
|
|
|
|
|
|
|
@override
|
|
|
|
ConsumerState<DesktopCashFusionView> createState() => _DesktopCashFusion();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _DesktopCashFusion extends ConsumerState<DesktopCashFusionView> {
|
2023-09-15 22:38:35 +00:00
|
|
|
late final TextEditingController serverController;
|
|
|
|
late final FocusNode serverFocusNode;
|
|
|
|
late final TextEditingController portController;
|
|
|
|
late final FocusNode portFocusNode;
|
2023-09-20 22:15:07 +00:00
|
|
|
late final TextEditingController fusionRoundController;
|
|
|
|
late final FocusNode fusionRoundFocusNode;
|
2023-11-14 22:33:54 +00:00
|
|
|
late final Coin coin;
|
2023-09-15 22:38:35 +00:00
|
|
|
|
2023-10-16 20:15:55 +00:00
|
|
|
bool _enableStartButton = false;
|
2023-10-16 21:04:27 +00:00
|
|
|
bool _enableSSLCheckbox = false;
|
2023-09-18 20:43:36 +00:00
|
|
|
|
2023-10-16 20:15:55 +00:00
|
|
|
FusionOption _roundType = FusionOption.continuous;
|
2023-09-15 22:38:35 +00:00
|
|
|
|
2023-10-18 15:02:25 +00:00
|
|
|
Future<void> _startFusion() async {
|
2023-11-03 19:46:55 +00:00
|
|
|
final fusionWallet =
|
2023-11-14 21:49:37 +00:00
|
|
|
ref.read(pWallets).getWallet(widget.walletId) as CashFusion;
|
2023-10-18 15:02:25 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
fusionWallet.uiState = ref.read(
|
|
|
|
fusionProgressUIStateProvider(widget.walletId),
|
|
|
|
);
|
|
|
|
} catch (e) {
|
|
|
|
if (!e.toString().contains(
|
|
|
|
"FusionProgressUIState was already set for ${widget.walletId}")) {
|
|
|
|
rethrow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final int rounds = _roundType == FusionOption.continuous
|
|
|
|
? 0
|
|
|
|
: int.parse(fusionRoundController.text);
|
|
|
|
|
|
|
|
final newInfo = FusionInfo(
|
|
|
|
host: serverController.text,
|
|
|
|
port: int.parse(portController.text),
|
|
|
|
ssl: _enableSSLCheckbox,
|
|
|
|
rounds: rounds,
|
|
|
|
);
|
|
|
|
|
|
|
|
// update user prefs (persistent)
|
2023-11-14 22:23:57 +00:00
|
|
|
|
|
|
|
ref.read(prefsChangeNotifierProvider).setFusionServerInfo(coin, newInfo);
|
2023-10-18 15:02:25 +00:00
|
|
|
|
|
|
|
unawaited(
|
|
|
|
fusionWallet.fuse(
|
|
|
|
fusionInfo: newInfo,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
await showDialog<void>(
|
|
|
|
context: context,
|
|
|
|
barrierDismissible: false,
|
|
|
|
builder: (context) {
|
|
|
|
return FusionDialogView(
|
|
|
|
walletId: widget.walletId,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-07-26 22:07:39 +00:00
|
|
|
@override
|
|
|
|
void initState() {
|
2023-09-15 22:38:35 +00:00
|
|
|
serverController = TextEditingController();
|
|
|
|
portController = TextEditingController();
|
2023-09-20 22:15:07 +00:00
|
|
|
fusionRoundController = TextEditingController();
|
2023-09-15 22:38:35 +00:00
|
|
|
|
|
|
|
serverFocusNode = FocusNode();
|
|
|
|
portFocusNode = FocusNode();
|
2023-09-20 22:15:07 +00:00
|
|
|
fusionRoundFocusNode = FocusNode();
|
2023-09-15 22:38:35 +00:00
|
|
|
|
2023-11-14 22:33:54 +00:00
|
|
|
coin = ref
|
|
|
|
.read(walletsChangeNotifierProvider)
|
|
|
|
.getManager(widget.walletId)
|
|
|
|
.wallet
|
|
|
|
.coin;
|
|
|
|
|
2023-11-14 22:23:57 +00:00
|
|
|
final info =
|
|
|
|
ref.read(prefsChangeNotifierProvider).getFusionServerInfo(coin);
|
2023-11-14 22:33:54 +00:00
|
|
|
|
2023-10-16 21:04:27 +00:00
|
|
|
serverController.text = info.host;
|
|
|
|
portController.text = info.port.toString();
|
|
|
|
_enableSSLCheckbox = info.ssl;
|
|
|
|
_roundType =
|
|
|
|
info.rounds == 0 ? FusionOption.continuous : FusionOption.custom;
|
|
|
|
fusionRoundController.text = info.rounds.toString();
|
2023-09-18 20:43:36 +00:00
|
|
|
|
2023-10-16 20:15:55 +00:00
|
|
|
_enableStartButton =
|
|
|
|
serverController.text.isNotEmpty && portController.text.isNotEmpty;
|
2023-09-18 20:43:36 +00:00
|
|
|
|
2023-07-26 22:07:39 +00:00
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
2023-09-15 22:38:35 +00:00
|
|
|
serverController.dispose();
|
|
|
|
portController.dispose();
|
2023-09-20 22:15:07 +00:00
|
|
|
fusionRoundController.dispose();
|
2023-09-15 22:38:35 +00:00
|
|
|
|
|
|
|
serverFocusNode.dispose();
|
|
|
|
portFocusNode.dispose();
|
2023-09-20 22:15:07 +00:00
|
|
|
fusionRoundFocusNode.dispose();
|
2023-09-15 22:38:35 +00:00
|
|
|
|
2023-07-26 22:07:39 +00:00
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
debugPrint("BUILD: $runtimeType");
|
|
|
|
|
|
|
|
return DesktopScaffold(
|
|
|
|
appBar: DesktopAppBar(
|
|
|
|
background: Theme.of(context).extension<StackColors>()!.popupBG,
|
|
|
|
isCompactHeight: true,
|
|
|
|
useSpacers: false,
|
|
|
|
leading: Expanded(
|
2023-09-15 18:57:01 +00:00
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(24.0),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
// const SizedBox(
|
|
|
|
// width: 32,
|
|
|
|
// ),
|
|
|
|
AppBarIconButton(
|
|
|
|
size: 32,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textFieldDefaultBG,
|
|
|
|
shadows: const [],
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
Assets.svg.arrowLeft,
|
|
|
|
width: 18,
|
|
|
|
height: 18,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.topNavIconPrimary,
|
|
|
|
),
|
|
|
|
onPressed: Navigator.of(context).pop,
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
width: 15,
|
|
|
|
),
|
|
|
|
SvgPicture.asset(
|
|
|
|
Assets.svg.cashFusion,
|
|
|
|
width: 32,
|
|
|
|
height: 32,
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
width: 12,
|
|
|
|
),
|
|
|
|
Text(
|
2023-11-13 16:04:32 +00:00
|
|
|
"Fusion",
|
2023-09-15 18:57:01 +00:00
|
|
|
style: STextStyles.desktopH3(context),
|
|
|
|
),
|
|
|
|
],
|
2023-07-26 22:07:39 +00:00
|
|
|
),
|
2023-09-15 18:57:01 +00:00
|
|
|
MouseRegion(
|
|
|
|
cursor: SystemMouseCursors.click,
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
SvgPicture.asset(
|
|
|
|
Assets.svg.circleQuestion,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.radioButtonIconBorder,
|
|
|
|
),
|
|
|
|
const SizedBox(
|
2023-09-15 22:38:35 +00:00
|
|
|
width: 8,
|
2023-09-15 18:57:01 +00:00
|
|
|
),
|
|
|
|
RichText(
|
|
|
|
text: TextSpan(
|
2023-11-13 16:04:32 +00:00
|
|
|
text: "What is Fusion?",
|
2023-09-15 18:57:01 +00:00
|
|
|
style: STextStyles.richLink(context).copyWith(
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
2023-09-18 20:43:36 +00:00
|
|
|
recognizer: TapGestureRecognizer()
|
|
|
|
..onTap = () {
|
|
|
|
showDialog<dynamic>(
|
|
|
|
context: context,
|
|
|
|
useSafeArea: false,
|
|
|
|
barrierDismissible: true,
|
|
|
|
builder: (context) {
|
|
|
|
return DesktopDialog(
|
|
|
|
maxWidth: 580,
|
|
|
|
maxHeight: double.infinity,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
top: 10,
|
|
|
|
left: 20,
|
|
|
|
bottom: 20,
|
|
|
|
right: 10,
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
2023-11-13 16:04:32 +00:00
|
|
|
"What is Fusion?",
|
2023-09-18 20:43:36 +00:00
|
|
|
style: STextStyles.desktopH2(
|
|
|
|
context),
|
|
|
|
),
|
|
|
|
DesktopDialogCloseButton(
|
|
|
|
onPressedOverride: () =>
|
|
|
|
Navigator.of(context)
|
|
|
|
.pop(true),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 16,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"A fully decentralized privacy protocol that allows "
|
|
|
|
"anyone to create multi-party transactions with other "
|
|
|
|
"network participants. This process obscures your real "
|
|
|
|
"spending and makes it difficult for chain-analysis "
|
|
|
|
"companies to track your coins.",
|
|
|
|
style:
|
|
|
|
STextStyles.desktopTextMedium(
|
|
|
|
context)
|
|
|
|
.copyWith(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textDark3,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
2023-09-15 18:57:01 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2023-07-26 22:07:39 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-09-15 18:57:01 +00:00
|
|
|
body: Row(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(24),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
width: 460,
|
|
|
|
child: RoundedWhiteContainer(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
2023-11-13 16:04:32 +00:00
|
|
|
"Fusion helps anonymize your coins by mixing them.",
|
2023-09-15 22:38:35 +00:00
|
|
|
style:
|
|
|
|
STextStyles.desktopTextExtraExtraSmall(context),
|
|
|
|
),
|
2023-09-15 18:57:01 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
2023-09-15 22:38:35 +00:00
|
|
|
height: 24,
|
2023-09-15 18:57:01 +00:00
|
|
|
),
|
2023-09-15 22:38:35 +00:00
|
|
|
SizedBox(
|
|
|
|
width: 460,
|
|
|
|
child: RoundedWhiteContainer(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2023-10-17 22:24:13 +00:00
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"Server settings",
|
|
|
|
style: STextStyles.desktopTextExtraExtraSmall(
|
|
|
|
context),
|
|
|
|
),
|
|
|
|
CustomTextButton(
|
|
|
|
text: "Default",
|
|
|
|
onTap: () {
|
2023-11-14 22:33:54 +00:00
|
|
|
final def = (coin == Coin.bitcoincash)
|
|
|
|
? FusionInfo.BCH_DEFAULTS
|
|
|
|
: FusionInfo.XEC_DEFAULTS;
|
2023-10-17 22:24:13 +00:00
|
|
|
serverController.text = def.host;
|
|
|
|
portController.text = def.port.toString();
|
|
|
|
fusionRoundController.text =
|
|
|
|
def.rounds.toString();
|
|
|
|
_roundType = FusionOption.continuous;
|
|
|
|
setState(() {
|
|
|
|
_enableSSLCheckbox = def.ssl;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
2023-09-15 22:38:35 +00:00
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
|
|
|
ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius,
|
|
|
|
),
|
|
|
|
child: TextField(
|
2023-10-16 21:04:27 +00:00
|
|
|
autocorrect: false,
|
|
|
|
enableSuggestions: false,
|
|
|
|
controller: serverController,
|
|
|
|
focusNode: serverFocusNode,
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
_enableStartButton = value.isNotEmpty &&
|
|
|
|
portController.text.isNotEmpty &&
|
|
|
|
fusionRoundController.text.isNotEmpty;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
style: STextStyles.field(context),
|
|
|
|
decoration: standardInputDecoration(
|
|
|
|
"Server",
|
|
|
|
serverFocusNode,
|
|
|
|
context,
|
|
|
|
desktopMed: true,
|
|
|
|
),
|
|
|
|
),
|
2023-09-15 22:38:35 +00:00
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
|
|
|
ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius,
|
|
|
|
),
|
|
|
|
child: TextField(
|
|
|
|
autocorrect: false,
|
|
|
|
enableSuggestions: false,
|
|
|
|
controller: portController,
|
|
|
|
focusNode: portFocusNode,
|
2023-10-16 20:01:26 +00:00
|
|
|
inputFormatters: [
|
|
|
|
FilteringTextInputFormatter.digitsOnly
|
|
|
|
],
|
2023-09-15 22:38:35 +00:00
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
2023-10-16 21:04:27 +00:00
|
|
|
_enableStartButton = value.isNotEmpty &&
|
|
|
|
serverController.text.isNotEmpty &&
|
|
|
|
fusionRoundController.text.isNotEmpty;
|
2023-09-15 22:38:35 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
style: STextStyles.field(context),
|
|
|
|
decoration: standardInputDecoration(
|
|
|
|
"Port",
|
|
|
|
portFocusNode,
|
|
|
|
context,
|
|
|
|
desktopMed: true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
2023-10-16 21:04:27 +00:00
|
|
|
setState(() {
|
|
|
|
_enableSSLCheckbox = !_enableSSLCheckbox;
|
|
|
|
});
|
2023-09-15 22:38:35 +00:00
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
child: Checkbox(
|
|
|
|
materialTapTargetSize:
|
|
|
|
MaterialTapTargetSize.shrinkWrap,
|
2023-10-16 21:04:27 +00:00
|
|
|
value: _enableSSLCheckbox,
|
2023-09-15 22:38:35 +00:00
|
|
|
onChanged: (newValue) {
|
2023-10-16 21:04:27 +00:00
|
|
|
setState(
|
|
|
|
() {
|
|
|
|
_enableSSLCheckbox =
|
|
|
|
!_enableSSLCheckbox;
|
|
|
|
},
|
|
|
|
);
|
2023-09-15 22:38:35 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
width: 12,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"Use SSL",
|
|
|
|
style: STextStyles.itemSubtitle12(context),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"Rounds of fusion",
|
|
|
|
style:
|
|
|
|
STextStyles.desktopTextExtraExtraSmall(context),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 10,
|
|
|
|
),
|
2023-09-18 21:40:52 +00:00
|
|
|
DropdownButtonHideUnderline(
|
2023-10-16 20:15:55 +00:00
|
|
|
child: DropdownButton2<FusionOption>(
|
2023-09-18 21:40:52 +00:00
|
|
|
value: _roundType,
|
|
|
|
items: [
|
2023-10-16 20:15:55 +00:00
|
|
|
...FusionOption.values.map(
|
2023-09-18 21:40:52 +00:00
|
|
|
(e) => DropdownMenuItem(
|
|
|
|
value: e,
|
|
|
|
child: Text(
|
2023-10-16 20:15:55 +00:00
|
|
|
e.name.capitalize(),
|
2023-09-20 22:15:07 +00:00
|
|
|
style: STextStyles.smallMed14(context)
|
|
|
|
.copyWith(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textDark,
|
|
|
|
),
|
2023-09-18 21:40:52 +00:00
|
|
|
),
|
2023-09-15 22:38:35 +00:00
|
|
|
),
|
|
|
|
),
|
2023-09-18 21:40:52 +00:00
|
|
|
],
|
|
|
|
onChanged: (value) {
|
2023-10-16 20:15:55 +00:00
|
|
|
if (value is FusionOption) {
|
2023-09-18 21:40:52 +00:00
|
|
|
setState(() {
|
|
|
|
_roundType = value;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
isExpanded: true,
|
|
|
|
iconStyleData: IconStyleData(
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
Assets.svg.chevronDown,
|
|
|
|
width: 12,
|
|
|
|
height: 6,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textFieldActiveSearchIconRight,
|
2023-09-15 22:38:35 +00:00
|
|
|
),
|
2023-09-18 21:40:52 +00:00
|
|
|
),
|
|
|
|
dropdownStyleData: DropdownStyleData(
|
|
|
|
offset: const Offset(0, -10),
|
|
|
|
elevation: 0,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Theme.of(context)
|
2023-09-15 22:38:35 +00:00
|
|
|
.extension<StackColors>()!
|
2023-09-18 21:40:52 +00:00
|
|
|
.textFieldActiveBG,
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius,
|
2023-09-15 22:38:35 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-09-18 21:40:52 +00:00
|
|
|
menuItemStyleData: const MenuItemStyleData(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: 16,
|
|
|
|
vertical: 8,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-09-15 22:38:35 +00:00
|
|
|
),
|
2023-10-16 20:15:55 +00:00
|
|
|
if (_roundType == FusionOption.custom)
|
2023-09-20 22:15:07 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 10,
|
|
|
|
),
|
2023-10-16 20:15:55 +00:00
|
|
|
if (_roundType == FusionOption.custom)
|
2023-09-20 22:15:07 +00:00
|
|
|
SizedBox(
|
|
|
|
width: 460,
|
|
|
|
child: RoundedWhiteContainer(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius,
|
|
|
|
),
|
|
|
|
child: TextField(
|
|
|
|
autocorrect: false,
|
|
|
|
enableSuggestions: false,
|
|
|
|
controller: fusionRoundController,
|
|
|
|
focusNode: fusionRoundFocusNode,
|
2023-10-16 21:04:27 +00:00
|
|
|
inputFormatters: [
|
|
|
|
FilteringTextInputFormatter.digitsOnly
|
|
|
|
],
|
2023-09-20 22:15:07 +00:00
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
2023-10-16 21:04:27 +00:00
|
|
|
_enableStartButton = value
|
|
|
|
.isNotEmpty &&
|
|
|
|
serverController
|
|
|
|
.text.isNotEmpty &&
|
|
|
|
portController.text.isNotEmpty;
|
2023-09-20 22:15:07 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
style: STextStyles.field(context),
|
|
|
|
decoration: standardInputDecoration(
|
2023-10-16 21:04:27 +00:00
|
|
|
"Number of fusions",
|
2023-09-20 22:15:07 +00:00
|
|
|
fusionRoundFocusNode,
|
|
|
|
context,
|
|
|
|
desktopMed: true,
|
|
|
|
).copyWith(
|
|
|
|
labelText:
|
|
|
|
"Enter number of fusions.."),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-09-15 22:38:35 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
PrimaryButton(
|
|
|
|
label: "Start",
|
2023-10-16 20:15:55 +00:00
|
|
|
enabled: _enableStartButton,
|
2023-10-18 15:02:25 +00:00
|
|
|
onPressed: _startFusion,
|
2023-09-15 22:38:35 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2023-09-15 18:57:01 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
2023-07-26 22:21:13 +00:00
|
|
|
),
|
2023-09-15 18:57:01 +00:00
|
|
|
),
|
|
|
|
],
|
2023-07-26 22:07:39 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|