From 03afe53e1867de5bec5437995402297612d3735a Mon Sep 17 00:00:00 2001 From: jawad Date: Thu, 21 Mar 2024 05:32:15 +0100 Subject: [PATCH] Recursively call the account creation api for the set username --- .vscode/settings.json | 1 + dart_sdk/example/android/app/build.gradle | 4 +- .../lib/src/ui/pylons_loading_animation.dart | 10 +- easel/android/app/build.gradle | 4 +- easel/android/build.gradle | 4 +- .../initial_draft_detail_dialog.dart | 4 +- easel/lib/screens/home_screen.dart | 8 +- .../preview_nft/preview_nft_full_screen.dart | 113 +++-- easel/lib/screens/preview_screen.dart | 173 +++---- easel/lib/widgets/audio_widget.dart | 204 +++++---- easel/lib/widgets/loading.dart | 4 +- easel/lib/widgets/loading_with_progress.dart | 4 +- easel/lib/widgets/message_dialog.dart | 4 +- easel/lib/widgets/video_widget.dart | 148 +++--- easel/pubspec.yaml | 4 +- testapp-flutter/android/app/build.gradle | 4 +- wallet/android/app/build.gradle | 2 +- wallet/android/build.gradle | 2 +- wallet/devtools_options.yaml | 1 + wallet/ios/Podfile | 4 + wallet/ios/Runner.xcodeproj/project.pbxproj | 20 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- wallet/lib/components/loading.dart | 4 +- wallet/lib/components/user_image_widget.dart | 68 ++- .../lib/ipc/widgets/sdk_approval_dialog.dart | 4 +- .../pages/detailed_asset_view/owner_view.dart | 21 +- .../widgets/create_trade_bottom_sheet.dart | 313 +++++++------ .../widgets/for_sale_bottom_sheet.dart | 427 +++++++++--------- .../widgets/nft_not_for_sale_dialog.dart | 154 +++---- wallet/lib/pages/home/home.dart | 25 +- .../purchase_item/purchase_item_screen.dart | 16 +- wallet/lib/pages/stripe_screen.dart | 8 +- .../local_transaction_detail_screen.dart | 38 +- wallet/lib/stores/wallet_store_imp.dart | 88 ++-- wallet/lib/utils/route_util.dart | 8 +- .../Flutter/GeneratedPluginRegistrant.swift | 6 + wallet/pkgs/alan/pubspec.yaml | 2 +- .../pdf_viewer-master/android/build.gradle | 2 +- wallet/pubspec.yaml | 21 +- 39 files changed, 982 insertions(+), 947 deletions(-) create mode 100644 wallet/devtools_options.yaml diff --git a/.vscode/settings.json b/.vscode/settings.json index e111d787f6..ea1590808a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,4 +4,5 @@ "go.lintTool": "golangci-lint", "go.inferGopath": false, "git.ignoreLimitWarning": true, + "dart.lineLength": 120, } \ No newline at end of file diff --git a/dart_sdk/example/android/app/build.gradle b/dart_sdk/example/android/app/build.gradle index c862559769..1a93708663 100644 --- a/dart_sdk/example/android/app/build.gradle +++ b/dart_sdk/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 31 + compileSdkVersion 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -45,7 +45,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.pylons.example" minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/dart_sdk/lib/src/ui/pylons_loading_animation.dart b/dart_sdk/lib/src/ui/pylons_loading_animation.dart index a2db0af8a3..5cead0a6b2 100644 --- a/dart_sdk/lib/src/ui/pylons_loading_animation.dart +++ b/dart_sdk/lib/src/ui/pylons_loading_animation.dart @@ -13,12 +13,16 @@ class PylonsLoadingAnimation { context: context, barrierDismissible: true, barrierColor: Colors.white.withOpacity(0), - builder: (ctx) => WillPopScope( - onWillPop: () async => false, + builder: (ctx) => PopScope( + canPop: false, child: AlertDialog( elevation: 0, backgroundColor: Colors.transparent, - content: SizedBox(height: _height, width: _width, child: Image.asset('assets/loading.gif', package: 'pylons_sdk',)), + content: SizedBox( + height: _height, + width: _width, + child: Image.asset('assets/loading.gif', package: 'pylons_sdk'), + ), ), ), ); diff --git a/easel/android/app/build.gradle b/easel/android/app/build.gradle index d91a5d8b12..cd8c6a63cd 100644 --- a/easel/android/app/build.gradle +++ b/easel/android/app/build.gradle @@ -28,7 +28,7 @@ apply plugin: 'com.google.firebase.crashlytics' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 33 + compileSdkVersion 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -47,7 +47,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "tech.pylons.easel" minSdkVersion 21 - targetSdkVersion 32 + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/easel/android/build.gradle b/easel/android/build.gradle index 2a3b1eaeb7..a02ce66205 100644 --- a/easel/android/build.gradle +++ b/easel/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.9.22' repositories { google() mavenCentral() @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/easel/lib/screens/custom_widgets/initial_draft_detail_dialog.dart b/easel/lib/screens/custom_widgets/initial_draft_detail_dialog.dart index bb5b48e04f..f2ba17687f 100644 --- a/easel/lib/screens/custom_widgets/initial_draft_detail_dialog.dart +++ b/easel/lib/screens/custom_widgets/initial_draft_detail_dialog.dart @@ -124,8 +124,8 @@ class _DraftDetailDialogState extends State<_DraftDetailDialog> { Widget build(BuildContext context) { final EaselProvider easelProvider = context.watch(); - return WillPopScope( - onWillPop: () async => false, + return PopScope( + canPop: false, child: Dialog( backgroundColor: EaselAppTheme.kTransparent, insetPadding: EdgeInsets.symmetric(horizontal: isTablet ? 65.w : 21.w), diff --git a/easel/lib/screens/home_screen.dart b/easel/lib/screens/home_screen.dart index daf4ff3bfc..976c07444d 100644 --- a/easel/lib/screens/home_screen.dart +++ b/easel/lib/screens/home_screen.dart @@ -72,11 +72,9 @@ class HomeScreenState extends State { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - onBackPressed(); - return false; - }, + return PopScope( + canPop: false, + onPopInvoked: (didPop) => onBackPressed(), child: ColoredBox( color: EaselAppTheme.kWhite, child: SafeArea( diff --git a/easel/lib/screens/preview_nft/preview_nft_full_screen.dart b/easel/lib/screens/preview_nft/preview_nft_full_screen.dart index 2a43592997..35b41ba01a 100644 --- a/easel/lib/screens/preview_nft/preview_nft_full_screen.dart +++ b/easel/lib/screens/preview_nft/preview_nft_full_screen.dart @@ -25,80 +25,71 @@ class _PreviewNFTFullScreenState extends State { @override void initState() { scheduleMicrotask(() { - easelProvider.initializePlayers( - publishedNFT: easelProvider.publishedNFTClicked); + easelProvider.initializePlayers(publishedNFT: easelProvider.publishedNFTClicked); }); super.initState(); } - void onBackPressed({required BuildContext context}) { - if (easelProvider.publishedNFTClicked.assetType == AssetType.Video.name && - easelProvider.videoPlayerController.value.isInitialized) { - if (easelProvider.videoPlayerController.value.isPlaying) { - easelProvider.videoPlayerController.pause(); - } - } - easelProvider.videoLoadingError = ''; - - Navigator.pop(context); - } - @override Widget build(BuildContext context) { return Material( - child: WillPopScope( - onWillPop: () async { - onBackPressed(context: context); - return true; - }, - child: Stack( - children: [ - PreviewNFTBuilder( - onImage: (context) => NftImageWidget( - imageUrl: easelProvider.publishedNFTClicked.url), - onVideo: (context) => const NFTVideoPlayerScreen(), - on3D: (context) => Model3dViewer( - isFile: false, - path: easelProvider.publishedNFTClicked.url, - ), - assetType: easelProvider.publishedNFTClicked.assetType - .toAssetTypeEnum()), - Column( - children: [ - ClipRect( - child: ColoredBox( - color: Colors.black.withOpacity(0.3), - child: Padding( - padding: EdgeInsets.fromLTRB(20.w, 30.h, 0, 10.h), - child: Row( - children: [ - IconButton( - onPressed: () { - onBackPressed(context: context); - }, - icon: Icon( - Icons.arrow_back_ios, - size: 22.h, - color: EaselAppTheme.kWhite, - ), - ), - Text( - kBack, - style: EaselAppTheme.titleStyle.copyWith( - fontSize: 18.sp, color: EaselAppTheme.kWhite), + child: Stack( + children: [ + PreviewNFTBuilder( + onImage: (context) => NftImageWidget(imageUrl: easelProvider.publishedNFTClicked.url), + onVideo: (context) => const NFTVideoPlayerScreen(), + on3D: (context) => Model3dViewer( + isFile: false, + path: easelProvider.publishedNFTClicked.url, + ), + assetType: easelProvider.publishedNFTClicked.assetType.toAssetTypeEnum()), + Column( + children: [ + ClipRect( + child: ColoredBox( + color: Colors.black.withOpacity(0.3), + child: Padding( + padding: EdgeInsets.fromLTRB(20.w, 30.h, 0, 10.h), + child: Row( + children: [ + IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: Icon( + Icons.arrow_back_ios, + size: 22.h, + color: EaselAppTheme.kWhite, ), - ], - ), + ), + Text( + kBack, + style: EaselAppTheme.titleStyle.copyWith(fontSize: 18.sp, color: EaselAppTheme.kWhite), + ), + ], ), ), - ) - ], - ) - ], - ), + ), + ) + ], + ) + ], ), ); } + + @override + void dispose() { + if (easelProvider.publishedNFTClicked.assetType == AssetType.Video.name && + easelProvider.videoPlayerController.value.isInitialized) { + if (easelProvider.videoPlayerController.value.isPlaying) { + easelProvider.videoPlayerController.pause(); + } + } + easelProvider.videoLoadingError = ''; + + super.dispose(); + } } class PreviewNFTBuilder extends StatelessWidget { diff --git a/easel/lib/screens/preview_screen.dart b/easel/lib/screens/preview_screen.dart index 6b61ea5fc6..323f5a5840 100644 --- a/easel/lib/screens/preview_screen.dart +++ b/easel/lib/screens/preview_screen.dart @@ -44,101 +44,92 @@ class _PreviewScreenState extends State { return Scaffold( backgroundColor: Colors.black, body: Consumer( - builder: (_, provider, __) => WillPopScope( - onWillPop: () { - provider.setAudioThumbnail(null); - provider.setVideoThumbnail(null); - provider.stopVideoIfPlaying(); - - return Future.value(true); - }, - child: Stack( - children: [ - if (provider.file != null) buildPreviewWidget(provider), - Image.asset(PngUtils.kPreviewGradient, width: 1.sw, fit: BoxFit.fill), - if (provider.nftFormat.format == NFTTypes.image) - SizedBox( - key: const Key(kImageFullScreenGridviewKey), - width: double.maxFinite, - child: SvgPicture.asset(SVGUtils.kFullScreenImgGridview, width: 1.sw, height: 1.sh, fit: BoxFit.fill), - ), - Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).viewPadding.top + 20.h), - child: Row( - children: [ - Padding( - padding: EdgeInsets.only(left: 10.w), - child: IconButton( - onPressed: () { - provider.setAudioThumbnail(null); - provider.setVideoThumbnail(null); - Navigator.of(context).pop(); - }, - icon: const Icon( - Icons.arrow_back_ios, - color: EaselAppTheme.kWhite, - ), + builder: (_, provider, __) => Stack( + children: [ + if (provider.file != null) buildPreviewWidget(provider), + Image.asset(PngUtils.kPreviewGradient, width: 1.sw, fit: BoxFit.fill), + if (provider.nftFormat.format == NFTTypes.image) + SizedBox( + key: const Key(kImageFullScreenGridviewKey), + width: double.maxFinite, + child: SvgPicture.asset(SVGUtils.kFullScreenImgGridview, width: 1.sw, height: 1.sh, fit: BoxFit.fill), + ), + Padding( + padding: EdgeInsets.only(top: MediaQuery.of(context).viewPadding.top + 20.h), + child: Row( + children: [ + Padding( + padding: EdgeInsets.only(left: 10.w), + child: IconButton( + onPressed: () { + provider.setAudioThumbnail(null); + provider.setVideoThumbnail(null); + Navigator.of(context).pop(); + }, + icon: const Icon( + Icons.arrow_back_ios, + color: EaselAppTheme.kWhite, ), ), - Expanded( - child: Text( - LocaleKeys.nft_preview_header.tr(), - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: EaselAppTheme.kLightPurple, - fontSize: 13.sp, - fontWeight: FontWeight.w600, - ), - ), + ), + Expanded( + child: Text( + LocaleKeys.nft_preview_header.tr(), + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + color: EaselAppTheme.kLightPurple, + fontSize: 13.sp, + fontWeight: FontWeight.w600, + ), ), - SizedBox( - width: 30.w, - ) - ], - ), + ), + SizedBox( + width: 30.w, + ) + ], ), - Padding( - padding: EdgeInsets.only( - bottom: 30.h, - ), - child: Align( - alignment: Alignment.bottomCenter, - child: GestureDetector( - onTap: () async { - final navigator = Navigator.of(context); - final result = await onUploadPressed(); - if (result) { - navigator.pop(); - widget.onMoveToNextScreen(); - } - }, - child: ClipPath( - clipper: PylonsButtonClipper(), - child: Container( - width: 0.75.sw, - height: isTablet ? 0.09.sw : 0.12.sw, - decoration: const BoxDecoration(color: EaselAppTheme.kBlue), - child: Stack( - children: [ - Center( - child: Text( - LocaleKeys.continue_key.tr(), - style: Theme.of(context).textTheme.bodyLarge!.copyWith( - fontSize: 15.sp, - color: EaselAppTheme.kWhite, - fontWeight: FontWeight.w600, - ), - ), - ) - ], - ), + ), + Padding( + padding: EdgeInsets.only( + bottom: 30.h, + ), + child: Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: () async { + final navigator = Navigator.of(context); + final result = await onUploadPressed(); + if (result) { + navigator.pop(); + widget.onMoveToNextScreen(); + } + }, + child: ClipPath( + clipper: PylonsButtonClipper(), + child: Container( + width: 0.75.sw, + height: isTablet ? 0.09.sw : 0.12.sw, + decoration: const BoxDecoration(color: EaselAppTheme.kBlue), + child: Stack( + children: [ + Center( + child: Text( + LocaleKeys.continue_key.tr(), + style: Theme.of(context).textTheme.bodyLarge!.copyWith( + fontSize: 15.sp, + color: EaselAppTheme.kWhite, + fontWeight: FontWeight.w600, + ), + ), + ) + ], ), ), ), ), ), - ], - ), + ), + ], ), ), ); @@ -212,4 +203,14 @@ class _PreviewScreenState extends State { } return true; } + + @override + void dispose() { + final provider = context.read(); + provider.setAudioThumbnail(null); + provider.setVideoThumbnail(null); + provider.stopVideoIfPlaying(); + + super.dispose(); + } } diff --git a/easel/lib/widgets/audio_widget.dart b/easel/lib/widgets/audio_widget.dart index d1686a386a..bf765822db 100644 --- a/easel/lib/widgets/audio_widget.dart +++ b/easel/lib/widgets/audio_widget.dart @@ -33,7 +33,7 @@ class AudioWidgetState extends State with WidgetsBindingObserver { Repository get repository => GetIt.I.get(); @override - void initState() { + void initState() { super.initState(); if (!widget.previewFlag) { @@ -52,113 +52,122 @@ class AudioWidgetState extends State with WidgetsBindingObserver { if (widget.previewFlag && viewModel.audioThumbnail != null) { return BoxDecoration(image: DecorationImage(image: FileImage(viewModel.audioThumbnail!), fit: BoxFit.fitHeight)); } - return BoxDecoration(image: viewModel.nft.thumbnailUrl.isNotEmpty ? DecorationImage(image: CachedNetworkImageProvider(viewModel.nft.thumbnailUrl.changeDomain()), fit: BoxFit.fitHeight) : null); + return BoxDecoration( + image: viewModel.nft.thumbnailUrl.isNotEmpty + ? DecorationImage( + image: CachedNetworkImageProvider(viewModel.nft.thumbnailUrl.changeDomain()), + fit: BoxFit.fitHeight, + ) + : null, + ); } @override Widget build(BuildContext context) { final viewModel = context.watch(); - return WillPopScope( - onWillPop: () { - easelProvider.setAudioThumbnail(null); - Navigator.pop(context); - return Future.value(true); - }, - child: Container( - width: double.infinity, - height: double.infinity, - decoration: getAudioBackgroundDecoration(viewModel: viewModel), - child: SafeArea( - child: SingleChildScrollView( - child: Column( - children: [ - SizedBox( - height: 0.4.sh, - ), - // ignore: prefer_if_elements_to_conditional_expressions - (shouldShowThumbnailButtonOrStepsOrNot()) - ? SizedBox( - height: 100.h, - width: 330.0.w, - child: Align( - alignment: Alignment.topCenter, - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Padding( - padding: EdgeInsets.only(right: 10.w, bottom: 10.h, top: 10.h, left: 5.w), - child: ValueListenableBuilder( - valueListenable: viewModel.buttonNotifier, - builder: (_, value, __) { - switch (value) { - case ButtonState.loading: - return SizedBox(height: 22.h, width: 22.h, child: CircularProgressIndicator(strokeWidth: 2.w, color: Colors.black)); - case ButtonState.paused: - return InkWell( - onTap: () { - viewModel.playAudio(forFile: widget.file != null); - }, - child: Icon( - Icons.play_arrow, - color: EaselAppTheme.kDarkBlue, - size: 35.h, - ), - ); - - case ButtonState.playing: - return InkWell( - onTap: () { - viewModel.pauseAudio(forFile: widget.file != null); - }, - child: Icon( - Icons.pause, - color: EaselAppTheme.kDarkBlue, - size: 35.h, - ), - ); - } - }, - ), - ), - Expanded( - child: ValueListenableBuilder( - valueListenable: viewModel.audioProgressNotifier, - builder: (_, value, __) { - return Padding( - padding: EdgeInsets.only(bottom: 3.h, right: 20.w), - child: ProgressBar( - progressBarColor: EaselAppTheme.kDarkBlue, - thumbColor: EaselAppTheme.kDarkBlue, - progress: value.current, - baseBarColor: EaselAppTheme.kGrey, - bufferedBarColor: EaselAppTheme.kLightGrey, - buffered: value.buffered, - total: value.total, - timeLabelTextStyle: TextStyle(color: EaselAppTheme.kGrey, fontWeight: FontWeight.w800, fontSize: 9.sp), - thumbRadius: 10.h, - timeLabelPadding: 3.h, - onSeek: (position) { - viewModel.seekAudio(position, forFile: widget.file != null); - }, + return Container( + width: double.infinity, + height: double.infinity, + decoration: getAudioBackgroundDecoration(viewModel: viewModel), + child: SafeArea( + child: SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: 0.4.sh, + ), + // ignore: prefer_if_elements_to_conditional_expressions + (shouldShowThumbnailButtonOrStepsOrNot()) + ? SizedBox( + height: 100.h, + width: 330.0.w, + child: Align( + alignment: Alignment.topCenter, + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Padding( + padding: EdgeInsets.only(right: 10.w, bottom: 10.h, top: 10.h, left: 5.w), + child: ValueListenableBuilder( + valueListenable: viewModel.buttonNotifier, + builder: (_, value, __) { + switch (value) { + case ButtonState.loading: + return SizedBox( + height: 22.h, + width: 22.h, + child: CircularProgressIndicator(strokeWidth: 2.w, color: Colors.black), + ); + case ButtonState.paused: + return InkWell( + onTap: () { + viewModel.playAudio(forFile: widget.file != null); + }, + child: Icon( + Icons.play_arrow, + color: EaselAppTheme.kDarkBlue, + size: 35.h, + ), + ); + + case ButtonState.playing: + return InkWell( + onTap: () { + viewModel.pauseAudio(forFile: widget.file != null); + }, + child: Icon( + Icons.pause, + color: EaselAppTheme.kDarkBlue, + size: 35.h, ), ); - }, - ), - ), - ], + } + }, + ), + ), + Expanded( + child: ValueListenableBuilder( + valueListenable: viewModel.audioProgressNotifier, + builder: (_, value, __) { + return Padding( + padding: EdgeInsets.only(bottom: 3.h, right: 20.w), + child: ProgressBar( + progressBarColor: EaselAppTheme.kDarkBlue, + thumbColor: EaselAppTheme.kDarkBlue, + progress: value.current, + baseBarColor: EaselAppTheme.kGrey, + bufferedBarColor: EaselAppTheme.kLightGrey, + buffered: value.buffered, + total: value.total, + timeLabelTextStyle: TextStyle( + color: EaselAppTheme.kGrey, + fontWeight: FontWeight.w800, + fontSize: 9.sp, + ), + thumbRadius: 10.h, + timeLabelPadding: 3.h, + onSeek: (position) { + viewModel.seekAudio(position, forFile: widget.file != null); + }, + ), + ); + }, + ), ), - )) - : const SizedBox(), - SizedBox( - height: 40.0.h, - ), - if (shouldShowThumbnailButtonOrStepsOrNot()) _buildThumbnailButton() else const SizedBox(), - ], + ], + ), + )) + : const SizedBox(), + SizedBox( + height: 40.0.h, ), - ), + if (shouldShowThumbnailButtonOrStepsOrNot()) _buildThumbnailButton() else const SizedBox(), + ], ), - )); + ), + ), + ); } bool shouldShowThumbnailButtonOrStepsOrNot() { @@ -167,6 +176,7 @@ class AudioWidgetState extends State with WidgetsBindingObserver { @override void dispose() { + easelProvider.setAudioThumbnail(null); easelProvider.disposeAudioController(); super.dispose(); } diff --git a/easel/lib/widgets/loading.dart b/easel/lib/widgets/loading.dart index 5afb3f0c14..8cdef25b1f 100644 --- a/easel/lib/widgets/loading.dart +++ b/easel/lib/widgets/loading.dart @@ -23,8 +23,8 @@ class Loading { context: navigatorKey.currentState!.overlay!.context, barrierDismissible: true, barrierColor: Colors.white.withOpacity(0), - builder: (ctx) => WillPopScope( - onWillPop: () async => false, + builder: (ctx) => PopScope( + canPop: false, child: AlertDialog( elevation: 0, backgroundColor: EaselAppTheme.kTransparent, diff --git a/easel/lib/widgets/loading_with_progress.dart b/easel/lib/widgets/loading_with_progress.dart index ae3d5621e0..b528621cb0 100644 --- a/easel/lib/widgets/loading_with_progress.dart +++ b/easel/lib/widgets/loading_with_progress.dart @@ -26,8 +26,8 @@ class LoadingProgress { return showDialog( context: navigatorKey.currentState!.overlay!.context, barrierDismissible: true, - builder: (ctx) => WillPopScope( - onWillPop: () async => false, + builder: (ctx) => PopScope( + canPop: false, child: AlertDialog( elevation: 0, backgroundColor: EaselAppTheme.kTransparent, diff --git a/easel/lib/widgets/message_dialog.dart b/easel/lib/widgets/message_dialog.dart index 2a2e989c75..7af47ab909 100644 --- a/easel/lib/widgets/message_dialog.dart +++ b/easel/lib/widgets/message_dialog.dart @@ -9,8 +9,8 @@ class MessageDialog { showDialog( context: navigatorKey.currentState!.overlay!.context, barrierDismissible: false, - builder: (ctx) => WillPopScope( - onWillPop: () => Future.value(false), + builder: (ctx) => PopScope( + canPop: false, child: AlertDialog( content: Text( message, diff --git a/easel/lib/widgets/video_widget.dart b/easel/lib/widgets/video_widget.dart index 102e8a1c7a..eb27adff47 100644 --- a/easel/lib/widgets/video_widget.dart +++ b/easel/lib/widgets/video_widget.dart @@ -2,8 +2,7 @@ import 'dart:async'; import 'dart:io'; import 'package:easel_flutter/easel_provider.dart'; -import 'package:easel_flutter/screens/clippers/right_triangle_clipper.dart' - as clipper; +import 'package:easel_flutter/screens/clippers/right_triangle_clipper.dart' as clipper; import 'package:easel_flutter/screens/clippers/right_triangle_clipper.dart'; import 'package:easel_flutter/screens/clippers/small_bottom_corner_clipper.dart'; import 'package:easel_flutter/utils/constants.dart'; @@ -49,8 +48,7 @@ class VideoWidgetState extends State { if (widget.file != null) { easelProvider.initializeVideoPlayerWithFile(); } else { - easelProvider.initializeVideoPlayerWithUrl( - publishedNftUrl: widget.filePath!); + easelProvider.initializeVideoPlayerWithUrl(publishedNftUrl: widget.filePath!); } }); super.initState(); @@ -61,8 +59,7 @@ class VideoWidgetState extends State { left: -1, bottom: 0, child: ClipPath( - clipper: RightTriangleClipper( - orientation: clipper.Orientation.orientationNE), + clipper: RightTriangleClipper(orientation: clipper.Orientation.orientationNE), child: InkWell( onTap: () { Navigator.pushNamed(context, RouteUtil.kVideoFullScreen); @@ -133,19 +130,39 @@ class VideoWidgetState extends State { Widget build(BuildContext context) { return ChangeNotifierProvider.value( value: easelProvider, - child: WillPopScope( - onWillPop: () async { - easelProvider.stopVideoIfPlaying(); - easelProvider.setVideoThumbnail(null); - Navigator.pop(context); - return true; - }, - child: SingleChildScrollView( - child: Column( - children: [ - if (shouldShowThumbnailButton()) VerticalSpace(80.h) else const SizedBox(), - if (!shouldShowThumbnailButton()) ...[ - VideoBuilder( + child: SingleChildScrollView( + child: Column( + children: [ + if (shouldShowThumbnailButton()) VerticalSpace(80.h) else const SizedBox(), + if (!shouldShowThumbnailButton()) ...[ + VideoBuilder( + onVideoLoading: (BuildContext context) => Center( + child: SizedBox( + height: 50.0.h, + child: Image.asset( + kLoadingGif, + ), + ), + ), + onVideoHasError: (BuildContext context) => Center( + child: Padding( + padding: const EdgeInsets.all(10), + child: Text( + "video_player_error".tr(), + style: TextStyle(fontSize: 18.sp, color: EaselAppTheme.kWhite), + ), + ), + ), + onVideoInitialized: (BuildContext context) => AspectRatio( + aspectRatio: easelProvider.videoPlayerController.value.aspectRatio, + child: VideoPlayer(easelProvider.videoPlayerController), + ), + easelProvider: easelProvider) + ], + if (shouldShowThumbnailButton()) ...[ + SizedBox( + height: 200.h, + child: VideoBuilder( onVideoLoading: (BuildContext context) => Center( child: SizedBox( height: 50.0.h, @@ -155,84 +172,47 @@ class VideoWidgetState extends State { ), ), onVideoHasError: (BuildContext context) => Center( - child: Padding( - padding: const EdgeInsets.all(10), - child: Text( - "video_player_error".tr(), - style: TextStyle( - fontSize: 18.sp, - color: EaselAppTheme.kWhite), - ), + child: Padding( + padding: const EdgeInsets.all(10), + child: Text( + "video_player_error".tr(), + style: TextStyle(fontSize: 18.sp, color: EaselAppTheme.kBlack), ), - ), - onVideoInitialized: (BuildContext context) => AspectRatio( - aspectRatio: easelProvider - .videoPlayerController.value.aspectRatio, - child: VideoPlayer( - easelProvider.videoPlayerController), - ), - easelProvider: easelProvider) - ], - if (shouldShowThumbnailButton()) ...[ - SizedBox( - height: 200.h, - child: VideoBuilder( - onVideoLoading: (BuildContext context) => Center( - child: SizedBox( - height: 50.0.h, - child: Image.asset( - kLoadingGif, + )), + onVideoInitialized: (BuildContext context) => Center( + child: Stack( + children: [ + AspectRatio( + aspectRatio: easelProvider.videoPlayerController.value.aspectRatio, + child: VideoPlayer(easelProvider.videoPlayerController), ), - ), + _buildVideoFullScreenIcon(), + ], ), - onVideoHasError: (BuildContext context) => Center( - child: Padding( - padding: const EdgeInsets.all(10), - child: Text( - "video_player_error".tr(), - style: TextStyle( - fontSize: 18.sp, - color: EaselAppTheme.kBlack), - ), - )), - onVideoInitialized: (BuildContext context) => Center( - child: Stack( - children: [ - AspectRatio( - aspectRatio: easelProvider - .videoPlayerController - .value - .aspectRatio, - child: VideoPlayer( - easelProvider.videoPlayerController), - ), - _buildVideoFullScreenIcon(), - ], - ), - ), - easelProvider: easelProvider), - ), - SizedBox( - height: 10.w, - ), - Padding( - padding: EdgeInsets.only(bottom: 70.h), - child: VideoProgressWidget( - darkMode: false, isForFile: widget.isForFile), - ), - ], + ), + easelProvider: easelProvider), + ), SizedBox( height: 10.w, ), - if (shouldShowThumbnailButton()) _buildThumbnailButton() else const SizedBox(), + Padding( + padding: EdgeInsets.only(bottom: 70.h), + child: VideoProgressWidget(darkMode: false, isForFile: widget.isForFile), + ), ], - ), + SizedBox( + height: 10.w, + ), + if (shouldShowThumbnailButton()) _buildThumbnailButton() else const SizedBox(), + ], ), )); } @override void dispose() { + easelProvider.stopVideoIfPlaying(); + easelProvider.setVideoThumbnail(null); easelProvider.disposeVideoController(); super.dispose(); } diff --git a/easel/pubspec.yaml b/easel/pubspec.yaml index d94cc58bb8..2d541ad5e5 100644 --- a/easel/pubspec.yaml +++ b/easel/pubspec.yaml @@ -32,7 +32,7 @@ dependencies: audio_video_progress_bar: ^1.0.0 auto_size_text: 3.0.0 bottom_drawer: ^0.0.5 - cached_network_image: ^3.1.0 + cached_network_image: collection: ^1.16.0 cupertino_icons: ^1.0.2 dartz: ^0.10.0 @@ -71,7 +71,7 @@ dependencies: provider: ^6.0.1 pylons_sdk: path: ../dart_sdk - share_plus: ^7.0.1 # Used for sharing the NFT link. + share_plus: shared_preferences: ^2.0.8 shimmer_animation: 2.1.0+1 sqflite: ^2.0.3+1 diff --git a/testapp-flutter/android/app/build.gradle b/testapp-flutter/android/app/build.gradle index 102542ab8d..b9fe5ca0c0 100644 --- a/testapp-flutter/android/app/build.gradle +++ b/testapp-flutter/android/app/build.gradle @@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 31 + compileSdkVersion 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -51,7 +51,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "tech.pylons.testapp_flutter" minSdkVersion 16 - targetSdkVersion 31 + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/wallet/android/app/build.gradle b/wallet/android/app/build.gradle index 8ad4ddf511..ba1c666c1e 100644 --- a/wallet/android/app/build.gradle +++ b/wallet/android/app/build.gradle @@ -28,7 +28,7 @@ apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' android { - compileSdkVersion 33 + compileSdkVersion 34 compileOptions { diff --git a/wallet/android/build.gradle b/wallet/android/build.gradle index 5bf4eeef0b..2c89f33026 100644 --- a/wallet/android/build.gradle +++ b/wallet/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.9.22' repositories { google() mavenCentral() diff --git a/wallet/devtools_options.yaml b/wallet/devtools_options.yaml new file mode 100644 index 0000000000..7e7e7f67de --- /dev/null +++ b/wallet/devtools_options.yaml @@ -0,0 +1 @@ +extensions: diff --git a/wallet/ios/Podfile b/wallet/ios/Podfile index 20ec412399..ba3e75d35a 100644 --- a/wallet/ios/Podfile +++ b/wallet/ios/Podfile @@ -42,6 +42,10 @@ post_install do |installer| config.build_settings['SWIFT_VERSION'] = '5.0' # required by simple_permission config.build_settings['ENABLE_BITCODE'] = 'NO' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' + xcconfig_path = config.base_configuration_reference.real_path + xcconfig = File.read(xcconfig_path) + xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR") + File.open(xcconfig_path, "w") { |file| file << xcconfig_mod } # Here are some configurations automatically generated by flutter diff --git a/wallet/ios/Runner.xcodeproj/project.pbxproj b/wallet/ios/Runner.xcodeproj/project.pbxproj index ef740201ca..b2f6f33c71 100644 --- a/wallet/ios/Runner.xcodeproj/project.pbxproj +++ b/wallet/ios/Runner.xcodeproj/project.pbxproj @@ -172,6 +172,7 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, CF928C1E0DCFC5A4D6CA1CDA /* [CP] Embed Pods Frameworks */, + A9B35EDB27B07E6A1784FF19 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -188,7 +189,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -301,6 +302,23 @@ shellPath = /bin/sh; shellScript = "\necho \"${CONFIGURATION}\"\necho \"${GOOGLE_SERVICE_PATH}\"\n\ncp -r \"${GOOGLE_SERVICE_PATH}\" \"${PROJECT_DIR}/Runner/GoogleService-Info.plist\"\n\necho \"Plist copied\"\n\n\nPLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app\necho \"Will copy ${GOOGLE_SERVICE_PATH} to final destination: ${PLIST_DESTINATION}\"\n\n\necho \"Using ${GOOGLE_SERVICE_PATH}\"\ncp \"${GOOGLE_SERVICE_PATH}\" \"${PLIST_DESTINATION}\"\n"; }; + A9B35EDB27B07E6A1784FF19 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; CF928C1E0DCFC5A4D6CA1CDA /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/wallet/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/wallet/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index f3d88aced0..4ba725f4c3 100644 --- a/wallet/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/wallet/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ WillPopScope( - onWillPop: () async => false, + builder: (ctx) => PopScope( + canPop: false, child: AlertDialog( elevation: 0, backgroundColor: Colors.transparent, diff --git a/wallet/lib/components/user_image_widget.dart b/wallet/lib/components/user_image_widget.dart index 769d39f8b5..38aacf13c2 100644 --- a/wallet/lib/components/user_image_widget.dart +++ b/wallet/lib/components/user_image_widget.dart @@ -36,15 +36,14 @@ abstract class UserImageWidget extends StatelessWidget { return defaultVal; } - file = File.fromUri(Uri.parse(imageEither.getOrElse(() => - ''))); // todo? - does this work when the URI points to a network file? + file = File.fromUri( + Uri.parse(imageEither.getOrElse(() => ''))); // todo? - does this work when the URI points to a network file? return FileImage(file); } @visibleForTesting - static void setToFile( - int filesizeLimit, String uriKey, File? file, BuildContext context) { + static void setToFile(int filesizeLimit, String uriKey, File? file, BuildContext context) { final userBanner = GetIt.I.get(); userBanner.setToFile(filesizeLimit, uriKey, file, context); } @@ -53,8 +52,7 @@ abstract class UserImageWidget extends StatelessWidget { class UserAvatarWidget extends UserImageWidget { final double radius; @visibleForTesting - static const filesizeLimit = - 1024 * 1024 * 4; // 4MB (this should always divide cleanly) + static const filesizeLimit = 1024 * 1024 * 4; // 4MB (this should always divide cleanly) @visibleForTesting static const resolutionLimitX = 2048; @visibleForTesting @@ -62,8 +60,7 @@ class UserAvatarWidget extends UserImageWidget { @visibleForTesting static const uriKey = "pylons_avatar_file_uri"; @visibleForTesting - static svg.Svg defaultImage = - svg.Svg(Assets.images.svg.userAvatar); // todo: sensible default avatar + static svg.Svg defaultImage = svg.Svg(Assets.images.svg.userAvatar); // todo: sensible default avatar const UserAvatarWidget({this.radius = 20}); @@ -95,24 +92,22 @@ class UserAvatarPickerWidget extends UserAvatarWidget { @override Widget build(BuildContext context) { - return StatefulBuilder(builder: - (BuildContext context, void Function(void Function()) setState) { + return StatefulBuilder(builder: (BuildContext context, void Function(void Function()) setState) { return GestureDetector( onTap: () async { final userInfoProvider = context.read(); final file = await pickImageFromGallery( - UserAvatarWidget.resolutionLimitX.toDouble(), - UserAvatarWidget.resolutionLimitY.toDouble(), - kImageQuality, - context); + UserAvatarWidget.resolutionLimitX.toDouble(), + UserAvatarWidget.resolutionLimitY.toDouble(), + kImageQuality, + context, + ); if (file == null) { return; } - final newImagePathEither = await GetIt.I - .get() - .saveImageInLocalDirectory(file.path); + final newImagePathEither = await GetIt.I.get().saveImageInLocalDirectory(file.path); if (newImagePathEither.isLeft()) { return; @@ -120,10 +115,11 @@ class UserAvatarPickerWidget extends UserAvatarWidget { // ignore: use_build_context_synchronously UserImageWidget.setToFile( - UserAvatarWidget.filesizeLimit, - UserAvatarWidget.uriKey, - File(newImagePathEither.getOrElse(() => '')), - context); + UserAvatarWidget.filesizeLimit, + UserAvatarWidget.uriKey, + File(newImagePathEither.getOrElse(() => '')), + context, + ); userInfoProvider.onImageChange(); @@ -143,8 +139,7 @@ class UserAvatarPickerWidget extends UserAvatarWidget { class UserBannerWidget extends UserImageWidget { final double height; @visibleForTesting - static const filesizeLimit = - 1024 * 1024 * 4; // 4MB (this should always divide cleanly) + static const filesizeLimit = 1024 * 1024 * 4; // 4MB (this should always divide cleanly) @visibleForTesting static const resolutionLimitX = 2048; @visibleForTesting @@ -162,8 +157,7 @@ class UserBannerWidget extends UserImageWidget { return ChangeNotifierProvider.value( value: userBannerViewModel, builder: (context, child) { - return Consumer( - builder: (context, viewModel, child) { + return Consumer(builder: (context, viewModel, child) { return Container( height: height, decoration: BoxDecoration( @@ -214,22 +208,21 @@ class UserBannerPickerWidget extends UserBannerWidget { @override Widget build(BuildContext context) { final viewModel = context.watch(); - return StatefulBuilder(builder: - (BuildContext context, void Function(void Function()) setState) { + return StatefulBuilder(builder: (BuildContext context, void Function(void Function()) setState) { return InkResponse( onTap: () async { final file = await pickImageFromGallery( - UserBannerWidget.resolutionLimitX.toDouble(), - UserBannerWidget.resolutionLimitY.toDouble(), - kImageQuality, - context); + UserBannerWidget.resolutionLimitX.toDouble(), + UserBannerWidget.resolutionLimitY.toDouble(), + kImageQuality, + context, + ); if (file == null) { return; } - final newImagePathEither = - await repository.saveImageInLocalDirectory(file.path); + final newImagePathEither = await repository.saveImageInLocalDirectory(file.path); if (newImagePathEither.isLeft()) { return; @@ -237,10 +230,11 @@ class UserBannerPickerWidget extends UserBannerWidget { // ignore: use_build_context_synchronously UserImageWidget.setToFile( - UserBannerWidget.filesizeLimit, - UserBannerWidget.uriKey, - File(newImagePathEither.getOrElse(() => '')), - context); + UserBannerWidget.filesizeLimit, + UserBannerWidget.uriKey, + File(newImagePathEither.getOrElse(() => '')), + context, + ); final int brightness = getBrightness(file); final bool isBannerDark = getIsBannerDark(brightness); diff --git a/wallet/lib/ipc/widgets/sdk_approval_dialog.dart b/wallet/lib/ipc/widgets/sdk_approval_dialog.dart index c278fce628..4cd53de278 100644 --- a/wallet/lib/ipc/widgets/sdk_approval_dialog.dart +++ b/wallet/lib/ipc/widgets/sdk_approval_dialog.dart @@ -24,8 +24,8 @@ class SDKApprovalDialog { barrierColor: Colors.transparent, builder: (_) { final screenSize = ScreenSizeUtil(_); - return WillPopScope( - onWillPop: () async => false, + return PopScope( + canPop: false, child: Stack( fit: StackFit.passthrough, children: [ diff --git a/wallet/lib/pages/detailed_asset_view/owner_view.dart b/wallet/lib/pages/detailed_asset_view/owner_view.dart index c391e1dd3f..14613a239a 100644 --- a/wallet/lib/pages/detailed_asset_view/owner_view.dart +++ b/wallet/lib/pages/detailed_asset_view/owner_view.dart @@ -67,20 +67,19 @@ class _OwnerViewState extends State { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - ownerViewViewModel.destroyPlayers(); - return true; - }, - child: ChangeNotifierProvider.value( - value: ownerViewViewModel, - builder: (_, __) => Scaffold( - backgroundColor: AppColors.kBlack, - body: const OwnerViewContent(), - ), + return ChangeNotifierProvider.value( + value: ownerViewViewModel, + builder: (_, __) => Scaffold( + backgroundColor: AppColors.kBlack, + body: const OwnerViewContent(), ), ); } + @override + void dispose() { + ownerViewViewModel.destroyPlayers(); + super.dispose(); + } } class OwnerViewContent extends StatefulWidget { diff --git a/wallet/lib/pages/detailed_asset_view/widgets/create_trade_bottom_sheet.dart b/wallet/lib/pages/detailed_asset_view/widgets/create_trade_bottom_sheet.dart index b530588021..65e244abdb 100644 --- a/wallet/lib/pages/detailed_asset_view/widgets/create_trade_bottom_sheet.dart +++ b/wallet/lib/pages/detailed_asset_view/widgets/create_trade_bottom_sheet.dart @@ -61,185 +61,180 @@ class _CreateTradeBottomSheetWidget extends StatefulWidget { class __CreateTradeBottomSheetWidgetState extends State<_CreateTradeBottomSheetWidget> { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - return true; - }, - child: Container( - key: const Key(kForSaleBottomSheetKey), - padding: EdgeInsets.only( - left: 18.w, - right: 18.w, - top: 10.h, - bottom: 10.h + MediaQuery.of(context).viewInsets.bottom, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.topRight, - child: GestureDetector( - onTap: () { - Navigator.of(context).pop(); - }, - child: Image.asset( - ImageUtil.CLOSE_ICON, - width: 25.w, - height: 25.h, - ), - ), - ), - Align( - child: Text( - LocaleKeys.sell_your_nft.tr(), - style: TextStyle( - color: AppColors.kDarkPurple, - fontSize: 15.sp, - fontFamily: kUniversalFontFamily, - fontWeight: FontWeight.w800, - ), + return Container( + key: const Key(kForSaleBottomSheetKey), + padding: EdgeInsets.only( + left: 18.w, + right: 18.w, + top: 10.h, + bottom: 10.h + MediaQuery.of(context).viewInsets.bottom, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topRight, + child: GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Image.asset( + ImageUtil.CLOSE_ICON, + width: 25.w, + height: 25.h, ), ), - SizedBox( - height: 20.h, - ), - Text( - LocaleKeys.payment_type.tr(), + ), + Align( + child: Text( + LocaleKeys.sell_your_nft.tr(), style: TextStyle( color: AppColors.kDarkPurple, - fontSize: 12.sp, + fontSize: 15.sp, fontFamily: kUniversalFontFamily, fontWeight: FontWeight.w800, ), ), - SizedBox( - height: 7.h, + ), + SizedBox( + height: 20.h, + ), + Text( + LocaleKeys.payment_type.tr(), + style: TextStyle( + color: AppColors.kDarkPurple, + fontSize: 12.sp, + fontFamily: kUniversalFontFamily, + fontWeight: FontWeight.w800, ), - ClipPath( - clipper: ToggleClipper(), - child: Container( - width: double.maxFinite, - height: 35.h, - decoration: BoxDecoration(color: AppColors.kGreyLight), - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), - child: TextFormField( - style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: AppColors.kTextBlackColor), - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - LengthLimitingTextInputFormatter(2), - ], - onChanged: (str) {}, - decoration: InputDecoration( - hintText: LocaleKeys.editions_are_sold_sequentially.tr(), - hintStyle: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w400, - color: AppColors.kUserInputTextColor, - ), - border: const OutlineInputBorder(borderSide: BorderSide.none), - floatingLabelBehavior: FloatingLabelBehavior.always, - contentPadding: EdgeInsets.fromLTRB(0, 0, 10.w, 0), + ), + SizedBox( + height: 7.h, + ), + ClipPath( + clipper: ToggleClipper(), + child: Container( + width: double.maxFinite, + height: 35.h, + decoration: BoxDecoration(color: AppColors.kGreyLight), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), + child: TextFormField( + style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: AppColors.kTextBlackColor), + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + LengthLimitingTextInputFormatter(2), + ], + onChanged: (str) {}, + decoration: InputDecoration( + hintText: LocaleKeys.editions_are_sold_sequentially.tr(), + hintStyle: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w400, + color: AppColors.kUserInputTextColor, ), + border: const OutlineInputBorder(borderSide: BorderSide.none), + floatingLabelBehavior: FloatingLabelBehavior.always, + contentPadding: EdgeInsets.fromLTRB(0, 0, 10.w, 0), ), ), ), - SizedBox( - height: 5.h, - ), - // Align( - // alignment: Alignment.centerRight, - // child: Text( - // "${ownerViewViewModel.nft.quantity - ownerViewViewModel.nft.amountMinted} ${LocaleKeys.available.tr()}", - // style: TextStyle( - // color: AppColors.kHashtagColor, - // fontSize: 12.sp, - // fontFamily: kUniversalFontFamily, - // fontWeight: FontWeight.w800, - // ), - // ), - // ), - SizedBox( - height: 20.h, - ), - Text( - LocaleKeys.price_per_edition.tr(), - style: TextStyle( - color: AppColors.kDarkPurple, - fontSize: 12.sp, - fontFamily: kUniversalFontFamily, - fontWeight: FontWeight.w800, - ), - ), - SizedBox( - height: 7.h, + ), + SizedBox( + height: 5.h, + ), + // Align( + // alignment: Alignment.centerRight, + // child: Text( + // "${ownerViewViewModel.nft.quantity - ownerViewViewModel.nft.amountMinted} ${LocaleKeys.available.tr()}", + // style: TextStyle( + // color: AppColors.kHashtagColor, + // fontSize: 12.sp, + // fontFamily: kUniversalFontFamily, + // fontWeight: FontWeight.w800, + // ), + // ), + // ), + SizedBox( + height: 20.h, + ), + Text( + LocaleKeys.price_per_edition.tr(), + style: TextStyle( + color: AppColors.kDarkPurple, + fontSize: 12.sp, + fontFamily: kUniversalFontFamily, + fontWeight: FontWeight.w800, ), - ClipPath( - clipper: ToggleClipper(), - child: Container( - width: double.maxFinite, - height: 35.h, - decoration: BoxDecoration(color: AppColors.kGreyLight), - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), - child: TextFormField( - style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: AppColors.kTextBlackColor), - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - DollarSignFormatter(maxDigits: kMaxPriceLength), - LengthLimitingTextInputFormatter(kMaxPriceLength), - ], - decoration: InputDecoration( - hintText: LocaleKeys.enter_whole_dollar_amount.tr(), - hintStyle: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w400, - color: AppColors.kUserInputTextColor, - ), - border: const OutlineInputBorder(borderSide: BorderSide.none), - floatingLabelBehavior: FloatingLabelBehavior.always, - contentPadding: EdgeInsets.fromLTRB(0, 0, 10.w, 0), + ), + SizedBox( + height: 7.h, + ), + ClipPath( + clipper: ToggleClipper(), + child: Container( + width: double.maxFinite, + height: 35.h, + decoration: BoxDecoration(color: AppColors.kGreyLight), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), + child: TextFormField( + style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: AppColors.kTextBlackColor), + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + DollarSignFormatter(maxDigits: kMaxPriceLength), + LengthLimitingTextInputFormatter(kMaxPriceLength), + ], + decoration: InputDecoration( + hintText: LocaleKeys.enter_whole_dollar_amount.tr(), + hintStyle: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w400, + color: AppColors.kUserInputTextColor, ), + border: const OutlineInputBorder(borderSide: BorderSide.none), + floatingLabelBehavior: FloatingLabelBehavior.always, + contentPadding: EdgeInsets.fromLTRB(0, 0, 10.w, 0), ), ), ), - SizedBox( - height: 7.h, - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: LocaleKeys.network_fee_required.tr(), - style: TextStyle( - color: AppColors.kHashtagColor, - fontSize: 12.sp, - fontFamily: kUniversalFontFamily, - fontWeight: FontWeight.w800, - ), - ), - TextSpan( - text: " ${LocaleKeys.learn_more.tr()}", - style: TextStyle(color: AppColors.kEmoneyColor, fontSize: 12.sp, fontWeight: FontWeight.bold), + ), + SizedBox( + height: 7.h, + ), + RichText( + text: TextSpan( + children: [ + TextSpan( + text: LocaleKeys.network_fee_required.tr(), + style: TextStyle( + color: AppColors.kHashtagColor, + fontSize: 12.sp, + fontFamily: kUniversalFontFamily, + fontWeight: FontWeight.w800, ), - ], - ), - ), - SizedBox( - height: 35.h, + ), + TextSpan( + text: " ${LocaleKeys.learn_more.tr()}", + style: TextStyle(color: AppColors.kEmoneyColor, fontSize: 12.sp, fontWeight: FontWeight.bold), + ), + ], ), - SwipeRightToSellButton( - activeColor: AppColors.kDarkGreen, - height: 40.h, - initialWidth: 40.w, - isEnabled: true, - onSwipeComplete: () { - createTrade(); - }, - ) - ], - ), + ), + SizedBox( + height: 35.h, + ), + SwipeRightToSellButton( + activeColor: AppColors.kDarkGreen, + height: 40.h, + initialWidth: 40.w, + isEnabled: true, + onSwipeComplete: () { + createTrade(); + }, + ) + ], ), ); } diff --git a/wallet/lib/pages/detailed_asset_view/widgets/for_sale_bottom_sheet.dart b/wallet/lib/pages/detailed_asset_view/widgets/for_sale_bottom_sheet.dart index 2dd74ebca4..20d3e781a9 100644 --- a/wallet/lib/pages/detailed_asset_view/widgets/for_sale_bottom_sheet.dart +++ b/wallet/lib/pages/detailed_asset_view/widgets/for_sale_bottom_sheet.dart @@ -57,260 +57,255 @@ class _ForSaleBottomSheetWidgetState extends State<_ForSaleBottomSheetWidget> { @override Widget build(BuildContext context) { final ownerViewViewModel = context.watch(); - return WillPopScope( - onWillPop: () async { - return true; - }, - child: Container( - key: const Key(kForSaleBottomSheetKey), - padding: EdgeInsets.only( - left: 18.w, - right: 18.w, - top: 10.h, - bottom: 10.h + MediaQuery.of(context).viewInsets.bottom, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Align( - alignment: Alignment.topRight, - child: GestureDetector( - onTap: () { - Navigator.of(context).pop(); - }, - child: Image.asset( - ImageUtil.CLOSE_ICON, - width: 25.w, - height: 25.h, - ), - ), - ), - Align( - child: Text( - LocaleKeys.sell_your_nft.tr(), - style: TextStyle( - color: AppColors.kDarkPurple, - fontSize: 15.sp, - fontFamily: kUniversalFontFamily, - fontWeight: FontWeight.w800, - ), + return Container( + key: const Key(kForSaleBottomSheetKey), + padding: EdgeInsets.only( + left: 18.w, + right: 18.w, + top: 10.h, + bottom: 10.h + MediaQuery.of(context).viewInsets.bottom, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Align( + alignment: Alignment.topRight, + child: GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Image.asset( + ImageUtil.CLOSE_ICON, + width: 25.w, + height: 25.h, ), ), - SizedBox( - height: 20.h, - ), - Text( - LocaleKeys.payment_type.tr(), + ), + Align( + child: Text( + LocaleKeys.sell_your_nft.tr(), style: TextStyle( color: AppColors.kDarkPurple, - fontSize: 12.sp, + fontSize: 15.sp, fontFamily: kUniversalFontFamily, fontWeight: FontWeight.w800, ), ), - SizedBox( - height: 7.h, + ), + SizedBox( + height: 20.h, + ), + Text( + LocaleKeys.payment_type.tr(), + style: TextStyle( + color: AppColors.kDarkPurple, + fontSize: 12.sp, + fontFamily: kUniversalFontFamily, + fontWeight: FontWeight.w800, ), - Container( - decoration: BoxDecoration( - border: Border.all(color: AppColors.kDarkPurple, width: 3), - ), - padding: const EdgeInsets.all(3), - child: Row( - children: [ - Expanded( - child: ClipPath( - clipper: ToggleClipper(), - child: GestureDetector( - onTap: () { - }, - child: Container( - decoration: const BoxDecoration( - ), - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), - child: Text( - LocaleKeys.credits.tr(), - textAlign: TextAlign.center, - style: TextStyle( - color: AppColors.kGreyColor, - fontWeight: FontWeight.bold, - ), + ), + SizedBox( + height: 7.h, + ), + Container( + decoration: BoxDecoration( + border: Border.all(color: AppColors.kDarkPurple, width: 3), + ), + padding: const EdgeInsets.all(3), + child: Row( + children: [ + Expanded( + child: ClipPath( + clipper: ToggleClipper(), + child: GestureDetector( + onTap: () { + }, + child: Container( + decoration: const BoxDecoration( + ), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), + child: Text( + LocaleKeys.credits.tr(), + textAlign: TextAlign.center, + style: TextStyle( + color: AppColors.kGreyColor, + fontWeight: FontWeight.bold, ), ), ), ), ), - SizedBox( - width: 1.w, - ), - Expanded( - child: ClipPath( - clipper: BottomLeftCurvedCorner(cuttingEdge: 10), - child: GestureDetector( - onTap: () { - }, - child: Container( - decoration: BoxDecoration( - color: AppColors.kTransparentColor, - ), - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), - child: Text( - LocaleKeys.cash.tr(), - textAlign: TextAlign.center, - style: TextStyle( - color: AppColors.kGreyColor, - fontWeight: FontWeight.bold, - ), + ), + SizedBox( + width: 1.w, + ), + Expanded( + child: ClipPath( + clipper: BottomLeftCurvedCorner(cuttingEdge: 10), + child: GestureDetector( + onTap: () { + }, + child: Container( + decoration: BoxDecoration( + color: AppColors.kTransparentColor, + ), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), + child: Text( + LocaleKeys.cash.tr(), + textAlign: TextAlign.center, + style: TextStyle( + color: AppColors.kGreyColor, + fontWeight: FontWeight.bold, ), ), ), ), ), - ], - ), - ), - SizedBox( - height: 20.h, - ), - Text( - LocaleKeys.no_of_editions.tr(), - style: TextStyle( - color: AppColors.kDarkPurple, - fontSize: 12.sp, - fontFamily: kUniversalFontFamily, - fontWeight: FontWeight.w800, - ), - ), - SizedBox( - height: 7.h, - ), - ClipPath( - clipper: ToggleClipper(), - child: Container( - width: double.maxFinite, - height: 35.h, - decoration: BoxDecoration(color: AppColors.kGreyLight), - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), - child: TextFormField( - style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: AppColors.kTextBlackColor), - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - LengthLimitingTextInputFormatter(2), - ], - onChanged: (str) { - - }, - decoration: InputDecoration( - hintText: LocaleKeys.editions_are_sold_sequentially.tr(), - hintStyle: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w400, - color: AppColors.kUserInputTextColor, - ), - border: const OutlineInputBorder(borderSide: BorderSide.none), - floatingLabelBehavior: FloatingLabelBehavior.always, - contentPadding: EdgeInsets.fromLTRB(0, 0, 10.w, 0), - ), ), - ), + ], ), - SizedBox( - height: 5.h, + ), + SizedBox( + height: 20.h, + ), + Text( + LocaleKeys.no_of_editions.tr(), + style: TextStyle( + color: AppColors.kDarkPurple, + fontSize: 12.sp, + fontFamily: kUniversalFontFamily, + fontWeight: FontWeight.w800, ), - Align( - alignment: Alignment.centerRight, - child: Text( - "${ownerViewViewModel.nft.quantity - ownerViewViewModel.nft.amountMinted} ${LocaleKeys.available.tr()}", - style: TextStyle( - color: AppColors.kHashtagColor, - fontSize: 12.sp, - fontFamily: kUniversalFontFamily, - fontWeight: FontWeight.w800, + ), + SizedBox( + height: 7.h, + ), + ClipPath( + clipper: ToggleClipper(), + child: Container( + width: double.maxFinite, + height: 35.h, + decoration: BoxDecoration(color: AppColors.kGreyLight), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), + child: TextFormField( + style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: AppColors.kTextBlackColor), + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + LengthLimitingTextInputFormatter(2), + ], + onChanged: (str) { + + }, + decoration: InputDecoration( + hintText: LocaleKeys.editions_are_sold_sequentially.tr(), + hintStyle: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w400, + color: AppColors.kUserInputTextColor, + ), + border: const OutlineInputBorder(borderSide: BorderSide.none), + floatingLabelBehavior: FloatingLabelBehavior.always, + contentPadding: EdgeInsets.fromLTRB(0, 0, 10.w, 0), ), ), ), - SizedBox( - height: 20.h, - ), - Text( - LocaleKeys.price_per_edition.tr(), + ), + SizedBox( + height: 5.h, + ), + Align( + alignment: Alignment.centerRight, + child: Text( + "${ownerViewViewModel.nft.quantity - ownerViewViewModel.nft.amountMinted} ${LocaleKeys.available.tr()}", style: TextStyle( - color: AppColors.kDarkPurple, + color: AppColors.kHashtagColor, fontSize: 12.sp, fontFamily: kUniversalFontFamily, fontWeight: FontWeight.w800, ), ), - SizedBox( - height: 7.h, + ), + SizedBox( + height: 20.h, + ), + Text( + LocaleKeys.price_per_edition.tr(), + style: TextStyle( + color: AppColors.kDarkPurple, + fontSize: 12.sp, + fontFamily: kUniversalFontFamily, + fontWeight: FontWeight.w800, ), - ClipPath( - clipper: ToggleClipper(), - child: Container( - width: double.maxFinite, - height: 35.h, - decoration: BoxDecoration(color: AppColors.kGreyLight), - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), - child: TextFormField( - style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: AppColors.kTextBlackColor), - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - DollarSignFormatter(maxDigits: kMaxPriceLength), - LengthLimitingTextInputFormatter(kMaxPriceLength), - ], - decoration: InputDecoration( - hintText: LocaleKeys.enter_whole_dollar_amount.tr(), - hintStyle: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w400, - color: AppColors.kUserInputTextColor, - ), - border: const OutlineInputBorder(borderSide: BorderSide.none), - floatingLabelBehavior: FloatingLabelBehavior.always, - contentPadding: EdgeInsets.fromLTRB(0, 0, 10.w, 0), + ), + SizedBox( + height: 7.h, + ), + ClipPath( + clipper: ToggleClipper(), + child: Container( + width: double.maxFinite, + height: 35.h, + decoration: BoxDecoration(color: AppColors.kGreyLight), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 7.h), + child: TextFormField( + style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: AppColors.kTextBlackColor), + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + DollarSignFormatter(maxDigits: kMaxPriceLength), + LengthLimitingTextInputFormatter(kMaxPriceLength), + ], + decoration: InputDecoration( + hintText: LocaleKeys.enter_whole_dollar_amount.tr(), + hintStyle: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w400, + color: AppColors.kUserInputTextColor, ), + border: const OutlineInputBorder(borderSide: BorderSide.none), + floatingLabelBehavior: FloatingLabelBehavior.always, + contentPadding: EdgeInsets.fromLTRB(0, 0, 10.w, 0), ), ), ), - SizedBox( - height: 7.h, - ), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: LocaleKeys.network_fee_required.tr(), - style: TextStyle( - color: AppColors.kHashtagColor, - fontSize: 12.sp, - fontFamily: kUniversalFontFamily, - fontWeight: FontWeight.w800, - ), + ), + SizedBox( + height: 7.h, + ), + RichText( + text: TextSpan( + children: [ + TextSpan( + text: LocaleKeys.network_fee_required.tr(), + style: TextStyle( + color: AppColors.kHashtagColor, + fontSize: 12.sp, + fontFamily: kUniversalFontFamily, + fontWeight: FontWeight.w800, ), - TextSpan( - text: " ${LocaleKeys.learn_more.tr()}", - style: TextStyle(color: AppColors.kEmoneyColor, fontSize: 12.sp, fontWeight: FontWeight.bold), - ), - ], - ), - ), - SizedBox( - height: 35.h, + ), + TextSpan( + text: " ${LocaleKeys.learn_more.tr()}", + style: TextStyle(color: AppColors.kEmoneyColor, fontSize: 12.sp, fontWeight: FontWeight.bold), + ), + ], ), - SwipeRightToSellButton( - activeColor: AppColors.kDarkGreen, - height: 40.h, - initialWidth: 40.w, - isEnabled: true, - onSwipeComplete: () { - - }, - ) - ], - ), + ), + SizedBox( + height: 35.h, + ), + SwipeRightToSellButton( + activeColor: AppColors.kDarkGreen, + height: 40.h, + initialWidth: 40.w, + isEnabled: true, + onSwipeComplete: () { + + }, + ) + ], ), ); } diff --git a/wallet/lib/pages/detailed_asset_view/widgets/nft_not_for_sale_dialog.dart b/wallet/lib/pages/detailed_asset_view/widgets/nft_not_for_sale_dialog.dart index 51179a5ce0..a84737c385 100644 --- a/wallet/lib/pages/detailed_asset_view/widgets/nft_not_for_sale_dialog.dart +++ b/wallet/lib/pages/detailed_asset_view/widgets/nft_not_for_sale_dialog.dart @@ -54,95 +54,89 @@ class NFTForSaleConfirmationWidget extends StatefulWidget { class _NFTForSaleConfirmationWidgetState extends State { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - Navigator.pop(context); - return false; - }, - child: Container( - key: const Key(kNotForSaleDialogKey), - color: Colors.black.withOpacity(0.7), - height: 250.h, - width: isTablet ? 200.w : 270.w, - margin: isTablet ? EdgeInsets.symmetric(horizontal: 30.w) : EdgeInsets.zero, - child: Stack( - children: [ - Positioned( - right: 0, - top: 0, - child: SizedBox( - height: 60.h, - width: 80.w, - child: ClipPath( - clipper: RightTriangleClipper(orientation: enums.Orientation.Orientation_SW), - child: Container( - color: AppColors.kDarkRed, - alignment: Alignment.topRight, - child: GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: EdgeInsets.only(right: isTablet ? 2.w : 5.w, top: 5.h), - child: Icon( - Icons.close, - color: Colors.white, - size: 20.h, - ), + return Container( + key: const Key(kNotForSaleDialogKey), + color: Colors.black.withOpacity(0.7), + height: 250.h, + width: isTablet ? 200.w : 270.w, + margin: isTablet ? EdgeInsets.symmetric(horizontal: 30.w) : EdgeInsets.zero, + child: Stack( + children: [ + Positioned( + right: 0, + top: 0, + child: SizedBox( + height: 60.h, + width: 80.w, + child: ClipPath( + clipper: RightTriangleClipper(orientation: enums.Orientation.Orientation_SW), + child: Container( + color: AppColors.kDarkRed, + alignment: Alignment.topRight, + child: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: EdgeInsets.only(right: isTablet ? 2.w : 5.w, top: 5.h), + child: Icon( + Icons.close, + color: Colors.white, + size: 20.h, ), ), ), ), ), ), - Positioned( - left: 0, - right: 0, - top: 0, - bottom: 0, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 20.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - SizedBox( + ), + Positioned( + left: 0, + right: 0, + top: 0, + bottom: 0, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SizedBox( + height: 40.h, + ), + Text( + LocaleKeys.confirmation.tr(), + textAlign: TextAlign.center, + style: TextStyle(color: AppColors.kWhite, fontSize: 18.sp, fontWeight: FontWeight.w700), + ), + SizedBox( + height: 30.h, + ), + Text( + LocaleKeys.delist_confirmation_msg.tr(), + textAlign: TextAlign.center, + style: TextStyle(color: AppColors.kWhite, fontSize: 15.sp, fontWeight: FontWeight.normal), + ), + SizedBox( + height: 30.h, + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 20.w), + child: PylonsPayWithSwipe( + activeColor: AppColors.kDarkRed, + inactiveColor: AppColors.kPayNowBackgroundGrey, height: 40.h, + initialWidth: 40.w, + onSwipeComplete: () {}, ), - Text( - LocaleKeys.confirmation.tr(), - textAlign: TextAlign.center, - style: TextStyle(color: AppColors.kWhite, fontSize: 18.sp, fontWeight: FontWeight.w700), - ), - SizedBox( - height: 30.h, - ), - Text( - LocaleKeys.delist_confirmation_msg.tr(), - textAlign: TextAlign.center, - style: TextStyle(color: AppColors.kWhite, fontSize: 15.sp, fontWeight: FontWeight.normal), - ), - SizedBox( - height: 30.h, - ), - Container( - padding: EdgeInsets.symmetric(horizontal: 20.w), - child: PylonsPayWithSwipe( - activeColor: AppColors.kDarkRed, - inactiveColor: AppColors.kPayNowBackgroundGrey, - height: 40.h, - initialWidth: 40.w, - onSwipeComplete: () {}, - ), - ), - SizedBox( - height: 30.h, - ), - ], - ), + ), + SizedBox( + height: 30.h, + ), + ], ), - ) - ], - ), + ), + ) + ], ), ); } diff --git a/wallet/lib/pages/home/home.dart b/wallet/lib/pages/home/home.dart index 1e79753dc8..2d363d5007 100644 --- a/wallet/lib/pages/home/home.dart +++ b/wallet/lib/pages/home/home.dart @@ -110,21 +110,18 @@ class HomeScreenState extends State with SingleTickerProviderStateMi quarterTurns: 0, child: ColoredBox( color: AppColors.kMainBG, - child: WillPopScope( - onWillPop: () async => false, - child: DefaultTabController( - length: tabLen, - child: Scaffold( - key: _scaffoldKey, - backgroundColor: AppColors.kMainBG, - drawer: const PylonsDrawer( - key: Key(drawerKey), - ), - appBar: buildAppBar(context, provider), - body: pages[provider.selectedIndex], - bottomSheet: - remoteConfigService.getMaintenanceMode() ? const MaintenanceModeMessageWidget() : null, + child: DefaultTabController( + length: tabLen, + child: Scaffold( + key: _scaffoldKey, + backgroundColor: AppColors.kMainBG, + drawer: const PylonsDrawer( + key: Key(drawerKey), ), + appBar: buildAppBar(context, provider), + body: pages[provider.selectedIndex], + bottomSheet: + remoteConfigService.getMaintenanceMode() ? const MaintenanceModeMessageWidget() : null, ), ), ), diff --git a/wallet/lib/pages/purchase_item/purchase_item_screen.dart b/wallet/lib/pages/purchase_item/purchase_item_screen.dart index 1a4defd79d..84d7e530c4 100644 --- a/wallet/lib/pages/purchase_item/purchase_item_screen.dart +++ b/wallet/lib/pages/purchase_item/purchase_item_screen.dart @@ -38,7 +38,6 @@ import 'package:pylons_wallet/utils/image_util.dart'; import 'package:pylons_wallet/utils/read_more.dart'; import 'package:pylons_wallet/utils/route_util.dart'; - import '../../generated/locale_keys.g.dart'; import '../../modules/Pylonstech.pylons.pylons/module/client/pylons/execution.pb.dart'; @@ -70,15 +69,16 @@ class _PurchaseItemScreenState extends State { Widget build(BuildContext context) { return ChangeNotifierProvider.value( value: viewModel, - child: WillPopScope( - onWillPop: () async { - viewModel.destroyPlayers(); - return true; - }, - child: const PurchaseItemContent(), - ), + child: const PurchaseItemContent(), ); } + + @override + void dispose() { + viewModel.destroyPlayers(); + + super.dispose(); + } } class PurchaseItemContent extends StatefulWidget { diff --git a/wallet/lib/pages/stripe_screen.dart b/wallet/lib/pages/stripe_screen.dart index 9d5143c5e4..b104e69f3f 100644 --- a/wallet/lib/pages/stripe_screen.dart +++ b/wallet/lib/pages/stripe_screen.dart @@ -59,11 +59,9 @@ class _StripeScreenState extends State { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - backHistory(context); - return false; - }, + return PopScope( + canPop: false, + onPopInvoked: (_) => backHistory(context), child: SafeArea( child: Scaffold( resizeToAvoidBottomInset: true, diff --git a/wallet/lib/pages/transaction_failure_manager/local_transaction_detail_screen.dart b/wallet/lib/pages/transaction_failure_manager/local_transaction_detail_screen.dart index 325c1c595f..4573c680ff 100644 --- a/wallet/lib/pages/transaction_failure_manager/local_transaction_detail_screen.dart +++ b/wallet/lib/pages/transaction_failure_manager/local_transaction_detail_screen.dart @@ -18,11 +18,17 @@ import 'package:pylons_wallet/utils/extension.dart'; import '../../generated/locale_keys.g.dart'; -TextStyle _titleTextStyle = TextStyle(color: AppColors.kBlack, fontFamily: kUniversalFontFamily, fontWeight: FontWeight.bold, fontSize: 20.sp); +TextStyle _titleTextStyle = TextStyle( + color: AppColors.kBlack, + fontFamily: kUniversalFontFamily, + fontWeight: FontWeight.bold, + fontSize: 20.sp, +); class LocalTransactionDetailScreen extends StatefulWidget { - const LocalTransactionDetailScreen({super.key}); + const LocalTransactionDetailScreen({super.key, required this.localTransactionModel}); + final LocalTransactionModel localTransactionModel; @override State createState() => _LocalTransactionDetailScreenState(); } @@ -121,7 +127,9 @@ class _LocalTransactionDetailScreenState extends State TransactionResponse.initial()).hash, - transaction: '', + return setUserNameFunction( + info: info, + walletCreationModel: walletCreationModel, + customTransactionSigningGateway: customTransactionSigningGateway, + username: username, + maxTries: 2, + accountCreationResult: accountCreationResult, ); } catch (error) { await deleteAccountCredentials(customTransactionSigningGateway, walletCreationModel.creds.publicInfo); @@ -166,6 +157,44 @@ class WalletsStoreImp implements WalletsStore { ); } + Future setUserNameFunction({ + required AccountPublicInfo info, + required WalletCreationModel walletCreationModel, + required CustomTransactionSigningGateway customTransactionSigningGateway, + required String username, + required int maxTries, + required Either accountCreationResult, + }) async { + int tries = 0; + + while (true) { + final setUserNameResult = await repository.setUserName( + accountPublicInfo: info, + address: walletCreationModel.creatorAddress.toString(), + username: username, + ); + + if (setUserNameResult.isLeft()) { + if (tries > maxTries) { + await deleteAccountCredentials(customTransactionSigningGateway, info); + return SdkIpcResponse.failure( + sender: '', + error: setUserNameResult.swap().toOption().toNullable().toString(), + errorCode: HandlerFactory.ERR_SOMETHING_WENT_WRONG, + ); + } else { + tries++; + } + } else { + return SdkIpcResponse.success( + sender: '', + data: accountCreationResult.getOrElse(() => TransactionResponse.initial()).hash, + transaction: '', + ); + } + } + } + Future> deleteAccountCredentials( CustomTransactionSigningGateway customTransactionSigningGateway, AccountPublicInfo info, @@ -335,14 +364,15 @@ class WalletsStoreImp implements WalletsStore { required String transactionDescription, }) { final LocalTransactionModel txManager = LocalTransactionModel( - transactionType: transactionTypeEnum.name, - transactionData: transactionData, - transactionCurrency: transactionCurrency, - transactionPrice: transactionPrice, - transactionDescription: transactionDescription, - transactionHash: "", - dateTime: DateTime.now().millisecondsSinceEpoch, - status: TransactionStatus.Undefined.name); + transactionType: transactionTypeEnum.name, + transactionData: transactionData, + transactionCurrency: transactionCurrency, + transactionPrice: transactionPrice, + transactionDescription: transactionDescription, + transactionHash: "", + dateTime: DateTime.now().millisecondsSinceEpoch, + status: TransactionStatus.Undefined.name, + ); return txManager; } diff --git a/wallet/lib/utils/route_util.dart b/wallet/lib/utils/route_util.dart index 0b29aa77d7..194caab143 100644 --- a/wallet/lib/utils/route_util.dart +++ b/wallet/lib/utils/route_util.dart @@ -5,6 +5,7 @@ import 'package:pylons_wallet/pages/settings/screens/general_screen/general_scre import 'package:pylons_wallet/pages/settings/screens/recovery_screen/recovery_screen.dart'; import '../model/nft.dart'; +import '../model/transaction_failure_model.dart'; import '../pages/detailed_asset_view/owner_view.dart'; import '../pages/detailed_asset_view/widgets/pdf_viewer_full_screen.dart'; import '../pages/home/home.dart'; @@ -100,7 +101,12 @@ class RouteUtil { return createRoute(const SizedBox()); case Routes.localTransactionDetails: - return createRoute(const LocalTransactionDetailScreen()); + if (settings.arguments != null && settings.arguments is LocalTransactionModel) { + return createRoute(LocalTransactionDetailScreen( + localTransactionModel: settings.arguments as LocalTransactionModel, + )); + } + break; case Routes.fallback: return createRoute(const SizedBox()); case Routes.transactionHistory: diff --git a/wallet/macos/Flutter/GeneratedPluginRegistrant.swift b/wallet/macos/Flutter/GeneratedPluginRegistrant.swift index 68639d0ba8..330e80cb6c 100644 --- a/wallet/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/wallet/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,6 +8,7 @@ import Foundation import audio_session import biometric_storage import cloud_firestore +import file_selector_macos import firebase_analytics import firebase_app_check import firebase_core @@ -16,6 +17,7 @@ import firebase_messaging import firebase_remote_config import flutter_local_notifications import flutter_secure_storage_macos +import google_sign_in_ios import icloud_storage import in_app_purchase_storekit import just_audio @@ -25,11 +27,13 @@ import share_plus import shared_preferences_foundation import sqflite import url_launcher_macos +import video_player_avfoundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) BiometricStorageMacOSPlugin.register(with: registry.registrar(forPlugin: "BiometricStorageMacOSPlugin")) FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) + FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FLTFirebaseAnalyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAnalyticsPlugin")) FLTFirebaseAppCheckPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAppCheckPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) @@ -38,6 +42,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLTFirebaseRemoteConfigPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseRemoteConfigPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) + FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) IcloudStoragePlugin.register(with: registry.registrar(forPlugin: "IcloudStoragePlugin")) InAppPurchasePlugin.register(with: registry.registrar(forPlugin: "InAppPurchasePlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) @@ -47,4 +52,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) } diff --git a/wallet/pkgs/alan/pubspec.yaml b/wallet/pkgs/alan/pubspec.yaml index 15cf557b0b..ea49896895 100644 --- a/wallet/pkgs/alan/pubspec.yaml +++ b/wallet/pkgs/alan/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: fixnum: ^1.0.0 grpc: ^3.0.2 hex: ^0.2.0 - http: ^0.13.4 + http: json_annotation: ^4.7.0 json_serializable: ^6.4.1 meta: ^1.3.0 diff --git a/wallet/pkgs/pdf_viewer-master/android/build.gradle b/wallet/pkgs/pdf_viewer-master/android/build.gradle index e165f24eed..e6a9c8c87f 100644 --- a/wallet/pkgs/pdf_viewer-master/android/build.gradle +++ b/wallet/pkgs/pdf_viewer-master/android/build.gradle @@ -22,7 +22,7 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { - compileSdkVersion 30 + compileSdkVersion 34 defaultConfig { minSdkVersion 21 diff --git a/wallet/pubspec.yaml b/wallet/pubspec.yaml index 5d22159e4e..1a77f752c8 100644 --- a/wallet/pubspec.yaml +++ b/wallet/pubspec.yaml @@ -1,9 +1,7 @@ name: pylons_wallet description: Pylons Wallet publish_to: "none" -version: 1.0.1+172 - - +version: 1.0.1+176 environment: sdk: ">=2.17.0 <3.0.0" @@ -17,7 +15,7 @@ dependencies: auto_size_text: ^3.0.0 backdrop: ^0.9.0 bottom_drawer: ^0.0.3 - cached_network_image: ^3.1.0 + cached_network_image: cloud_firestore: ^4.3.0 cupertino_icons: ^1.0.3 dartz: ^0.10.1 @@ -27,7 +25,7 @@ dependencies: easy_localization: ^3.0.1 equatable: ^2.0.5 expandable: ^5.0.1 - firebase_analytics: ^10.0.8 + firebase_analytics: firebase_app_check: ^0.1.1+7 firebase_core: ^2.4.0 firebase_crashlytics: ^3.0.8 @@ -49,19 +47,22 @@ dependencies: flutter_secure_storage: ^8.0.0 flutter_staggered_grid_view: ^0.6.2 flutter_sticky_header: ^0.6.0 - flutter_stripe: ^9.0.0+1 - flutter_svg: ^1.0.3 - flutter_svg_provider: ^1.0.3 + flutter_stripe: + flutter_svg: + flutter_svg_provider: + git: + url: https://github.com/arigilder/flutter_svg_provider + ref: patch-1 focus_detector: ^2.0.1 get_it: ^7.2.0 google_sign_in: ^6.0.2 googleapis: ^11.1.0 grpc: ^3.0.2 home_widget: ^0.2.0+1 - http: ^0.13.4 + http: icloud_storage: ^2.0.0 image: ^4.0.12 - image_cropper: ^4.0.1 + image_cropper: image_picker: ^0.8.5+3 in_app_purchase: ^3.0.7 internet_connection_checker: ^1.0.0+1