flutter_widget_from_html icon indicating copy to clipboard operation
flutter_widget_from_html copied to clipboard

the HtmlWidget is too slow

Open xiaolei123 opened this issue 2 years ago • 5 comments

Use case

HtmlWidget(
  html,
  buildAsync: true,
);

Proposal

i found you parsed html with main isolate ,:

Widget _buildSync() {
    Timeline.startSync('Build $widget (sync)');

    Widget built;
    try {
      final domNodes = _parseHtml(widget.html);
      built = _buildBody(this, domNodes);
    } catch (error, stackTrace) {
      built =
          _wf.onErrorBuilder(context, _rootMeta, error, stackTrace) ?? widget0;
    }

    Timeline.finishSync();

    return built;
  }

but _parseHtml(html) is too slow, can you use the Isolate.spow, in the child isolate,it's will be faster

xiaolei123 avatar Jun 05 '23 06:06 xiaolei123

How big is your HTML?

daohoangson avatar Jun 08 '23 06:06 daohoangson

my html is small , but when i open a new page . and load html when i open new page .

but the page Transition animations has not finish, the HtmlWidget load html is success,

the app will be Stutter dropped frames.

xiaolei123 avatar Jun 09 '23 07:06 xiaolei123

So it was... too fast?

daohoangson avatar Jun 09 '23 08:06 daohoangson

emm .... it like yes. and this scene have any method to fix it ? (the app will be Stutter dropped frames)

xiaolei123 avatar Jun 09 '23 08:06 xiaolei123

Can you share your HTML? With a medium size HTML or smaller, it should not impact navigation animation. Did you test in release mode?

daohoangson avatar Jun 09 '23 15:06 daohoangson