Priyanka
Priyanka

Reputation: 3699

keyboardDismissBehavior on drag dismiss the keyboard always

after updating Flutter on 14-Dec-2024 to version 3.27.0, this happens

keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,

this line inside SingleChildScrollView always dismiss the keyboard without scrolling the UI

I noticed this line is removed in single_child_scroll_view.dart file at line #279

notification.dragDetails != null &&

see this video. https://www.veed.io/view/968e92cd-23e1-4c68-9895-a3aed846c8e8?panel=share&sharingWidget=true any idea what to do now?

Upvotes: 3

Views: 131

Answers (3)

MickaCapi
MickaCapi

Reputation: 131

The bug has been fixed in 3.27.2 : https://github.com/flutter/flutter/blob/master/CHANGELOG.md#3272

Upvotes: 0

Mircea Dragota
Mircea Dragota

Reputation: 754

A quick fix that I found is to replace SingleChildScrollView with a ListView. Hope it helps!

Upvotes: 0

Priyanka
Priyanka

Reputation: 3699

below code can work same as scrollview's onDrag behaviours

GestureDetector(
    onTap: () => FocusScope.of(context).unfocus(),
    onVerticalDragDown: (_) => FocusScope.of(context).unfocus(),
    child: SingleChildScrollView());

Upvotes: 0

Related Questions