diff --git a/evently/lib/evently_provider.dart b/evently/lib/evently_provider.dart index 0e13b3f409..2cf50625e3 100644 --- a/evently/lib/evently_provider.dart +++ b/evently/lib/evently_provider.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:convert'; + import 'package:dartz/dartz.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:evently/generated/locale_keys.g.dart'; @@ -21,6 +22,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:injectable/injectable.dart'; import 'package:pylons_sdk/low_level.dart'; + import 'services/third_party_services/quick_node.dart'; @LazySingleton() @@ -66,7 +68,8 @@ class EventlyProvider extends ChangeNotifier { } checkIsOverEnable() { - setOverviewEnable = thumbnail!.isNotEmpty && eventName.length > 8 && hostName.isNotEmpty; + setOverviewEnable = + thumbnail!.isNotEmpty && eventName.length > 4 && hostName.isNotEmpty; } ///* detail screen @@ -190,9 +193,11 @@ class EventlyProvider extends ChangeNotifier { notifyListeners(); } - final StreamController _uploadProgressController = StreamController.broadcast(); + final StreamController _uploadProgressController = + StreamController.broadcast(); - Stream get uploadProgressStream => _uploadProgressController.stream; + Stream get uploadProgressStream => + _uploadProgressController.stream; void pickThumbnail() async { final pickedFile = await repository.pickFile(); @@ -207,11 +212,15 @@ class EventlyProvider extends ChangeNotifier { if (result.path.isEmpty) return; - final loading = LoadingProgress()..showLoadingWithProgress(message: LocaleKeys.uploading.tr()); + final loading = LoadingProgress() + ..showLoadingWithProgress(message: LocaleKeys.uploading.tr()); Either response; response = await repository.uploadFileUsingQuickNode( - uploadIPFSInput: UploadIPFSInput(fileName: result.fileName, filePath: result.path, contentType: QuickNode.getContentType(result.extension)), + uploadIPFSInput: UploadIPFSInput( + fileName: result.fileName, + filePath: result.path, + contentType: QuickNode.getContentType(result.extension)), onUploadProgressCallback: (value) { _uploadProgressController.sink.add(value); }, @@ -223,7 +232,8 @@ class EventlyProvider extends ChangeNotifier { return; } - final fileUploadResponse = response.getOrElse(() => StorageResponseModel.initial()); + final fileUploadResponse = + response.getOrElse(() => StorageResponseModel.initial()); loading.dismiss(); setThumbnail = "$ipfsDomain/${fileUploadResponse.value?.cid}"; @@ -234,7 +244,10 @@ class EventlyProvider extends ChangeNotifier { String? _cookbookId; String? get cookbookId => _cookbookId; - bool showStripeDialog() => !stripeAccountExists && _selectedDenom.symbol == kUsdSymbol && isFreeDrop == FreeDrop.no; + bool showStripeDialog() => + !stripeAccountExists && + _selectedDenom.symbol == kUsdSymbol && + isFreeDrop == FreeDrop.no; ///* this method is used to get the profile Future> getProfile() async { @@ -243,7 +256,10 @@ class EventlyProvider extends ChangeNotifier { if (sdkResponse.success) { stripeAccountExists = sdkResponse.data!.stripeExists; - supportedDenomList = Denom.availableDenoms.where((Denom e) => sdkResponse.data!.supportedCoins.contains(e.symbol)).toList(); + supportedDenomList = Denom.availableDenoms + .where( + (Denom e) => sdkResponse.data!.supportedCoins.contains(e.symbol)) + .toList(); if (supportedDenomList.isNotEmpty && selectedDenom.symbol.isEmpty) { _selectedDenom = supportedDenomList.first; @@ -292,7 +308,9 @@ class EventlyProvider extends ChangeNotifier { step: '', ); - final String prices = isFreeDrop == FreeDrop.yes ? "0" : _selectedDenom.formatAmount(price: price.toString()); + final String prices = isFreeDrop == FreeDrop.yes + ? "0" + : _selectedDenom.formatAmount(price: price.toString()); final recipe = event.createRecipe( cookbookId: _cookbookId!, @@ -302,7 +320,8 @@ class EventlyProvider extends ChangeNotifier { price: prices, ); - final response = await PylonsWallet.instance.txCreateRecipe(recipe, requestResponse: false); + final response = await PylonsWallet.instance + .txCreateRecipe(recipe, requestResponse: false); if (!response.success) { scaffoldMessengerState?.show(message: "$kErrRecipe ${response.error}"); diff --git a/evently/lib/main.dart b/evently/lib/main.dart index 2d9ea8ad0b..76cde65d6c 100644 --- a/evently/lib/main.dart +++ b/evently/lib/main.dart @@ -1,4 +1,5 @@ import 'dart:ui'; + import 'package:easy_localization/easy_localization.dart'; import 'package:evently/evently_provider.dart'; import 'package:evently/screens/buyer_status_screen.dart'; @@ -65,7 +66,8 @@ class MyApp extends StatelessWidget { builder: (context, widget) { ScreenUtil.init(context); return MediaQuery( - data: MediaQuery.of(context).copyWith(textScaler: TextScaler.noScaling), + data: MediaQuery.of(context) + .copyWith(textScaler: TextScaler.noScaling), child: widget!, ); }, @@ -89,6 +91,7 @@ class MyApp extends StatelessWidget { } bool _getIsCurrentDeviceTablet() { - final MediaQueryData mediaQuery = MediaQueryData.fromView(PlatformDispatcher.instance.implicitView!); + final MediaQueryData mediaQuery = + MediaQueryData.fromView(PlatformDispatcher.instance.implicitView!); return mediaQuery.size.shortestSide >= tabletMinWidth; } diff --git a/evently/lib/models/events.dart b/evently/lib/models/events.dart index b9d32b2f1c..5a17f9fe74 100644 --- a/evently/lib/models/events.dart +++ b/evently/lib/models/events.dart @@ -1,8 +1,8 @@ import 'package:equatable/equatable.dart'; import 'package:evently/utils/enums.dart'; +import 'package:fixnum/fixnum.dart'; import 'package:floor/floor.dart'; import 'package:pylons_sdk/low_level.dart'; -import 'package:fixnum/fixnum.dart'; @entity class Events extends Equatable { @@ -60,7 +60,8 @@ class Events extends Equatable { }); factory Events.fromRecipe(Recipe recipe) { - Map map = _extractAttributeValues(recipe.entries.itemOutputs[0].strings); + Map map = + _extractAttributeValues(recipe.entries.itemOutputs[0].strings); return Events( eventName: map[kEventName]!, hostName: map[kEventHostName]!, @@ -80,7 +81,8 @@ class Events extends Equatable { ); } - static Map _extractAttributeValues(List attributes) { + static Map _extractAttributeValues( + List attributes) { final Map attributeValues = {}; for (final attribute in attributes) { switch (attribute.key) { @@ -110,8 +112,24 @@ class Events extends Equatable { } @override - List get props => - [eventName, hostName, thumbnail, startDate, endDate, startTime, endTime, location, description, numberOfTickets, price, listOfPerks, isFreeDrops, cookbookID, recipeID, step]; + List get props => [ + eventName, + hostName, + thumbnail, + startDate, + endDate, + startTime, + endTime, + location, + description, + numberOfTickets, + price, + listOfPerks, + isFreeDrops, + cookbookID, + recipeID, + step + ]; @override String toString() { @@ -131,7 +149,7 @@ extension CreateRecipe on Events { cookbookId: cookbookId, id: recipeId, nodeVersion: Int64(1), - name: eventName.trim(), + name: eventName.trim() + hostName.trim(), description: description.trim(), version: kVersion, coinInputs: [ @@ -216,17 +234,22 @@ class PerksModel { final String name; final String description; - factory PerksModel.updateName({required String name, required PerksModel perksModel}) => PerksModel( + factory PerksModel.updateName( + {required String name, required PerksModel perksModel}) => + PerksModel( name: name, description: perksModel.description, ); - factory PerksModel.updateDescription({required String description, required PerksModel perksModel}) => PerksModel( + factory PerksModel.updateDescription( + {required String description, required PerksModel perksModel,}) => + PerksModel( name: perksModel.name, description: description, ); - factory PerksModel.fromJson(Map map) => PerksModel(name: map['name'] ?? '', description: map['description'] ?? ''); + factory PerksModel.fromJson(Map map) => PerksModel( + name: map['name'] ?? '', description: map['description'] ?? '',); Map toJson() { Map map = {};