Skip to content

[QUESTION] Recursive TagExtension #1410

Open
@romainpurchla

Description

@romainpurchla

Hello,

If I use <a> inside <p> with TagExtension for both, the first TagExtension works but the second does not.

How I can make TagExtension recursive ?

Example :

String html = "<p>This is my html <a href="https://myurl.com">My link</a></p>

[...]

extensions: [
   TagExtension(
          tagsToExtend: {"a"},
          builder: (extensionContext) {
            return Semantics(
                button: true,
                child: GestureDetector(
                    onTap: () {
                      HcLaunchURL(extensionContext.element!.attributes["href"]);
                    },
                    child: Text(extensionContext.element!.text,
                        style: TextStyle(
                          color: Colors.red,
                        ),
                        textAlign: TextAlign.start)));
          },
   ),
   TagExtension(
          tagsToExtend: {"p"},
          builder: (extensionContext) {
            return Padding(
                padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
                child: Text(
                      extensionContext.element!.text));
          },
   ),
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationIssues in our documentation, or suggestions on how the documentation should be improvedextensionsquestion

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions