Skip to content

With RTL, the RichText content moves but the widget does not #62550

@mehmetf

Description

@mehmetf

Internal: b/162318478

See repro:

Container(
    padding: EdgeInsets.all(matGrid * 2),
    child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text('LTR Text Span (Default TextWidthBasis):',
              style: Theme.of(context).textTheme.caption),
          Container(
              decoration: BoxDecoration(border: Border.all(width: 1)),
              child: Text.rich(
                TextSpan(children: [
                  TextSpan(text: 'this is a line of text with words'),
                ]),
              )),
          Container(
              decoration: BoxDecoration(border: Border.all(width: 1)),
              child: Text.rich(
                TextSpan(children: [
                  TextSpan(
                      text:
                          'this is a line of text with words followed by areallylongwordthatneedstobewrapped'),
                ]),
              )),
          Text('RTL Text Span (Default TextWidthBasis):',
              style: Theme.of(context).textTheme.caption),
          Container(
              decoration: BoxDecoration(border: Border.all(width: 1)),
              child: Text.rich(
                  TextSpan(children: [
                    TextSpan(text: 'this is a line of text with words'),
                  ]),
                  textDirection: TextDirection.rtl)),
          Container(
              decoration: BoxDecoration(border: Border.all(width: 1)),
              child: Text.rich(
                  TextSpan(children: [
                    TextSpan(
                        text:
                            'this is a line of text with words followed by areallylongwordthatneedstobewrapped'),
                  ]),
                  textDirection: TextDirection.rtl)),
          Text('LTR Text Span (TextWidthBasis.longestLine):',
              style: Theme.of(context).textTheme.caption),
          Container(
              decoration: BoxDecoration(border: Border.all(width: 1)),
              child: Text.rich(
                  TextSpan(children: [
                    TextSpan(text: 'this is a line of text with words'),
                  ]),
                  textWidthBasis: TextWidthBasis.longestLine)),
          Container(
              decoration: BoxDecoration(border: Border.all(width: 1)),
              child: Text.rich(
                  TextSpan(children: [
                    TextSpan(
                        text:
                            'this is a line of text with words followed by areallylongwordthatneedstobewrapped'),
                  ]),
                  textWidthBasis: TextWidthBasis.longestLine)),
          Text('RTL Text Span (TextWidthBasis.longestLine):',
              style: Theme.of(context).textTheme.caption),
          Container(
              decoration: BoxDecoration(border: Border.all(width: 1)),
              child: Text.rich(
                  TextSpan(children: [
                    TextSpan(text: 'this is a line of text with words'),
                  ]),
                  textWidthBasis: TextWidthBasis.longestLine,
                  textDirection: TextDirection.rtl)),
          Container(
              decoration: BoxDecoration(border: Border.all(width: 1)),
              child: Text.rich(
                  TextSpan(children: [
                    TextSpan(
                        text:
                            'this is a line of text with words followed by areallylongwordthatneedstobewrapped '),
                  ]),
                  textWidthBasis: TextWidthBasis.longestLine,
                  textDirection: TextDirection.rtl)),
        ]));

Produces the following screen (screen does not map to code directly. Customer reported two issues in a single repro and I edited the code):

image

Metadata

Metadata

Labels

P0Critical issues such as a build break or regressiona: internationalizationSupporting other languages or locales. (aka i18n)a: typographyText rendering, possibly libtxtcustomer: mulligan (g3)frameworkflutter/packages/flutter repository. See also f: labels.waiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions