Skip to content

Commit

Permalink
feat: toString
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanRns committed May 15, 2024
1 parent 0519684 commit f20be2f
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 12 deletions.
3 changes: 2 additions & 1 deletion evently/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"free_shirt": "1 free t-shirt",
"free_gift": "Free Gift",
"free_drink": "1 free drink",
"publish" : "Publish"
"publish" : "Publish",
"recipe_created": "Recipe созданный"
}
3 changes: 2 additions & 1 deletion evently/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"free_shirt": "1 free t-shirt",
"free_gift": "Free Gift",
"free_drink": "1 free drink",
"publish" : "Publish"
"publish" : "Publish",
"recipe_created": "Recipe created"
}
3 changes: 2 additions & 1 deletion evently/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"free_shirt": "1 free t-shirt",
"free_gift": "Free Gift",
"free_drink": "1 free drink",
"publish" : "Publish"
"publish" : "Publish",
"recipe_created": "Recipe creada"
}
3 changes: 2 additions & 1 deletion evently/i18n/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"free_shirt": "1 free t-shirt",
"free_gift": "Free Gift",
"free_drink": "1 free drink",
"publish" : "Publish"
"publish" : "Publish",
"recipe_created": "Recipe созданный"
}
38 changes: 32 additions & 6 deletions evently/lib/evently_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class EventlyProvider extends ChangeNotifier {

String currentUserName = "";
bool stripeAccountExists = false;
late Event event;

String? _cookbookId;
String _recipeId = "";

Expand All @@ -215,8 +215,8 @@ class EventlyProvider extends ChangeNotifier {
return sdkResponse;
}

Future<bool> createRecipe({required Event event}) async {
final scaffoldMessengerState = navigatorKey.getState();
Future<bool> createRecipe() async {
// final scaffoldMessengerState = navigatorKey.getState();

_cookbookId = repository.getCookbookId();

Expand All @@ -235,16 +235,42 @@ class EventlyProvider extends ChangeNotifier {
}

_recipeId = repository.autoGenerateEventlyId();
event.createRecipe(

final event = Event(
eventName: eventName,
hostName: hostName,
thumbnail: thumbnail!.path,
startDate: startDate,
endDate: endDate,
startTime: startTime,
endTime: endTime,
location: location,
description: description,
isFreeDrop: isFreeDrop,
numberOfTickets: numberOfTickets,
price: price,
listOfPerks: perks.map((e) => e.toString()).toList());

final recipe = event.createRecipe(
cookbookId: _cookbookId!,
recipeId: _recipeId,
isFreeDrop: isFreeDrop,
symbol: selectedDenom.symbol,
hashtagsList: perks,
perksList: perks,
price: price,
);

return Future.value(true);
final response = await PylonsWallet.instance.txCreateRecipe(recipe, requestResponse: false);

if (!response.success) {
// scaffoldMessengerState?.show(message: "$kErrRecipe ${response.error}");
return false;
}
// scaffoldMessengerState?.show(message: LocaleKeys.recipe_created.tr());
// final nftFromRecipe = NFT.fromRecipe(recipe);
// GetIt.I.get<>().updatePublishedNFTList(nft: nftFromRecipe);
// deleteNft(nft.id);
return false;
}

/// send createCookBook tx message to the wallet app
Expand Down
1 change: 1 addition & 0 deletions evently/lib/generated/locale_keys.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ abstract class LocaleKeys {
static const start = 'start';
static const free_gift = 'free_gift';
static const free_drink = 'free_drink';
static const recipe_created = 'recipe_created';

}
2 changes: 1 addition & 1 deletion evently/lib/models/events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension CreateRecipe on Event {
required String recipeId,
required FreeDrop isFreeDrop,
required String symbol,
required List<PerksModel> hashtagsList,
required List<PerksModel> perksList,
required String price,
}) {
return Recipe(
Expand Down
5 changes: 5 additions & 0 deletions evently/lib/models/perks_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ class PerksModel {
name: perksModel.name,
description: description,
);

@override
String toString() {
return 'PerksModel{name: $name, description: $description}';
}
}
2 changes: 1 addition & 1 deletion evently/lib/screens/host_view_ticket_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class _HostTicketPreviewState extends State<HostTicketPreview> {
return;
}

final bool isRecipeCreated = await viewModel.createRecipe(event: viewModel.event);
final bool isRecipeCreated = await viewModel.createRecipe();
pylonsLoadingAnimation.hide();
if (!isRecipeCreated) {
return;
Expand Down
3 changes: 3 additions & 0 deletions evently/lib/utils/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ const kPerks = "kPerks";
const kNumberOfTickets = "kNumberOfTickets";
const kPrice = "kPrice";

const kErrRecipe = 'Recipe error :';


/// ```SVG assets
class SVGUtils {
static const kSvgSplash = 'assets/images/svg/splash.svg';
Expand Down

0 comments on commit f20be2f

Please sign in to comment.