hide price values on favorite card when incognito mode enabled

This commit is contained in:
julian 2022-10-17 15:56:03 -06:00
parent 23c2b2f50f
commit cfc8f2ab9d

View file

@ -49,6 +49,8 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final coin = ref.watch(managerProvider.select((value) => value.coin)); final coin = ref.watch(managerProvider.select((value) => value.coin));
final externalCalls = ref.watch(
prefsChangeNotifierProvider.select((value) => value.externalCalls));
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
@ -70,7 +72,9 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
width: widget.width, width: widget.width,
height: widget.height, height: widget.height,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).extension<StackColors>()!.colorForCoin(coin), color: Theme.of(context)
.extension<StackColors>()!
.colorForCoin(coin),
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius, Constants.size.circularBorderRadius,
), ),
@ -138,7 +142,9 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
ref.watch(managerProvider ref.watch(managerProvider
.select((value) => value.walletName)), .select((value) => value.walletName)),
style: STextStyles.itemSubtitle12(context).copyWith( style: STextStyles.itemSubtitle12(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard, color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
), ),
overflow: TextOverflow.fade, overflow: TextOverflow.fade,
), ),
@ -159,14 +165,16 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
snapshot.hasData) { snapshot.hasData) {
if (snapshot.data != null) { if (snapshot.data != null) {
_cachedBalance = snapshot.data!; _cachedBalance = snapshot.data!;
_cachedFiatValue = _cachedBalance * if (externalCalls) {
ref _cachedFiatValue = _cachedBalance *
.watch( ref
priceAnd24hChangeNotifierProvider.select( .watch(
(value) => value.getPrice(coin), priceAnd24hChangeNotifierProvider.select(
), (value) => value.getPrice(coin),
) ),
.item1; )
.item1;
}
} }
} }
return Column( return Column(
@ -185,30 +193,36 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
)} ${coin.ticker}", )} ${coin.ticker}",
style: STextStyles.titleBold12(context).copyWith( style: STextStyles.titleBold12(context).copyWith(
fontSize: 16, fontSize: 16,
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard, color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
), ),
), ),
), ),
const SizedBox( if (externalCalls)
height: 4, const SizedBox(
), height: 4,
Text( ),
"${Format.localizedStringAsFixed( if (externalCalls)
decimalPlaces: 2, Text(
value: _cachedFiatValue, "${Format.localizedStringAsFixed(
locale: ref.watch( decimalPlaces: 2,
localeServiceChangeNotifierProvider value: _cachedFiatValue,
.select((value) => value.locale), locale: ref.watch(
), localeServiceChangeNotifierProvider
)} ${ref.watch( .select((value) => value.locale),
prefsChangeNotifierProvider ),
.select((value) => value.currency), )} ${ref.watch(
)}", prefsChangeNotifierProvider
style: STextStyles.itemSubtitle12(context).copyWith( .select((value) => value.currency),
fontSize: 10, )}",
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard, style: STextStyles.itemSubtitle12(context).copyWith(
fontSize: 10,
color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
), ),
),
], ],
); );
}, },