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,9 +145,7 @@ 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,
@ -218,25 +211,14 @@ class BalanceRowWidget extends StatelessWidget {
), ),
//), //),
if (frozenBalance.isNotEmpty) if (frozenBalance.isNotEmpty)
GestureDetector( Column(
behavior: HitTestBehavior.opaque,
onTap: hasAdditionalBalance
? () =>
_showBalanceDescription(
context, S
.of(context)
.unavailable_balance_description)
: null,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox(height: 26), SizedBox(height: 26),
Row( Row(
children: [ children: [
Text( Text(
S S.of(context).frozen_balance,
.of(context)
.unavailable_balance,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
@ -247,14 +229,6 @@ class BalanceRowWidget extends StatelessWidget {
height: 1, 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), SizedBox(height: 8),
@ -286,11 +260,8 @@ class BalanceRowWidget extends StatelessWidget {
), ),
], ],
), ),
),
if (hasAdditionalBalance) if (hasAdditionalBalance)
GestureDetector( Column(
onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox(height: 24), SizedBox(height: 24),
@ -301,8 +272,7 @@ class BalanceRowWidget extends StatelessWidget {
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>()!.labelTextColor,
.labelTextColor,
height: 1, height: 1,
), ),
), ),
@ -313,8 +283,7 @@ class BalanceRowWidget extends StatelessWidget {
fontSize: 20, fontSize: 20,
fontFamily: 'Lato', fontFamily: 'Lato',
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Theme.of(context).extension<BalancePageTheme>()! color: Theme.of(context).extension<BalancePageTheme>()!.assetTitleColor,
.assetTitleColor,
height: 1, height: 1,
), ),
maxLines: 1, maxLines: 1,
@ -335,7 +304,6 @@ class BalanceRowWidget extends StatelessWidget {
), ),
], ],
), ),
),
], ],
), ),
), ),
@ -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,19 +372,16 @@ class BalanceRowWidget extends StatelessWidget {
], ],
), ),
if (hasSecondAvailableBalance) if (hasSecondAvailableBalance)
GestureDetector( Row(
onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(),
child: Row(
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () => onTap: () => launchUrl(
launchUrl(
Uri.parse( Uri.parse(
"https://docs.cakewallet.com/cryptos/litecoin.html#mweb"), "https://docs.cakewallet.com/cryptos/litecoin#mweb"),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
), ),
child: Row( child: Row(
@ -472,7 +444,6 @@ class BalanceRowWidget extends StatelessWidget {
), ),
], ],
), ),
),
], ],
), ),
), ),
@ -539,15 +510,13 @@ 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 =
@ -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,9 +574,7 @@ 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 =
@ -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)));
} }