Skip to content

Paragraph maxIntrinsicWidth incorrect when text wraps #21965

@yjbanov

Description

@yjbanov

Steps to Reproduce

Flutter Engine computes incorrect maxIntrinsicWidth when ParagraphConstraints cause the paragraph to wrap. IOW, the following test should fail, but it passes:

  testWidgets('odd Ahem width', (WidgetTester tester) async {
    final ui.ParagraphBuilder builder = ui.ParagraphBuilder(ui.ParagraphStyle(
      fontFamily: 'Ahem',
      fontStyle: FontStyle.normal,
      fontWeight: FontWeight.normal,
      fontSize: 10.0,
    ));
    builder.addText('Test Ahem');
    final ui.Paragraph paragraph = builder.build();
    paragraph.layout(ui.ParagraphConstraints(width: 50.0));
    expect(paragraph.maxIntrinsicWidth, 80.0);

    paragraph.layout(ui.ParagraphConstraints(width: 1000.0));
    expect(paragraph.maxIntrinsicWidth, 90.0);
  });

Specifically, we should be getting maxIntrinsicWidth of 90.0 for both constraints. However, the engine incorrectly returns 80.0 for constraint 50.0.

/cc @Hixie @GaryQian

Metadata

Metadata

Assignees

Labels

a: qualityA truly polished experiencea: typographyText rendering, possibly libtxtengineflutter/engine related. See also e: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions