Repository navigation
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: animationAnimation APIsAnimation APIsa: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Steps to Reproduce
- Create AnimatedContainer with height
25and curve set toCurves.easeOutBack - change State to Animate it to
0 - the Exception/Error is thrown.
While transitioning height with the easeOutBack curve, flutter throws an Exception because height becomes negative at some point during the animation.
The expected behavior would have been to "clamp" the height so it never goes below 0. or maybe behave like negative margins in CSS. idk 🤷♂
Source
return AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeOutQuint,
height: containerHeight, // ex: it toggles between 25 and 0.
alignment: Alignment.center,
child: Text('some text',
style: TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
)Logs
flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building
flutter: AnimatedContainer-[<'read-receit-text-bottom-6'>](duration: 400ms, centerLeft,
flutter: BoxConstraints(0.0<=w<=Infinity, h=1.0), margin: EdgeInsets(45.0, 0.0, 25.0, 0.0), dirty, state:
flutter: _AnimatedContainerState#4493e(ticker active, AlignmentGeometryTween(centerLeft → centerLeft),
flutter: BoxConstraintsTween(BoxConstraints(0.0<=w<=Infinity, h=25.0) → BoxConstraints(0.0<=w<=Infinity,
flutter: h=1.0)), margin: EdgeInsetsGeometryTween(EdgeInsets(45.0, 0.0, 25.0, 0.0) → EdgeInsets(45.0, 0.0,
flutter: 25.0, 0.0)))):
flutter: BoxConstraints has a negative minimum height.
flutter: The offending constraints were:
flutter: BoxConstraints(0.0<=w<=Infinity, h=-0.3; NOT NORMALIZED)
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 BoxConstraints.debugAssertIsValid.<anonymous closure>.throwError
package:flutter/…/rendering/box.dart:507
flutter: #1 BoxConstraints.debugAssertIsValid.<anonymous closure>
package:flutter/…/rendering/box.dart:537
flutter: #2 BoxConstraints.debugAssertIsValid
package:flutter/…/rendering/box.dart:554
flutter: #3 new Container
package:flutter/…/widgets/container.dart:270
flutter: #4 _AnimatedContainerState.build
package:flutter/…/widgets/implicit_animations.dart:668
flutter: #5 StatefulElement.build
package:flutter/…/widgets/framework.dart:4012
flutter: #6 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3924
flutter: #7 Element.rebuild
package:flutter/…/widgets/framework.dart:3721
flutter: #8 BuildOwner.buildScope
package:flutter/…/widgets/framework.dart:2340
flutter: #9 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame
package:flutter/…/widgets/binding.dart:700
flutter: #10 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback
package:flutter/…/rendering/binding.dart:285
flutter: #11 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback
package:flutter/…/scheduler/binding.dart:1016
flutter: #12 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame
package:flutter/…/scheduler/binding.dart:958
flutter: #13 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame
package:flutter/…/scheduler/binding.dart:874
flutter: #17 _invoke (dart:ui/hooks.dart:236:10)
flutter: #18 _drawFrame (dart:ui/hooks.dart:194:3)
flutter: (elided 3 frames from package dart:async)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: BoxConstraints has a negative minimum height.
flutter analyze
// nothing except few linting logs.
flutter doctor -v
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.5 18F132, locale
en-CA)
• Flutter version 1.7.8+hotfix.4 at /Users/iliasbhallil/flutter
• Framework revision 20e59316b8 (2 weeks ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/iliasbhallil/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/iliasbhallil/Library/Android/sdk
• 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-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
• CocoaPods version 1.6.0.beta.2
[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.36.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.3.0
[✓] Connected device (1 available)
• iPhone Xʀ • 80A92D26-45F4-400A-95DF-89CA1CDA58A7 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)
Reacted by luccascorrea, ilias bhallil, bahriddin-iress, Vlad Bondarenko and Arthur Cohen
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: animationAnimation APIsAnimation APIsa: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Activity
TahaTesser commentedon Feb 21, 2020
Hi @iliasbhal
After testing this on
Flutter 1.12.13+hotfix.8 • channel stable, it couldn't be reproduced.Are you still experiencing this issue?
Thank you
VladyslavBondarenko commentedon Mar 16, 2020
a bit modified code from https://flutter.dev/docs/cookbook/animation/animated-container
this code sample
throws the exception with
easeOutBack(flutter version v1.15.22-pre.33)
markusaksli-nc commentedon Aug 11, 2020
This happens because easeOutBack, like a lot of other Curves, overshoots its bounds.
This means when shrinking, the animation overshoots the height bound (0) and goes negative for a bit. This behavior should be expected and can be avoided with a lot of other curves that do not overshoot their bounds. Not even sure what the expected behavior for an animation overshooting a size of 0 should be. As far as I know, there is no official documentation about any clamped dimensions in Flutter.
Leaving this open since the error message or the documentation for overshooting curves can be improved to clarify this case.
Normalize lerped BoxConstraints with overshooting t values (flutter#1…
github-actions commentedon Aug 29, 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.