From 557f175954f9d91bcf279f02461d008010cc390f Mon Sep 17 00:00:00 2001 From: Andrii Date: Mon, 25 Jul 2022 12:03:07 +0300 Subject: [PATCH 01/12] Initial --- lib/ui/page/call/widget/minimizable_view.dart | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/ui/page/call/widget/minimizable_view.dart b/lib/ui/page/call/widget/minimizable_view.dart index fc5b5a63491..d935ceb2587 100644 --- a/lib/ui/page/call/widget/minimizable_view.dart +++ b/lib/ui/page/call/widget/minimizable_view.dart @@ -78,6 +78,9 @@ class _MinimizableViewState extends State /// View padding of the screen. EdgeInsets _padding = EdgeInsets.zero; + /// Difference between start dragging position and current dragging position. + double _panDragDifference = 0; + /// [DecorationTween] of this view. final DecorationTween _decorationTween = DecorationTween( begin: const BoxDecoration(borderRadius: BorderRadius.zero), @@ -150,6 +153,17 @@ class _MinimizableViewState extends State } : null, onPanUpdate: (d) { + _panDragDifference = _panDragDifference - d.delta.dy; + + if (_panDragDifference < -50 && + _drag == null && + _value == null) { + _controller.stop(); + _drag = d.localPosition; + _value = _controller.value; + setState(() {}); + } + if (_drag != null && _value != null) { _controller.value = _value! + (d.localPosition.dy - _drag!.dy) * @@ -162,16 +176,12 @@ class _MinimizableViewState extends State }); } }, - onPanStart: _controller.value == 0 - ? (d) { - _controller.stop(); - _drag = d.localPosition; - _value = _controller.value; - setState(() {}); - } - : null, - onPanEnd: - _drag != null && _value != null ? _onVerticalDragEnd : null, + onPanEnd: (d) { + if (_drag != null && _value != null) { + _onVerticalDragEnd(d); + } + _panDragDifference = 0; + }, child: DecoratedBoxTransition( key: _key, decoration: _decorationTween.animate(_controller), From 085c5548d7114fcb6982fe36202b622f66f1bd38 Mon Sep 17 00:00:00 2001 From: Andrii Date: Mon, 25 Jul 2022 13:55:11 +0300 Subject: [PATCH 02/12] Corrections --- lib/ui/page/call/widget/minimizable_view.dart | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/ui/page/call/widget/minimizable_view.dart b/lib/ui/page/call/widget/minimizable_view.dart index d935ceb2587..21aadd800e8 100644 --- a/lib/ui/page/call/widget/minimizable_view.dart +++ b/lib/ui/page/call/widget/minimizable_view.dart @@ -25,6 +25,7 @@ class MinimizableView extends StatefulWidget { this.onInit, this.onDispose, required this.child, + this.startMinimizeDifference = 50, }) : super(key: key); /// Callback, called when the [AnimationController] of this [MinimizableView] @@ -37,6 +38,9 @@ class MinimizableView extends StatefulWidget { /// [Widget] to minimize. final Widget child; + /// Distance between start drag position and position to start minimizing. + final double startMinimizeDifference; + @override State createState() => _MinimizableViewState(); } @@ -78,7 +82,7 @@ class _MinimizableViewState extends State /// View padding of the screen. EdgeInsets _padding = EdgeInsets.zero; - /// Difference between start dragging position and current dragging position. + /// Distance between start dragging position and current dragging position. double _panDragDifference = 0; /// [DecorationTween] of this view. @@ -153,15 +157,11 @@ class _MinimizableViewState extends State } : null, onPanUpdate: (d) { - _panDragDifference = _panDragDifference - d.delta.dy; - - if (_panDragDifference < -50 && - _drag == null && - _value == null) { - _controller.stop(); - _drag = d.localPosition; - _value = _controller.value; - setState(() {}); + _panDragDifference = _panDragDifference + d.delta.dy; + + if (_panDragDifference < widget.startMinimizeDifference && + _controller.value == 0) { + return; } if (_drag != null && _value != null) { @@ -176,6 +176,14 @@ class _MinimizableViewState extends State }); } }, + onPanStart: _controller.value == 0 + ? (d) { + _controller.stop(); + _drag = d.localPosition; + _value = _controller.value; + setState(() {}); + } + : null, onPanEnd: (d) { if (_drag != null && _value != null) { _onVerticalDragEnd(d); From 1b797e15c05c66c3515f8cb641d148cefd2c3594 Mon Sep 17 00:00:00 2001 From: Andrii Date: Mon, 25 Jul 2022 13:56:08 +0300 Subject: [PATCH 03/12] Small correction --- lib/ui/page/call/widget/minimizable_view.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/page/call/widget/minimizable_view.dart b/lib/ui/page/call/widget/minimizable_view.dart index 21aadd800e8..7d41388a91c 100644 --- a/lib/ui/page/call/widget/minimizable_view.dart +++ b/lib/ui/page/call/widget/minimizable_view.dart @@ -24,8 +24,8 @@ class MinimizableView extends StatefulWidget { Key? key, this.onInit, this.onDispose, - required this.child, this.startMinimizeDifference = 50, + required this.child, }) : super(key: key); /// Callback, called when the [AnimationController] of this [MinimizableView] From a9336239c634c71a2af7f2770a81c1c6ff05c0c3 Mon Sep 17 00:00:00 2001 From: Andrii Date: Mon, 25 Jul 2022 13:56:33 +0300 Subject: [PATCH 04/12] Small correction --- lib/ui/page/call/widget/minimizable_view.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ui/page/call/widget/minimizable_view.dart b/lib/ui/page/call/widget/minimizable_view.dart index 7d41388a91c..84b10711af7 100644 --- a/lib/ui/page/call/widget/minimizable_view.dart +++ b/lib/ui/page/call/widget/minimizable_view.dart @@ -35,12 +35,12 @@ class MinimizableView extends StatefulWidget { /// Callback, called when the state of this [MinimizableView] is disposed. final void Function()? onDispose; - /// [Widget] to minimize. - final Widget child; - /// Distance between start drag position and position to start minimizing. final double startMinimizeDifference; + /// [Widget] to minimize. + final Widget child; + @override State createState() => _MinimizableViewState(); } From 4c2ec6f80574d9dd47b862e6e4273b966c9f50f7 Mon Sep 17 00:00:00 2001 From: Andrii Date: Mon, 25 Jul 2022 14:10:08 +0300 Subject: [PATCH 05/12] Add changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a22e3bb2fad..36737d77793 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ All user visible changes to this project will be documented in this file. This p - Android: - [ConnectionService] displaying call when application is in foreground ([#14]). + - Media panel: + - Swipe down gesture rekognition ([#45]); - UI: - Chat page: - Missing avatars in group creation popup ([#15], [#2]). @@ -46,6 +48,7 @@ All user visible changes to this project will be documented in this file. This p [#34]: /../../pull/34 [#41]: /../../issues/41 [#42]: /../../pull/42 +[#45]: /../../pull/45 From 95a45cb6e41f9584f34c407a76759b4597d30b54 Mon Sep 17 00:00:00 2001 From: Andrii Date: Mon, 25 Jul 2022 14:20:23 +0300 Subject: [PATCH 06/12] Final correction --- lib/ui/page/call/widget/minimizable_view.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ui/page/call/widget/minimizable_view.dart b/lib/ui/page/call/widget/minimizable_view.dart index 84b10711af7..b15bba17ebe 100644 --- a/lib/ui/page/call/widget/minimizable_view.dart +++ b/lib/ui/page/call/widget/minimizable_view.dart @@ -24,7 +24,7 @@ class MinimizableView extends StatefulWidget { Key? key, this.onInit, this.onDispose, - this.startMinimizeDifference = 50, + this.startMinimizeDistance = 50, required this.child, }) : super(key: key); @@ -36,7 +36,7 @@ class MinimizableView extends StatefulWidget { final void Function()? onDispose; /// Distance between start drag position and position to start minimizing. - final double startMinimizeDifference; + final double startMinimizeDistance; /// [Widget] to minimize. final Widget child; @@ -82,8 +82,8 @@ class _MinimizableViewState extends State /// View padding of the screen. EdgeInsets _padding = EdgeInsets.zero; - /// Distance between start dragging position and current dragging position. - double _panDragDifference = 0; + /// Distance between start and current dragging positions. + double _panningDistance = 0; /// [DecorationTween] of this view. final DecorationTween _decorationTween = DecorationTween( @@ -157,9 +157,9 @@ class _MinimizableViewState extends State } : null, onPanUpdate: (d) { - _panDragDifference = _panDragDifference + d.delta.dy; + _panningDistance = _panningDistance + d.delta.dy; - if (_panDragDifference < widget.startMinimizeDifference && + if (_panningDistance < widget.startMinimizeDistance && _controller.value == 0) { return; } @@ -188,7 +188,7 @@ class _MinimizableViewState extends State if (_drag != null && _value != null) { _onVerticalDragEnd(d); } - _panDragDifference = 0; + _panningDistance = 0; }, child: DecoratedBoxTransition( key: _key, From aad9f0934312e7c6e4bbb2cc7aed11f05cacb248 Mon Sep 17 00:00:00 2001 From: SleepySquash Date: Tue, 26 Jul 2022 11:34:41 +0300 Subject: [PATCH 07/12] Corrections --- CHANGELOG.md | 4 ++-- lib/ui/page/call/widget/minimizable_view.dart | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36737d77793..bd72922d7e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,13 +29,13 @@ All user visible changes to this project will be documented in this file. This p - Android: - [ConnectionService] displaying call when application is in foreground ([#14]). - - Media panel: - - Swipe down gesture rekognition ([#45]); - UI: - Chat page: - Missing avatars in group creation popup ([#15], [#2]). - Home page: - Horizontal scroll overlapping with vertical ([#42], [#41]). + - Media panel: + - Mobile minimization gesture being too rapid ([#45]); [#2]: /../../issues/2 [#4]: /../../issues/4 diff --git a/lib/ui/page/call/widget/minimizable_view.dart b/lib/ui/page/call/widget/minimizable_view.dart index b15bba17ebe..fe0703d4844 100644 --- a/lib/ui/page/call/widget/minimizable_view.dart +++ b/lib/ui/page/call/widget/minimizable_view.dart @@ -24,7 +24,7 @@ class MinimizableView extends StatefulWidget { Key? key, this.onInit, this.onDispose, - this.startMinimizeDistance = 50, + this.minimizationDelta = 50, required this.child, }) : super(key: key); @@ -35,8 +35,9 @@ class MinimizableView extends StatefulWidget { /// Callback, called when the state of this [MinimizableView] is disposed. final void Function()? onDispose; - /// Distance between start drag position and position to start minimizing. - final double startMinimizeDistance; + /// Distance to travel in order for the panning to be recognized as a + /// minimization gesture. + final double minimizationDelta; /// [Widget] to minimize. final Widget child; @@ -82,7 +83,7 @@ class _MinimizableViewState extends State /// View padding of the screen. EdgeInsets _padding = EdgeInsets.zero; - /// Distance between start and current dragging positions. + /// Current panning distance. double _panningDistance = 0; /// [DecorationTween] of this view. @@ -159,14 +160,16 @@ class _MinimizableViewState extends State onPanUpdate: (d) { _panningDistance = _panningDistance + d.delta.dy; - if (_panningDistance < widget.startMinimizeDistance && + if (_panningDistance < widget.minimizationDelta && _controller.value == 0) { return; } if (_drag != null && _value != null) { _controller.value = _value! + - (d.localPosition.dy - _drag!.dy) * + (d.localPosition.dy - + _drag!.dy - + widget.minimizationDelta) * (1 / constraints.maxHeight); } else { setState(() { From fc4b2ae08b435c11fbc57f1ee388bbf915e3c7b7 Mon Sep 17 00:00:00 2001 From: SleepySquash Date: Tue, 26 Jul 2022 11:35:58 +0300 Subject: [PATCH 08/12] Corrections --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b428e8eb5dd..80c161ad54e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ All user visible changes to this project will be documented in this file. This p - Home page: - Horizontal scroll overlapping with vertical ([#42], [#41]). - Media panel: - - Mobile minimization gesture being too rapid ([#45]); + - Mobile minimization gesture being too rapid ([#45]). [#2]: /../../issues/2 [#4]: /../../issues/4 From e80bdf8e89a88a47e2f03a9eb96aca8838c9379a Mon Sep 17 00:00:00 2001 From: SleepySquash Date: Tue, 26 Jul 2022 11:38:15 +0300 Subject: [PATCH 09/12] Add issue link --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80c161ad54e..8310a84b47b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ All user visible changes to this project will be documented in this file. This p - Home page: - Horizontal scroll overlapping with vertical ([#42], [#41]). - Media panel: - - Mobile minimization gesture being too rapid ([#45]). + - Mobile minimization gesture being too rapid ([#45], [#44]). [#2]: /../../issues/2 [#4]: /../../issues/4 @@ -52,6 +52,7 @@ All user visible changes to this project will be documented in this file. This p [#34]: /../../pull/34 [#41]: /../../issues/41 [#42]: /../../pull/42 +[#44]: /../../issues/44 [#45]: /../../pull/45 From f026cb7b883c2db39d04f80d0f8e28d411ddb345 Mon Sep 17 00:00:00 2001 From: SleepySquash Date: Tue, 26 Jul 2022 15:06:52 +0300 Subject: [PATCH 10/12] Try image_picker from pub --- pubspec.lock | 24 ++++++++++++++++++------ pubspec.yaml | 6 +----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index cf64a02a3b0..48c333f19d0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -758,12 +758,17 @@ packages: image_picker: dependency: "direct main" description: - path: "packages/image_picker/image_picker" - ref: main - resolved-ref: "597f9c8a8f34068207e25a0e9bbe13f781c68a2e" - url: "https://github.com/krida2000/image_picker" - source: git - version: "0.8.4+11" + name: image_picker + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.5+3" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.5+1" image_picker_for_web: dependency: transitive description: @@ -771,6 +776,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.8" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.5+6" image_picker_platform_interface: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b4f8f96ae5c..e7668cc97da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,11 +46,7 @@ dependencies: hive: ^2.1.0 http: ^0.13.4 http_parser: ^4.0.0 - image_picker: - git: - url: https://github.com/krida2000/image_picker - ref: main - path: packages/image_picker/image_picker/ + image_picker: ^0.8.5+3 intl: ^0.17.0 js: ^0.6.4 material_floating_search_bar: ^0.3.7 From 9757edd2a89056346cf3c0062a97b447a0f1cc19 Mon Sep 17 00:00:00 2001 From: SleepySquash Date: Tue, 26 Jul 2022 15:38:09 +0300 Subject: [PATCH 11/12] Try --- pubspec.lock | 16 ++++++++++------ pubspec.yaml | 6 +++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 48c333f19d0..78574f06228 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -758,9 +758,11 @@ packages: image_picker: dependency: "direct main" description: - name: image_picker - url: "https://pub.dartlang.org" - source: hosted + path: "packages/image_picker/image_picker" + ref: main + resolved-ref: "903cf07c5c8e90b85eb624a1cc4ed049c37661b5" + url: "https://github.com/krida2000/image_picker" + source: git version: "0.8.5+3" image_picker_android: dependency: transitive @@ -779,9 +781,11 @@ packages: image_picker_ios: dependency: transitive description: - name: image_picker_ios - url: "https://pub.dartlang.org" - source: hosted + path: "." + ref: HEAD + resolved-ref: "7e5052a2c1b050234c150df74c7641c95e441a09" + url: "https://github.com/krida2000/image_picker_ios.git" + source: git version: "0.8.5+6" image_picker_platform_interface: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index e7668cc97da..b4f8f96ae5c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,7 +46,11 @@ dependencies: hive: ^2.1.0 http: ^0.13.4 http_parser: ^4.0.0 - image_picker: ^0.8.5+3 + image_picker: + git: + url: https://github.com/krida2000/image_picker + ref: main + path: packages/image_picker/image_picker/ intl: ^0.17.0 js: ^0.6.4 material_floating_search_bar: ^0.3.7 From 9c1729ebcb152e17c8eb73b667a4d8755ae37177 Mon Sep 17 00:00:00 2001 From: Andrii Date: Wed, 27 Jul 2022 10:23:03 +0300 Subject: [PATCH 12/12] Fix image_picker --- pubspec.lock | 8 ++++---- pubspec.yaml | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 78574f06228..6502b8e8d12 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -758,10 +758,10 @@ packages: image_picker: dependency: "direct main" description: - path: "packages/image_picker/image_picker" - ref: main - resolved-ref: "903cf07c5c8e90b85eb624a1cc4ed049c37661b5" - url: "https://github.com/krida2000/image_picker" + path: "." + ref: HEAD + resolved-ref: a9744e87ea76884b6f77e184378007ca2a0db80d + url: "https://github.com/krida2000/image_picker.git" source: git version: "0.8.5+3" image_picker_android: diff --git a/pubspec.yaml b/pubspec.yaml index b4f8f96ae5c..6e32fddb70a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,9 +48,7 @@ dependencies: http_parser: ^4.0.0 image_picker: git: - url: https://github.com/krida2000/image_picker - ref: main - path: packages/image_picker/image_picker/ + url: https://github.com/krida2000/image_picker.git intl: ^0.17.0 js: ^0.6.4 material_floating_search_bar: ^0.3.7