some basic ui prep for paynym integration

This commit is contained in:
julian 2022-12-20 14:29:25 -06:00
parent 07eabb6092
commit 1ae4f40d63
7 changed files with 435 additions and 316 deletions

View file

@ -507,7 +507,7 @@ class _WalletNetworkSettingsViewState
children: [ children: [
Text( Text(
"Synchronized", "Synchronized",
style: STextStyles.w600_10(context), style: STextStyles.w600_12(context),
), ),
Text( Text(
"100%", "100%",
@ -581,7 +581,7 @@ class _WalletNetworkSettingsViewState
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
AnimatedText( AnimatedText(
style: STextStyles.w600_10(context), style: STextStyles.w600_12(context),
stringsToLoopThrough: const [ stringsToLoopThrough: const [
"Synchronizing", "Synchronizing",
"Synchronizing.", "Synchronizing.",
@ -679,7 +679,7 @@ class _WalletNetworkSettingsViewState
children: [ children: [
Text( Text(
"Unable to synchronize", "Unable to synchronize",
style: STextStyles.w600_10(context).copyWith( style: STextStyles.w600_12(context).copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.accentColorRed, .accentColorRed,

View file

@ -1,10 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.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/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
class WalletNavigationBar extends StatelessWidget { class WalletNavigationBar extends StatefulWidget {
const WalletNavigationBar({ const WalletNavigationBar({
Key? key, Key? key,
required this.onReceivePressed, required this.onReceivePressed,
@ -13,6 +14,7 @@ class WalletNavigationBar extends StatelessWidget {
required this.onBuyPressed, required this.onBuyPressed,
required this.height, required this.height,
required this.enableExchange, required this.enableExchange,
required this.coin,
}) : super(key: key); }) : super(key: key);
final VoidCallback onReceivePressed; final VoidCallback onReceivePressed;
@ -21,265 +23,367 @@ class WalletNavigationBar extends StatelessWidget {
final VoidCallback onBuyPressed; final VoidCallback onBuyPressed;
final double height; final double height;
final bool enableExchange; final bool enableExchange;
final Coin coin;
@override
State<WalletNavigationBar> createState() => _WalletNavigationBarState();
}
class _WalletNavigationBarState extends State<WalletNavigationBar> {
double scale = 0;
final duration = const Duration(milliseconds: 200);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Column(
height: height, mainAxisAlignment: MainAxisAlignment.end,
decoration: BoxDecoration( crossAxisAlignment: CrossAxisAlignment.end,
color: Theme.of(context).extension<StackColors>()!.bottomNavBack, children: [
boxShadow: [ // const Spacer(),
Theme.of(context).extension<StackColors>()!.standardBoxShadow
], AnimatedScale(
borderRadius: BorderRadius.circular( scale: scale,
height / 2.0, duration: duration,
), child: Column(
), mainAxisSize: MainAxisSize.min,
child: Padding( children: [
padding: const EdgeInsets.symmetric( AnimatedOpacity(
horizontal: 6, opacity: scale,
vertical: 4, duration: duration,
), child: GestureDetector(
child: Row( onTap: () {},
mainAxisAlignment: MainAxisAlignment.spaceEvenly, child: Container(
children: [ padding: const EdgeInsets.all(16),
const SizedBox( width: 146,
width: 12, decoration: BoxDecoration(
), color:
RawMaterialButton( Theme.of(context).extension<StackColors>()!.popupBG,
constraints: const BoxConstraints( boxShadow: [
minWidth: 66, Theme.of(context)
), .extension<StackColors>()!
onPressed: onReceivePressed, .standardBoxShadow
splashColor: ],
Theme.of(context).extension<StackColors>()!.highlight, borderRadius: BorderRadius.circular(
shape: RoundedRectangleBorder( widget.height / 2.0,
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<StackColors>()!
.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<StackColors>()!
.accentColorDark,
),
),
), ),
const SizedBox( ),
height: 4, child: Row(
), mainAxisAlignment: MainAxisAlignment.center,
Text(
"Receive",
style: STextStyles.buttonSmall(context),
),
const Spacer(),
],
),
),
),
),
RawMaterialButton(
constraints: const BoxConstraints(
minWidth: 66,
),
onPressed: onSendPressed,
splashColor:
Theme.of(context).extension<StackColors>()!.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<StackColors>()!
.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<StackColors>()!
.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<StackColors>()!.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: [ children: [
const Spacer(),
SvgPicture.asset(
Assets.svg.exchange(context),
width: 24,
height: 24,
),
const SizedBox(
height: 4,
),
Text( Text(
"Exchange", "Whirlpool",
style: STextStyles.buttonSmall(context), style: STextStyles.w600_12(context),
), ),
const Spacer(),
], ],
), ),
), ),
), ),
), ),
const SizedBox( const SizedBox(
width: 12, height: 8,
), ),
// TODO: Do not delete this code. AnimatedOpacity(
// only temporarily disabled opacity: scale,
// Spacer( duration: duration,
// flex: 2, child: GestureDetector(
// ), onTap: () {},
// GestureDetector( child: Container(
// onTap: onBuyPressed, padding: const EdgeInsets.all(16),
// child: Container( width: 146,
// color: Colors.transparent, decoration: BoxDecoration(
// child: Padding( color:
// padding: const EdgeInsets.symmetric(vertical: 2.0), Theme.of(context).extension<StackColors>()!.popupBG,
// child: Column( boxShadow: [
// crossAxisAlignment: CrossAxisAlignment.center, Theme.of(context)
// children: [ .extension<StackColors>()!
// Spacer(), .standardBoxShadow
// SvgPicture.asset( ],
// Assets.svg.buy, borderRadius: BorderRadius.circular(
// width: 24, widget.height / 2.0,
// height: 24, ),
// ), ),
// SizedBox( child: Row(
// height: 4, mainAxisAlignment: MainAxisAlignment.center,
// ), children: [
// Text( Text(
// "Buy", "Paynym",
// style: STextStyles.buttonSmall(context), style: STextStyles.w600_12(context),
// ), ),
// Spacer(), ],
// ], ),
// ), ),
// ), ),
// ), ),
// ), const SizedBox(
], height: 8,
),
],
),
), ),
), Container(
height: widget.height,
decoration: BoxDecoration(
color: Theme.of(context).extension<StackColors>()!.bottomNavBack,
boxShadow: [
Theme.of(context).extension<StackColors>()!.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<StackColors>()!.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<StackColors>()!
.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<StackColors>()!
.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<StackColors>()!.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<StackColors>()!
.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<StackColors>()!
.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<StackColors>()!.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<StackColors>()!.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<StackColors>()!.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,
// ),
// ),
// ],
// ),
// ),
// ),
// );
// }
// }

View file

@ -35,7 +35,6 @@ import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart'; import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
import 'package:stackwallet/utilities/enums/coin_enum.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/enums/wallet_balance_toggle_state.dart';
import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
@ -707,7 +706,6 @@ class _WalletViewState extends ConsumerState<WalletView> {
Column( Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
const Spacer(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -717,67 +715,63 @@ class _WalletViewState extends ConsumerState<WalletView> {
left: 16, left: 16,
right: 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, height: WalletView.navBarHeight,
child: WalletNavigationBar( onExchangePressed: () =>
enableExchange: _onExchangePressed(context),
Constants.enableExchange && onReceivePressed: () async {
ref.watch(managerProvider.select( final coin =
(value) => value.coin)) != ref.read(managerProvider).coin;
Coin.epicCash, if (mounted) {
height: WalletView.navBarHeight, unawaited(
onExchangePressed: () => Navigator.of(context).pushNamed(
_onExchangePressed(context), ReceiveView.routeName,
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,
arguments: Tuple2( arguments: Tuple2(
walletId, walletId,
coin, 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: () {},
), ),
), ),
], ],

View file

@ -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/monero/monero_wallet.dart' as xmr;
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart' import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'
as nmc; 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/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/utilities/util.dart';
import 'package:stackwallet/services/coins/particl/particl_wallet.dart'
as particl;
enum Coin { enum Coin {
bitcoin, 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 { int get requiredConfirmations {
switch (this) { switch (this) {
case Coin.bitcoin: case Coin.bitcoin:

View file

@ -568,7 +568,7 @@ class STextStyles {
} }
} }
static TextStyle w600_10(BuildContext context) { static TextStyle w600_12(BuildContext context) {
switch (_theme(context).themeType) { switch (_theme(context).themeType) {
case ThemeType.light: case ThemeType.light:
return GoogleFonts.inter( return GoogleFonts.inter(

View file

@ -100,8 +100,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: main ref: testing
resolved-ref: "48bd568b4f64c976813387fbae71a5daf48cff81" resolved-ref: "8ed2f6245c71a4457ed4ffdd3a74e4bcb9f9d2d0"
url: "https://github.com/cypherstack/bip47.git" url: "https://github.com/cypherstack/bip47.git"
source: git source: git
version: "1.0.0" version: "1.0.0"

View file

@ -59,7 +59,7 @@ dependencies:
bip47: bip47:
git: git:
url: https://github.com/cypherstack/bip47.git url: https://github.com/cypherstack/bip47.git
ref: main ref: testing
# Utility plugins # Utility plugins
# provider: ^6.0.1 # provider: ^6.0.1