Skip to content

Commit

Permalink
fix: free text when nft price is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanRns committed Apr 30, 2024
1 parent d0b6e26 commit 1cc665b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
35 changes: 16 additions & 19 deletions wallet/lib/pages/detailed_asset_view/owner_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import 'widgets/create_trade_bottom_sheet.dart';
import 'widgets/toggle_button.dart';
import 'package:pylons_wallet/utils/constants.dart' as constants;


class OwnerView extends StatefulWidget {
final NFT nft;

Expand Down Expand Up @@ -289,7 +288,9 @@ class _CollapsedBottomMenuState extends State<_CollapsedBottomMenu> {
final ibcEnumCoins = viewModel.nft.ibcCoins;

/// this change will reflect only for upylon ibcCoins
final isPylon = ibcEnumCoins.getAbbrev() == constants.kPYLN_ABBREVATION;
final updatedText =ibcEnumCoins.getAbbrev() == constants.kPYLN_ABBREVATION
? "\$${ibcEnumCoins.pylnToCredit(viewModel.nft.ibcCoins.getCoinWithProperDenomination(viewModel.nft.price))} ${viewModel.nft.ibcCoins.getAbbrev()}"
: "${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}";

return Padding(
padding: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.w, top: 8.w),
Expand Down Expand Up @@ -333,10 +334,9 @@ class _CollapsedBottomMenuState extends State<_CollapsedBottomMenu> {
children: [
if (viewModel.nft.type != NftType.TYPE_ITEM)
Text(
/// message change request will reflect only if [isPylon] is [true]
isPylon?
"\$${ibcEnumCoins.pylnToCredit(viewModel.nft.ibcCoins.getCoinWithProperDenomination(viewModel.nft.price))} ${viewModel.nft.ibcCoins.getAbbrev()}":
"${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}",
viewModel.nft.price == "0"
? LocaleKeys.free.tr()
: updatedText,
style: TextStyle(color: Colors.white, fontSize: 15.sp, fontWeight: FontWeight.bold),
)
],
Expand Down Expand Up @@ -401,7 +401,10 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
final viewModel = context.read<OwnerViewViewModel>();
final ibcEnumCoins = viewModel.nft.ibcCoins;

final isPylon = ibcEnumCoins.getAbbrev() == constants.kPYLN_ABBREVATION;
// this change will reflect only for upylon ibcCoins
final updatedText = ibcEnumCoins.getAbbrev() == constants.kPYLN_ABBREVATION
? "\$${ibcEnumCoins.pylnToCredit(viewModel.nft.ibcCoins.getCoinWithProperDenomination(viewModel.nft.price))} ${viewModel.nft.ibcCoins.getAbbrev()}"
: "${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}";

return Stack(
key: const ValueKey(kOwnerViewBottomSheetKeyValue),
Expand Down Expand Up @@ -469,9 +472,7 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
width: 10.w,
),
Text(
viewModel.viewsCount == 1
? "${viewModel.viewsCount} ${LocaleKeys.view.tr()}"
: "${viewModel.viewsCount} ${LocaleKeys.views.tr()}",
viewModel.viewsCount == 1 ? "${viewModel.viewsCount} ${LocaleKeys.view.tr()}" : "${viewModel.viewsCount} ${LocaleKeys.views.tr()}",
style: TextStyle(color: Colors.white, fontSize: 12.sp),
)
],
Expand Down Expand Up @@ -592,9 +593,7 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
recipeId: viewModel.nft.recipeID,
);
},
child: viewModel.isLiking
? getLikingLoader()
: getLikeIcon(likedByMe: viewModel.likedByMe),
child: viewModel.isLiking ? getLikingLoader() : getLikeIcon(likedByMe: viewModel.likedByMe),
),
),
SizedBox(
Expand Down Expand Up @@ -629,8 +628,7 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
if (viewModel.nft.assetType == AssetType.Image && Platform.isAndroid)
GestureDetector(
onTap: () {
final WallpaperScreen wallpaperScreen =
WallpaperScreen(nft: viewModel.nft.url, context: context);
final WallpaperScreen wallpaperScreen = WallpaperScreen(nft: viewModel.nft.url, context: context);
wallpaperScreen.show();
},
child: SvgPicture.asset(
Expand Down Expand Up @@ -666,10 +664,9 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
children: [
if (viewModel.nft.type != NftType.TYPE_ITEM) ...[
Text(
/// message change request will reflect only if [isPylon] is [true]
isPylon?
"\$${ibcEnumCoins.pylnToCredit(viewModel.nft.ibcCoins.getCoinWithProperDenomination(viewModel.nft.price))} ${viewModel.nft.ibcCoins.getAbbrev()}":
"${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}",
viewModel.nft.price == "0"
? LocaleKeys.free.tr()
: updatedText,
style: TextStyle(color: Colors.white, fontSize: 15.sp, fontWeight: FontWeight.bold),
)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ class CreationsCollection extends StatelessWidget {
final nft = viewModel.creations[index];

/// this change will reflect only for upylon ibcCoins
final isPylon = nft.ibcCoins.getAbbrev() == constants.kPYLN_ABBREVATION;
/// message change request will reflect only if [isPylon] is [true]
final updatedText = nft.ibcCoins.getAbbrev() == constants.kPYLN_ABBREVATION? "\$${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))} ${nft.ibcCoins.getAbbrev()}"
: "${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))} ${nft.ibcCoins.getAbbrev()}";


return ClipRRect(
child: GestureDetector(
onTap: () => onNFTSelected(nft),
child: Banner(
color: AppColors.kPriceTagColor,
location: BannerLocation.topStart,
/// message change request will reflect only if [isPylon] is [true]
message: isPylon
? "\$${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))} ${nft.ibcCoins.getAbbrev()}"
: "${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))} ${nft.ibcCoins.getAbbrev()}",
message: nft.price == "0" ? LocaleKeys.free.tr() : updatedText,
child: PreviewNFTGrid(
assetType: nft.assetType,
on3dNFT: (BuildContext context) => Container(
Expand Down
9 changes: 5 additions & 4 deletions wallet/lib/services/data_stores/remote_data_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,10 @@ class RemoteDataStoreImp implements RemoteDataStore {

@override
Future<String> createDynamicLinkForRecipeNftShare({required String address, required NFT nft}) async {
final isPylon = nft.ibcCoins.getAbbrev() == constants.kPYLN_ABBREVATION;
final updateText = nft.ibcCoins.getAbbrev() == constants.kPYLN_ABBREVATION?
"\$${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))}"
: "${nft.ibcCoins.getCoinWithProperDenomination(nft.price)} ${nft.ibcCoins.getAbbrev()}";

final dynamicLinkParams = DynamicLinkParameters(
link: Uri.parse("$bigDipperBaseLink?recipe_id=${nft.recipeID}&cookbook_id=${nft.cookbookID}&address=$address"),
uriPrefix: kDeepLink,
Expand All @@ -1219,9 +1222,7 @@ class RemoteDataStoreImp implements RemoteDataStore {
socialMetaTagParameters: SocialMetaTagParameters(
title: nft.name,
imageUrl: Uri.parse(nft.url),
description: '${nft.description} Price:${isPylon ?
"\$${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))}"
: "${nft.ibcCoins.getCoinWithProperDenomination(nft.price)} ${nft.ibcCoins.getAbbrev()}"}'
description: '${nft.description} Price:${nft.price == "0" ? LocaleKeys.free.tr() :updateText}'
,
)
);
Expand Down

0 comments on commit 1cc665b

Please sign in to comment.