fix: bad cache on balances

This commit is contained in:
poka 2022-05-24 18:31:41 +02:00
parent 14f784fdc9
commit 04ffabf052
3 changed files with 25 additions and 15 deletions

View File

@ -285,8 +285,7 @@ class WalletOptionsProvider with ChangeNotifier {
}
}
// Map<String, String> balanceCache = {};
String balanceCache = '';
Map<String, String> balanceCache = {};
Widget balance(BuildContext context, String address, double size) {
return Column(children: <Widget>[
@ -296,14 +295,25 @@ Widget balance(BuildContext context, String address, double size) {
builder: (BuildContext context, AsyncSnapshot<num?> _balance) {
if (_balance.connectionState != ConnectionState.done ||
_balance.hasError) {
return Text(balanceCache,
style: TextStyle(
fontSize: isTall ? size : size * 0.9,
));
if (balanceCache[address] != null) {
return Text(balanceCache[address]!,
style: TextStyle(
fontSize: isTall ? size : size * 0.9,
));
} else {
return SizedBox(
height: 15,
width: 15,
child: CircularProgressIndicator(
color: orangeC,
strokeWidth: 2,
),
);
}
}
balanceCache = "${_balance.data.toString()} $currencyName";
balanceCache[address] = "${_balance.data.toString()} $currencyName";
return Text(
balanceCache,
balanceCache[address]!,
style: TextStyle(
fontSize: isTall ? size : 18,
),

View File

@ -140,7 +140,7 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.0"
version: "8.3.2"
carousel_slider:
dependency: "direct main"
description:
@ -259,7 +259,7 @@ packages:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3"
version: "0.3.3+1"
crypto:
dependency: "direct main"
description:
@ -431,7 +431,7 @@ packages:
name: get
url: "https://pub.dartlang.org"
source: hosted
version: "4.6.3"
version: "4.6.5"
get_storage:
dependency: transitive
description:
@ -636,7 +636,7 @@ packages:
name: infinite_scroll_pagination
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
version: "3.2.0"
integration_test:
dependency: "direct dev"
description: flutter
@ -999,7 +999,7 @@ packages:
description:
path: printing
ref: HEAD
resolved-ref: "95bbc1f33b7cb45f7a4b98088b96bc541fefc495"
resolved-ref: "96fe6ef3c1ee702a86dd311b3feebdb1f7491cd6"
url: "https://github.com/DavBfr/dart_pdf.git"
source: git
version: "5.9.1"
@ -1016,7 +1016,7 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.2"
version: "6.0.3"
pub_semver:
dependency: transitive
description:

View File

@ -5,7 +5,7 @@ description: Pay with G1.
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.5+3
version: 0.0.6+2
environment:
sdk: '>=2.12.0 <3.0.0'