mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-19 00:54:33 +00:00
hide swap and buy buttons around the ui
and const keys
This commit is contained in:
parent
1e9775eded
commit
2b2127aeb5
5 changed files with 43 additions and 24 deletions
|
@ -44,8 +44,10 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//todo: check if print needed
|
final prefs = ref.watch(prefsChangeNotifierProvider);
|
||||||
// debugPrint("BUILD: HomeViewButtonBar");
|
|
||||||
|
final showExchange = prefs.showExchange;
|
||||||
|
|
||||||
final selectedIndex = ref.watch(homeViewPageIndexStateProvider.state).state;
|
final selectedIndex = ref.watch(homeViewPageIndexStateProvider.state).state;
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
@ -88,11 +90,11 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.swap))
|
if (AppConfig.hasFeature(AppFeature.swap) && showExchange)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 8,
|
width: 8,
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.swap))
|
if (AppConfig.hasFeature(AppFeature.swap) && showExchange)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
style: selectedIndex == 1
|
style: selectedIndex == 1
|
||||||
|
@ -139,11 +141,11 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.buy))
|
if (AppConfig.hasFeature(AppFeature.buy) && showExchange)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 8,
|
width: 8,
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.buy))
|
if (AppConfig.hasFeature(AppFeature.buy) && showExchange)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
style: selectedIndex == 2
|
style: selectedIndex == 2
|
||||||
|
|
|
@ -218,6 +218,9 @@ class TokenWalletOptions extends ConsumerWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final prefs = ref.watch(prefsChangeNotifierProvider);
|
||||||
|
final showExchange = prefs.showExchange;
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
@ -251,11 +254,11 @@ class TokenWalletOptions extends ConsumerWidget {
|
||||||
subLabel: "Send",
|
subLabel: "Send",
|
||||||
iconAssetPathSVG: Assets.svg.arrowUpRight,
|
iconAssetPathSVG: Assets.svg.arrowUpRight,
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.swap))
|
if (AppConfig.hasFeature(AppFeature.swap) && showExchange)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 16,
|
width: 16,
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.swap))
|
if (AppConfig.hasFeature(AppFeature.swap) && showExchange)
|
||||||
TokenOptionsButton(
|
TokenOptionsButton(
|
||||||
onPressed: () => _onExchangePressed(context),
|
onPressed: () => _onExchangePressed(context),
|
||||||
subLabel: "Swap",
|
subLabel: "Swap",
|
||||||
|
@ -265,11 +268,11 @@ class TokenWalletOptions extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.buy))
|
if (AppConfig.hasFeature(AppFeature.buy) && showExchange)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 16,
|
width: 16,
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.buy))
|
if (AppConfig.hasFeature(AppFeature.buy) && showExchange)
|
||||||
TokenOptionsButton(
|
TokenOptionsButton(
|
||||||
onPressed: () => _onBuyPressed(context),
|
onPressed: () => _onBuyPressed(context),
|
||||||
subLabel: "Buy",
|
subLabel: "Buy",
|
||||||
|
|
|
@ -518,6 +518,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
|
|
||||||
final coin = ref.watch(pWalletCoin(walletId));
|
final coin = ref.watch(pWalletCoin(walletId));
|
||||||
|
|
||||||
|
final prefs = ref.watch(prefsChangeNotifierProvider);
|
||||||
|
final showExchange = prefs.showExchange;
|
||||||
|
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
condition: _rescanningOnOpen,
|
condition: _rescanningOnOpen,
|
||||||
builder: (child) {
|
builder: (child) {
|
||||||
|
@ -1053,7 +1056,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
),
|
),
|
||||||
if (Constants.enableExchange &&
|
if (Constants.enableExchange &&
|
||||||
ref.watch(pWalletCoin(walletId)) is! FrostCurrency &&
|
ref.watch(pWalletCoin(walletId)) is! FrostCurrency &&
|
||||||
AppConfig.hasFeature(AppFeature.swap))
|
AppConfig.hasFeature(AppFeature.swap) &&
|
||||||
|
showExchange)
|
||||||
WalletNavigationBarItemData(
|
WalletNavigationBarItemData(
|
||||||
label: "Swap",
|
label: "Swap",
|
||||||
icon: const ExchangeNavIcon(),
|
icon: const ExchangeNavIcon(),
|
||||||
|
@ -1061,7 +1065,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
),
|
),
|
||||||
if (Constants.enableExchange &&
|
if (Constants.enableExchange &&
|
||||||
ref.watch(pWalletCoin(walletId)) is! FrostCurrency &&
|
ref.watch(pWalletCoin(walletId)) is! FrostCurrency &&
|
||||||
AppConfig.hasFeature(AppFeature.buy))
|
AppConfig.hasFeature(AppFeature.buy) &&
|
||||||
|
showExchange)
|
||||||
WalletNavigationBarItemData(
|
WalletNavigationBarItemData(
|
||||||
label: "Buy",
|
label: "Buy",
|
||||||
icon: const BuyNavIcon(),
|
icon: const BuyNavIcon(),
|
||||||
|
|
|
@ -186,7 +186,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('myStack'),
|
key: const ValueKey('myStack'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopMyStackIcon(),
|
icon: const DesktopMyStackIcon(),
|
||||||
label: "My ${AppConfig.prefix}",
|
label: "My ${AppConfig.prefix}",
|
||||||
|
@ -200,7 +200,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('swap'),
|
key: const ValueKey('swap'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopExchangeIcon(),
|
icon: const DesktopExchangeIcon(),
|
||||||
label: "Swap",
|
label: "Swap",
|
||||||
|
@ -215,7 +215,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('buy'),
|
key: const ValueKey('buy'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopBuyIcon(),
|
icon: const DesktopBuyIcon(),
|
||||||
label: "Buy crypto",
|
label: "Buy crypto",
|
||||||
|
@ -228,7 +228,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('notifications'),
|
key: const ValueKey('notifications'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopNotificationsIcon(),
|
icon: const DesktopNotificationsIcon(),
|
||||||
label: "Notifications",
|
label: "Notifications",
|
||||||
|
@ -240,7 +240,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('addressBook'),
|
key: const ValueKey('addressBook'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopAddressBookIcon(),
|
icon: const DesktopAddressBookIcon(),
|
||||||
label: "Address Book",
|
label: "Address Book",
|
||||||
|
@ -252,7 +252,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('settings'),
|
key: const ValueKey('settings'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopSettingsIcon(),
|
icon: const DesktopSettingsIcon(),
|
||||||
label: "Settings",
|
label: "Settings",
|
||||||
|
@ -264,7 +264,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('support'),
|
key: const ValueKey('support'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopSupportIcon(),
|
icon: const DesktopSupportIcon(),
|
||||||
label: "Support",
|
label: "Support",
|
||||||
|
@ -276,7 +276,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('about'),
|
key: const ValueKey('about'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopAboutIcon(),
|
icon: const DesktopAboutIcon(),
|
||||||
label: "About",
|
label: "About",
|
||||||
|
@ -287,7 +287,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (!Platform.isIOS)
|
if (!Platform.isIOS)
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
key: ValueKey('exit'),
|
key: const ValueKey('exit'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
labelLength: 123,
|
labelLength: 123,
|
||||||
icon: const DesktopExitIcon(),
|
icon: const DesktopExitIcon(),
|
||||||
|
|
|
@ -353,6 +353,9 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
|
||||||
final wallet = ref.watch(pWallets).getWallet(widget.walletId);
|
final wallet = ref.watch(pWallets).getWallet(widget.walletId);
|
||||||
final coin = wallet.info.coin;
|
final coin = wallet.info.coin;
|
||||||
|
|
||||||
|
final prefs = ref.watch(prefsChangeNotifierProvider);
|
||||||
|
final showExchange = prefs.showExchange;
|
||||||
|
|
||||||
final showMore = wallet is PaynymInterface ||
|
final showMore = wallet is PaynymInterface ||
|
||||||
(wallet is CoinControlInterface &&
|
(wallet is CoinControlInterface &&
|
||||||
ref.watch(
|
ref.watch(
|
||||||
|
@ -368,7 +371,9 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
if (Constants.enableExchange && AppConfig.hasFeature(AppFeature.swap))
|
if (Constants.enableExchange &&
|
||||||
|
AppConfig.hasFeature(AppFeature.swap) &&
|
||||||
|
showExchange)
|
||||||
SecondaryButton(
|
SecondaryButton(
|
||||||
label: "Swap",
|
label: "Swap",
|
||||||
width: buttonWidth,
|
width: buttonWidth,
|
||||||
|
@ -383,11 +388,15 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
|
||||||
),
|
),
|
||||||
onPressed: () => _onSwapPressed(),
|
onPressed: () => _onSwapPressed(),
|
||||||
),
|
),
|
||||||
if (Constants.enableExchange && AppConfig.hasFeature(AppFeature.buy))
|
if (Constants.enableExchange &&
|
||||||
|
AppConfig.hasFeature(AppFeature.buy) &&
|
||||||
|
showExchange)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 16,
|
width: 16,
|
||||||
),
|
),
|
||||||
if (Constants.enableExchange && AppConfig.hasFeature(AppFeature.buy))
|
if (Constants.enableExchange &&
|
||||||
|
AppConfig.hasFeature(AppFeature.buy) &&
|
||||||
|
showExchange)
|
||||||
SecondaryButton(
|
SecondaryButton(
|
||||||
label: "Buy",
|
label: "Buy",
|
||||||
width: buttonWidth,
|
width: buttonWidth,
|
||||||
|
|
Loading…
Reference in a new issue