-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown list incorrect position when on-screen keyboard closes #46676
Comments
Tested on physical device code sampleimport 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context)=> MaterialApp(
home: MyHomePage(),
);
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
static final List<int> _items = [1, 2, 3,];
static void _showDialog(BuildContext context) =>
showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
content: Row(
children: <Widget>[
Expanded(
child: TextField(),
),
Expanded(
child: DropdownButton<String>(
items: [ for (int i in _items) DropdownMenuItem<String>(
value: '$i',
child: Text('$i'),)],
onChanged: (_) {},
),
),
],
),
),
);
@override
Widget build(BuildContext context) => Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: () => _showDialog(context),
child: Icon(Icons.add),
),
);
} flutter doctor -v[√] Flutter (Channel master, v1.13.1-pre.80, on Microsoft Windows [Version 10.0.19013.1122], locale en-US)
• Flutter version 1.13.1-pre.80 at C:\src\flutter
• Framework revision 2fe9623c36 (2 hours ago), 2019-12-10 04:22:32 -0500
• Engine revision 12bf95fd49
• Dart version 2.7.0 (build 2.7.0-dev.2.1 8b8894648f)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
8000
• Android SDK at C:\Users\iapic\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code, 64-bit edition (version 1.40.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.7.0
[√] Connected device (3 available)
• Pixel 3a • 965AY0WP5C • android-arm64 • Android 10 (API 29)
• Chrome • chrome • web-javascript • Google Chrome 78.0.3904.108
• Web Server • web-server • web-javascript • Flutter Tools
• No issues found! same result |
Is there any update on a fix or a workaround for this? |
Code Sample
flutter doctor -v
|
can reproduce this on emulator & physical device |
Anybody found a solution for this annoying issue ? |
I face the same issue on flutter for web (Flutter, Channel master, 1.22.0-10.0.pre.269, on Microsoft Windows [Version 10.0.19041.508], locale gsw-CH) will be fixed with #65605 |
Same issue on the web (Flutter version of 1.22.0) |
Same issue here :/ |
Same issue on web |
Fixed locally for myself by making the following change here:
final RenderBox overlayBox = Overlay.of(context)!.context.findRenderObject() as RenderBox;
final Rect itemRect = itemBox.localToGlobal(Offset.zero, ancestor: overlayBox,) & itemBox.size; I believe this could be made into a PR and submitted to the team as it is the same thing they do for popupmenubutton:
Even the tests in the (abandoned and closed I think?) PR someone did above should work I would guess: #65605 I'm just not very well setup to submit myself :-) |
Reproducible on stable 3.3 and the master 3.6 channel. Screen.Recording.2022-12-02.at.7.56.03.PM.movflutter doctor -v (mac)
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I used dropdown button 2 library from pub.dev for a quick solution.
…On Fri, Mar 1, 2024, 12:44 AM Miguel Jara ***@***.***> wrote:
Any updates on this?
—
Reply to this email directly, view it on GitHub
<#46676 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHHPCLDXIPN4L4PMA5ITIELYV56YNAVCNFSM4JY4NHPKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJXGE3TSNZQGM2Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This appears to be fixed 🎊 - tested at tip of tree with the original sample on multiple platforms. If this does persist, please file a new issue with an updated reproduction. Thanks! |
Steps to Reproduce
This could also be reproduced without a dialog, but in some form which scrolls, but the behaviour is much more visible with a dialog.
Screenshot of this behaviour:

Code sample:
Target Platform: Android
Target OS version/browser: tested with Android 9 and 8
Devices: tested with Android 9 emulator, Lenovo Tab M10 (Android 8)
Logs
The text was updated successfully, but these errors were encountered: