Skip to content

Conflicting Semantics causes crash #128

@jwehrle

Description

@jwehrle

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions