Skip to content

Incorrect IntrinsicHeight calculation for RichText #48679

@mehmetf

Description

@mehmetf

Internal: b/147481532

This IntrinsicHeight calculation being incorrect seems to be the underlying issue for a number of things that customer:money is seeing.

I've stripped it back to a simplistic example.

With IntrinsicHeight absent, this is what I see:

image

With IntrinsicHeight present, this is what I see:

image

The expectation is that both of these should look the same.

Full repro code:

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'IntrinsicHeight',
      theme: ThemeData(primarySwatch: Colors.blue),
      darkTheme: ThemeData(primarySwatch: Colors.blue),
      home: Scaffold(
        appBar: AppBar(title: Text('IntrinsicHeight Test')),
        body: Align(
          alignment: Alignment.topLeft,
          child: Container(
            color: Colors.green,
            child: IntrinsicHeight(
              child: RichText(
                text: TextSpan(
                  text: 'Root\n',
                  children: [
                    TextSpan(text: 'Start\n'),
                    WidgetSpan(
                      child: Row(
                        children: [
                          Icon(Icons.edit, size: 16),
                        ],
                      ),
                    ),
                    TextSpan(text: 'End'),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: typographyText rendering, possibly libtxtcustomer: money (g3)found in release: 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions