Skip to content

IntrinsicHeight not correctly calculated/propagated by LimitedBox to Text #172860

@HannesGitH

Description

@HannesGitH

Steps to reproduce

DartPad

i.e.

  1. have a Row wrapped in IntrinsicHeight
  2. inside this row have LimitedBox that constraints its childs width
  3. the child, a Text should take up all the vertical space it needs, but instead only takes one line

Expected results

as mentioned in step 3., the child should take the height it needs, as it does when replaceing LimitedBox with ConstrainedBox

Actual results

it only takes minimum height of 1 text line

Code sample

Code sample

This is the same as linked in dartPad

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(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(),
      home: Scaffold(
        body: ListView(
          children: [
            WorkingExample(),
            const SizedBox(height: 100),
            DisfunctExample(),
          ],
        ),
      ),
    );
  }
}

class WorkingExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return IntrinsicHeight(
      child: Row(
        children: List.generate(
          4,
          (i) => ConstrainedBox(
            constraints: BoxConstraints(maxWidth: 300),
            child: Container(
              child: Text('very very long text' * 20 * i),
              color: Colors.teal,
            ),
          ),
        ),
      ),
    );
  }
}

class DisfunctExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return IntrinsicHeight(
      child: Row(
        children: List.generate(
          4,
          (i) => LimitedBox(
            maxWidth: 300,
            child: Container(
              child: Text('very very long text' * 20 * i),
              color: Colors.amber,
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

Top: expected, archieved with constrainedBox
Bottom: actual result

Image

Logs

Flutter Doctor output

Doctor output
dart pad stable channel: Based on Dart SDK 3.8.1 and Flutter SDK 3.32.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions