From 332dfda8db4774375e1579aa1523e24c3f85a846 Mon Sep 17 00:00:00 2001 From: d-reader-luka Date: Thu, 24 Oct 2024 11:48:06 +0200 Subject: [PATCH] render proper price icon check for image format publish --- lib/constants/constants.dart | 1 + .../widgets/buttons/mint_button.dart | 23 +++++++++++++------ .../widgets/buttons/transaction_button.dart | 4 ++-- .../tabs/about/group_with_currency.dart | 18 +++++++++++---- .../tabs/about/mint_info_container.dart | 4 ++-- .../widgets/tabs/cards/comic_issue_card.dart | 4 ++-- .../tabs/cards/comic_issue_card_large.dart | 4 ++-- .../tabs/listings/listed_item_row.dart | 4 ++-- .../widgets/cards/collectible_card.dart | 4 ++-- .../cards/discover_comic_issue_card.dart | 4 ++-- .../widgets/unsorted/mint_price_widget.dart | 19 +++++++++++---- .../{solana_price.dart => price_widget.dart} | 4 ++-- publishing/.asset-manifest.json | 4 ++-- publishing/config.yaml | 12 +++++----- pubspec.yaml | 2 +- 15 files changed, 69 insertions(+), 42 deletions(-) rename lib/shared/widgets/unsorted/{solana_price.dart => price_widget.dart} (94%) diff --git a/lib/constants/constants.dart b/lib/constants/constants.dart index ac64190c..3d639556 100644 --- a/lib/constants/constants.dart +++ b/lib/constants/constants.dart @@ -31,3 +31,4 @@ const String failedToSignTransactionsMessage = 'Failed to sign transactions'; const String dAuthCouponName = 'dAuth'; const String solAddress = 'So11111111111111111111111111111111111111112'; +const String svgExtension = '.svg'; diff --git a/lib/features/comic_issue/presentation/widgets/buttons/mint_button.dart b/lib/features/comic_issue/presentation/widgets/buttons/mint_button.dart index a8ad1f80..3002b926 100644 --- a/lib/features/comic_issue/presentation/widgets/buttons/mint_button.dart +++ b/lib/features/comic_issue/presentation/widgets/buttons/mint_button.dart @@ -13,6 +13,7 @@ import 'package:d_reader_flutter/shared/utils/screen_navigation.dart'; import 'package:d_reader_flutter/shared/utils/show_snackbar.dart'; import 'package:d_reader_flutter/shared/widgets/buttons/custom_text_button.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; @@ -115,6 +116,7 @@ class _MintButton extends ConsumerWidget { activeSplToken, ), ); + final selectedSplToken = ref.watch(activeSplToken); return CustomTextButton( size: const Size(150, 50), isLoading: isLoading, @@ -144,13 +146,20 @@ class _MintButton extends ConsumerWidget { const SizedBox( width: 4, ), - CachedNetworkImage( - imageUrl: ref.read(activeSplToken)?.icon ?? - ref.read(activeSplToken)?.symbol ?? - '', - width: 16, - height: 16, - ), + selectedSplToken != null && + selectedSplToken.icon.endsWith(svgExtension) + ? SvgPicture.network( + selectedSplToken.icon, + width: 12, + height: 12, + ) + : CachedNetworkImage( + imageUrl: ref.read(activeSplToken)?.icon ?? + ref.read(activeSplToken)?.symbol ?? + '', + width: 16, + height: 16, + ), const SizedBox( width: 4, ), diff --git a/lib/features/comic_issue/presentation/widgets/buttons/transaction_button.dart b/lib/features/comic_issue/presentation/widgets/buttons/transaction_button.dart index 7748ab8b..fa06bad5 100644 --- a/lib/features/comic_issue/presentation/widgets/buttons/transaction_button.dart +++ b/lib/features/comic_issue/presentation/widgets/buttons/transaction_button.dart @@ -3,7 +3,7 @@ import 'package:d_reader_flutter/features/candy_machine/presentations/providers/ import 'package:d_reader_flutter/shared/utils/formatter.dart'; import 'package:d_reader_flutter/shared/widgets/buttons/custom_text_button.dart'; import 'package:d_reader_flutter/shared/widgets/unsorted/mint_price_widget.dart'; -import 'package:d_reader_flutter/shared/widgets/unsorted/solana_price.dart'; +import 'package:d_reader_flutter/shared/widgets/unsorted/price_widget.dart'; import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; @@ -59,7 +59,7 @@ class TransactionButton extends ConsumerWidget { ? const MintPriceWidget( priceColor: Colors.black, ) - : SolanaPrice( + : PriceWidget( price: price != null && price! > 0 ? Formatter.formatPriceByCurrency( mintPrice: price!, diff --git a/lib/features/comic_issue/presentation/widgets/tabs/about/group_with_currency.dart b/lib/features/comic_issue/presentation/widgets/tabs/about/group_with_currency.dart index 1351af94..430a915d 100644 --- a/lib/features/comic_issue/presentation/widgets/tabs/about/group_with_currency.dart +++ b/lib/features/comic_issue/presentation/widgets/tabs/about/group_with_currency.dart @@ -1,4 +1,5 @@ import 'package:cached_network_image/cached_network_image.dart'; +import 'package:d_reader_flutter/constants/constants.dart'; import 'package:d_reader_flutter/features/candy_machine/domain/models/candy_machine_coupon.dart'; import 'package:d_reader_flutter/features/candy_machine/presentations/notifiers/candy_machine_notifier.dart'; import 'package:d_reader_flutter/features/candy_machine/presentations/providers/candy_machine_providers.dart'; @@ -6,6 +7,7 @@ import 'package:d_reader_flutter/features/settings/domain/models/spl_token.dart' import 'package:d_reader_flutter/shared/theme/app_colors.dart'; import 'package:d_reader_flutter/shared/utils/formatter.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; class CouponWithCurrencyRow extends ConsumerWidget { @@ -54,11 +56,17 @@ class CouponWithCurrencyRow extends ConsumerWidget { children: [ Row( children: [ - CachedNetworkImage( - imageUrl: splToken.icon, - width: 16, - height: 16, - ), + splToken.icon.endsWith(svgExtension) + ? SvgPicture.network( + splToken.icon, + height: 14, + width: 14, + ) + : CachedNetworkImage( + imageUrl: splToken.icon, + width: 16, + height: 16, + ), const SizedBox( width: 8, ), diff --git a/lib/features/comic_issue/presentation/widgets/tabs/about/mint_info_container.dart b/lib/features/comic_issue/presentation/widgets/tabs/about/mint_info_container.dart index dd2576f0..538c500a 100644 --- a/lib/features/comic_issue/presentation/widgets/tabs/about/mint_info_container.dart +++ b/lib/features/comic_issue/presentation/widgets/tabs/about/mint_info_container.dart @@ -7,7 +7,7 @@ import 'package:d_reader_flutter/features/settings/presentation/providers/spl_to import 'package:d_reader_flutter/shared/theme/app_colors.dart'; import 'package:d_reader_flutter/shared/utils/formatter.dart'; import 'package:d_reader_flutter/shared/widgets/unsorted/mint_price_widget.dart'; -import 'package:d_reader_flutter/shared/widgets/unsorted/solana_price.dart'; +import 'package:d_reader_flutter/shared/widgets/unsorted/price_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -144,7 +144,7 @@ class _MintInfoContainerState extends ConsumerState padding: const EdgeInsets.only(top: 16), child: _HeadingRow( candyMachineCoupon: selectedCandyMachineCoupon, - suffix: SolanaPrice( + suffix: PriceWidget( price: mintPrice > 0 ? Formatter.formatPriceByCurrency( mintPrice: mintPrice, diff --git a/lib/features/comic_issue/presentation/widgets/tabs/cards/comic_issue_card.dart b/lib/features/comic_issue/presentation/widgets/tabs/cards/comic_issue_card.dart index 6c1e32f1..5d176054 100644 --- a/lib/features/comic_issue/presentation/widgets/tabs/cards/comic_issue_card.dart +++ b/lib/features/comic_issue/presentation/widgets/tabs/cards/comic_issue_card.dart @@ -6,7 +6,7 @@ import 'package:d_reader_flutter/shared/utils/formatter.dart'; import 'package:d_reader_flutter/shared/utils/screen_navigation.dart'; import 'package:d_reader_flutter/shared/widgets/image_widgets/cached_image_bg_placeholder.dart'; import 'package:d_reader_flutter/shared/widgets/icons/hot_icon.dart'; -import 'package:d_reader_flutter/shared/widgets/unsorted/solana_price.dart'; +import 'package:d_reader_flutter/shared/widgets/unsorted/price_widget.dart'; import 'package:flutter/material.dart'; class ComicIssueCard extends StatelessWidget { @@ -118,7 +118,7 @@ class _IssueInfoContainer extends StatelessWidget { 'EP ${issue.number}/${issue.stats?.totalIssuesCount}', style: textTheme.bodySmall, ), - SolanaPrice( + PriceWidget( price: Formatter.formatLamportPrice(issue.stats?.price), mainAxisAlignment: MainAxisAlignment.end, ), diff --git a/lib/features/comic_issue/presentation/widgets/tabs/cards/comic_issue_card_large.dart b/lib/features/comic_issue/presentation/widgets/tabs/cards/comic_issue_card_large.dart index 238d3a69..9eac8973 100644 --- a/lib/features/comic_issue/presentation/widgets/tabs/cards/comic_issue_card_large.dart +++ b/lib/features/comic_issue/presentation/widgets/tabs/cards/comic_issue_card_large.dart @@ -9,7 +9,7 @@ import 'package:d_reader_flutter/shared/widgets/unsorted/date_widget.dart'; import 'package:d_reader_flutter/shared/widgets/icons/favorite_icon_count.dart'; import 'package:d_reader_flutter/shared/widgets/icons/rating_icon.dart'; import 'package:d_reader_flutter/shared/widgets/icons/viewed_icon_count.dart'; -import 'package:d_reader_flutter/shared/widgets/unsorted/solana_price.dart'; +import 'package:d_reader_flutter/shared/widgets/unsorted/price_widget.dart'; import 'package:flutter/material.dart'; class ComicIssueCardLarge extends StatelessWidget { @@ -129,7 +129,7 @@ class ComicIssueCardLarge extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - SolanaPrice( + PriceWidget( price: issue.stats?.price != null ? Formatter.formatPriceWithSignificant( issue.stats!.price!, diff --git a/lib/features/comic_issue/presentation/widgets/tabs/listings/listed_item_row.dart b/lib/features/comic_issue/presentation/widgets/tabs/listings/listed_item_row.dart index e5dec4c7..1c259dcc 100644 --- a/lib/features/comic_issue/presentation/widgets/tabs/listings/listed_item_row.dart +++ b/lib/features/comic_issue/presentation/widgets/tabs/listings/listed_item_row.dart @@ -8,7 +8,7 @@ import 'package:d_reader_flutter/shared/utils/formatter.dart'; import 'package:d_reader_flutter/features/digital_asset/presentation/utils/utils.dart'; import 'package:d_reader_flutter/shared/widgets/image_widgets/cached_image_bg_placeholder.dart'; import 'package:d_reader_flutter/shared/widgets/unsorted/rarity.dart'; -import 'package:d_reader_flutter/shared/widgets/unsorted/solana_price.dart'; +import 'package:d_reader_flutter/shared/widgets/unsorted/price_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; @@ -123,7 +123,7 @@ class ListingItem extends ConsumerWidget { Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - SolanaPrice( + PriceWidget( price: listing.price / lamportsPerSol, priceDecimals: 4, ), diff --git a/lib/features/creator/presentation/widgets/cards/collectible_card.dart b/lib/features/creator/presentation/widgets/cards/collectible_card.dart index 353e0f5c..f65ae884 100644 --- a/lib/features/creator/presentation/widgets/cards/collectible_card.dart +++ b/lib/features/creator/presentation/widgets/cards/collectible_card.dart @@ -1,7 +1,7 @@ import 'package:d_reader_flutter/shared/theme/app_colors.dart'; import 'package:d_reader_flutter/shared/widgets/buttons/custom_text_button.dart'; import 'package:d_reader_flutter/shared/widgets/image_widgets/cached_image_bg_placeholder.dart'; -import 'package:d_reader_flutter/shared/widgets/unsorted/solana_price.dart'; +import 'package:d_reader_flutter/shared/widgets/unsorted/price_widget.dart'; import 'package:flutter/material.dart'; const String imageUrl = @@ -95,7 +95,7 @@ class CollectibleCard extends StatelessWidget { style: textTheme.labelMedium ?.copyWith(fontSize: 11), ), - const SolanaPrice( + const PriceWidget( price: 0.965, ), ], diff --git a/lib/features/discover/root/presentation/widgets/cards/discover_comic_issue_card.dart b/lib/features/discover/root/presentation/widgets/cards/discover_comic_issue_card.dart index 91604367..5a2f2759 100644 --- a/lib/features/discover/root/presentation/widgets/cards/discover_comic_issue_card.dart +++ b/lib/features/discover/root/presentation/widgets/cards/discover_comic_issue_card.dart @@ -9,7 +9,7 @@ import 'package:d_reader_flutter/shared/widgets/unsorted/date_widget.dart'; import 'package:d_reader_flutter/shared/widgets/unsorted/mature_audience.dart'; import 'package:d_reader_flutter/shared/widgets/icons/favorite_icon_count.dart'; import 'package:d_reader_flutter/shared/widgets/icons/rating_icon.dart'; -import 'package:d_reader_flutter/shared/widgets/unsorted/solana_price.dart'; +import 'package:d_reader_flutter/shared/widgets/unsorted/price_widget.dart'; import 'package:d_reader_flutter/features/discover/genre/presentation/widgets/genre_tags_default.dart'; import 'package:flutter/material.dart'; @@ -110,7 +110,7 @@ class DiscoverComicIssueCard extends StatelessWidget { ), Expanded( flex: 1, - child: SolanaPrice( + child: PriceWidget( mainAxisAlignment: MainAxisAlignment.end, price: Formatter.formatLamportPrice(issue.stats?.price), diff --git a/lib/shared/widgets/unsorted/mint_price_widget.dart b/lib/shared/widgets/unsorted/mint_price_widget.dart index c4a8ac8b..715bf8ae 100644 --- a/lib/shared/widgets/unsorted/mint_price_widget.dart +++ b/lib/shared/widgets/unsorted/mint_price_widget.dart @@ -1,8 +1,10 @@ import 'package:cached_network_image/cached_network_image.dart'; +import 'package:d_reader_flutter/constants/constants.dart'; import 'package:d_reader_flutter/features/candy_machine/presentations/notifiers/candy_machine_notifier.dart'; import 'package:d_reader_flutter/features/candy_machine/presentations/providers/candy_machine_providers.dart'; import 'package:d_reader_flutter/shared/utils/formatter.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; class MintPriceWidget extends ConsumerWidget { @@ -14,13 +16,20 @@ class MintPriceWidget extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + final selectedSplToken = ref.watch(activeSplToken); return Row( children: [ - CachedNetworkImage( - imageUrl: ref.watch(activeSplToken)?.icon ?? '', - height: 18, - width: 18, - ), + selectedSplToken != null && selectedSplToken.icon.endsWith(svgExtension) + ? SvgPicture.network( + selectedSplToken.icon, + height: 14, + width: 14, + ) + : CachedNetworkImage( + imageUrl: ref.watch(activeSplToken)?.icon ?? '', + height: 18, + width: 18, + ), const SizedBox( width: 4, ), diff --git a/lib/shared/widgets/unsorted/solana_price.dart b/lib/shared/widgets/unsorted/price_widget.dart similarity index 94% rename from lib/shared/widgets/unsorted/solana_price.dart rename to lib/shared/widgets/unsorted/price_widget.dart index bd8ff1fb..cdc330fd 100644 --- a/lib/shared/widgets/unsorted/solana_price.dart +++ b/lib/shared/widgets/unsorted/price_widget.dart @@ -2,13 +2,13 @@ import 'package:d_reader_flutter/config/config.dart'; import 'package:d_reader_flutter/shared/utils/formatter.dart'; import 'package:flutter/material.dart'; -class SolanaPrice extends StatelessWidget { +class PriceWidget extends StatelessWidget { final dynamic price; final MainAxisAlignment mainAxisAlignment; final TextDirection? textDirection; final Color? textColor; final int priceDecimals; - const SolanaPrice({ + const PriceWidget({ super.key, this.price, this.mainAxisAlignment = MainAxisAlignment.start, diff --git a/publishing/.asset-manifest.json b/publishing/.asset-manifest.json index e9d5ea70..52ad48e2 100644 --- a/publishing/.asset-manifest.json +++ b/publishing/.asset-manifest.json @@ -12,8 +12,8 @@ }, "./dReader.apk": { "path": "./dReader.apk", - "sha256": "GkcAkSlWBHx3nu03nmiH+fkXKExggAxXL0UHKny0PRM=", - "uri": "https://s3.us-east-1.amazonaws.com/d-reader-main-mainnet/lcU1kLPzAajQ3Tdt8CAe" + "sha256": "7bLOX0TDap1EkdjctrMmDnEz7ehgGc1615bTmBH19+0=", + "uri": "https://s3.us-east-1.amazonaws.com/d-reader-main-mainnet/jYdtFyEBrJtfgWjGjISY" }, "./screenshots/1.png": { "path": "./screenshots/1.png", diff --git a/publishing/config.yaml b/publishing/config.yaml index 0ccb3837..0c1ad9dc 100644 --- a/publishing/config.yaml +++ b/publishing/config.yaml @@ -19,7 +19,7 @@ app: - purpose: icon uri: ./512x512_rounded.png release: - address: GFRybHsTyn4wsQXiLSz5Fe7CTjncZ6sqfCypg6AXSmQX + address: AdSaX7WDM9DdA29BFzcRiFDGy2ywudSoHWLD7Pb5mFyd media: - purpose: icon uri: ./512x512_rounded.png @@ -41,14 +41,14 @@ release: name: dReader short_description: Digital comic book store long_description: Platform for discovering, trading, collecting, and reading digital graphic novels - new_in_version: New mint flow + new_in_version: Improve mint ui saga_features: Exclusive early access, free/discounted collectible comics solana_mobile_dapp_publisher_portal: google_store_package: io.app.dreader testing_instructions: Run the app lastSubmittedVersionOnChain: - address: GFRybHsTyn4wsQXiLSz5Fe7CTjncZ6sqfCypg6AXSmQX - version_code: 2052 - apk_hash: GkcAkSlWBHx3nu03nmiH+fkXKExggAxXL0UHKny0PRM= + address: AdSaX7WDM9DdA29BFzcRiFDGy2ywudSoHWLD7Pb5mFyd + version_code: 2053 + apk_hash: 7bLOX0TDap1EkdjctrMmDnEz7ehgGc1615bTmBH19+0= lastUpdatedVersionOnStore: - address: GFRybHsTyn4wsQXiLSz5Fe7CTjncZ6sqfCypg6AXSmQX + address: AdSaX7WDM9DdA29BFzcRiFDGy2ywudSoHWLD7Pb5mFyd diff --git a/pubspec.yaml b/pubspec.yaml index 9338977c..da8ffe42 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: dReader Flutter app. publish_to: 'none' -version: 1.4.4+84 # # dappStore: 1.4.2+52 (next release: 1.4.3+53) google play: 1.4.4+84 (next release: 1.4.5+85) +version: 1.4.5+85 # # dappStore: 1.4.3+53 (next release: 1.4.4+54) google play: 1.4.5+85 (next release: 1.4.6+86) environment: sdk: '>=3.0.0 <4.0.0'