From 2ee55c85ac90cc2b9a3bfcedf14f4fbc6f97fa17 Mon Sep 17 00:00:00 2001 From: Frank Merkel <138444693+frankmer@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:10:59 +0100 Subject: [PATCH] hotfix for 4.4.2 --- .../folder_widgets/token_folder_expandable.dart | 2 +- .../folder_widgets/token_folder_widget.dart | 13 +++++++------ .../token_widgets/token_widget_base.dart | 8 +++++--- pubspec.yaml | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/views/main_view/main_view_widgets/folder_widgets/token_folder_expandable.dart b/lib/views/main_view/main_view_widgets/folder_widgets/token_folder_expandable.dart index f9d4738eb..3a13538e5 100644 --- a/lib/views/main_view/main_view_widgets/folder_widgets/token_folder_expandable.dart +++ b/lib/views/main_view/main_view_widgets/folder_widgets/token_folder_expandable.dart @@ -133,7 +133,7 @@ class _TokenFolderExpandableState extends ConsumerState w log('Moving token to folder ${widget.folder.label}', name: 'TokenFolderExpandable'); ref.read(tokenProvider.notifier).updateToken( details.data, - (p0) => p0.copyWith(folderId: () => widget.folder.folderId, sortIndex: (widget.folder.sortIndex!) + 1), + (p0) => p0.copyWith(folderId: () => widget.folder.folderId, sortIndex: (widget.folder.sortIndex ?? 0) + 1), ); }, builder: (context, willAccept, willReject) => Center( diff --git a/lib/views/main_view/main_view_widgets/folder_widgets/token_folder_widget.dart b/lib/views/main_view/main_view_widgets/folder_widgets/token_folder_widget.dart index 941a11359..27fbb0e14 100644 --- a/lib/views/main_view/main_view_widgets/folder_widgets/token_folder_widget.dart +++ b/lib/views/main_view/main_view_widgets/folder_widgets/token_folder_widget.dart @@ -17,7 +17,6 @@ class TokenFolderWidget extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final draggingSortable = ref.watch(draggingSortableProvider); - final draggingSortableNotifier = ref.read(draggingSortableProvider.notifier); final TokenFolder? draggingFolder = draggingSortable is TokenFolder ? draggingSortable : null; return draggingSortable == null ? LongPressDraggable( @@ -31,14 +30,16 @@ class TokenFolderWidget extends ConsumerWidget { ); return Offset(max(textSize.width / 2, 30), textSize.height / 2 + 30); }, - onDragStarted: () => draggingSortableNotifier.state = folder, - onDragCompleted: () { + onDragStarted: () => ref.read(draggingSortableProvider.notifier).state = folder, + onDragCompleted: () async { Logger.info('Draggable completed', name: 'TokenFolderWidget#build'); - // Will be handled by the sortableNotifier + await Future.delayed(const Duration(milliseconds: 100)); + globalRef?.read(draggingSortableProvider.notifier).state = null; }, - onDraggableCanceled: (velocity, offset) { + onDraggableCanceled: (velocity, offset) async { Logger.info('Draggable canceled', name: 'TokenFolderWidget#build'); - draggingSortableNotifier.state = null; + await Future.delayed(const Duration(milliseconds: 100)); + globalRef?.read(draggingSortableProvider.notifier).state = null; }, data: folder, childWhenDragging: const SizedBox(), diff --git a/lib/views/main_view/main_view_widgets/token_widgets/token_widget_base.dart b/lib/views/main_view/main_view_widgets/token_widgets/token_widget_base.dart index e7d1b6688..2598af42e 100644 --- a/lib/views/main_view/main_view_widgets/token_widgets/token_widget_base.dart +++ b/lib/views/main_view/main_view_widgets/token_widgets/token_widget_base.dart @@ -50,12 +50,14 @@ class TokenWidgetBase extends ConsumerWidget { ? LongPressDraggable( maxSimultaneousDrags: 1, onDragStarted: () => ref.read(draggingSortableProvider.notifier).state = token, - onDragCompleted: () { + onDragCompleted: () async { Logger.info('Draggable completed', name: 'TokenWidgetBase#build'); - // Will be handled by the sortableNotifier + await Future.delayed(const Duration(milliseconds: 100)); + globalRef?.read(draggingSortableProvider.notifier).state = null; }, - onDraggableCanceled: (velocity, offset) { + onDraggableCanceled: (velocity, offset) async { Logger.info('Draggable canceled', name: 'TokenWidgetBase#build'); + await Future.delayed(const Duration(milliseconds: 100)); globalRef?.read(draggingSortableProvider.notifier).state = null; }, dragAnchorStrategy: (Draggable d, BuildContext context, Offset point) { diff --git a/pubspec.yaml b/pubspec.yaml index d3ab1f2f8..799e70a7f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ publish_to: none # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.4.2+404205 # TODO Set the right version number +version: 4.4.2+404206 # TODO Set the right version number # version: major.minor.build + 2x major|2x minor|3x build # version: version number + build number (optional)