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: [
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<StackColors>()!
.accentColorRed,

View file

@ -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,18 +23,112 @@ class WalletNavigationBar extends StatelessWidget {
final VoidCallback onBuyPressed;
final double height;
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
Widget build(BuildContext context) {
return Container(
height: height,
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<StackColors>()!.popupBG,
boxShadow: [
Theme.of(context)
.extension<StackColors>()!
.standardBoxShadow
],
borderRadius: BorderRadius.circular(
widget.height / 2.0,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Whirlpool",
style: STextStyles.w600_12(context),
),
],
),
),
),
),
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<StackColors>()!.popupBG,
boxShadow: [
Theme.of(context)
.extension<StackColors>()!
.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<StackColors>()!.bottomNavBack,
boxShadow: [
Theme.of(context).extension<StackColors>()!.standardBoxShadow
],
borderRadius: BorderRadius.circular(
height / 2.0,
widget.height / 2.0,
),
),
child: Padding(
@ -50,12 +146,12 @@ class WalletNavigationBar extends StatelessWidget {
constraints: const BoxConstraints(
minWidth: 66,
),
onPressed: onReceivePressed,
onPressed: widget.onReceivePressed,
splashColor:
Theme.of(context).extension<StackColors>()!.highlight,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
height / 2.0,
widget.height / 2.0,
),
),
child: Container(
@ -105,12 +201,12 @@ class WalletNavigationBar extends StatelessWidget {
constraints: const BoxConstraints(
minWidth: 66,
),
onPressed: onSendPressed,
onPressed: widget.onSendPressed,
splashColor:
Theme.of(context).extension<StackColors>()!.highlight,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
height / 2.0,
widget.height / 2.0,
),
),
child: Container(
@ -156,17 +252,17 @@ class WalletNavigationBar extends StatelessWidget {
),
),
),
if (enableExchange)
if (widget.enableExchange)
RawMaterialButton(
constraints: const BoxConstraints(
minWidth: 66,
),
onPressed: onExchangePressed,
onPressed: widget.onExchangePressed,
splashColor:
Theme.of(context).extension<StackColors>()!.highlight,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
height / 2.0,
widget.height / 2.0,
),
),
child: Container(
@ -195,6 +291,58 @@ class WalletNavigationBar extends StatelessWidget {
),
),
),
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,
),
@ -234,52 +382,8 @@ class WalletNavigationBar extends StatelessWidget {
],
),
),
),
],
);
}
}
//
// 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/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<WalletView> {
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
const Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -717,11 +715,10 @@ class _WalletViewState extends ConsumerState<WalletView> {
left: 16,
right: 16,
),
child: SizedBox(
height: WalletView.navBarHeight,
child: WalletNavigationBar(
enableExchange:
Constants.enableExchange &&
coin: ref.watch(managerProvider
.select((value) => value.coin)),
enableExchange: Constants.enableExchange &&
ref.watch(managerProvider.select(
(value) => value.coin)) !=
Coin.epicCash,
@ -748,8 +745,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
final coin =
ref.read(managerProvider).coin;
switch (ref
.read(
walletBalanceToggleStateProvider
.read(walletBalanceToggleStateProvider
.state)
.state) {
case WalletBalanceToggleState.full:
@ -759,8 +755,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
.state)
.state = "Public";
break;
case WalletBalanceToggleState
.available:
case WalletBalanceToggleState.available:
ref
.read(
publicPrivateBalanceStateProvider
@ -779,7 +774,6 @@ class _WalletViewState extends ConsumerState<WalletView> {
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/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:

View file

@ -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(

View file

@ -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"

View file

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