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,6 +165,7 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
snapshot.hasData) { snapshot.hasData) {
if (snapshot.data != null) { if (snapshot.data != null) {
_cachedBalance = snapshot.data!; _cachedBalance = snapshot.data!;
if (externalCalls) {
_cachedFiatValue = _cachedBalance * _cachedFiatValue = _cachedBalance *
ref ref
.watch( .watch(
@ -169,6 +176,7 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
.item1; .item1;
} }
} }
}
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -185,13 +193,17 @@ 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,
), ),
), ),
), ),
if (externalCalls)
const SizedBox( const SizedBox(
height: 4, height: 4,
), ),
if (externalCalls)
Text( Text(
"${Format.localizedStringAsFixed( "${Format.localizedStringAsFixed(
decimalPlaces: 2, decimalPlaces: 2,
@ -206,7 +218,9 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
)}", )}",
style: STextStyles.itemSubtitle12(context).copyWith( style: STextStyles.itemSubtitle12(context).copyWith(
fontSize: 10, fontSize: 10,
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard, color: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
), ),
), ),
], ],