Skip to content

[Android] View resize is not synchronized with the IME animation: content snaps after the keyboard finishes opening, and a blank gap is exposed while it closes #191094

Open

Description

@zabefofoon

Steps to reproduce

Repro project: https://github.com/zabefofoon/flutter_keyboard_scroll_test

  1. flutter run the project on a physical Android device.
  2. The app is a full-screen WebViewWidget loading a bundled assets/index.html — a column with a fixed header, a scrollable list, and a text input pinned at the bottom of the page.
  3. Tap the input at the bottom to raise the software keyboard.
  4. Dismiss the keyboard.

Relevant configuration:

<!-- android/app/src/main/AndroidManifest.xml -->
<activity
    android:name=".MainActivity"
    ...
    android:windowSoftInputMode="adjustResize">
return Scaffold(
  resizeToAvoidBottomInset: false,
  body: SafeArea(
    child: Stack(
      children: [
        WebViewWidget(controller: _controller),
        if (_loading) const LinearProgressIndicator(),
      ],
    ),
  ),
);

Expected results

The view geometry follows the IME animation frame by frame, the way Chrome for Android does: as the keyboard slides up the content moves with it, and as the keyboard slides down the content expands back in step with it. No intermediate frame should show an empty area where the keyboard used to be.

Actual results

Opening. The keyboard slides all the way up while the content stays completely still. Only after the IME animation has finished does the content change, in a single step — the list jumps and the bottom input appears above the keyboard.

Closing. As the keyboard slides away, the view stays at its reduced size, so the area the keyboard occupied is exposed as a blank region. The view expands back to full height only after the IME animation has completed.

Frame-by-frame from the attached recording (sampled at 6 fps, 1080x2316, Android 16):

  • Frames 13-15: keyboard rising, then fully extended — content unchanged the whole time (header + items 1..30, bottom input not visible).
  • Frame 16: content changes in one step (items 15..30, input now above the keyboard).
  • Frames 21-22: keyboard sliding down — content still in its raised position, blank area visible below it.
  • Frame 23: content restored to full height.

Additional observations:

  • The same lag appears with resizeToAvoidBottomInset: true; the resulting geometry differs, but the change still lands after the IME animation ends instead of tracking it.
  • With android:windowSoftInputMode="adjustPan" the OS pans the window and that is smooth, but the page keeps the full viewport height, so it is not a workaround where the viewport needs to shrink.
  • Applying the inset manually with Transform.translate driven by MediaQuery.viewInsetsOf(context).bottom does follow the animation smoothly. That suggests the animated inset values reach the framework in time, and the lag is in when the resize is applied to the view. That workaround only translates the view, though, so it cannot re-lay out the page.

Not yet verified: the content under test is a WebViewWidget (an Android platform view). I have not checked whether the same lag reproduces with a pure Flutter widget tree and no platform view, so this may be specific to platform view resizing.

Code sample

Full reproducible project: https://github.com/zabefofoon/flutter_keyboard_scroll_test

Code sample

android/app/src/main/AndroidManifest.xml

<activity
    android:name=".MainActivity"
    android:exported="true"
    android:launchMode="singleTop"
    android:taskAffinity=""
    android:theme="@style/LaunchTheme"
    android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
    android:hardwareAccelerated="true"
    android:windowSoftInputMode="adjustResize">

lib/main.dart

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() {
  runApp(const MyApp());
}

const localPage = 'assets/index.html';

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'keyboard scroll test',
      home: const HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  late final WebViewController _controller;
  bool _loading = true;

  @override
  void initState() {
    super.initState();
    _controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..setNavigationDelegate(
        NavigationDelegate(
          onPageStarted: (_) => setState(() => _loading = true),
          onPageFinished: (_) => setState(() => _loading = false),
        ),
      )
      ..loadFlutterAsset(localPage);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      body: SafeArea(
        child: Stack(
          children: [
            WebViewWidget(controller: _controller),
            if (_loading) const LinearProgressIndicator(),
          ],
        ),
      ),
    );
  }
}

assets/index.html — a column with a fixed header, a scrollable list, and a textarea pinned at the bottom:

<div class="page">
  <div class="header">header</div>
  <div class="list" id="list"></div>
  <textarea class="composer" placeholder="web input"></textarea>
</div>
.page { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.header { flex: none; height: 52px; }
.list { flex: 1; min-height: 0; overflow-y: auto; }
.composer { flex: none; width: 100%; }

Dependency: webview_flutter: ^4.14.1

Screenshots or Video

Screenshots / Video demonstration
flutter_keyboard_scroll_test.mp4

Logs

Logs

No exception is thrown and nothing is logged while the bug happens — the problem is purely a timing/visual one, so there is no relevant log output to attach.

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.47.0, on macOS 26.5.2 25F84 darwin-arm64, locale ko-KR)
    • Flutter version 3.47.0 on channel stable at /Users/rowan/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cf2416426 (2 days ago), 2026-08-11 11:53:49 -0700
    • Engine revision 5f77625673
    • Dart version 3.13.0
    • DevTools version 2.60.0

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
    • Android SDK at /Users/rowan/Library/Android/sdk
    • Platform android-36, build-tools 36.0.0
    • Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.2)
    • Build 17C52
    • CocoaPods version 1.17.0

[✓] Chrome - develop for the web

[✓] Connected device (4 available)
    • SM S908N (mobile) • R3CT7051DSK • android-arm64 • Android 16 (API 36)

[✓] Network resources

• No issues found!

Activity

  1. saurabh-mirajkar commented on Aug 14, 2026

    @saurabh-mirajkar
    Contributor

    @zabefofoon Thanks for the detailed report. I was able to reproduce this on latest stable 3.47. Routing this to investigate further.

  2. added
    platform-androidAndroid applications specifically
    packageflutter/packages repository. See also p: labels.
    p: webview-keyboardKeyboard issues with flutter_webview plugin
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-androidOwned by Android platform team
    fyi-ecosystemFor the attention of Ecosystem team
    and removed
    in triagePresently being triaged by the triage team
    on Aug 14, 2026
  3. added
    P2Important issues not at the top of the work list
    triaged-androidTriaged by Android platform team
    on Aug 18, 2026
  4. added
    P1High-priority issues at the top of the work list
    and removed
    P2Important issues not at the top of the work list
    on Aug 18, 2026
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

    P1High-priority issues at the top of the work listfound in release: 3.47Found to occur in 3.47has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginp: webview-keyboardKeyboard issues with flutter_webview pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions