Skip to content

InputDecorator with IntrinsicHeight does not conform layout height when isDense: true or isCollapsed: true #190536

Closed
flutter/packages
#13522

Description

@Gustl22

Steps to reproduce

  1. Execute the example code (Tested on mac and web)

Expected results

To not give an overflow pixel error

Actual results

A RenderFlex overflowed by 8.0 pixels on the bottom.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

  const MyHomePage({super.key, required this.title});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: IntrinsicHeight(
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            Expanded(
              child: Card(
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    Text('Text'),
                    TextField(
                      decoration: InputDecoration(
                        isDense: true,
                        isCollapsed: true,
                        contentPadding: EdgeInsets.zero,
                        border: InputBorder.none,
                        hintText: 'Test',
                      ),
                    ),
                  ],
                ),
              ),
            ),
            // As an example, the ard should adapt to the same height as its left neighbour
            Card(child: Text('Right text')),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration Image

Logs

Logs
======== Exception caught by rendering library =====================================================
The following assertion was thrown during layout:
A RenderFlex overflowed by 8.0 pixels on the bottom.

The relevant error-causing widget was: 
  Column Column: .../Documents/git/flutter/flutter_beta/examples/platform_view/lib/main.dart:36:24
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.

Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.

The specific RenderFlex in question is: RenderFlex#4b4dd OVERFLOWING
...  needs compositing
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=718.0, h=36.0)
...  size: Size(718.0, 36.0)
...  direction: vertical
...  mainAxisAlignment: start
...  mainAxisSize: min
...  crossAxisAlignment: center
...  verticalDirection: down
...  spacing: 0.0
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
====================================================================================================

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel beta, 3.47.0-0.3.pre, on macOS 26.5.2 25F84 darwin-arm64, locale en-US)
    ! Warning: `flutter` on your path resolves to /opt/homebrew/share/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/swi-oberhauser/Documents/git/flutter/flutter_beta. Consider adding /Users/swi-oberhauser/Documents/git/flutter/flutter_beta/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /opt/homebrew/share/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/swi-oberhauser/Documents/git/flutter/flutter_beta. Consider adding /Users/swi-oberhauser/Documents/git/flutter/flutter_beta/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.5)
[✓] Chrome - develop for the web
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 1 category.

Activity

  1. Gustl22 commented on Aug 4, 2026

    @Gustl22
    ContributorAuthor

    AI analysis:

    Root cause

    The discrepancy is in _RenderDecoration in packages/flutter/lib/src/material/input_decorator.dart. The minContainerHeight guard is computed differently in the two paths:

      performLayout (layout path):                                                                                                                                                                                                                                                                                     
      // line ~1122                                                                                                                                                                                                                                                                                                    
      final double minContainerHeight = decoration.isDense! || decoration.isCollapsed || expands                                                                                                                                                                                                                       
          ? inputHeight                                                                                                                                                                                                                                                                                                
          : kMinInteractiveDimension;
    computeMinIntrinsicHeight (intrinsic path):                                                                                                                                                                                                                                                                      
      // line ~1329                                                                                                                                                                                                                                                                                                    
      final double minContainerHeight = decoration.isDense! || expands                                                                                                                                                                                                                                                 
          ? 0.0                                                                                                                                                                                                                                                                                                        
          : kMinInteractiveDimension;

    Two issues compared to the layout path:

    1. decoration.isCollapsed is missing from the condition — so a collapsed field does not suppress the kMinInteractiveDimension floor during intrinsic measurement.
    2. When the condition is true, the layout path uses inputHeight as the floor, while the intrinsic path uses 0.0 — meaning the intrinsic path can return a value below the input's own natural height.

    Suggested fix

    Align the intrinsic path with the layout path:

      // in computeMinIntrinsicHeight                                                                                                                                                                                                                                                                                  
      final double minContainerHeight = decoration.isDense! || decoration.isCollapsed! || expands                                                                                                                                                                                                                      
          ? inputHeight   // use inputHeight, not 0.0                                                                                                                                                                                                                                                                  
          : kMinInteractiveDimension;                                                                                                                                                                                                                                                                                  

    Workaround (app-side)

    Pass isDense: false and isCollapsed: true to InputDecoration when the field is inside an IntrinsicHeight tree.

  2. added
    in triagePresently being triaged by the triage team
    workaround availableThere is a workaround available to overcome the issue
    on Aug 5, 2026
  3. puneetkukreja98 commented on Aug 5, 2026

    @puneetkukreja98
    Contributor

    @Gustl22 Thanks for reporting this issue. I was able to reproduce it on both macOS and Web. Routing this to team-design for further investigation as it pertains to InputDecoration.

    Flutter doctor -v:

    [✓] Flutter (Channel master, 3.47.0-1.0.pre-354, on macOS 26.4.1 25E253 darwin-arm64, locale en-US) [2.4s]
        • Flutter version 3.47.0-1.0.pre-354 on channel master at /Users/puneetkukreja/flutter-contribution/flutter
        • Upstream repository https://github.com/puneetkukreja98/flutter
        • FLUTTER_GIT_URL = https://github.com/puneetkukreja98/flutter
        • Framework revision b766512c65 (21 hours ago), 2026-08-04 06:41:39 -0400
        • Engine revision b766512c65
        • Dart version 3.14.0 (build 3.14.0-89.0.dev)
        • DevTools version 2.61.0-dev.0
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use,
          enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 37.0.0-rc1) [2.8s]
        • Android SDK at /Users/puneetkukreja/Library/Android/sdk
        • Emulator version 36.6.11.0 (build_id 15507667) (CL:N/A)
        • Platform android-37.1, build-tools 37.0.0-rc1
        • Java binary at: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/java
          This JDK is specified in your Flutter configuration.
          To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 26.6) [1,451ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 17F113
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [9ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (3 available) [6.9s]
        • Puneet’s iPhone (wireless) (mobile) • 00008110-00167CEE0C46401E • ios            • iOS 18.0.1 22A3370
        • macOS (desktop)                     • macos                     • darwin-arm64   • macOS 26.4.1 25E253 darwin-arm64
        • Chrome (web)                        • chrome                    • web-javascript • Google Chrome 150.0.7871.187
    
    [✓] Network resources [522ms]
        • All expected network resources are available.
    
    • No issues found!
    
  4. added
    p: material_uimaterial_ui package in flutter/packages
    team-designOwned by Design Languages team
    fyi-text-inputFor the attention of Text Input team
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    fyi-frameworkFor the attention of Framework team
    and removed
    in triagePresently being triaged by the triage team
    on Aug 5, 2026
  5. added
    P2Important issues not at the top of the work list
    triaged-designTriaged by Design Languages team
    on Aug 5, 2026
  6. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages teamworkaround availableThere is a workaround available to overcome the issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions