Skip to content

When the on-screen keyboard is open, NavigationBar does not maintainBottomViewPadding in Edge-to-Edge mode #159526

Closed

Description

@VinhNgT

Steps to reproduce

  1. Create this NavigationBar example:

Alternatively you can clone https://github.com/VinhNgT/navbar-edge2edge-bug and skip step 1 and 2.

flutter create --sample=material.NavigationBar.3 mysample
  1. Enable Edge-To-Edge mode by adding these to void main():
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setSystemUIOverlayStyle(
    const SystemUiOverlayStyle(systemNavigationBarColor: Colors.transparent));
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
  1. Press "Push/list" -> "Push/text", then tap on the text field to open the on-screen keyboard.
  2. Notice every time you close/open the keyboard, the NavigationBar moves up and down.

Expected results

The NavigationBar should lock in place when the keyboard is open. Similar to SafeArea.maintainBottomViewPadding

Actual results

The NavigationBar follows padding instead of viewPadding, which causes it to move when the keyboard closes/opens.

Code sample

Code sample

https://github.com/VinhNgT/navbar-edge2edge-bug

Screenshots or Video

Screenshots / Video demonstration
screen-20241127-104148.mp4

Logs

No log

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.24.5, on Microsoft Windows [Version 10.0.22631.4460], locale en-US)
    • Flutter version 3.24.5 on channel stable at F:\tools\fvm\versions\3.24.5
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (13 days ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\victo\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.11.35327.3
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[√] VS Code (version 1.95.3)
    • VS Code at C:\Users\victo\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.100.0

[√] Connected device (4 available)
    • Redmi Note 8 (mobile) • 192.168.99.126:42415                      • android-arm64  • Android 14 (API 34)
    • Redmi Note 8 (mobile) • adb-139ed888-lNT5l9._adb-tls-connect._tcp • android-arm64  • Android 14 (API 34)
    • Windows (desktop)     • windows                                   • windows-x64    • Microsoft Windows [Version 10.0.22631.4460]
    • Edge (web)            • edge                                      • web-javascript • Microsoft Edge 130.0.2849.80

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. VinhNgT commented on Nov 27, 2024

    @VinhNgT
    Author

    The current workaround is to wrap the NavigationBar inside SafeArea with maintainBottomViewPadding: true and a ColoredBox like this:

    ColoredBox(
      color: Theme.of(context).navigationBarTheme.backgroundColor!,
      child: SafeArea(
        maintainBottomViewPadding: true,
        child: NavigationBar(
        ...
  2. darshankawar commented on Nov 27, 2024

    @darshankawar
    Member

    Thanks for the report. I was able to replicate this using latest versions and seems specific to edge to edge. I tried with manual and immersive with which the navigationBar doesn't jump as shown below:

    Screen_Recording_20241127_155430.mp4

    Verified on Android S10+ device and also on emulator.

    stable : 3.24.5
    master : 3.27.0-1.0.pre.628
    

    maybe related to #89914

  3. added
    a: text inputEntering text in a text field or keyboard related problems
    a: layoutSystemChrome and Framework's Layout Issues
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-androidAndroid applications specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    engineflutter/engine related. See also e: labels.
    team-designOwned by Design Languages team
    and removed
    in triagePresently being triaged by the triage team
    on Nov 27, 2024
  4. added
    P2Important issues not at the top of the work list
    on Dec 4, 2024
  5. 3 remaining items

  6. self-assigned this
    on Jan 21, 2025
  7. removed
    platform-androidAndroid applications specifically
    engineflutter/engine related. See also e: labels.
    on Jan 23, 2025
  8. moved this from To do to In progress in Nevercodeon Jan 23, 2025
  9. moved this from In progress to PR submitted in Nevercodeon Jan 23, 2025
  10. moved this from PR submitted to Done (PR merged) in Nevercodeon Jan 23, 2025
  11. added
    r: fixedIssue is closed as already fixed in a newer version
    on Jan 24, 2025
  12. github-actions commented on Feb 7, 2025

    @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.

  13. locked as resolved and limited conversation to collaborators on Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: layoutSystemChrome and Framework's Layout Issuesa: text inputEntering text in a text field or keyboard related problemsfound in release: 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages teamworkaround availableThere is a workaround available to overcome the issue

Type

No type

Projects

  • Status
    Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions