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.79k stars 860 forks source link

[QUESTION] wrap table is scrollview flutter 3.0.0-beta.1 #1262

Closed Sembauke closed 1 year ago

Sembauke commented 1 year ago

Now that child is no longer here and context is no longer type of RenderContext but ExtensionContext I can't seem to find a way to do this correctly.

extensions: [
          TagExtension(
            tagsToExtend: {'table'},
            builder: (extContext) {
              return SingleChildScrollView(
                scrollDirection: Axis.horizontal,
                child: extContext. ??,
              );
            },
          )
        ],
Sub6Resources commented 1 year ago

This actually got a lot more difficult! I just opened a pull request (#1264) that simplifies wrapping any html tag in a widget and updated the example to use the new WrapperExtension to wrap a <table> in a SingleChildScrollView as you were trying to do here.

If the PR gets merged, the API looks like:

extensions: [
  WrapperExtension(
    tagsToWrap: {'table'},
    builder: (child) {
      return SingleChildScrollView(
        scrollDirection: Axis.horizontal,
        child: child,
      );
    }
  ),
],

Please let me know what you think of the new helper extension!