diff --git a/android/app/build.gradle b/android/app/build.gradle index b1dc282..150e7a2 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/easel_provider.dart b/lib/easel_provider.dart index 83e692b..7b09f75 100644 --- a/lib/easel_provider.dart +++ b/lib/easel_provider.dart @@ -1,4 +1,6 @@ import 'dart:async'; +import 'dart:convert'; +import 'dart:developer'; import 'dart:io'; import 'package:easel_flutter/main.dart'; @@ -691,6 +693,8 @@ class EaselProvider extends ChangeNotifier { enabled: true, extraInfo: kExtraInfo); + log("MY JSON: ${json.encode(recipe.toProto3Json())}"); + var response = await PylonsWallet.instance.txCreateRecipe(recipe, requestResponse: false); if (!response.success) { diff --git a/lib/screens/describe_screen.dart b/lib/screens/describe_screen.dart index ddd1d0f..6bdcc7a 100644 --- a/lib/screens/describe_screen.dart +++ b/lib/screens/describe_screen.dart @@ -146,10 +146,6 @@ class _DescribeScreenState extends State { _artNameFieldError.value = kEnterNFTNameText; return; } - if (value.length <= kMinNFTName) { - _artNameFieldError.value = "$kNameShouldHaveText $kMinNFTName $kCharactersOrMoreText"; - return; - } _artNameFieldError.value = ''; return null; }, @@ -213,18 +209,6 @@ 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, diff --git a/lib/screens/preview_screen.dart b/lib/screens/preview_screen.dart index fe5f6fa..4ddb720 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/price_screen.dart b/lib/screens/price_screen.dart index 72585b0..c123eb0 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/screens/publish_screen.dart b/lib/screens/publish_screen.dart index c133e2b..817e96a 100644 --- a/lib/screens/publish_screen.dart +++ b/lib/screens/publish_screen.dart @@ -202,7 +202,7 @@ class _OwnerBottomDrawerState extends State { return SizedBox( width: 330.0.w, child: Row( - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( padding: EdgeInsets.only( @@ -222,7 +222,7 @@ class _OwnerBottomDrawerState extends State { child: Icon( Icons.play_arrow_outlined, color: EaselAppTheme.kWhite, - size: 30.h, + size: 35.h, ), ); @@ -234,7 +234,7 @@ class _OwnerBottomDrawerState extends State { child: Icon( Icons.pause, color: EaselAppTheme.kWhite, - size: 30.h, + size: 35.h, ), ); } @@ -246,7 +246,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, @@ -261,6 +261,7 @@ class _OwnerBottomDrawerState extends State { onSeek: (position) { viewModel.seekAudio(position, false); }, + timeLabelLocation: TimeLabelLocation.none, ), ); }, diff --git a/lib/screens/splash_screen.dart b/lib/screens/splash_screen.dart index dc1f8da..29fd73a 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 094656f..49b283b 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, @@ -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/utils/amount_formatter.dart b/lib/utils/amount_formatter.dart index b51c40c..a41c929 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}); + + int maxDigits; + + @override + TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue 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("#.0##", "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 ba74c60..51b1bc1 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 = 99.99; +const kMaxRoyalty = 100; const kFileSizeLimitInGB = 32; const kFileSizeLimitForAudiVideoInGB = 0.2; const kMaxPriceLength = 14; diff --git a/lib/utils/extension_util.dart b/lib/utils/extension_util.dart index 49e1809..3ae922d 100644 --- a/lib/utils/extension_util.dart +++ b/lib/utils/extension_util.dart @@ -167,6 +167,15 @@ extension IsSvgExtension on String { } } +extension ValueConverterToBigInt on String { + double toBigInt() { + if (this == "") { + return 0; + } + return BigInt.parse(this).toDouble() * kPrecision; + } +} + extension ChangeDomain on String { String changeDomain() { if (!contains(ipfsDomain)) {