Skip to content

Commit 72254d3

Browse files
Use ScrollViewKeyboardDismissBehavior.onDrag on both platforms
Enable keyboard dismissal by dragging the message list on both iOS and Android. This provides a consistent experience across platforms while preserving Android's built-in keyboard close button. Previously we used ScrollViewKeyboardDismissBehavior.manual on Android which didn't work effectively for dismissing the keyboard. Now users on both platforms can dismiss the keyboard by dragging the message list, matching iOS's existing behavior. The change is simple - we now use ScrollViewKeyboardDismissBehavior.onDrag unconditionally instead of switching based on platform. Please refer - [comment - 897](#897 (comment)) and [Topic discussion](https://chat.zulip.org/#narrow/channel/48-mobile/topic/Dismiss.20keyboard.20and.20shift.20focus.20when.20tap.20background)
1 parent 347e19e commit 72254d3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/widgets/message_list.dart

+4-7
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,10 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
552552
// TODO: Offer `ScrollViewKeyboardDismissBehavior.interactive` (or
553553
// similar) if that is ever offered:
554554
// https://github.com/flutter/flutter/issues/57609#issuecomment-1355340849
555-
keyboardDismissBehavior: switch (Theme.of(context).platform) {
556-
// This seems to offer the only built-in way to close the keyboard
557-
// on iOS. It's not ideal; see TODO above.
558-
TargetPlatform.iOS => ScrollViewKeyboardDismissBehavior.onDrag,
559-
// The Android keyboard seems to have a built-in close button.
560-
_ => ScrollViewKeyboardDismissBehavior.manual,
561-
},
555+
// This seems to offer the only built-in way to close the keyboard
556+
// on iOS. It's not ideal; see TODO above.
557+
// For Android also users gets ability to dismiss the keyboard by dragging the message list.
558+
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
562559

563560
controller: scrollController,
564561
semanticChildCount: length + 2,

0 commit comments

Comments
 (0)