Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting Semantics causes crash #128

Open
jwehrle opened this issue Dec 5, 2023 · 0 comments
Open

Conflicting Semantics causes crash #128

jwehrle opened this issue Dec 5, 2023 · 0 comments

Comments

@jwehrle
Copy link

jwehrle commented Dec 5, 2023

Error: 'package:flutter/src/semantics/semantics.dart': Failed assertion: line 3184 pos 16: 'node.parent == null || !node.parent!.isPartOfNodeMerging || node.isMergedIntoParent': is not true.

I copy pasted the example code as the title of a ListTile and the error above is thrown.

   ListTile(
      leading: leading,
      title: Linkify(
        onOpen: (link) async {
          if (!await launchUrl(Uri.parse(link.url))) {
            throw Exception('Could not launch ${link.url}');
          }
        },
        text: "Made by https://cretezy.com",
        style: TextStyle(color: Colors.yellow),
        linkStyle: TextStyle(color: Colors.red),
      ),
      trailing: trailing,
    )

Unless I wrap Linkify in ExcludeSemantics:

   ListTile(
      leading: leading,
      title: ExcludeSemantics(
        child: Linkify(
          onOpen: (link) async {
            if (!await launchUrl(Uri.parse(link.url))) {
              throw Exception('Could not launch ${link.url}');
            }
          },
          text: "Made by https://cretezy.com",
          style: TextStyle(color: Colors.yellow),
          linkStyle: TextStyle(color: Colors.red),
        ),
      ),
      trailing: trailing,
    )

The idea for this came from
flutter/flutter#31437

Which suggests there is a conflict between the ListTile semantics and the RichText semantics in Linkify.

Excluding semantics is not a good option for my app and I'd rather not have to replicate ListTile to use Linkify.

Has anyone else run into this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant