desktop wallet balance info style fixes

This commit is contained in:
julian 2022-10-27 11:21:22 -06:00
parent 51b6a95390
commit 00e8019639
2 changed files with 119 additions and 106 deletions

View file

@ -10,6 +10,7 @@ import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
/// [eventBus] should only be set during testing /// [eventBus] should only be set during testing
class WalletRefreshButton extends ConsumerStatefulWidget { class WalletRefreshButton extends ConsumerStatefulWidget {
@ -70,7 +71,7 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
_spinController?.stop(); _spinController?.stop();
break; break;
case WalletSyncStatus.syncing: case WalletSyncStatus.syncing:
_spinController?.repeat(); unawaited(_spinController?.repeat());
break; break;
} }
} }
@ -92,10 +93,15 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = Util.isDesktop;
return SizedBox( return SizedBox(
height: 36, height: isDesktop ? 22 : 36,
width: 36, width: isDesktop ? 22 : 36,
child: MaterialButton( child: MaterialButton(
color: isDesktop
? Theme.of(context).extension<StackColors>()!.buttonBackSecondary
: null,
splashColor: Theme.of(context).extension<StackColors>()!.highlight, splashColor: Theme.of(context).extension<StackColors>()!.highlight,
onPressed: () { onPressed: () {
final managerProvider = ref final managerProvider = ref
@ -110,6 +116,9 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
.then((_) => _spinController?.stop()); .then((_) => _spinController?.stop());
} }
}, },
elevation: 0,
highlightElevation: 0,
hoverElevation: 0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -121,9 +130,13 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
turns: _spinAnimation, turns: _spinAnimation,
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.svg.arrowRotate, Assets.svg.arrowRotate,
width: 24, width: isDesktop ? 12 : 24,
height: 24, height: isDesktop ? 12 : 24,
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard, color: isDesktop
? Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultSearchIconRight
: Theme.of(context).extension<StackColors>()!.textFavoriteCard,
), ),
), ),
), ),

View file

@ -1,17 +1,13 @@
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart'; import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart';
import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_refresh_button.dart'; import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_refresh_button.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/providers/wallet/wallet_balance_toggle_state_provider.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/services/coins/manager.dart'; import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart'; import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
import 'package:stackwallet/utilities/format.dart'; import 'package:stackwallet/utilities/format.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';
@ -100,9 +96,9 @@ class _WDesktopWalletSummaryState extends State<DesktopWalletSummary> {
final priceTuple = ref.watch(priceAnd24hChangeNotifierProvider final priceTuple = ref.watch(priceAnd24hChangeNotifierProvider
.select((value) => value.getPrice(coin))); .select((value) => value.getPrice(coin)));
final _showAvailable = final _showAvailable = false;
ref.watch(walletBalanceToggleStateProvider.state).state == // ref.watch(walletBalanceToggleStateProvider.state).state ==
WalletBalanceToggleState.available; // WalletBalanceToggleState.available;
return FutureBuilder( return FutureBuilder(
future: _showAvailable future: _showAvailable
@ -125,46 +121,46 @@ class _WDesktopWalletSummaryState extends State<DesktopWalletSummary> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
GestureDetector( // GestureDetector(
onTap: showSheet, // onTap: showSheet,
child: Row( // child: Row(
children: [ // children: [
if (coin == Coin.firo || // if (coin == Coin.firo ||
coin == Coin.firoTestNet) // coin == Coin.firoTestNet)
Text( // Text(
"${_showAvailable ? "Private" : "Public"} Balance", // "${_showAvailable ? "Private" : "Public"} Balance",
style: STextStyles.subtitle500(context) // style: STextStyles.subtitle500(context)
.copyWith( // .copyWith(
color: Theme.of(context) // color: Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.textFavoriteCard, // .textFavoriteCard,
), // ),
), // ),
if (coin != Coin.firo && // if (coin != Coin.firo &&
coin != Coin.firoTestNet) // coin != Coin.firoTestNet)
Text( // Text(
"${_showAvailable ? "Available" : "Full"} Balance", // "${_showAvailable ? "Available" : "Full"} Balance",
style: STextStyles.subtitle500(context) // style: STextStyles.subtitle500(context)
.copyWith( // .copyWith(
color: Theme.of(context) // color: Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.textFavoriteCard, // .textFavoriteCard,
), // ),
), // ),
const SizedBox( // const SizedBox(
width: 4, // width: 4,
), // ),
SvgPicture.asset( // SvgPicture.asset(
Assets.svg.chevronDown, // Assets.svg.chevronDown,
color: Theme.of(context) // color: Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.textFavoriteCard, // .textFavoriteCard,
width: 8, // width: 8,
height: 4, // height: 4,
), // ),
], // ],
), // ),
), // ),
FittedBox( FittedBox(
fit: BoxFit.scaleDown, fit: BoxFit.scaleDown,
child: Text( child: Text(
@ -196,46 +192,46 @@ class _WDesktopWalletSummaryState extends State<DesktopWalletSummary> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
GestureDetector( // GestureDetector(
onTap: showSheet, // onTap: showSheet,
child: Row( // child: Row(
children: [ // children: [
if (coin == Coin.firo || // if (coin == Coin.firo ||
coin == Coin.firoTestNet) // coin == Coin.firoTestNet)
Text( // Text(
"${_showAvailable ? "Private" : "Public"} Balance", // "${_showAvailable ? "Private" : "Public"} Balance",
style: STextStyles.subtitle500(context) // style: STextStyles.subtitle500(context)
.copyWith( // .copyWith(
color: Theme.of(context) // color: Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.textFavoriteCard, // .textFavoriteCard,
), // ),
), // ),
if (coin != Coin.firo && // if (coin != Coin.firo &&
coin != Coin.firoTestNet) // coin != Coin.firoTestNet)
Text( // Text(
"${_showAvailable ? "Available" : "Full"} Balance", // "${_showAvailable ? "Available" : "Full"} Balance",
style: STextStyles.subtitle500(context) // style: STextStyles.subtitle500(context)
.copyWith( // .copyWith(
color: Theme.of(context) // color: Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.textFavoriteCard, // .textFavoriteCard,
), // ),
), // ),
const SizedBox( // const SizedBox(
width: 4, // width: 4,
), // ),
SvgPicture.asset( // SvgPicture.asset(
Assets.svg.chevronDown, // Assets.svg.chevronDown,
width: 8, // width: 8,
height: 4, // height: 4,
color: Theme.of(context) // color: Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.textFavoriteCard, // .textFavoriteCard,
), // ),
], // ],
), // ),
), // ),
AnimatedText( AnimatedText(
stringsToLoopThrough: const [ stringsToLoopThrough: const [
"Loading balance ", "Loading balance ",
@ -250,6 +246,7 @@ class _WDesktopWalletSummaryState extends State<DesktopWalletSummary> {
.textFavoriteCard, .textFavoriteCard,
), ),
), ),
if (externalCalls)
AnimatedText( AnimatedText(
stringsToLoopThrough: const [ stringsToLoopThrough: const [
"Loading balance ", "Loading balance ",
@ -273,6 +270,9 @@ class _WDesktopWalletSummaryState extends State<DesktopWalletSummary> {
), ),
], ],
), ),
const SizedBox(
width: 8,
),
WalletRefreshButton( WalletRefreshButton(
walletId: walletId, walletId: walletId,
initialSyncStatus: widget.initialSyncStatus, initialSyncStatus: widget.initialSyncStatus,