diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart index 7e29010b1..84cda95fc 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart @@ -507,7 +507,7 @@ class _WalletNetworkSettingsViewState children: [ Text( "Synchronized", - style: STextStyles.w600_10(context), + style: STextStyles.w600_12(context), ), Text( "100%", @@ -581,7 +581,7 @@ class _WalletNetworkSettingsViewState mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AnimatedText( - style: STextStyles.w600_10(context), + style: STextStyles.w600_12(context), stringsToLoopThrough: const [ "Synchronizing", "Synchronizing.", @@ -679,7 +679,7 @@ class _WalletNetworkSettingsViewState children: [ Text( "Unable to synchronize", - style: STextStyles.w600_10(context).copyWith( + style: STextStyles.w600_12(context).copyWith( color: Theme.of(context) .extension()! .accentColorRed, diff --git a/lib/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart b/lib/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart index 04147c883..50738d483 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:stackwallet/utilities/assets.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart'; -class WalletNavigationBar extends StatelessWidget { +class WalletNavigationBar extends StatefulWidget { const WalletNavigationBar({ Key? key, required this.onReceivePressed, @@ -13,6 +14,7 @@ class WalletNavigationBar extends StatelessWidget { required this.onBuyPressed, required this.height, required this.enableExchange, + required this.coin, }) : super(key: key); final VoidCallback onReceivePressed; @@ -21,265 +23,367 @@ class WalletNavigationBar extends StatelessWidget { final VoidCallback onBuyPressed; final double height; final bool enableExchange; + final Coin coin; + + @override + State createState() => _WalletNavigationBarState(); +} + +class _WalletNavigationBarState extends State { + double scale = 0; + final duration = const Duration(milliseconds: 200); @override Widget build(BuildContext context) { - return Container( - height: height, - decoration: BoxDecoration( - color: Theme.of(context).extension()!.bottomNavBack, - boxShadow: [ - Theme.of(context).extension()!.standardBoxShadow - ], - borderRadius: BorderRadius.circular( - height / 2.0, - ), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 6, - vertical: 4, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - const SizedBox( - width: 12, - ), - RawMaterialButton( - constraints: const BoxConstraints( - minWidth: 66, - ), - onPressed: onReceivePressed, - splashColor: - Theme.of(context).extension()!.highlight, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - height / 2.0, - ), - ), - child: Container( - color: Colors.transparent, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Spacer(), - Container( - decoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .accentColorDark - .withOpacity(0.4), - borderRadius: BorderRadius.circular( - 24, - ), - ), - child: Padding( - padding: const EdgeInsets.all(6.0), - child: SvgPicture.asset( - Assets.svg.arrowDownLeft, - width: 12, - height: 12, - color: Theme.of(context) - .extension()! - .accentColorDark, - ), - ), + return Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + // const Spacer(), + + AnimatedScale( + scale: scale, + duration: duration, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + AnimatedOpacity( + opacity: scale, + duration: duration, + child: GestureDetector( + onTap: () {}, + child: Container( + padding: const EdgeInsets.all(16), + width: 146, + decoration: BoxDecoration( + color: + Theme.of(context).extension()!.popupBG, + boxShadow: [ + Theme.of(context) + .extension()! + .standardBoxShadow + ], + borderRadius: BorderRadius.circular( + widget.height / 2.0, ), - const SizedBox( - height: 4, - ), - Text( - "Receive", - style: STextStyles.buttonSmall(context), - ), - const Spacer(), - ], - ), - ), - ), - ), - RawMaterialButton( - constraints: const BoxConstraints( - minWidth: 66, - ), - onPressed: onSendPressed, - splashColor: - Theme.of(context).extension()!.highlight, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - height / 2.0, - ), - ), - child: Container( - color: Colors.transparent, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Spacer(), - Container( - decoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .accentColorDark - .withOpacity(0.4), - borderRadius: BorderRadius.circular( - 24, - ), - ), - child: Padding( - padding: const EdgeInsets.all(6.0), - child: SvgPicture.asset( - Assets.svg.arrowUpRight, - width: 12, - height: 12, - color: Theme.of(context) - .extension()! - .accentColorDark, - ), - ), - ), - const SizedBox( - height: 4, - ), - Text( - "Send", - style: STextStyles.buttonSmall(context), - ), - const Spacer(), - ], - ), - ), - ), - ), - if (enableExchange) - RawMaterialButton( - constraints: const BoxConstraints( - minWidth: 66, - ), - onPressed: onExchangePressed, - splashColor: - Theme.of(context).extension()!.highlight, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - height / 2.0, - ), - ), - child: Container( - color: Colors.transparent, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ - const Spacer(), - SvgPicture.asset( - Assets.svg.exchange(context), - width: 24, - height: 24, - ), - const SizedBox( - height: 4, - ), Text( - "Exchange", - style: STextStyles.buttonSmall(context), + "Whirlpool", + style: STextStyles.w600_12(context), ), - const Spacer(), ], ), ), ), ), - const SizedBox( - width: 12, - ), - // TODO: Do not delete this code. - // only temporarily disabled - // Spacer( - // flex: 2, - // ), - // GestureDetector( - // onTap: onBuyPressed, - // child: Container( - // color: Colors.transparent, - // child: Padding( - // padding: const EdgeInsets.symmetric(vertical: 2.0), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.center, - // children: [ - // Spacer(), - // SvgPicture.asset( - // Assets.svg.buy, - // width: 24, - // height: 24, - // ), - // SizedBox( - // height: 4, - // ), - // Text( - // "Buy", - // style: STextStyles.buttonSmall(context), - // ), - // Spacer(), - // ], - // ), - // ), - // ), - // ), - ], + const SizedBox( + height: 8, + ), + AnimatedOpacity( + opacity: scale, + duration: duration, + child: GestureDetector( + onTap: () {}, + child: Container( + padding: const EdgeInsets.all(16), + width: 146, + decoration: BoxDecoration( + color: + Theme.of(context).extension()!.popupBG, + boxShadow: [ + Theme.of(context) + .extension()! + .standardBoxShadow + ], + borderRadius: BorderRadius.circular( + widget.height / 2.0, + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Paynym", + style: STextStyles.w600_12(context), + ), + ], + ), + ), + ), + ), + const SizedBox( + height: 8, + ), + ], + ), ), - ), + Container( + height: widget.height, + decoration: BoxDecoration( + color: Theme.of(context).extension()!.bottomNavBack, + boxShadow: [ + Theme.of(context).extension()!.standardBoxShadow + ], + borderRadius: BorderRadius.circular( + widget.height / 2.0, + ), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 6, + vertical: 4, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + const SizedBox( + width: 12, + ), + RawMaterialButton( + constraints: const BoxConstraints( + minWidth: 66, + ), + onPressed: widget.onReceivePressed, + splashColor: + Theme.of(context).extension()!.highlight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + widget.height / 2.0, + ), + ), + child: Container( + color: Colors.transparent, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Spacer(), + Container( + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .accentColorDark + .withOpacity(0.4), + borderRadius: BorderRadius.circular( + 24, + ), + ), + child: Padding( + padding: const EdgeInsets.all(6.0), + child: SvgPicture.asset( + Assets.svg.arrowDownLeft, + width: 12, + height: 12, + color: Theme.of(context) + .extension()! + .accentColorDark, + ), + ), + ), + const SizedBox( + height: 4, + ), + Text( + "Receive", + style: STextStyles.buttonSmall(context), + ), + const Spacer(), + ], + ), + ), + ), + ), + RawMaterialButton( + constraints: const BoxConstraints( + minWidth: 66, + ), + onPressed: widget.onSendPressed, + splashColor: + Theme.of(context).extension()!.highlight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + widget.height / 2.0, + ), + ), + child: Container( + color: Colors.transparent, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Spacer(), + Container( + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .accentColorDark + .withOpacity(0.4), + borderRadius: BorderRadius.circular( + 24, + ), + ), + child: Padding( + padding: const EdgeInsets.all(6.0), + child: SvgPicture.asset( + Assets.svg.arrowUpRight, + width: 12, + height: 12, + color: Theme.of(context) + .extension()! + .accentColorDark, + ), + ), + ), + const SizedBox( + height: 4, + ), + Text( + "Send", + style: STextStyles.buttonSmall(context), + ), + const Spacer(), + ], + ), + ), + ), + ), + if (widget.enableExchange) + RawMaterialButton( + constraints: const BoxConstraints( + minWidth: 66, + ), + onPressed: widget.onExchangePressed, + splashColor: + Theme.of(context).extension()!.highlight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + widget.height / 2.0, + ), + ), + child: Container( + color: Colors.transparent, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Spacer(), + SvgPicture.asset( + Assets.svg.exchange(context), + width: 24, + height: 24, + ), + const SizedBox( + height: 4, + ), + Text( + "Exchange", + style: STextStyles.buttonSmall(context), + ), + const Spacer(), + ], + ), + ), + ), + ), + if (widget.coin.hasPaynymSupport) + RawMaterialButton( + constraints: const BoxConstraints( + minWidth: 66, + ), + onPressed: () { + if (scale == 0) { + setState(() { + scale = 1; + }); + } else if (scale == 1) { + setState(() { + scale = 0; + }); + } + }, + splashColor: + Theme.of(context).extension()!.highlight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + widget.height / 2.0, + ), + ), + child: Container( + color: Colors.transparent, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Spacer(), + const SizedBox( + height: 2, + ), + SvgPicture.asset( + Assets.svg.bars, + width: 20, + height: 20, + ), + const SizedBox( + height: 6, + ), + Text( + "More", + style: STextStyles.buttonSmall(context), + ), + const Spacer(), + ], + ), + ), + ), + ), + const SizedBox( + width: 12, + ), + // TODO: Do not delete this code. + // only temporarily disabled + // Spacer( + // flex: 2, + // ), + // GestureDetector( + // onTap: onBuyPressed, + // child: Container( + // color: Colors.transparent, + // child: Padding( + // padding: const EdgeInsets.symmetric(vertical: 2.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Spacer(), + // SvgPicture.asset( + // Assets.svg.buy, + // width: 24, + // height: 24, + // ), + // SizedBox( + // height: 4, + // ), + // Text( + // "Buy", + // style: STextStyles.buttonSmall(context), + // ), + // Spacer(), + // ], + // ), + // ), + // ), + // ), + ], + ), + ), + ), + ], ); } } -// -// class BarButton extends StatelessWidget { -// const BarButton( -// {Key? key, required this.icon, required this.text, this.onPressed}) -// : super(key: key); -// -// final Widget icon; -// final String text; -// final VoidCallback? onPressed; -// -// @override -// Widget build(BuildContext context) { -// return Container( -// child: MaterialButton( -// splashColor: Theme.of(context).extension()!.highlight, -// padding: const EdgeInsets.all(0), -// minWidth: 45, -// shape: RoundedRectangleBorder( -// borderRadius: BorderRadius.circular( -// Constants.size.circularBorderRadius, -// ), -// ), -// materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, -// onPressed: onPressed, -// child: Padding( -// padding: const EdgeInsets.all(4.0), -// child: Column( -// mainAxisAlignment: MainAxisAlignment.center, -// children: [ -// icon, -// SizedBox( -// height: 4, -// ), -// Text( -// text, -// style: STextStyles.itemSubtitle12(context).copyWith( -// fontSize: 10, -// ), -// ), -// ], -// ), -// ), -// ), -// ); -// } -// } diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index 4b415074c..16f4519b9 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -35,7 +35,6 @@ import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/enums/backup_frequency_type.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; -import 'package:stackwallet/utilities/enums/flush_bar_type.dart'; import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart'; import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/text_styles.dart'; @@ -707,7 +706,6 @@ class _WalletViewState extends ConsumerState { Column( mainAxisAlignment: MainAxisAlignment.end, children: [ - const Spacer(), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -717,67 +715,63 @@ class _WalletViewState extends ConsumerState { left: 16, right: 16, ), - child: SizedBox( + child: WalletNavigationBar( + coin: ref.watch(managerProvider + .select((value) => value.coin)), + enableExchange: Constants.enableExchange && + ref.watch(managerProvider.select( + (value) => value.coin)) != + Coin.epicCash, height: WalletView.navBarHeight, - child: WalletNavigationBar( - enableExchange: - Constants.enableExchange && - ref.watch(managerProvider.select( - (value) => value.coin)) != - Coin.epicCash, - height: WalletView.navBarHeight, - onExchangePressed: () => - _onExchangePressed(context), - onReceivePressed: () async { - final coin = - ref.read(managerProvider).coin; - if (mounted) { - unawaited( - Navigator.of(context).pushNamed( - ReceiveView.routeName, - arguments: Tuple2( - walletId, - coin, - ), - )); - } - }, - onSendPressed: () { - final walletId = - ref.read(managerProvider).walletId; - final coin = - ref.read(managerProvider).coin; - switch (ref - .read( - walletBalanceToggleStateProvider - .state) - .state) { - case WalletBalanceToggleState.full: - ref - .read( - publicPrivateBalanceStateProvider - .state) - .state = "Public"; - break; - case WalletBalanceToggleState - .available: - ref - .read( - publicPrivateBalanceStateProvider - .state) - .state = "Private"; - break; - } - Navigator.of(context).pushNamed( - SendView.routeName, + onExchangePressed: () => + _onExchangePressed(context), + onReceivePressed: () async { + final coin = + ref.read(managerProvider).coin; + if (mounted) { + unawaited( + Navigator.of(context).pushNamed( + ReceiveView.routeName, arguments: Tuple2( walletId, coin, ), - ); - }, - onBuyPressed: () {}, - ), + )); + } + }, + onSendPressed: () { + final walletId = + ref.read(managerProvider).walletId; + final coin = + ref.read(managerProvider).coin; + switch (ref + .read(walletBalanceToggleStateProvider + .state) + .state) { + case WalletBalanceToggleState.full: + ref + .read( + publicPrivateBalanceStateProvider + .state) + .state = "Public"; + break; + case WalletBalanceToggleState.available: + ref + .read( + publicPrivateBalanceStateProvider + .state) + .state = "Private"; + break; + } + Navigator.of(context).pushNamed( + SendView.routeName, + arguments: Tuple2( + walletId, + coin, + ), + ); + }, + onBuyPressed: () {}, ), ), ], diff --git a/lib/utilities/enums/coin_enum.dart b/lib/utilities/enums/coin_enum.dart index e90509305..1d1f6e15d 100644 --- a/lib/utilities/enums/coin_enum.dart +++ b/lib/utilities/enums/coin_enum.dart @@ -11,12 +11,10 @@ import 'package:stackwallet/services/coins/litecoin/litecoin_wallet.dart' import 'package:stackwallet/services/coins/monero/monero_wallet.dart' as xmr; import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart' as nmc; +import 'package:stackwallet/services/coins/particl/particl_wallet.dart' + as particl; import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart' as wow; -import 'package:stackwallet/services/coins/particl/particl_wallet.dart' - as particl; import 'package:stackwallet/utilities/util.dart'; -import 'package:stackwallet/services/coins/particl/particl_wallet.dart' - as particl; enum Coin { bitcoin, @@ -174,6 +172,29 @@ extension CoinExt on Coin { } } + bool get hasPaynymSupport { + switch (this) { + case Coin.bitcoin: + case Coin.litecoin: + case Coin.bitcoincash: + case Coin.firo: + case Coin.namecoin: + case Coin.particl: + case Coin.bitcoinTestNet: + case Coin.litecoinTestNet: + case Coin.bitcoincashTestnet: + case Coin.firoTestNet: + case Coin.epicCash: + case Coin.monero: + case Coin.wownero: + return false; + + case Coin.dogecoin: + case Coin.dogecoinTestNet: + return true; + } + } + int get requiredConfirmations { switch (this) { case Coin.bitcoin: diff --git a/lib/utilities/text_styles.dart b/lib/utilities/text_styles.dart index 56c313219..42a0ba488 100644 --- a/lib/utilities/text_styles.dart +++ b/lib/utilities/text_styles.dart @@ -568,7 +568,7 @@ class STextStyles { } } - static TextStyle w600_10(BuildContext context) { + static TextStyle w600_12(BuildContext context) { switch (_theme(context).themeType) { case ThemeType.light: return GoogleFonts.inter( diff --git a/pubspec.lock b/pubspec.lock index 92f0eb3d7..701cc6636 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -100,8 +100,8 @@ packages: dependency: "direct main" description: path: "." - ref: main - resolved-ref: "48bd568b4f64c976813387fbae71a5daf48cff81" + ref: testing + resolved-ref: "8ed2f6245c71a4457ed4ffdd3a74e4bcb9f9d2d0" url: "https://github.com/cypherstack/bip47.git" source: git version: "1.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 05cbe66b0..af8e082e6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -59,7 +59,7 @@ dependencies: bip47: git: url: https://github.com/cypherstack/bip47.git - ref: main + ref: testing # Utility plugins # provider: ^6.0.1