mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
add fusion progress provider to dialog + custom fusion
This commit is contained in:
parent
0597e317ba
commit
77e638af16
2 changed files with 221 additions and 148 deletions
|
@ -62,9 +62,12 @@ class _DesktopCashFusion extends ConsumerState<DesktopCashFusionView> {
|
|||
late final FocusNode serverFocusNode;
|
||||
late final TextEditingController portController;
|
||||
late final FocusNode portFocusNode;
|
||||
late final TextEditingController fusionRoundController;
|
||||
late final FocusNode fusionRoundFocusNode;
|
||||
|
||||
String _serverTerm = "";
|
||||
String _portTerm = "";
|
||||
String _fusionRoundTerm = "";
|
||||
|
||||
bool _useSSL = false;
|
||||
bool _trusted = false;
|
||||
|
@ -139,9 +142,11 @@ class _DesktopCashFusion extends ConsumerState<DesktopCashFusionView> {
|
|||
void initState() {
|
||||
serverController = TextEditingController();
|
||||
portController = TextEditingController();
|
||||
fusionRoundController = TextEditingController();
|
||||
|
||||
serverFocusNode = FocusNode();
|
||||
portFocusNode = FocusNode();
|
||||
fusionRoundFocusNode = FocusNode();
|
||||
|
||||
enableSSLCheckbox = true;
|
||||
|
||||
|
@ -169,9 +174,11 @@ class _DesktopCashFusion extends ConsumerState<DesktopCashFusionView> {
|
|||
void dispose() {
|
||||
serverController.dispose();
|
||||
portController.dispose();
|
||||
fusionRoundController.dispose();
|
||||
|
||||
serverFocusNode.dispose();
|
||||
portFocusNode.dispose();
|
||||
fusionRoundFocusNode.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
@ -478,8 +485,12 @@ class _DesktopCashFusion extends ConsumerState<DesktopCashFusionView> {
|
|||
value: e,
|
||||
child: Text(
|
||||
e.name,
|
||||
style:
|
||||
STextStyles.desktopTextMedium(context),
|
||||
style: STextStyles.smallMed14(context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -522,6 +533,46 @@ class _DesktopCashFusion extends ConsumerState<DesktopCashFusionView> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (_roundType == FusionRounds.Custom)
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
if (_roundType == FusionRounds.Custom)
|
||||
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,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_fusionRoundTerm = value;
|
||||
});
|
||||
},
|
||||
style: STextStyles.field(context),
|
||||
decoration: standardInputDecoration(
|
||||
"",
|
||||
fusionRoundFocusNode,
|
||||
context,
|
||||
desktopMed: true,
|
||||
).copyWith(
|
||||
labelText:
|
||||
"Enter number of fusions.."),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_item_card.dart';
|
||||
import 'package:stackwallet/providers/cash_fusion/fusion_progress_ui_state_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
@ -9,7 +11,7 @@ import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
|||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/rounded_container.dart';
|
||||
|
||||
enum CashFusionStatus { waiting, restoring, success, failed }
|
||||
enum CashFusionStatus { waiting, fusing, success, failed }
|
||||
|
||||
class FusionDialog extends StatelessWidget {
|
||||
const FusionDialog({
|
||||
|
@ -26,7 +28,7 @@ class FusionDialog extends StatelessWidget {
|
|||
color:
|
||||
Theme.of(context).extension<StackColors>()!.buttonBackSecondary,
|
||||
);
|
||||
case CashFusionStatus.restoring:
|
||||
case CashFusionStatus.fusing:
|
||||
return SvgPicture.asset(
|
||||
Assets.svg.loader,
|
||||
color: Theme.of(context).extension<StackColors>()!.accentColorGreen,
|
||||
|
@ -100,182 +102,202 @@ class FusionDialog extends StatelessWidget {
|
|||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.node,
|
||||
width: 16,
|
||||
height: 16,
|
||||
Consumer(builder: (_, ref, __) {
|
||||
final state = ref.watch(fusionProgressUIStateProvider
|
||||
.select((value) => value.connecting));
|
||||
return RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.node,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: _getIconForState(state),
|
||||
),
|
||||
title: "Connecting to server",
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: SvgPicture.asset(Assets.svg.circleQuestion),
|
||||
),
|
||||
title: "Connecting to server",
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.upFromLine,
|
||||
width: 30,
|
||||
height: 30,
|
||||
Consumer(builder: (_, ref, __) {
|
||||
final state = ref.watch(fusionProgressUIStateProvider
|
||||
.select((value) => value.outputs));
|
||||
return RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.upFromLine,
|
||||
width: 30,
|
||||
height: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: _getIconForState(state),
|
||||
),
|
||||
title: "Allocating outputs",
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: SvgPicture.asset(Assets.svg.circleQuestion),
|
||||
),
|
||||
title: "Allocating outputs",
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.peers,
|
||||
width: 30,
|
||||
height: 30,
|
||||
Consumer(builder: (_, ref, __) {
|
||||
final state = ref.watch(fusionProgressUIStateProvider
|
||||
.select((value) => value.peers));
|
||||
return RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.peers,
|
||||
width: 30,
|
||||
height: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: _getIconForState(state),
|
||||
),
|
||||
title: "Waiting for peers",
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: SvgPicture.asset(Assets.svg.circleQuestion),
|
||||
),
|
||||
title: "Waiting for peers",
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.fusing,
|
||||
width: 30,
|
||||
height: 30,
|
||||
Consumer(builder: (_, ref, __) {
|
||||
final state = ref.watch(fusionProgressUIStateProvider
|
||||
.select((value) => value.fusing));
|
||||
return RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.fusing,
|
||||
width: 30,
|
||||
height: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: _getIconForState(state),
|
||||
),
|
||||
title: "Fusing",
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: SvgPicture.asset(Assets.svg.circleQuestion),
|
||||
),
|
||||
title: "Fusing",
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor:
|
||||
Theme.of(context).extension<StackColors>()!.shadow,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.checkCircle,
|
||||
width: 16,
|
||||
height: 16,
|
||||
Consumer(builder: (_, ref, __) {
|
||||
final state = ref.watch(fusionProgressUIStateProvider
|
||||
.select((value) => value.complete));
|
||||
return RoundedContainer(
|
||||
padding: EdgeInsets.zero,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderColor:
|
||||
Theme.of(context).extension<StackColors>()!.shadow,
|
||||
child: RestoringItemCard(
|
||||
left: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: RoundedContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.buttonBackSecondary,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.checkCircle,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: _getIconForState(state),
|
||||
),
|
||||
title: "Complete",
|
||||
),
|
||||
right: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: SvgPicture.asset(Assets.svg.circleQuestion),
|
||||
),
|
||||
title: "Complete",
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue