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.76k stars 815 forks source link

Scrolling on real devices extremely laggy/slow #191

Closed Ahmadre closed 1 year ago

Ahmadre commented 4 years ago

When I run my app in the simulator/emulator the scrolling with SingleChildScrollView is fast, but when i build an release app and run it on my real device it's lagging extremly! why?

related snippet:

SafeArea(
    bottom: false,
        child: SingleChildScrollView(
            controller: _scrollController,
                child: ConstrainedBox(
                    constraints: BoxConstraints(maxWidth: 680),
                    child: Html(
                        padding: EdgeInsets.all(16),
                        onLinkTap: (url) async {
                            if (await canLaunch(url)) {
                                await launch(url);
                            }
                        },
                       data: markdownToHtml(
                           MetaData.myMarkdown(context)),
                       ),
                  ),
            )
)
Sub6Resources commented 4 years ago

There are many possible issues, so it's hard to say. What device are you using? Is the HTML complex? Are you running lots of apps on your device? This could even be an issue with Flutter's performance.

cuongloveit commented 4 years ago

I have a same issue.

<p>Để cải thiện vấn đề sắp xếp task, triển khai c&ocirc;ng việc &amp; &yacute; tưởng mới. Hỗ trợ lead v&agrave; PM trong việc đ&aacute;nh gi&aacute; t&igrave;nh h&igrave;nh assign c&ocirc;ng việc v&agrave; l&ecirc;n kế hoạch kế tiếp.</p>

<p>Từ th&aacute;ng 2/2020, TEQ sẽ &aacute;p dụng Heatmap để monitor t&igrave;nh h&igrave;nh c&ocirc;ng việc của tất cả member một c&aacute;ch trực quan nhất v&agrave; chia sẽ th&ocirc;ng tin n&agrave;y cho tất cả c&aacute;c th&agrave;nh vi&ecirc;n.</p>

<p>I. Mục ti&ecirc;u<br />
- Thể hiện được t&igrave;nh trạng hiện tại của việc assign &amp; commit của member v&agrave;o từng dự &aacute;n hoặc c&aacute;c c&ocirc;ng việc R&amp;D, hỗ trợ nội bộ.<br />
- Gi&uacute;p cho việc tổng kết cuối th&aacute;ng v&agrave; kế hoạch th&aacute;ng kế tiếp của Lead / PM dễ d&agrave;ng hơn. Đ&aacute;nh gi&aacute; hiệu quả&nbsp;theo Qu&iacute; / Năm của team v&agrave; của member ch&iacute;nh x&aacute;c hơn. Từ đ&oacute; c&oacute; những gợi &yacute; để team / member ph&aacute;t triển hơn nữa.<br />
- Dễ d&agrave;ng triển khai những &yacute; tưởng mới, n&acirc;ng cao chất lượng dự &aacute;n v&agrave; ph&aacute;t triển R&amp;D nội bộ<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
II. C&aacute;ch thực hiện.<br />
- Mỗi cuối ng&agrave;y, từng th&agrave;nh vi&ecirc;n&nbsp;d&agrave;nh 3 - 5 ph&uacute;t để input th&ocirc;ng tin v&agrave;o form sau.<br />

&nbsp;&nbsp;&nbsp;&nbsp;p/s: Đ&atilde; chuẩn bị sẵn link form auto điền t&ecirc;n member. &lt;Li&ecirc;n hệ leader để c&oacute; link cho từng members&gt;<br />
- Khi post form, mỗi dự &aacute;n l&agrave; 1 record, phần 【Activity / purpose / mission 】chỉ cần ghi ngắn gọn. V&iacute; dụ như: &quot;Đọc t&agrave;i liệu&quot;, &quot;Support ABC&quot;, &quot;Hỗ trợ member X&quot;, &quot;Seminar&quot; v.v...<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ nếu commit ch&iacute;nh 1 dự &aacute;n v&agrave; support 1 dự &aacute;n th&igrave; post 2 record<br />
- Lead dự &aacute;n sẽ được xem v&agrave; kiểm tra lại th&ocirc;ng tin member đ&atilde; nh&acirc;p c&oacute; ch&iacute;nh x&aacute;c chưa (h&agrave;ng ng&agrave;y hoặc h&agrave;ng tuần), nếu cần c&oacute; thể tự sửa lại cho đ&uacute;ng.<br />
- Member c&oacute; thể được xem những th&ocirc;ng tin li&ecirc;n quan đến dự &aacute;n v&agrave; member của dự &aacute;n m&igrave;nh đang tham gia &lt;t&iacute;nh năng n&agrave;y sẽ cập nhật sau&gt;<br />
III. Lưu &yacute;<br />
- Mỗi th&agrave;nh vi&ecirc;n c&oacute; thể commit nhiều hơn hoặc &iacute;t hơn 8 tiếng 1 ng&agrave;y. C&oacute; thể post form v&agrave;o cuối tuần hoặc buổi tối nếu c&oacute; hỗ trợ dự &aacute;n&nbsp;những việc đột xuất.<br />
- C&oacute; project 【TEQ_TRT】&amp; 【TEQ_Other】d&agrave;nh cho những c&ocirc;ng việc R&amp;D, support nội bộ hoặc sermina, present v.v..<br />
- Nếu hỗ trợ nhiều task linh tinh trong 1 dự &aacute;n th&igrave; chỉ cần summary lại theo dự &aacute;n v&agrave; post 1 form.<br />
- Mọi thắc mắc c&oacute; thể li&ecirc;n hệ với leader / lead dự &aacute;n,</p>
Sub6Resources commented 4 years ago

Thank you for the code snippet to test. I will investigate the slowness issue. Is the app slow every time?

aquilarafa commented 4 years ago

Same with me... SOLVED: For me the issue was that I had a long html text in Html widget. Scrolling caused Html widget to rebuilt and therefore was very laggy.

My approach was to build the Html widget only once:

if(htmlWidget == null){ htmlWidget = Html(...); } return htmlWidget;

cuongloveit commented 4 years ago

Thank you for the code snippet to test. I will investigate the slowness issue. Is the app slow every time?

the app slow is not always slow every time but the above html snippets cause lagginess to the app.

cuongloveit commented 4 years ago

Same with me... SOLVED: For me the issue was that I had a long html text in Html widget. Scrolling caused Html widget to rebuilt and therefore was very laggy.

My approach was to build the Html widget only once:

if(htmlWidget == null){ htmlWidget = Html(...); } return htmlWidget;

yes. me too. it's very slow when scroll

khanhnguyen-96 commented 4 years ago

Same with me... SOLVED: For me the issue was that I had a long html text in Html widget. Scrolling caused Html widget to rebuilt and therefore was very laggy.

My approach was to build the Html widget only once:

if(htmlWidget == null){ htmlWidget = Html(...); } return htmlWidget;

Thank you, this solved the laggy scrolling html widget for me

Ahmadre commented 4 years ago

I used another package, which worked fluently. No workarounds needed like this. And the other package is maintained regularly

Sub6Resources commented 4 years ago

I am working to improve performance for this package right now as well.

Doflatango commented 3 years ago

I used another package, which worked fluently. No workarounds needed like this. And the other package is maintained regularly

Hi @Ahmadre , which package you are using now? Does it have a good performance form very long content(may include images)?

abhi36456 commented 2 years ago

No solution is there for this issue? @Sub6Resources

erickok commented 1 year ago

Closing this in favor of the more detailed duplicate issue #361 which also explains why this isn't a straightforward thing to solve.