diff --git a/wallet/lib/model/event.dart b/wallet/lib/model/event.dart index a0de629b8c..ad9d0414c6 100644 --- a/wallet/lib/model/event.dart +++ b/wallet/lib/model/event.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:equatable/equatable.dart'; import 'package:get_it/get_it.dart'; +import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_coins.dart'; import 'package:pylons_wallet/stores/wallet_store.dart'; import '../modules/Pylonstech.pylons.pylons/module/client/cosmos/base/v1beta1/coin.pb.dart'; import '../modules/Pylonstech.pylons.pylons/module/client/pylons/recipe.pb.dart'; @@ -25,7 +26,7 @@ class Events extends Equatable { final String isFreeDrops; final String cookbookID; final String step; - final String denom; + final IBCCoins denom; String ownerAddress = ""; String owner = ""; @@ -52,7 +53,7 @@ class Events extends Equatable { this.numberOfTickets = '0', this.price = '', this.isFreeDrops = 'unselected', - this.denom = '', + this.denom = IBCCoins.upylon, ///* other this.cookbookID = '', @@ -104,7 +105,7 @@ class Events extends Equatable { listOfPerks: listOfPerks, cookbookID: map[kCookBookId]!, recipeID: map[kRecipeId]!, - denom: denom!, + denom: denom!.toIBCCoinsEnum(), ); } diff --git a/wallet/lib/pages/events/event_purchase_view.dart b/wallet/lib/pages/events/event_purchase_view.dart index 3787aa8c75..6e8c2b4b98 100644 --- a/wallet/lib/pages/events/event_purchase_view.dart +++ b/wallet/lib/pages/events/event_purchase_view.dart @@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:pylons_wallet/components/space_widgets.dart'; import 'package:pylons_wallet/model/event.dart'; +import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_coins.dart'; import 'package:pylons_wallet/utils/constants.dart'; class EventPurchaseView extends StatefulWidget { @@ -44,12 +45,6 @@ class EventPassViewContent extends StatelessWidget { @override Widget build(BuildContext context) { - final scanWindow = Rect.fromCenter( - center: MediaQuery.sizeOf(context).center(Offset.zero), - width: 100, - height: 100, - ); - return ColoredBox( color: AppColors.kBlack87, child: SafeArea( @@ -166,7 +161,7 @@ class EventPassViewContent extends StatelessWidget { style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite), ), Text( - events.price == "0" ? "Free" : events.price, + events.price == "0" ? "Free" : '${events.price} ${events.denom.getName()}', style: Theme.of(context).textTheme.labelSmall?.copyWith(fontSize: 15.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite), ), ], diff --git a/wallet/lib/pages/events/events_owner_view.dart b/wallet/lib/pages/events/events_owner_view.dart index d8a0f89887..62c275b0b0 100644 --- a/wallet/lib/pages/events/events_owner_view.dart +++ b/wallet/lib/pages/events/events_owner_view.dart @@ -7,6 +7,7 @@ import 'package:provider/provider.dart'; import 'package:pylons_wallet/components/space_widgets.dart'; import 'package:pylons_wallet/model/event.dart'; import 'package:pylons_wallet/pages/detailed_asset_view/owner_view_view_model.dart'; +import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_coins.dart'; import 'package:pylons_wallet/utils/constants.dart'; class EventOwnerView extends StatefulWidget { @@ -149,7 +150,7 @@ class EventPassViewContent extends StatelessWidget { style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite), ), Text( - viewModel.events.price == "0" ? "Free" : viewModel.events.price, + viewModel.events.price == "0" ? "Free" : '${viewModel.events.price} ${viewModel.events.denom.getName()}', style: Theme.of(context).textTheme.labelSmall?.copyWith(fontSize: 15.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite), ), ], diff --git a/wallet/lib/services/data_stores/remote_data_store.dart b/wallet/lib/services/data_stores/remote_data_store.dart index 27b375f826..f66686523a 100644 --- a/wallet/lib/services/data_stores/remote_data_store.dart +++ b/wallet/lib/services/data_stores/remote_data_store.dart @@ -1460,7 +1460,10 @@ class RemoteDataStoreImp implements RemoteDataStore { @override Future createDynamicLinkForRecipeEventShare({required String address, required Events events}) async { - final updateText = '${events.eventName} is hosted by ${events.hostName} at location ${events.location} ticket price is ${events.price}'; + final updateText = events.denom.getAbbrev() == constants.kPYLN_ABBREVATION + ? "\$${events.denom.pylnToCredit(events.denom.getCoinWithProperDenomination(events.price))}" + : "${events.denom.getCoinWithProperDenomination(events.price)} ${events.denom.getAbbrev()}"; + final dynamicLinkParams = DynamicLinkParameters( link: Uri.parse("$bigDipperBaseLink?recipe_id=${events.recipeID}&cookbook_id=${events.cookbookID}&address=$address"), uriPrefix: kDeepLink, @@ -1539,34 +1542,3 @@ class GoogleInAppPurchaseModel { return base64Url.encode(utf8.encode(jsonEncode(receiptData))); } } - -class EventlyDenom { - final String name; - final String symbol; - final String icon; - - EventlyDenom({required this.name, required this.symbol, required this.icon}); - - factory EventlyDenom.initial() { - return EventlyDenom(icon: '', name: '', symbol: ''); - } - - @override - String toString() { - return '{name: $name, symbol: $symbol, icon: $icon}'; - } - - Map toJson() { - final Map map = {}; - map['name'] = name; - map['symbol'] = symbol; - map['icon'] = icon; - return map; - } - - factory EventlyDenom.fromJson(Map json) => EventlyDenom( - name: json['name']!, - symbol: json['symbol']!, - icon: json['icon']!, - ); -}