Repository navigation
Show DatePicker when keyboard is open throws an exception #18672
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: date/time pickerDate or time picker widgetsDate or time picker widgetsframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages
Description
The error message on the bottom of the dialog BOTTOM OVERFLOWED BY 67 PIXELS only appears for a few moments, and when the keyboard closes, it disappears.
Logs
I/flutter ( 5633): The following message was thrown during layout:
I/flutter ( 5633): A RenderFlex overflowed by 67 pixels on the bottom.
I/flutter ( 5633):
I/flutter ( 5633): The overflowing RenderFlex has an orientation of Axis.vertical.
I/flutter ( 5633): The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
I/flutter ( 5633): black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
I/flutter ( 5633): Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
I/flutter ( 5633): RenderFlex to fit within the available space instead of being sized to their natural size.
I/flutter ( 5633): This is considered an error condition because it indicates that there is content that cannot be
I/flutter ( 5633): seen. If the content is legitimately bigger than the available space, consider clipping it with a
I/flutter ( 5633): ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
I/flutter ( 5633): like a ListView.
I/flutter ( 5633): The specific RenderFlex in question is:
I/flutter ( 5633): RenderFlex#a2b29 relayoutBoundary=up7 OVERFLOWING
I/flutter ( 5633): creator: Column ← SizedBox ← LayoutBuilder ← OrientationBuilder ← DefaultTextStyle ←
I/flutter ( 5633): AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#71507 ink renderer] ←
I/flutter ( 5633): NotificationListener<LayoutChangedNotification> ← CustomPaint ← _ShapeBorderPaint ← PhysicalShape
I/flutter ( 5633): ← _MaterialInterior ← ⋯
I/flutter ( 5633): parentData: <none> (can use size)
I/flutter ( 5633): constraints: BoxConstraints(w=330.0, 0.0<=h<=420.9)
I/flutter ( 5633): size: Size(330.0, 420.9)
I/flutter ( 5633): direction: vertical
I/flutter ( 5633): mainAxisAlignment: start
I/flutter ( 5633): mainAxisSize: min
I/flutter ( 5633): crossAxisAlignment: stretch
I/flutter ( 5633): verticalDirection: down
I/flutter ( 5633): ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
I/flutter ( 5633): ════════════════════════════════════════════════════════════════════════════════════════════════════
Flutter Doctor
[✓] Flutter (Channel master, v0.5.5-pre.46, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] Android Studio (version 3.1)
[✓] VS Code (version 1.24.1)
[✓] Connected devices (2 available)
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: date/time pickerDate or time picker widgetsDate or time picker widgetsframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages

Activity
zoechi commentedon Jun 21, 2018
@Hixie
HansMuller commentedon Jun 21, 2018
When the keyboard appears your app, including the dialog, is being resized to make room for it. This would also happen if you changed the device's orientation from portrait to landscape.
Wrapping the dialog's widget - the one you're building with showDialog's builder parameter - in a SingleChildScrollView or a ListView or a ClipRect (per the error message) will make it resizable.
nesscx commentedon Jun 21, 2018
Dialoginside aSingleChildScrollView(like the example code below) it solves the problem but creates 2 issues more.1- The dialog can't be dismissed,
2- The dialog is not being centered in the vertical axis.
SingleChildScrollViewinside aDialog(like the example code below) it solves the problem and the issues mentioned above don't appear.ClipRectinside or outside theDialog, it solves the problem too and the issues above don't happen.I'm making use of
showDatePicker()method too that is inside ofdate_picker.dartfrom thepackage:flutter/material.dart. The only way I can solve the problem [BOTTOM OVERFLOWED BY 67 PIXELS] is by making use ofSingleChildScrollViewinside the Dialog widget in the line 938 ofdate_picker.dart.But when I rotate the screen, it looks like this:
Is there a way to solve it without modifying the code inside
date_picker.dartclass?rafaelcb21 commentedon Jul 25, 2018
These issues have been open for more than a month, is there an alternative? Because this error did not happen in previous versions of Flutter.
@nesscx This solution of
SingleChildScrollViewdoes not show theCANCELandOKbuttons, so it does not work@Hixie
nesscx commentedon Jul 26, 2018
@rafaelcb21 The solution of using
SingleChildScrollViewonly works for dialogs components like SingleDialog, AlertDialog, ..., it doesn't work for datePickerDialog. When you wrap the Dialog component of theDateTimePickerclass with the scroll view, then it shows incomplete (without the cancel and ok buttons) because the DateTimePicker dialog doesn't turn to "horizontal mode", I don't know why...This is the expected behavior (horizontal mode)

But instead, it is being render in "vertical mode"...
rvowles commentedon Jul 28, 2018
Hitting this problem on an app that is due to go to student phones, which are by definition fairly cheap and small (480x800).
Andrious commentedon Aug 2, 2018
Yes, well. Out of desperation I edited
date_picker.dart. Removed the 'two extra rows' they speak of and bingo!Not a good solution however.
rvowles commentedon Aug 2, 2018
turkovsky commentedon Aug 29, 2018
My solution for this situation:
pdefuns commentedon Sep 20, 2018
Facing the same issue (eg. iPhone X simulator) > showDatePicker with open keyboard throws exception
Any updates here?
1 remaining item
turkovsky commentedon Oct 3, 2018
In my case I have to show dialog with TextFormField, so I need keyboard )
stanchanpsu commentedon Feb 14, 2019
This is the only viable option I've seen for this specific test case. Thank you.
When another text input is open in the form, and the keyboard is open…
Removing render overflow error when keyboard open
[-]Show dialog with high height when keyboard is open throws an exception[/-][+]Show DatePicker when keyboard is open throws an exception[/+]Dinver commentedon Feb 11, 2020
Problem is relevant.
TahaTesser commentedon Apr 22, 2020
Hi @Dinver @ianloic
To better address the issue, would be helpful
if you could post a minimal code sample to reproduce the problem
No exception when opening datepicker while keyboard is open
Thank you
no-response commentedon May 29, 2020
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
github-actions commentedon Aug 1, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.