mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 19:05:51 +00:00
show sum of total firo public and private balance on wallet select sheet
This commit is contained in:
parent
9ae95b3591
commit
97f36e6f04
1 changed files with 19 additions and 39 deletions
|
@ -2,12 +2,13 @@ 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:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
|
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
||||||
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.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';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/animated_text.dart';
|
|
||||||
|
|
||||||
class WalletInfoRowBalanceFuture extends ConsumerWidget {
|
class WalletInfoRowBalanceFuture extends ConsumerWidget {
|
||||||
const WalletInfoRowBalanceFuture({Key? key, required this.walletId})
|
const WalletInfoRowBalanceFuture({Key? key, required this.walletId})
|
||||||
|
@ -27,44 +28,23 @@ class WalletInfoRowBalanceFuture extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO redo this widget now that its not actually a future
|
Decimal balance = manager.balance.getTotal();
|
||||||
return FutureBuilder(
|
|
||||||
future: Future(() => manager.balance.getTotal()),
|
if (manager.coin == Coin.firo || manager.coin == Coin.firoTestNet) {
|
||||||
builder: (builderContext, AsyncSnapshot<Decimal> snapshot) {
|
balance += (manager.wallet as FiroWallet).balancePrivate.getTotal();
|
||||||
if (snapshot.connectionState == ConnectionState.done &&
|
}
|
||||||
snapshot.hasData) {
|
|
||||||
return Text(
|
return Text(
|
||||||
"${Format.localizedStringAsFixed(
|
"${Format.localizedStringAsFixed(
|
||||||
value: snapshot.data!,
|
value: balance,
|
||||||
locale: locale,
|
locale: locale,
|
||||||
decimalPlaces: 8,
|
decimalPlaces: Constants.decimalPlacesForCoin(manager.coin),
|
||||||
)} ${manager.coin.ticker}",
|
)} ${manager.coin.ticker}",
|
||||||
style: Util.isDesktop
|
style: Util.isDesktop
|
||||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).extension<StackColors>()!.textSubtitle1,
|
||||||
.extension<StackColors>()!
|
|
||||||
.textSubtitle1,
|
|
||||||
)
|
|
||||||
: STextStyles.itemSubtitle(context),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return AnimatedText(
|
|
||||||
stringsToLoopThrough: const [
|
|
||||||
"Loading balance",
|
|
||||||
"Loading balance.",
|
|
||||||
"Loading balance..",
|
|
||||||
"Loading balance..."
|
|
||||||
],
|
|
||||||
style: Util.isDesktop
|
|
||||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textSubtitle1,
|
|
||||||
)
|
)
|
||||||
: STextStyles.itemSubtitle(context),
|
: STextStyles.itemSubtitle(context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue