Skip to content

GestureRecognizer on TextSpan takes up all remaining spaces of a line instead just over the TextSpan #43400

Closed
@huntrist

Description

@huntrist
class Body extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.black,
      margin: EdgeInsets.all(100),
      child: RichText(
        softWrap: true,
        text: TextSpan(
          children: <InlineSpan>[
            TextSpan(
              text: "very_long_starting_text",
              style: TextStyle(
                color: Colors.red,
              )
            ),
            TextSpan(
              text: "                                         ",
              style: TextStyle(
                color: Colors.green,
                decoration: TextDecoration.lineThrough,
                decorationThickness: 2,
              )
            ),
            TextSpan(
              text: "trailing_text",
              style: TextStyle(
                color: Colors.yellow,
              ),
              recognizer: TapGestureRecognizer()
              ..onTap = () {
                //distinguish between real external link & jiki link
                print("clicked!");
              },
            )
          ],
        )
      ),
    );
  }
}

produces the following effect

{2AM_VG9Y(R_ (XAU9$O_W2

when click on the area after the yelllow "trailing_text"
"clicked!" is printed

flutter doctor -v

[√] Flutter (Channel stable, v1.9.1+hotfix.5, on Microsoft Windows [Version 10.0.18362.418], locale zh-CN)
    • Flutter version 1.9.1+hotfix.5 at D:\Env\flutter
    • Framework revision 1aedbb1835 (7 days ago), 2019-10-17 08:37:27 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

 
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at D:\Env\Android\SDK
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = D:\Env\Android\SDK
    • Java binary at: D:\Executable\Android\AndroidStudio\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 D:\Executable\Android\AndroidStudio
    • Flutter plugin version 40.1.2
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: qualityA truly polished experiencea: typographyText rendering, possibly libtxtengineflutter/engine repository. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions