Balance card fixes (#1933)
Some checks failed
Cache Dependencies / test (push) Has been cancelled

This commit is contained in:
tuxsudo 2025-01-04 01:50:06 -05:00 committed by GitHub
parent da9c309805
commit cee3abcb72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 160 additions and 197 deletions

View file

@ -78,15 +78,13 @@ class BalanceRowWidget extends StatelessWidget {
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor, color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
), ),
child: TextButton( child: TextButton(
onPressed: () => onPressed: () => Fluttertoast.showToast(
Fluttertoast.showToast( msg: S.current.show_balance_toast,
msg: S.current.show_balance_toast, backgroundColor: Color.fromRGBO(0, 0, 0, 0.85),
backgroundColor: Color.fromRGBO(0, 0, 0, 0.85), ),
),
onLongPress: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), onLongPress: () => dashboardViewModel.balanceViewModel.switchBalanceValue(),
style: TextButton.styleFrom( style: TextButton.styleFrom(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
borderRadius: BorderRadius.circular(30)),
), ),
child: Container( child: Container(
margin: const EdgeInsets.only(top: 10, left: 12, right: 12, bottom: 10), margin: const EdgeInsets.only(top: 10, left: 12, right: 12, bottom: 10),
@ -103,11 +101,8 @@ class BalanceRowWidget extends StatelessWidget {
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: hasAdditionalBalance onTap: hasAdditionalBalance
? () => ? () => _showBalanceDescription(
_showBalanceDescription( context, S.of(context).available_balance_description)
context, S
.of(context)
.available_balance_description)
: null, : null,
child: Row( child: Row(
children: [ children: [
@ -150,16 +145,14 @@ class BalanceRowWidget extends StatelessWidget {
textAlign: TextAlign.start), textAlign: TextAlign.start),
SizedBox(height: 6), SizedBox(height: 6),
if (isTestnet) if (isTestnet)
Text(S Text(S.of(context).testnet_coins_no_value,
.of(context)
.testnet_coins_no_value,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontFamily: 'Lato', fontFamily: 'Lato',
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: color:
Theme.of(context).extension<BalancePageTheme>()!.textColor, Theme.of(context).extension<BalancePageTheme>()!.textColor,
height: 1)), height: 1)),
if (!isTestnet) if (!isTestnet)
Text('${availableFiatBalance}', Text('${availableFiatBalance}',
@ -169,7 +162,7 @@ class BalanceRowWidget extends StatelessWidget {
fontFamily: 'Lato', fontFamily: 'Lato',
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: color:
Theme.of(context).extension<BalancePageTheme>()!.textColor, Theme.of(context).extension<BalancePageTheme>()!.textColor,
height: 1)), height: 1)),
], ],
), ),
@ -218,123 +211,98 @@ class BalanceRowWidget extends StatelessWidget {
), ),
//), //),
if (frozenBalance.isNotEmpty) if (frozenBalance.isNotEmpty)
GestureDetector( Column(
behavior: HitTestBehavior.opaque, crossAxisAlignment: CrossAxisAlignment.start,
onTap: hasAdditionalBalance children: [
? () => SizedBox(height: 26),
_showBalanceDescription( Row(
context, S children: [
.of(context)
.unavailable_balance_description)
: null,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 26),
Row(
children: [
Text(
S
.of(context)
.unavailable_balance,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color:
Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
height: 1,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Icon(Icons.help_outline,
size: 16,
color: Theme.of(context)
.extension<BalancePageTheme>()!
.labelTextColor),
),
],
),
SizedBox(height: 8),
AutoSizeText(
frozenBalance,
style: TextStyle(
fontSize: 20,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color:
Theme.of(context).extension<BalancePageTheme>()!.balanceAmountColor,
height: 1,
),
maxLines: 1,
textAlign: TextAlign.center,
),
SizedBox(height: 4),
if (!isTestnet)
Text( Text(
frozenFiatBalance, S.of(context).frozen_balance,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontFamily: 'Lato', fontFamily: 'Lato',
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Theme.of(context).extension<BalancePageTheme>()!.textColor, color:
Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
height: 1, height: 1,
), ),
), ),
], ],
), ),
), SizedBox(height: 8),
if (hasAdditionalBalance) AutoSizeText(
GestureDetector( frozenBalance,
onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), style: TextStyle(
child: Column( fontSize: 20,
crossAxisAlignment: CrossAxisAlignment.start, fontFamily: 'Lato',
children: [ fontWeight: FontWeight.w400,
SizedBox(height: 24), color:
Theme.of(context).extension<BalancePageTheme>()!.balanceAmountColor,
height: 1,
),
maxLines: 1,
textAlign: TextAlign.center,
),
SizedBox(height: 4),
if (!isTestnet)
Text( Text(
'${additionalBalanceLabel}', frozenFiatBalance,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontFamily: 'Lato', fontFamily: 'Lato',
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Theme.of(context).extension<BalancePageTheme>()! color: Theme.of(context).extension<BalancePageTheme>()!.textColor,
.labelTextColor,
height: 1, height: 1,
), ),
), ),
SizedBox(height: 8), ],
AutoSizeText( ),
additionalBalance, if (hasAdditionalBalance)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 24),
Text(
'${additionalBalanceLabel}',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
height: 1,
),
),
SizedBox(height: 8),
AutoSizeText(
additionalBalance,
style: TextStyle(
fontSize: 20,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).extension<BalancePageTheme>()!.assetTitleColor,
height: 1,
),
maxLines: 1,
textAlign: TextAlign.center,
),
SizedBox(height: 4),
if (!isTestnet)
Text(
'${additionalFiatBalance}',
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 12,
fontFamily: 'Lato', fontFamily: 'Lato',
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Theme.of(context).extension<BalancePageTheme>()! color: Theme.of(context).extension<BalancePageTheme>()!.textColor,
.assetTitleColor,
height: 1, height: 1,
), ),
maxLines: 1,
textAlign: TextAlign.center,
), ),
SizedBox(height: 4), ],
if (!isTestnet)
Text(
'${additionalFiatBalance}',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context).extension<BalancePageTheme>()!.textColor,
height: 1,
),
),
],
),
), ),
], ],
), ),
@ -353,12 +321,20 @@ class BalanceRowWidget extends StatelessWidget {
), ),
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor, color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
), ),
child: Container( child: TextButton(
onPressed: () => Fluttertoast.showToast(
msg: S.current.show_balance_toast,
backgroundColor: Color.fromRGBO(0, 0, 0, 0.85),
),
onLongPress: () => dashboardViewModel.balanceViewModel.switchBalanceValue(),
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: const EdgeInsets.only(top: 16, left: 24, right: 8, bottom: 16), margin: const EdgeInsets.only(top: 10, left: 12, right: 12, bottom: 10),
child: Stack( child: Stack(
children: [ children: [
if (currency == CryptoCurrency.ltc) if (currency == CryptoCurrency.ltc)
@ -366,7 +342,6 @@ class BalanceRowWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Container( Container(
padding: EdgeInsets.only(right: 16, top: 0),
child: Column( child: Column(
children: [ children: [
Container( Container(
@ -397,81 +372,77 @@ class BalanceRowWidget extends StatelessWidget {
], ],
), ),
if (hasSecondAvailableBalance) if (hasSecondAvailableBalance)
GestureDetector( Row(
onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), children: [
child: Row( Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, GestureDetector(
children: [ behavior: HitTestBehavior.opaque,
GestureDetector( onTap: () => launchUrl(
behavior: HitTestBehavior.opaque, Uri.parse(
onTap: () => "https://docs.cakewallet.com/cryptos/litecoin#mweb"),
launchUrl( mode: LaunchMode.externalApplication,
Uri.parse( ),
"https://docs.cakewallet.com/cryptos/litecoin.html#mweb"), child: Row(
mode: LaunchMode.externalApplication, children: [
Text(
'${secondAvailableBalanceLabel}',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context)
.extension<BalancePageTheme>()!
.labelTextColor,
height: 1,
), ),
child: Row( ),
children: [ Padding(
Text( padding: const EdgeInsets.symmetric(horizontal: 4),
'${secondAvailableBalanceLabel}', child: Icon(Icons.help_outline,
textAlign: TextAlign.center, size: 16,
style: TextStyle(
fontSize: 12,
fontFamily: 'Lato',
fontWeight: FontWeight.w400,
color: Theme.of(context) color: Theme.of(context)
.extension<BalancePageTheme>()! .extension<BalancePageTheme>()!
.labelTextColor, .labelTextColor),
height: 1, )
), ],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Icon(Icons.help_outline,
size: 16,
color: Theme.of(context)
.extension<BalancePageTheme>()!
.labelTextColor),
)
],
),
), ),
SizedBox(height: 8), ),
AutoSizeText( SizedBox(height: 8),
secondAvailableBalance, AutoSizeText(
secondAvailableBalance,
style: TextStyle(
fontSize: 24,
fontFamily: 'Lato',
fontWeight: FontWeight.w900,
color: Theme.of(context)
.extension<BalancePageTheme>()!
.assetTitleColor,
height: 1,
),
maxLines: 1,
textAlign: TextAlign.center,
),
SizedBox(height: 6),
if (!isTestnet)
Text(
'${secondAvailableFiatBalance}',
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 16,
fontFamily: 'Lato', fontFamily: 'Lato',
fontWeight: FontWeight.w900, fontWeight: FontWeight.w500,
color: Theme.of(context) color: Theme.of(context)
.extension<BalancePageTheme>()! .extension<BalancePageTheme>()!
.assetTitleColor, .textColor,
height: 1, height: 1,
), ),
maxLines: 1,
textAlign: TextAlign.center,
), ),
SizedBox(height: 6), ],
if (!isTestnet) ),
Text( ],
'${secondAvailableFiatBalance}',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
fontFamily: 'Lato',
fontWeight: FontWeight.w500,
color: Theme.of(context)
.extension<BalancePageTheme>()!
.textColor,
height: 1,
),
),
],
),
],
),
), ),
], ],
), ),
@ -539,19 +510,17 @@ class BalanceRowWidget extends StatelessWidget {
), ),
IntrinsicHeight( IntrinsicHeight(
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 24), padding: EdgeInsets.symmetric(horizontal: 12),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded( Expanded(
child: Semantics( child: Semantics(
label: S label: S.of(context).litecoin_mweb_pegin,
.of(context)
.litecoin_mweb_pegin,
child: OutlinedButton( child: OutlinedButton(
onPressed: () { onPressed: () {
final mwebAddress = final mwebAddress =
bitcoin!.getUnusedMwebAddress(dashboardViewModel.wallet); bitcoin!.getUnusedMwebAddress(dashboardViewModel.wallet);
PaymentRequest? paymentRequest = null; PaymentRequest? paymentRequest = null;
if ((mwebAddress?.isNotEmpty ?? false)) { if ((mwebAddress?.isNotEmpty ?? false)) {
paymentRequest = PaymentRequest.fromUri( paymentRequest = PaymentRequest.fromUri(
@ -589,9 +558,7 @@ class BalanceRowWidget extends StatelessWidget {
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
S S.of(context).litecoin_mweb_pegin,
.of(context)
.litecoin_mweb_pegin,
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: Theme.of(context)
.extension<BalancePageTheme>()! .extension<BalancePageTheme>()!
@ -607,13 +574,11 @@ class BalanceRowWidget extends StatelessWidget {
SizedBox(width: 24), SizedBox(width: 24),
Expanded( Expanded(
child: Semantics( child: Semantics(
label: S label: S.of(context).litecoin_mweb_pegout,
.of(context)
.litecoin_mweb_pegout,
child: OutlinedButton( child: OutlinedButton(
onPressed: () { onPressed: () {
final litecoinAddress = final litecoinAddress =
bitcoin!.getUnusedSegwitAddress(dashboardViewModel.wallet); bitcoin!.getUnusedSegwitAddress(dashboardViewModel.wallet);
PaymentRequest? paymentRequest = null; PaymentRequest? paymentRequest = null;
if ((litecoinAddress?.isNotEmpty ?? false)) { if ((litecoinAddress?.isNotEmpty ?? false)) {
paymentRequest = PaymentRequest.fromUri( paymentRequest = PaymentRequest.fromUri(
@ -651,9 +616,7 @@ class BalanceRowWidget extends StatelessWidget {
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
S S.of(context).litecoin_mweb_pegout,
.of(context)
.litecoin_mweb_pegout,
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: Theme.of(context)
.extension<BalancePageTheme>()! .extension<BalancePageTheme>()!

View file

@ -218,13 +218,13 @@ abstract class BalanceViewModelBase with Store {
availableBalance: '●●●●●●', availableBalance: '●●●●●●',
additionalBalance: additionalBalance, additionalBalance: additionalBalance,
frozenBalance: '', frozenBalance: '',
secondAvailableBalance: '', secondAvailableBalance: '●●●●●●',
secondAdditionalBalance: '', secondAdditionalBalance: '●●●●●●',
fiatAdditionalBalance: isFiatDisabled ? '' : '', fiatAdditionalBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●',
fiatAvailableBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●', fiatAvailableBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●',
fiatFrozenBalance: isFiatDisabled ? '' : '', fiatFrozenBalance: isFiatDisabled ? '' : '',
fiatSecondAvailableBalance: isFiatDisabled ? '' : '', fiatSecondAvailableBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●',
fiatSecondAdditionalBalance: isFiatDisabled ? '' : '', fiatSecondAdditionalBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●',
asset: key, asset: key,
formattedAssetTitle: _formatterAsset(key))); formattedAssetTitle: _formatterAsset(key)));
} }