Skip to content

SafeArea with keyboard #25758

Closed
Closed

Description

@1AlexFix1

Hello! (For iPhone x, xr and the like)
The bottom: true / false parameter for the safe area does not respond to changes when the keyboard is on, the bottom parameter is always false. In this connection, if the scaffold parameter has resizeToAvoidBottomPadding: false, and the keyboard appears, the entire widgets is shifted to down MediaQuery.of (context) .padding.bottom

return Scaffold(
      resizeToAvoidBottomPadding: false,
      body: SafeArea(
          child: Center(
        child: Container(
          width: 200,
          child: TextFormField(
            decoration: InputDecoration(
              hintText: 'text',
            ),
          ),
        ),
      )),
    );
[✓] Flutter (Channel dev, v1.1.4, on Mac OS X 10.14.2 18C54, locale ru-RU)
    • Flutter version 1.1.4 at /Users/alexfix/Flutter/flutter
    • Framework revision 7a88fbc5fd (5 days ago), 2018-12-20 11:38:07 -0800
    • Engine revision dbdb5e6f8c
    • Dart version 2.2.0 (build 2.2.0-dev.1.1 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/alexfix/Library/Android/sdk
    • Android NDK at /Users/alexfix/Library/Android/sdk/ndk-bundle
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] Connected device (1 available)
    • iPhone XR • 0AB397AD-D503-4882-8849-B6F3229D2B23 • ios • iOS 12.1 (simulator)

• No issues found!

Activity

  1. added
    platform-iosiOS applications specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Dec 26, 2018
  2. added this to the milestone on Dec 27, 2018
  3. HansMuller commented on Jan 9, 2019

    @HansMuller
    Contributor

    Scaffold was using its resizeToAvoidBottomPaddding flag to conditionally inset the bottom of the body's layout by MediaQuery.viewInsets.bottom rather than padding.bottom.

        // The minimum insets for contents of the Scaffold to keep visible.
        final EdgeInsets minInsets = mediaQuery.padding.copyWith(
          bottom: widget.resizeToAvoidBottomPadding ? mediaQuery.viewInsets.bottom : 0.0,
        );

    Additionally when resizeToAvoidBottomPaddding was true, the MediaQuery that wraps the Scaffold's body wasn't clearing padding.left.

    This PR corrects the problems: #26259

    This is the app I used to test this issue: https://gist.github.com/HansMuller/744554f045d62406f6b7f7240ab66fb2

    When the keyboard appears the Scaffold's body is resized (bottom padding is ignored) and the text field remains centered above the keyboard. I assume that's what you expected.

  4. added
    p: material_uimaterial_ui package in flutter/packages
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    platform-iosiOS applications specifically
    on Jan 9, 2019
  5. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jan 10, 2019
  6. zoechi commented on Jan 10, 2019

    @zoechi
  7. HansMuller commented on Jan 10, 2019

    @HansMuller
  8. github-actions commented on Aug 14, 2021

    @github-actions

    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 -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    frameworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions