Skip to content

WidgetSpans in RTL text laying out LTR if they occur on the same line #54400

@mimbrown

Description

@mimbrown

Steps to Reproduce

Run the following app:

import 'package:flutter/material.dart';

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

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Widget Test',
      home: TestWidgetSpans(),
    );
  }
}

class TestWidgetSpans extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Directionality(
      textDirection: TextDirection.rtl,
      child: Scaffold(
        body: Center(
          child: Text.rich(
            TextSpan(
              text: 'هذا اختبار',
              style: TextStyle(
                backgroundColor: Colors.grey.withOpacity(0.5),
                fontSize: 30,
              ),
              children: [
                WidgetSpan(
                  child: Container(
                    width: 30.0,
                    color: Colors.blue.withOpacity(0.5),
                    child: Center(
                      child: Text('1'),
                    ),
                  ),
                ),
                TextSpan(text: ' و '),
                WidgetSpan(
                  child: Container(
                    width: 50.0,
                    color: Colors.red.withOpacity(0.5),
                    child: Center(
                      child: Text('2'),
                    ),
                  ),
                ),
                TextSpan(text: ' ثم '),
                WidgetSpan(
                  child: Container(
                    width: 70.0,
                    color: Colors.green.withOpacity(0.5),
                    child: Center(
                      child: Text('3'),
                    ),
                  ),
                ),
                TextSpan(text: ' ، لكنه معطل'),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Expected results:
The 1, 2, and 3 widgets laid out RTL.

Actual results:
Screenshot_1586469450

Logs
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18362.720], locale en-US)
    • Flutter version 1.12.13+hotfix.9 at C:\src\flutter
    • Framework revision f139b11009 (10 days ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\mimbr\AppData\Local\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = C:\Users\mimbr\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[√] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 44.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.44.0)
    • VS Code at C:\Users\mimbr\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.9.1

[√] Connected device (1 available)
    • sdk gphone x86 • emulator-5554 • android-x86 • Android R (API 29) (emulator)

• No issues found!

Metadata

Metadata

Labels

P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)a: qualityA truly polished experiencea: typographyText rendering, possibly libtxtfound in release: 3.10Found to occur in 3.10found in release: 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions