add coin control prefs setting to desktop

This commit is contained in:
julian 2023-03-15 09:56:02 -06:00
parent 4be2bd6fcd
commit 8838f68524
2 changed files with 46 additions and 1 deletions

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/providers/global/prefs_provider.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -39,6 +40,12 @@ class _MoreFeaturesDialogState extends ConsumerState<MoreFeaturesDialog> {
), ),
); );
final coinControlPrefEnabled = ref.watch(
prefsChangeNotifierProvider.select(
(value) => value.enableCoinControl,
),
);
return DesktopDialog( return DesktopDialog(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -72,7 +79,7 @@ class _MoreFeaturesDialogState extends ConsumerState<MoreFeaturesDialog> {
iconAsset: Assets.svg.whirlPool, iconAsset: Assets.svg.whirlPool,
onPressed: () => widget.onWhirlpoolPressed?.call(), onPressed: () => widget.onWhirlpoolPressed?.call(),
), ),
if (manager.hasCoinControlSupport) if (manager.hasCoinControlSupport && coinControlPrefEnabled)
_MoreFeaturesItem( _MoreFeaturesItem(
label: "Coin control", label: "Coin control",
detail: "Control, freeze, and utilize outputs at your discretion", detail: "Control, freeze, and utilize outputs at your discretion",

View file

@ -110,6 +110,44 @@ class _AdvancedSettings extends ConsumerState<AdvancedSettings> {
thickness: 0.5, thickness: 0.5,
), ),
), ),
Padding(
padding: const EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Enable coin control",
style: STextStyles.desktopTextExtraSmall(context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark),
textAlign: TextAlign.left,
),
SizedBox(
height: 20,
width: 40,
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider
.select((value) => value.enableCoinControl),
),
onValueChanged: (newValue) {
ref
.read(prefsChangeNotifierProvider)
.enableCoinControl = newValue;
},
),
),
],
),
),
const Padding(
padding: EdgeInsets.all(10.0),
child: Divider(
thickness: 0.5,
),
),
/// TODO: Make a dialog popup /// TODO: Make a dialog popup
Consumer(builder: (_, ref, __) { Consumer(builder: (_, ref, __) {