InputDecorator with IntrinsicHeight does not conform layout height when `isDense: true` or `isCollapsed: true`
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### 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
```dart
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 createState() => _MyHomePageState();
}
class _MyHomePageState extends State {
@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
### Logs
Logs
```console
======== 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: (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
```console
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.
```
Contributor guide
Research direction
Run the provided Dart reproduction on macOS or web and focus on the InputDecorator with IntrinsicHeight, isDense, and isCollapsed. Confirm the reported RenderFlex overflow and use the absence of the 8-pixel overflow as the completion check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- frontend, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100