From acccce62a8f8d1ec8ace267b67bbb9411b4b4328 Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 29 Apr 2024 09:51:39 -0600 Subject: [PATCH] frost wallet bottom nav bar ui refactor on mobile --- lib/pages/wallet_view/wallet_view.dart | 27 +++++++++++--- .../components/icons/frost_sign_nav_icon.dart | 36 +++++++++++++++++++ 2 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 lib/widgets/wallet_navigation_bar/components/icons/frost_sign_nav_icon.dart diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index cfa690f11..79046c600 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -84,6 +84,7 @@ import 'package:stackwallet/widgets/stack_dialog.dart'; import 'package:stackwallet/widgets/wallet_navigation_bar/components/icons/buy_nav_icon.dart'; import 'package:stackwallet/widgets/wallet_navigation_bar/components/icons/coin_control_nav_icon.dart'; import 'package:stackwallet/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart'; +import 'package:stackwallet/widgets/wallet_navigation_bar/components/icons/frost_sign_nav_icon.dart'; import 'package:stackwallet/widgets/wallet_navigation_bar/components/icons/fusion_nav_icon.dart'; import 'package:stackwallet/widgets/wallet_navigation_bar/components/icons/ordinals_nav_icon.dart'; import 'package:stackwallet/widgets/wallet_navigation_bar/components/icons/paynym_nav_icon.dart'; @@ -356,7 +357,17 @@ class _WalletViewState extends ConsumerState { } } - void _onExchangePressed(BuildContext context) async { + Future _onFrostSignPressed(BuildContext context) async { + // TODO + await showDialog( + context: context, + builder: (_) => StackOkDialog( + title: "TODO FROST SIGN TX", + ), + ); + } + + Future _onExchangePressed(BuildContext context) async { final Coin coin = ref.read(pWalletCoin(walletId)); if (coin.isTestNet) { @@ -401,7 +412,7 @@ class _WalletViewState extends ConsumerState { } } - void _onBuyPressed(BuildContext context) async { + Future _onBuyPressed(BuildContext context) async { final Coin coin = ref.read(pWalletCoin(walletId)); if (coin.isTestNet) { @@ -976,6 +987,12 @@ class _WalletViewState extends ConsumerState { } }, ), + if (ref.watch(pWalletCoin(walletId)).isFrost) + WalletNavigationBarItemData( + label: "Sign", + icon: const FrostSignNavIcon(), + onTap: () => _onFrostSignPressed(context), + ), WalletNavigationBarItemData( label: "Send", icon: const SendNavIcon(), @@ -1007,13 +1024,15 @@ class _WalletViewState extends ConsumerState { ); }, ), - if (Constants.enableExchange) + if (Constants.enableExchange && + !ref.watch(pWalletCoin(walletId)).isFrost) WalletNavigationBarItemData( label: "Swap", icon: const ExchangeNavIcon(), onTap: () => _onExchangePressed(context), ), - if (Constants.enableExchange) + if (Constants.enableExchange && + !ref.watch(pWalletCoin(walletId)).isFrost) WalletNavigationBarItemData( label: "Buy", icon: const BuyNavIcon(), diff --git a/lib/widgets/wallet_navigation_bar/components/icons/frost_sign_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/frost_sign_nav_icon.dart new file mode 100644 index 000000000..a7a81c20f --- /dev/null +++ b/lib/widgets/wallet_navigation_bar/components/icons/frost_sign_nav_icon.dart @@ -0,0 +1,36 @@ +/* +* 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 +* +*/ + +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:stackwallet/themes/theme_providers.dart'; + +class FrostSignNavIcon extends ConsumerWidget { + const FrostSignNavIcon({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + return SvgPicture.file( + File( + ref.watch( + themeProvider.select( + // TODO: [prio=high] update themes with icon asset + (value) => value.assets.stackIcon, + ), + ), + ), + width: 24, + height: 24, + ); + } +}