balance display total fix

This commit is contained in:
julian 2023-04-12 11:27:31 -06:00
parent a85c79b367
commit a344366648

View file

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/utilities/amount/amount.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/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -212,7 +214,7 @@ class _DesktopChooseFromStackState
], ],
), ),
const Spacer(), const Spacer(),
BalanceDisplay( _BalanceDisplay(
walletId: walletIds[index], walletId: walletIds[index],
), ),
const SizedBox( const SizedBox(
@ -265,8 +267,8 @@ class _DesktopChooseFromStackState
} }
} }
class BalanceDisplay extends ConsumerWidget { class _BalanceDisplay extends ConsumerWidget {
const BalanceDisplay({ const _BalanceDisplay({
Key? key, Key? key,
required this.walletId, required this.walletId,
}) : super(key: key); }) : super(key: key);
@ -280,8 +282,14 @@ class BalanceDisplay extends ConsumerWidget {
final locale = ref.watch( final locale = ref.watch(
localeServiceChangeNotifierProvider.select((value) => value.locale)); localeServiceChangeNotifierProvider.select((value) => value.locale));
Amount total = manager.balance.total;
if (manager.coin == Coin.firo || manager.coin == Coin.firoTestNet) {
final firoWallet = manager.wallet as FiroWallet;
total += firoWallet.balancePrivate.total;
}
return Text( return Text(
"${manager.balance.spendable.localizedStringAsFixed(locale: locale)} " "${total.localizedStringAsFixed(locale: locale)} "
"${manager.coin.ticker}", "${manager.coin.ticker}",
style: STextStyles.desktopTextExtraSmall(context).copyWith( style: STextStyles.desktopTextExtraSmall(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textSubtitle1, color: Theme.of(context).extension<StackColors>()!.textSubtitle1,