From 3e2b54ef7366b61b2e6ca629cf09c52356df5ffb Mon Sep 17 00:00:00 2001 From: ahmadrns <106388520+ahmadrns@users.noreply.github.com> Date: Thu, 21 Jul 2022 18:07:23 +0500 Subject: [PATCH 1/9] remove description check --- lib/screens/describe_screen.dart | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/lib/screens/describe_screen.dart b/lib/screens/describe_screen.dart index dc35817b..2fd0a85a 100644 --- a/lib/screens/describe_screen.dart +++ b/lib/screens/describe_screen.dart @@ -131,33 +131,7 @@ class _DescribeScreenState extends State { controller: provider.descriptionController, textCapitalization: TextCapitalization.sentences, inputFormatters: [LengthLimitingTextInputFormatter(kMaxDescription)], - validator: (value) { - setState(() { - if (value!.isEmpty) { - _descriptionFieldError = kEnterNFTDescriptionText; - return; - } - if (value.length <= kMinDescription) { - _descriptionFieldError = "$kEnterMoreThanText $kMinDescription $kCharactersText"; - return; - } - _descriptionFieldError = ''; - }); - return null; - }, ), - _descriptionFieldError.isNotEmpty - ? Padding( - padding: EdgeInsets.only(left: 10.w, right: 10.w, top: 2.h), - child: Text( - _descriptionFieldError, - style: TextStyle( - fontSize: 12.sp, - color: Colors.red, - ), - ), - ) - : const SizedBox.shrink(), Text( "$kMaxDescription $kCharacterLimitText", style: TextStyle(color: EaselAppTheme.kLightPurple, fontSize: 14.sp, fontWeight: FontWeight.w800), @@ -174,7 +148,7 @@ class _DescribeScreenState extends State { if (!_formKey.currentState!.validate()) { return; } - if ((_artNameFieldError.isNotEmpty || _artistNameFieldError.isNotEmpty || _descriptionFieldError.isNotEmpty)) { + if ((_artNameFieldError.isNotEmpty || _artistNameFieldError.isNotEmpty)) { return; } @@ -195,7 +169,7 @@ class _DescribeScreenState extends State { return; } - if ((_artNameFieldError.isNotEmpty || _artistNameFieldError.isNotEmpty || _descriptionFieldError.isNotEmpty)) { + if ((_artNameFieldError.isNotEmpty || _artistNameFieldError.isNotEmpty)) { return; } From f8d906c9465aed8d1fe49d5c721b67f83a792624 Mon Sep 17 00:00:00 2001 From: ahmadrns <106388520+ahmadrns@users.noreply.github.com> Date: Fri, 29 Jul 2022 19:36:05 +0500 Subject: [PATCH 2/9] bug fixes --- lib/utils/progress_bar_builder.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils/progress_bar_builder.dart b/lib/utils/progress_bar_builder.dart index 8cbc59af..e3ca5816 100644 --- a/lib/utils/progress_bar_builder.dart +++ b/lib/utils/progress_bar_builder.dart @@ -11,6 +11,7 @@ class ProgressBarBuilder extends StatelessWidget { @override Widget build(BuildContext context) { if (assetType == kVideoText) return videoProgressBar(context); - return audioProgressBar(context); + if (assetType == kAudioText) return audioProgressBar(context); + return const SizedBox(); } } From 1dc9673a19c3e1b9cdb2c07575767f7a4d6c2325 Mon Sep 17 00:00:00 2001 From: ahmadrns <106388520+ahmadrns@users.noreply.github.com> Date: Tue, 2 Aug 2022 11:54:17 +0500 Subject: [PATCH 3/9] point 5 issue resolved mentioned in PS-471 --- lib/screens/home_screen.dart | 1 - lib/screens/preview_screen.dart | 1 - lib/screens/publish_screen.dart | 15 ++--- lib/screens/tutorial_screen.dart | 110 ++++++++++++++++--------------- lib/widgets/audio_widget.dart | 6 +- 5 files changed, 68 insertions(+), 65 deletions(-) diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 8c227e2d..6a1658e8 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -99,7 +99,6 @@ class HomeScreenContent extends StatelessWidget { homeViewModel.currentPage.value = page; final map = {0: 0, 1: 1, 2: 1, 3: 2}; homeViewModel.currentStep.value = map[page]!; - }, itemBuilder: (BuildContext context, int index) { final map = {0: chooseFormatScreen, 1: describeScreen, 2: priceScreen, 3: publishScreen}; diff --git a/lib/screens/preview_screen.dart b/lib/screens/preview_screen.dart index b9e38c0d..a68cc403 100644 --- a/lib/screens/preview_screen.dart +++ b/lib/screens/preview_screen.dart @@ -40,7 +40,6 @@ class _PreviewScreenState extends State { provider.setAudioThumbnail(null); provider.setVideoThumbnail(null); provider.stopVideoIfPlaying(); - return Future.value(true); }, child: Stack( diff --git a/lib/screens/publish_screen.dart b/lib/screens/publish_screen.dart index 3929f18c..dff9456a 100644 --- a/lib/screens/publish_screen.dart +++ b/lib/screens/publish_screen.dart @@ -1,5 +1,3 @@ -import 'dart:developer'; - import 'package:audio_video_progress_bar/audio_video_progress_bar.dart'; import 'package:detectable_text_field/detector/sample_regular_expressions.dart'; import 'package:detectable_text_field/widgets/detectable_text.dart'; @@ -51,7 +49,7 @@ class _PublishScreenState extends State { @override initState() { easelProvider.nft = repository.getCacheDynamicType(key: nftKey); - easelProvider.collapsed=false; + easelProvider.collapsed = false; super.initState(); } @@ -191,7 +189,7 @@ class _OwnerBottomDrawerState extends State { return SizedBox( width: 330.0.w, child: Row( - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( padding: EdgeInsets.only( @@ -211,7 +209,7 @@ class _OwnerBottomDrawerState extends State { child: Icon( Icons.play_arrow_outlined, color: EaselAppTheme.kWhite, - size: 30.h, + size: 35.h, ), ); @@ -223,7 +221,7 @@ class _OwnerBottomDrawerState extends State { child: Icon( Icons.pause, color: EaselAppTheme.kWhite, - size: 30.h, + size: 35.h, ), ); } @@ -235,7 +233,7 @@ class _OwnerBottomDrawerState extends State { valueListenable: viewModel.audioProgressNotifier, builder: (_, value, __) { return Padding( - padding: EdgeInsets.only(bottom: 3.h, right: 20.w), + padding: EdgeInsets.only(right: 20.w), child: ProgressBar( progressBarColor: EaselAppTheme.kWhite, thumbColor: EaselAppTheme.kWhite, @@ -250,6 +248,7 @@ class _OwnerBottomDrawerState extends State { onSeek: (position) { viewModel.seekAudio(position, false); }, + timeLabelLocation: TimeLabelLocation.none, ), ); }, @@ -388,7 +387,7 @@ class _OwnerBottomDrawerState extends State { valueListenable: viewModel.audioProgressNotifier, builder: (_, value, __) { return Padding( - padding: EdgeInsets.only(bottom: 5.h, right: 20.w), + padding: EdgeInsets.only(bottom: 6.h, right: 20.w), child: ProgressBar( progressBarColor: EaselAppTheme.kWhite, thumbColor: EaselAppTheme.kWhite, diff --git a/lib/screens/tutorial_screen.dart b/lib/screens/tutorial_screen.dart index 094656f5..0abdf948 100644 --- a/lib/screens/tutorial_screen.dart +++ b/lib/screens/tutorial_screen.dart @@ -1,7 +1,5 @@ import 'package:bottom_drawer/bottom_drawer.dart'; -import 'package:easel_flutter/easel_provider.dart'; import 'package:easel_flutter/main.dart'; -import 'package:easel_flutter/repository/repository.dart'; import 'package:easel_flutter/utils/easel_app_theme.dart'; import 'package:easel_flutter/utils/extension_util.dart'; import 'package:easel_flutter/utils/route_util.dart'; @@ -12,7 +10,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get_it/get_it.dart'; -import 'package:provider/provider.dart'; import 'package:pylons_sdk/pylons_sdk.dart'; import '../utils/constants.dart'; @@ -32,14 +29,14 @@ class _TutorialScreenState extends State { List indicator() => List.generate( slides.length, - (index) => Container( - margin: EdgeInsets.symmetric(horizontal: 4.w), - height: currentPage.round() == index ? 16.w : 12.h, - width: currentPage.round() == index ? 18.w : 12.h, - decoration: BoxDecoration( - color: currentPage.round() == index ? getColorPerPage(index) : EaselAppTheme.kLightGrey, - ), - )); + (index) => Container( + margin: EdgeInsets.symmetric(horizontal: 4.w), + height: currentPage.round() == index ? 16.w : 12.h, + width: currentPage.round() == index ? 18.w : 12.h, + decoration: BoxDecoration( + color: currentPage.round() == index ? getColorPerPage(index) : EaselAppTheme.kLightGrey, + ), + )); double currentPage = 0.0; final _pageViewController = PageController(); @@ -63,57 +60,56 @@ class _TutorialScreenState extends State { myBottomDrawerController = BottomDrawerController(); slides = kTutorialItems .map((item) => Column( - children: [ - SizedBox(height: 0.1.sh), - Padding( - padding: EdgeInsets.symmetric(horizontal: 0.22.sw), - child: Image.asset( - item[kImageTutorial], - height: 10.h, - width: 40, - fit: BoxFit.fill, - )), - SizedBox(height: 0.1.sh), - Text(item[kHeaderTutorial], style: TextStyle(fontSize: isTablet ? 16.sp : 18.sp, fontWeight: FontWeight.w800, color: EaselAppTheme.kDartGrey), textAlign: TextAlign.center), - SizedBox(height: 15.h), - SizedBox(width: 0.63.sw, child: Text(item[kDescriptionTutorial], style: TextStyle(color: Colors.black, fontSize: 13.sp, fontWeight: FontWeight.w400), textAlign: TextAlign.center)), - ], - )) + children: [ + SizedBox(height: 0.1.sh), + Padding( + padding: EdgeInsets.symmetric(horizontal: 0.22.sw), + child: Image.asset( + item[kImageTutorial], + height: 10.h, + width: 40, + fit: BoxFit.fill, + )), + SizedBox(height: 0.1.sh), + Text(item[kHeaderTutorial], style: TextStyle(fontSize: isTablet ? 16.sp : 18.sp, fontWeight: FontWeight.w800, color: EaselAppTheme.kDartGrey), textAlign: TextAlign.center), + SizedBox(height: 15.h), + SizedBox(width: 0.63.sw, child: Text(item[kDescriptionTutorial], style: TextStyle(color: Colors.black, fontSize: 13.sp, fontWeight: FontWeight.w400), textAlign: TextAlign.center)), + ], + )) .toList(); _pageViewController.addListener(() { - if(doMoveForwardToMessageScreen()) { + if (doMoveForwardToMessageScreen()) { moveForwardToEaselMessage(); return; } setState(() { currentPage = _pageViewController.page!; }); - }); } - bool doMoveForwardToMessageScreen() => currentPage==2&&_pageViewController.position.userScrollDirection==ScrollDirection.reverse&&!tutorialProvider.isForwarding; + bool doMoveForwardToMessageScreen() => currentPage == 2 && _pageViewController.position.userScrollDirection == ScrollDirection.reverse && !tutorialProvider.isForwarding; @override Widget build(BuildContext context) { slides = kTutorialItems .map((item) => Column( - children: [ - SizedBox(height: 0.2.sh), - Padding( - padding: EdgeInsets.symmetric(horizontal: 0.22.sw), - child: Image.asset( - item[kImageTutorial], - height: isTablet ? 140.w : 200.w, - width: isTablet ? 140.w : 200.w, - fit: BoxFit.fill, - )), - SizedBox(height: 0.15.sh), - Text(item[kHeaderTutorial], style: TextStyle(fontSize: isTablet ? 16.sp : 18.sp, fontWeight: FontWeight.w800, color: EaselAppTheme.kDartGrey), textAlign: TextAlign.center), - SizedBox(height: 15.h), - SizedBox(width: 0.63.sw, child: Text(item[kDescriptionTutorial], style: TextStyle(color: Colors.black, fontSize: 13.sp, fontWeight: FontWeight.w400), textAlign: TextAlign.center)), - ], - )) + children: [ + SizedBox(height: 0.2.sh), + Padding( + padding: EdgeInsets.symmetric(horizontal: 0.22.sw), + child: Image.asset( + item[kImageTutorial], + height: isTablet ? 140.w : 200.w, + width: isTablet ? 140.w : 200.w, + fit: BoxFit.fill, + )), + SizedBox(height: 0.15.sh), + Text(item[kHeaderTutorial], style: TextStyle(fontSize: isTablet ? 16.sp : 18.sp, fontWeight: FontWeight.w800, color: EaselAppTheme.kDartGrey), textAlign: TextAlign.center), + SizedBox(height: 15.h), + SizedBox(width: 0.63.sw, child: Text(item[kDescriptionTutorial], style: TextStyle(color: Colors.black, fontSize: 13.sp, fontWeight: FontWeight.w400), textAlign: TextAlign.center)), + ], + )) .toList(); return Scaffold( backgroundColor: EaselAppTheme.kWhite03, @@ -121,7 +117,7 @@ class _TutorialScreenState extends State { children: [ PageView.builder( controller: _pageViewController, - physics: const BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemCount: slides.length, itemBuilder: (BuildContext context, int index) { return slides[index]; @@ -144,8 +140,6 @@ class _TutorialScreenState extends State { ); } - bool isLastPage() => currentPage.round() == slides.length - 1; - Widget buildBottomDrawer(BuildContext context) { return BottomDrawer( header: Container(), @@ -170,7 +164,11 @@ class _TutorialScreenState extends State { width: 0.7.sw, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text(kWhyAppNeededDesc1, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), SizedBox(height: 8.h), Text(kWhyAppNeededDescSummary1, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey))], + children: [ + Text(kWhyAppNeededDesc1, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), + SizedBox(height: 8.h), + Text(kWhyAppNeededDescSummary1, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey)) + ], ), ) ], @@ -191,7 +189,11 @@ class _TutorialScreenState extends State { width: 0.7.sw, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text(kWhyAppNeededDesc2, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), SizedBox(height: 8.h), Text(kWhyAppNeededDescSummary2, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey))], + children: [ + Text(kWhyAppNeededDesc2, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), + SizedBox(height: 8.h), + Text(kWhyAppNeededDescSummary2, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey)) + ], ), ) ], @@ -212,7 +214,11 @@ class _TutorialScreenState extends State { width: 0.7.sw, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text(kWhyAppNeededDesc3, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), SizedBox(height: 8.h), Text(kWhyAppNeededDescSummary3, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey))], + children: [ + Text(kWhyAppNeededDesc3, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), + SizedBox(height: 8.h), + Text(kWhyAppNeededDescSummary3, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey)) + ], ), ) ], diff --git a/lib/widgets/audio_widget.dart b/lib/widgets/audio_widget.dart index 23dd6147..057944b0 100644 --- a/lib/widgets/audio_widget.dart +++ b/lib/widgets/audio_widget.dart @@ -97,7 +97,7 @@ class _AudioWidgetState extends State with WidgetsBindingObserver { child: Icon( Icons.play_arrow, color: EaselAppTheme.kDarkBlue, - size: 35.h, + size: 40.h, ), ); @@ -109,7 +109,7 @@ class _AudioWidgetState extends State with WidgetsBindingObserver { child: Icon( Icons.pause, color: EaselAppTheme.kDarkBlue, - size: 35.h, + size: 40.h, ), ); } @@ -121,7 +121,7 @@ class _AudioWidgetState extends State with WidgetsBindingObserver { valueListenable: viewModel.audioProgressNotifier, builder: (_, value, __) { return Padding( - padding: EdgeInsets.only(bottom: 3.h, right: 20.w), + padding: EdgeInsets.only(bottom: 6.h, right: 20.w), child: ProgressBar( progressBarColor: EaselAppTheme.kDarkBlue, thumbColor: EaselAppTheme.kDarkBlue, From 6ca38dc6e0d677a2392209c6a4ea160f7e02d981 Mon Sep 17 00:00:00 2001 From: ahmadrns <106388520+ahmadrns@users.noreply.github.com> Date: Tue, 2 Aug 2022 15:48:44 +0500 Subject: [PATCH 4/9] working on royalties --- lib/easel_provider.dart | 5 ++--- lib/screens/describe_screen.dart | 33 -------------------------------- lib/utils/constants.dart | 4 +--- lib/utils/extension_util.dart | 9 +++++++++ 4 files changed, 12 insertions(+), 39 deletions(-) diff --git a/lib/easel_provider.dart b/lib/easel_provider.dart index 78233a20..984f0d74 100644 --- a/lib/easel_provider.dart +++ b/lib/easel_provider.dart @@ -21,7 +21,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:fixnum/fixnum.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:just_audio/just_audio.dart'; import 'package:media_info/media_info.dart'; import 'package:pylons_sdk/pylons_sdk.dart'; @@ -612,6 +611,7 @@ class EaselProvider extends ChangeNotifier { String residual = nft.tradePercentage.trim(); String price = isFreeDrop ? "0" : _selectedDenom.formatAmount(price: priceController.text); + var recipe = Recipe( cookbookId: _cookbookId, id: _recipeId, @@ -659,7 +659,7 @@ class EaselProvider extends ChangeNotifier { ], mutableStrings: [], transferFee: [Coin(denom: kPylonSymbol, amount: transferFeeAmount)], - tradePercentage: nft.tradePercentage.trim(), + tradePercentage: BigInt.parse(nft.tradePercentage.trim()).pow(17).toString(), tradeable: true, amountMinted: Int64(0), quantity: Int64(int.parse(nft.quantity.toString().replaceAll(",", "").trim()))), @@ -743,7 +743,6 @@ class EaselProvider extends ChangeNotifier { return sdkResponse; } - Future initializeAudioPlayerForFile({required File file}) async { audioProgressNotifier = ValueNotifier( ProgressBarState( diff --git a/lib/screens/describe_screen.dart b/lib/screens/describe_screen.dart index b81cc610..ac1931df 100644 --- a/lib/screens/describe_screen.dart +++ b/lib/screens/describe_screen.dart @@ -138,10 +138,6 @@ class _DescribeScreenState extends State { _artNameFieldError.value = kEnterNFTNameText; return; } - if (value.length <= kMinNFTName) { - _artNameFieldError.value = "$kNameShouldHaveText $kMinNFTName $kCharactersOrMoreText"; - return; - } _artNameFieldError.value = ''; return null; }, @@ -204,36 +200,7 @@ class _DescribeScreenState extends State { controller: provider.descriptionController, textCapitalization: TextCapitalization.sentences, inputFormatters: [LengthLimitingTextInputFormatter(kMaxDescription)], - validator: (value) { - if (value!.isEmpty) { - _descriptionFieldError.value = kEnterNFTDescriptionText; - return; - } - if (value.length <= kMinDescription) { - _descriptionFieldError.value = "$kEnterMoreThanText $kMinDescription $kCharactersText"; - return; - } - _descriptionFieldError.value = ''; - return null; - }, ), - ValueListenableBuilder( - valueListenable: _descriptionFieldError, - builder: (_, String descriptionFieldError, __) { - if (descriptionFieldError.isEmpty) { - return const SizedBox.shrink(); - } - return Padding( - padding: EdgeInsets.only(left: 10.w, right: 10.w, top: 2.h), - child: Text( - descriptionFieldError, - style: TextStyle( - fontSize: 12.sp, - color: Colors.red, - ), - ), - ); - }), Text( "$kMaxDescription $kCharacterLimitText", style: TextStyle(color: EaselAppTheme.kLightPurple, fontSize: 14.sp, fontWeight: FontWeight.w800), diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index 765cd43d..36c005a2 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -52,7 +52,6 @@ const kDummyImg = 'assets/images/svg/dummy_img.png'; const kVideoIcon = 'assets/images/video_icon.png'; const kViewIpfs = 'assets/images/view_ipfs.png'; - const kSvgPylonsLogo = 'assets/images/svg/pylons_logo.svg'; const kSvgIpfsLogo = 'assets/images/ipfs_logo.png'; const kSvgViewIcon = 'assets/images/svg/view_icon.svg'; @@ -91,7 +90,7 @@ const int kNumberOfSeconds = 1000; const int kSixtySeconds = 60; const int kFileCompressQuality = 50; -const double kPrecision = 100000000000000000; +const double kPrecision = 10000000000000000; const int kBigIntBase = 1000000; const int kEthIntBase = 1000000000000000000; @@ -275,7 +274,6 @@ const String kHeightKey = "Height"; const String kQuantityKey = "Quantity"; const String kHashtagKey = "Hashtags"; - const String kDescriptionTutorial = "description"; const String kHeaderTutorial = "header"; const String kImageTutorial = "image"; diff --git a/lib/utils/extension_util.dart b/lib/utils/extension_util.dart index ee22115a..4575dba2 100644 --- a/lib/utils/extension_util.dart +++ b/lib/utils/extension_util.dart @@ -160,3 +160,12 @@ extension IsSvgExtension on String { return _extension == ".svg"; } } + +extension ValueConverterToBigInt on String { + double toBigInt() { + if (this == "") { + return 0; + } + return BigInt.parse(this).toDouble() * kPrecision; + } +} From bc787e7010b4aaf5ce0173028c4de7090d57c358 Mon Sep 17 00:00:00 2001 From: ahmadrns <106388520+ahmadrns@users.noreply.github.com> Date: Tue, 2 Aug 2022 17:18:37 +0500 Subject: [PATCH 5/9] working on royalites --- lib/easel_provider.dart | 6 +++++- lib/screens/price_screen.dart | 11 ++++------- lib/utils/amount_formatter.dart | 30 +++++++++++++++++++++++++----- lib/utils/constants.dart | 2 +- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/lib/easel_provider.dart b/lib/easel_provider.dart index 984f0d74..d4dc16bc 100644 --- a/lib/easel_provider.dart +++ b/lib/easel_provider.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer'; import 'dart:io'; import 'package:easel_flutter/main.dart'; @@ -611,6 +612,7 @@ class EaselProvider extends ChangeNotifier { String residual = nft.tradePercentage.trim(); String price = isFreeDrop ? "0" : _selectedDenom.formatAmount(price: priceController.text); + String tradePercentage = (double.parse(nft.tradePercentage.trim()) * kPrecision).toString(); var recipe = Recipe( cookbookId: _cookbookId, @@ -659,7 +661,7 @@ class EaselProvider extends ChangeNotifier { ], mutableStrings: [], transferFee: [Coin(denom: kPylonSymbol, amount: transferFeeAmount)], - tradePercentage: BigInt.parse(nft.tradePercentage.trim()).pow(17).toString(), + tradePercentage: tradePercentage, tradeable: true, amountMinted: Int64(0), quantity: Int64(int.parse(nft.quantity.toString().replaceAll(",", "").trim()))), @@ -671,6 +673,8 @@ class EaselProvider extends ChangeNotifier { enabled: true, extraInfo: kExtraInfo); + log("MY JSON: ${recipe.toProto3Json().toString()}"); + var response = await PylonsWallet.instance.txCreateRecipe(recipe, requestResponse: false); if (!response.success) { diff --git a/lib/screens/price_screen.dart b/lib/screens/price_screen.dart index a9adfcca..a6fd3a3a 100644 --- a/lib/screens/price_screen.dart +++ b/lib/screens/price_screen.dart @@ -216,13 +216,10 @@ class _PriceScreenState extends State { EaselTextField( label: kRoyaltiesText, hint: kRoyaltyHintText, - keyboardType: TextInputType.number, + keyboardType: TextInputType.text, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - LengthLimitingTextInputFormatter(2), - AmountFormatter( - maxDigits: 2, - ) + FilteringTextInputFormatter.allow(RegExp("[0-9.]")), + LengthLimitingTextInputFormatter(3), ], controller: provider.royaltyController, validator: (value) { @@ -230,7 +227,7 @@ class _PriceScreenState extends State { _royaltiesFieldError.value = kEnterRoyaltyText; return; } - if (int.parse(value) > kMaxRoyalty) { + if (double.parse(value) < kMinRoyalty || double.parse(value) > kMaxRoyalty) { _royaltiesFieldError.value = "$kRoyaltyRangeText $kMinRoyalty-$kMaxRoyalty %"; return; } diff --git a/lib/utils/amount_formatter.dart b/lib/utils/amount_formatter.dart index b51c40cb..1f7b3bad 100644 --- a/lib/utils/amount_formatter.dart +++ b/lib/utils/amount_formatter.dart @@ -8,8 +8,7 @@ class AmountFormatter extends TextInputFormatter { bool isDecimal; @override - TextEditingValue formatEditUpdate( - TextEditingValue oldValue, TextEditingValue newValue) { + TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) { maxDigits = 20; if (newValue.selection.baseOffset == 0) { return newValue; @@ -21,8 +20,29 @@ class AmountFormatter extends TextInputFormatter { final formatter = NumberFormat(isDecimal ? "#,##0.00" : "#,###", "en_US"); String newText = formatter.format(isDecimal ? value / 100 : value); - return newValue.copyWith( - text: newText, - selection: TextSelection.collapsed(offset: newText.length)); + return newValue.copyWith(text: newText, selection: TextSelection.collapsed(offset: newText.length)); + } +} + +class RoyaltiesFormatter extends TextInputFormatter { + RoyaltiesFormatter({required this.maxDigits, this.isDecimal = false}); + + int maxDigits; + bool isDecimal; + + @override + TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) { + maxDigits = 20; + if (newValue.selection.baseOffset == 0) { + return newValue; + } + if (newValue.selection.baseOffset > maxDigits) { + return oldValue; + } + double value = double.parse(newValue.text); + final formatter = NumberFormat("#.#", "en_US"); + String newText = formatter.format(value); + + return newValue.copyWith(text: newText, selection: TextSelection.collapsed(offset: newText.length)); } } diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index 36c005a2..55786495 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -80,7 +80,7 @@ const kMinEditionValue = 1; const kMaxDescription = 256; const kMaxEdition = 10000; const kMinRoyalty = 0; -const kMaxRoyalty = 99.99; +const kMaxRoyalty = 1; const kFileSizeLimitInGB = 32; const kFileSizeLimitForAudiVideoInGB = 0.2; const kMaxPriceLength = 14; From 9a736803e266478a8840c09cdc9338172bc10fbf Mon Sep 17 00:00:00 2001 From: ahmadrns <106388520+ahmadrns@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:43:50 +0500 Subject: [PATCH 6/9] working on royalties issue --- lib/easel_provider.dart | 5 +++-- lib/screens/price_screen.dart | 7 ++++--- lib/utils/amount_formatter.dart | 14 +++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/easel_provider.dart b/lib/easel_provider.dart index d4dc16bc..45d3ed85 100644 --- a/lib/easel_provider.dart +++ b/lib/easel_provider.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:convert'; import 'dart:developer'; import 'dart:io'; @@ -612,7 +613,7 @@ class EaselProvider extends ChangeNotifier { String residual = nft.tradePercentage.trim(); String price = isFreeDrop ? "0" : _selectedDenom.formatAmount(price: priceController.text); - String tradePercentage = (double.parse(nft.tradePercentage.trim()) * kPrecision).toString(); + String tradePercentage = (double.parse(nft.tradePercentage.trim()) / 1000000000000000000).toString(); var recipe = Recipe( cookbookId: _cookbookId, @@ -673,7 +674,7 @@ class EaselProvider extends ChangeNotifier { enabled: true, extraInfo: kExtraInfo); - log("MY JSON: ${recipe.toProto3Json().toString()}"); + log("MY JSON: ${json.encode(recipe.toProto3Json())}"); var response = await PylonsWallet.instance.txCreateRecipe(recipe, requestResponse: false); diff --git a/lib/screens/price_screen.dart b/lib/screens/price_screen.dart index a6fd3a3a..3309f9ae 100644 --- a/lib/screens/price_screen.dart +++ b/lib/screens/price_screen.dart @@ -216,10 +216,11 @@ class _PriceScreenState extends State { EaselTextField( label: kRoyaltiesText, hint: kRoyaltyHintText, - keyboardType: TextInputType.text, + keyboardType: TextInputType.number, inputFormatters: [ FilteringTextInputFormatter.allow(RegExp("[0-9.]")), - LengthLimitingTextInputFormatter(3), + LengthLimitingTextInputFormatter(4), + // RoyaltiesFormatter(maxDigits: 3), ], controller: provider.royaltyController, validator: (value) { @@ -227,7 +228,7 @@ class _PriceScreenState extends State { _royaltiesFieldError.value = kEnterRoyaltyText; return; } - if (double.parse(value) < kMinRoyalty || double.parse(value) > kMaxRoyalty) { + if (double.parse(value) < kMinRoyalty || double.parse(value) >= kMaxRoyalty) { _royaltiesFieldError.value = "$kRoyaltyRangeText $kMinRoyalty-$kMaxRoyalty %"; return; } diff --git a/lib/utils/amount_formatter.dart b/lib/utils/amount_formatter.dart index 1f7b3bad..a41c9290 100644 --- a/lib/utils/amount_formatter.dart +++ b/lib/utils/amount_formatter.dart @@ -25,22 +25,22 @@ class AmountFormatter extends TextInputFormatter { } class RoyaltiesFormatter extends TextInputFormatter { - RoyaltiesFormatter({required this.maxDigits, this.isDecimal = false}); + RoyaltiesFormatter({required this.maxDigits}); int maxDigits; - bool isDecimal; @override TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) { - maxDigits = 20; - if (newValue.selection.baseOffset == 0) { - return newValue; - } + maxDigits = 3; + if (newValue.selection.baseOffset > maxDigits) { return oldValue; } + if (newValue.selection.baseOffset == 0) { + return newValue; + } double value = double.parse(newValue.text); - final formatter = NumberFormat("#.#", "en_US"); + final formatter = NumberFormat("#.0##", "en_US"); String newText = formatter.format(value); return newValue.copyWith(text: newText, selection: TextSelection.collapsed(offset: newText.length)); From e4b6b1fc41179d7f848558e4d0505f1e3ddfdf69 Mon Sep 17 00:00:00 2001 From: ahmadrns <106388520+ahmadrns@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:33:07 +0500 Subject: [PATCH 7/9] working on royalties issue --- lib/easel_provider.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/easel_provider.dart b/lib/easel_provider.dart index 45d3ed85..eabf93f2 100644 --- a/lib/easel_provider.dart +++ b/lib/easel_provider.dart @@ -613,7 +613,7 @@ class EaselProvider extends ChangeNotifier { String residual = nft.tradePercentage.trim(); String price = isFreeDrop ? "0" : _selectedDenom.formatAmount(price: priceController.text); - String tradePercentage = (double.parse(nft.tradePercentage.trim()) / 1000000000000000000).toString(); + String tradePercentage = (double.parse(nft.tradePercentage.trim()) * 10000000000000000).toInt().toString(); var recipe = Recipe( cookbookId: _cookbookId, From fcb308b2815acc1f75d926bc71d819e701e3b79c Mon Sep 17 00:00:00 2001 From: faizhashmiRnS Date: Thu, 11 Aug 2022 11:45:48 +0500 Subject: [PATCH 8/9] minor UI fixes --- android/app/build.gradle | 12 ++-- lib/screens/splash_screen.dart | 2 +- lib/screens/tutorial_screen.dart | 110 +++++++++++++++++-------------- 3 files changed, 66 insertions(+), 58 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index b1dc282b..150e7a2e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -53,12 +53,12 @@ android { } signingConfigs { - debug { - storeFile file('keystore.jks') - storePassword 'tech.pylons' - keyAlias 'key_tech_pylon' - keyPassword 'tech.pylons' - } +// debug { +// storeFile file('keystore.jks') +// storePassword 'tech.pylons' +// keyAlias 'key_tech_pylon' +// keyPassword 'tech.pylons' +// } } buildTypes { diff --git a/lib/screens/splash_screen.dart b/lib/screens/splash_screen.dart index dc1f8da1..29fd73af 100644 --- a/lib/screens/splash_screen.dart +++ b/lib/screens/splash_screen.dart @@ -82,7 +82,7 @@ class _SplashScreenState extends State { void onGetStarted() { var onBoardingComplete = GetIt.I.get().getOnBoardingComplete(); if (!onBoardingComplete) { - Navigator.of(context).pushNamed(RouteUtil.kRouteTutorial); + Navigator.of(context).pushReplacementNamed(RouteUtil.kRouteTutorial); return; } diff --git a/lib/screens/tutorial_screen.dart b/lib/screens/tutorial_screen.dart index 094656f5..ef776b81 100644 --- a/lib/screens/tutorial_screen.dart +++ b/lib/screens/tutorial_screen.dart @@ -1,7 +1,5 @@ import 'package:bottom_drawer/bottom_drawer.dart'; -import 'package:easel_flutter/easel_provider.dart'; import 'package:easel_flutter/main.dart'; -import 'package:easel_flutter/repository/repository.dart'; import 'package:easel_flutter/utils/easel_app_theme.dart'; import 'package:easel_flutter/utils/extension_util.dart'; import 'package:easel_flutter/utils/route_util.dart'; @@ -12,7 +10,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get_it/get_it.dart'; -import 'package:provider/provider.dart'; import 'package:pylons_sdk/pylons_sdk.dart'; import '../utils/constants.dart'; @@ -32,14 +29,14 @@ class _TutorialScreenState extends State { List indicator() => List.generate( slides.length, - (index) => Container( - margin: EdgeInsets.symmetric(horizontal: 4.w), - height: currentPage.round() == index ? 16.w : 12.h, - width: currentPage.round() == index ? 18.w : 12.h, - decoration: BoxDecoration( - color: currentPage.round() == index ? getColorPerPage(index) : EaselAppTheme.kLightGrey, - ), - )); + (index) => Container( + margin: EdgeInsets.symmetric(horizontal: 4.w), + height: currentPage.round() == index ? 16.w : 12.h, + width: currentPage.round() == index ? 18.w : 12.h, + decoration: BoxDecoration( + color: currentPage.round() == index ? getColorPerPage(index) : EaselAppTheme.kLightGrey, + ), + )); double currentPage = 0.0; final _pageViewController = PageController(); @@ -63,57 +60,56 @@ class _TutorialScreenState extends State { myBottomDrawerController = BottomDrawerController(); slides = kTutorialItems .map((item) => Column( - children: [ - SizedBox(height: 0.1.sh), - Padding( - padding: EdgeInsets.symmetric(horizontal: 0.22.sw), - child: Image.asset( - item[kImageTutorial], - height: 10.h, - width: 40, - fit: BoxFit.fill, - )), - SizedBox(height: 0.1.sh), - Text(item[kHeaderTutorial], style: TextStyle(fontSize: isTablet ? 16.sp : 18.sp, fontWeight: FontWeight.w800, color: EaselAppTheme.kDartGrey), textAlign: TextAlign.center), - SizedBox(height: 15.h), - SizedBox(width: 0.63.sw, child: Text(item[kDescriptionTutorial], style: TextStyle(color: Colors.black, fontSize: 13.sp, fontWeight: FontWeight.w400), textAlign: TextAlign.center)), - ], - )) + children: [ + SizedBox(height: 0.1.sh), + Padding( + padding: EdgeInsets.symmetric(horizontal: 0.22.sw), + child: Image.asset( + item[kImageTutorial], + height: 10.h, + width: 40, + fit: BoxFit.fill, + )), + SizedBox(height: 0.1.sh), + Text(item[kHeaderTutorial], style: TextStyle(fontSize: isTablet ? 16.sp : 18.sp, fontWeight: FontWeight.w800, color: EaselAppTheme.kDartGrey), textAlign: TextAlign.center), + SizedBox(height: 15.h), + SizedBox(width: 0.63.sw, child: Text(item[kDescriptionTutorial], style: TextStyle(color: Colors.black, fontSize: 13.sp, fontWeight: FontWeight.w400), textAlign: TextAlign.center)), + ], + )) .toList(); _pageViewController.addListener(() { - if(doMoveForwardToMessageScreen()) { + if (doMoveForwardToMessageScreen()) { moveForwardToEaselMessage(); return; } setState(() { currentPage = _pageViewController.page!; }); - }); } - bool doMoveForwardToMessageScreen() => currentPage==2&&_pageViewController.position.userScrollDirection==ScrollDirection.reverse&&!tutorialProvider.isForwarding; + bool doMoveForwardToMessageScreen() => currentPage == 2 && _pageViewController.position.userScrollDirection == ScrollDirection.reverse && !tutorialProvider.isForwarding; @override Widget build(BuildContext context) { slides = kTutorialItems .map((item) => Column( - children: [ - SizedBox(height: 0.2.sh), - Padding( - padding: EdgeInsets.symmetric(horizontal: 0.22.sw), - child: Image.asset( - item[kImageTutorial], - height: isTablet ? 140.w : 200.w, - width: isTablet ? 140.w : 200.w, - fit: BoxFit.fill, - )), - SizedBox(height: 0.15.sh), - Text(item[kHeaderTutorial], style: TextStyle(fontSize: isTablet ? 16.sp : 18.sp, fontWeight: FontWeight.w800, color: EaselAppTheme.kDartGrey), textAlign: TextAlign.center), - SizedBox(height: 15.h), - SizedBox(width: 0.63.sw, child: Text(item[kDescriptionTutorial], style: TextStyle(color: Colors.black, fontSize: 13.sp, fontWeight: FontWeight.w400), textAlign: TextAlign.center)), - ], - )) + children: [ + SizedBox(height: 0.2.sh), + Padding( + padding: EdgeInsets.symmetric(horizontal: 0.22.sw), + child: Image.asset( + item[kImageTutorial], + height: isTablet ? 140.w : 200.w, + width: isTablet ? 140.w : 200.w, + fit: BoxFit.fill, + )), + SizedBox(height: 0.15.sh), + Text(item[kHeaderTutorial], style: TextStyle(fontSize: isTablet ? 16.sp : 18.sp, fontWeight: FontWeight.w800, color: EaselAppTheme.kDartGrey), textAlign: TextAlign.center), + SizedBox(height: 15.h), + SizedBox(width: 0.63.sw, child: Text(item[kDescriptionTutorial], style: TextStyle(color: Colors.black, fontSize: 13.sp, fontWeight: FontWeight.w400), textAlign: TextAlign.center)), + ], + )) .toList(); return Scaffold( backgroundColor: EaselAppTheme.kWhite03, @@ -121,7 +117,7 @@ class _TutorialScreenState extends State { children: [ PageView.builder( controller: _pageViewController, - physics: const BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemCount: slides.length, itemBuilder: (BuildContext context, int index) { return slides[index]; @@ -130,7 +126,7 @@ class _TutorialScreenState extends State { Align( alignment: Alignment.bottomCenter, child: Container( - margin: EdgeInsets.only(bottom: isTablet ? 85.h : 120.h), + margin: EdgeInsets.only(bottom: isTablet ? 85.h : 80.h), padding: EdgeInsets.symmetric(vertical: 10.h), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -170,7 +166,11 @@ class _TutorialScreenState extends State { width: 0.7.sw, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text(kWhyAppNeededDesc1, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), SizedBox(height: 8.h), Text(kWhyAppNeededDescSummary1, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey))], + children: [ + Text(kWhyAppNeededDesc1, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), + SizedBox(height: 8.h), + Text(kWhyAppNeededDescSummary1, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey)) + ], ), ) ], @@ -191,7 +191,11 @@ class _TutorialScreenState extends State { width: 0.7.sw, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text(kWhyAppNeededDesc2, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), SizedBox(height: 8.h), Text(kWhyAppNeededDescSummary2, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey))], + children: [ + Text(kWhyAppNeededDesc2, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), + SizedBox(height: 8.h), + Text(kWhyAppNeededDescSummary2, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey)) + ], ), ) ], @@ -212,7 +216,11 @@ class _TutorialScreenState extends State { width: 0.7.sw, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [Text(kWhyAppNeededDesc3, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), SizedBox(height: 8.h), Text(kWhyAppNeededDescSummary3, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey))], + children: [ + Text(kWhyAppNeededDesc3, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w800, color: Colors.black)), + SizedBox(height: 8.h), + Text(kWhyAppNeededDescSummary3, style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.w400, color: EaselAppTheme.kLightGrey)) + ], ), ) ], From ab2b82509332645bc51d8890a99f7933469dff41 Mon Sep 17 00:00:00 2001 From: faizhashmiRnS Date: Thu, 11 Aug 2022 14:14:30 +0500 Subject: [PATCH 9/9] Merge Fixes --- lib/screens/price_screen.dart | 4 +--- lib/utils/constants.dart | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/screens/price_screen.dart b/lib/screens/price_screen.dart index 72585b02..c123eb09 100644 --- a/lib/screens/price_screen.dart +++ b/lib/screens/price_screen.dart @@ -237,9 +237,7 @@ class _PriceScreenState extends State { inputFormatters: [ FilteringTextInputFormatter.digitsOnly, LengthLimitingTextInputFormatter(2), - AmountFormatter( - maxDigits: 2, - ) + AmountFormatter(maxDigits: 2), ], controller: provider.royaltyController, validator: (value) { diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index 4b550184..51b1bc18 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -83,7 +83,7 @@ const kMinEditionValue = 1; const kMaxDescription = 256; const kMaxEdition = 10000; const kMinRoyalty = 0; -const kMaxRoyalty = 1; +const kMaxRoyalty = 100; const kFileSizeLimitInGB = 32; const kFileSizeLimitForAudiVideoInGB = 0.2; const kMaxPriceLength = 14; @@ -96,8 +96,6 @@ const int kSplashScreenDuration = 3; const double kPrecision = 100000000000000000; const double kRoyaltyPrecision = 10000000000000000; -const double kPrecision = 10000000000000000; - const int kBigIntBase = 1000000; const int kEthIntBase = 1000000000000000000;