Skip to content

Commit

Permalink
fix: Fix dropdown not closing on touch outside zone
Browse files Browse the repository at this point in the history
  • Loading branch information
witwash committed Jan 14, 2025
1 parent 822d157 commit 5c6135c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions optimus/lib/src/common/gesture_detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ class AllowMultipleRawGestureDetector extends RawGestureDetector {
AllowMultipleRawGestureDetector({
super.key,
GestureTapCallback? onTap,
GestureTapDownCallback? onTapDown,
super.behavior = HitTestBehavior.opaque,
super.child,
}) : super(
behavior: HitTestBehavior.opaque,
gestures: <Type, GestureRecognizerFactory>{
AllowMultipleGestureRecognizer:
GestureRecognizerFactoryWithHandlers<
AllowMultipleGestureRecognizer>(
AllowMultipleGestureRecognizer.new,
(AllowMultipleGestureRecognizer instance) =>
instance.onTap = onTap,
(AllowMultipleGestureRecognizer instance) {
instance
..onTap = onTap
..onTapDown = onTapDown;
},
),
},
);
Expand Down
2 changes: 1 addition & 1 deletion optimus/lib/src/dropdown/dropdown_select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class _DropdownSelectState<T> extends State<DropdownSelect<T>>
}
}

return GestureDetector(
return AllowMultipleRawGestureDetector(
key: const Key('OptimusDropdownOverlay'),
behavior: HitTestBehavior.translucent,
onTapDown: handleTapDown,
Expand Down

0 comments on commit 5c6135c

Please sign in to comment.