Repository navigation
Description
Steps to reproduce
Dear Flutter Team,
I am encountering a runtime assertion error in a Flutter Web application when running on Android Chrome.
Error:
Assertion failed:
file:///C:/flutter/packages/flutter/lib/src/widgets/implicit_animations.dart:912:15
padding.isNonNegative is not true
Issue Description:
The application contains a dialog with TextFields. The error occurs only on Android Chrome when the soft keyboard is opened and closed multiple times.
Steps to Reproduce:
- Open the Flutter Web application in Android Chrome.
- Open a dialog containing TextFields.
- Tap a TextField to open the keyboard.
- Close the keyboard.
- Reopen the keyboard or interact with the dialog again.
- The application throws the assertion mentioned above.
Observations:
- The issue does not occur on desktop browsers.
- The error appears to be related to keyboard-triggered MediaQuery updates.
- The assertion originates from implicit_animations.dart and seems related to a negative EdgeInsets value being passed to an AnimatedPadding or similar widget.
- The problem is reproducible only in Flutter Web on Android Chrome.
Environment:
- Flutter Version: [Your Flutter Version]
- Chrome Version: [Chrome Version]
- Android Device: [Device Name]
- Platform: Flutter Web
Could you please advise whether this is a known issue or provide guidance on additional debugging steps?
Thank you for your time and support.
Kind regards,
Harpreet Singh
Flutter Developer
Expected results
Analyze my complete Flutter project and find the exact source of the following runtime error:
Assertion failed:
file:///C:/flutter/packages/flutter/lib/src/widgets/implicit_animations.dart:912:15
padding.isNonNegative is not true
The error occurs specifically on Flutter Web running in Android Chrome. When I open a dialog, tap a TextField, open the mobile keyboard, and then close/open the keyboard, the app throws this assertion.
Tasks:
-
Scan the entire project for all usages of:
- Padding
- AnimatedPadding
- EdgeInsets.only
- EdgeInsets.symmetric
- EdgeInsets.fromLTRB
- EdgeInsets.all
- MediaQuery.of(context).viewInsets
- MediaQuery.of(context).padding
- MediaQuery.of(context).viewPadding
- keyboard-related calculations
- Responsive layout calculations
-
Identify every place where padding values can become negative due to:
- screen width calculations
- screen height calculations
- keyboard opening/closing
- MediaQuery changes
- responsive helper methods
- subtraction operations such as:
viewInsets.bottom - X
screenWidth - X
screenHeight - X
-
Add temporary debug logs before every suspicious padding calculation to print:
- calculated padding values
- screen width
- screen height
- viewInsets.bottom
- viewPadding values
-
Trace the widget tree and determine the exact widget causing:
padding.isNonNegative is not true -
Check all custom widgets including:
- Dashboard
- ProductCard
- CartScreen
- FooterSection
- ResponsiveScreenFeature
- All dialogs
- Any widget using AnimatedContainer or AnimatedPadding
-
Replace unsafe padding calculations with safe versions using:
math.max(0, value)
or
value.clamp(0.0, double.infinity) -
Provide:
- exact file name
- exact line number
- problematic code
- corrected code
- explanation of why the padding becomes negative on Android Chrome
-
Do not stop after finding one issue. Continue scanning the entire project for all possible negative padding sources and list every occurrence.
Goal:
Find and permanently fix the root cause of the Android Chrome keyboard/dialog crash caused by negative padding.
Actual results
The closing of the keyboard is not correct nd make issue in the flutter web page
Code sample
Code sample
[Paste your code here]Screenshots or Video
<details open>
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[Paste your output here]
Activity
puneetkukreja98 commentedon Jun 1, 2026
@Harpreet-ui Thanks for reporting the issue! To make this issue actionable, we need more information:
github-actions commentedon Jun 22, 2026
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.
Harpreet-ui commentedon Jun 22, 2026
Harpreet-ui commentedon Jun 22, 2026
Harpreet-ui commentedon Jul 7, 2026
github-actions commentedon Jul 21, 2026
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.