Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.8k stars 876 forks source link

[BUG] Only the first builder function is called when there are multiple TagWrapExtensions #1438

Open incofab opened 2 months ago

incofab commented 2 months ago

Describe the bug: If I have more than one TagWrapExtension for different Tags and what to wrap then with different tags. All the tags eventually gets wrapped by the same tag of the first TagWrapExtension in the entry.

HTML to reproduce the issue:

  Html(
          document: data,
          extensions: [
            TagWrapExtension(
              tagsToWrap: {'table', 'math'},
              builder: (child) {
                return SingleChildScrollView(
                  scrollDirection: Axis.horizontal,
                  child: Container(
                    width: 700,
                    margin: const EdgeInsets.symmetric(vertical: 5),
                    child: child,
                  ),
                );
              },
            ),
            TagWrapExtension(
              tagsToWrap: {'p''},
              builder: (child) {
                return  Container(
                    height: 100,
                    margin: const EdgeInsets.symmetric(vertical: 20),
                    child: child,
                );
              },
            ),
     ]
);

Html widget configuration:

Expected behavior: The builder function of each TagWrapExtension should be applied to accordingly

Screenshots:

Device details and Flutter/Dart/flutter_html versions:

Stacktrace/Logcat

Additional info:

A picture of a cute animal (not mandatory but encouraged)