Flutter_widget_from_html: more than one HtmlWidget leads to the dissappering of some of them

Created on 2 Nov 2019  路  4Comments  路  Source: daohoangson/flutter_widget_from_html

I have to add more than one HtmlWidget inside every screen...When I added them some time they display the content and sometimes they don't and if I navigated to a new screen, mostly it does not display the content and I do not know the reason.
The following code is a simple example of the issue that I am facing

 class testClass extends StatelessWidget {
           @override
              Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Test Screen"),
      ),
      body: Center(
        child: ListView(
          children: <Widget>[
            Container(
                child: HtmlWidget(
              "<a href=\"https://www.alwakeelnews.com\"><img alt=\"\" src=\"https://via.placeholder.com/320x100.jpg?text=C1-320x100\" /></a>",
              webViewJs: true,
              webView: true,
            )),
            Text("Heloo"),
            Container(
                child: HtmlWidget(
              "<a href=\"https://www.alwakeelnews.com\"><img alt=\"\" src=\"https://via.placeholder.com/320x100.jpg?text=C1-320x100\" /></a>",
              webViewJs: true,
              webView: true,
            )),
            InkWell(
              child: Text("Move to Next Page ==>"),
              onTap: () {
                Navigator.push(context,
                    MaterialPageRoute(builder: (context) => testClass()));
              },
            ),
            Container(
                child: HtmlWidget(
              "<a href=\"https://www.alwakeelnews.com\"><img alt=\"\" src=\"https://via.placeholder.com/320x100.jpg?text=C1-320x100\" /></a>",
              webViewJs: true,
              webView: true,
            )),
            Container(
                child: HtmlWidget(
              "<a href=\"https://www.alwakeelnews.com\"><img alt=\"\" src=\"https://via.placeholder.com/320x100.jpg?text=C1-320x100\" /></a>",
              webViewJs: true,
              webView: true,
            )),
          ],
        ),
      ),
    );
  }
}
bug

Most helpful comment

I have identified a bug when the same image is rendered again and again in different HtmlWidget, it may be hidden on the first pass. A new version (v0.2.4+1) has been released with the fix, please try upgrading and see if it works correctly in your app @ahmadkhedr

All 4 comments

Thank you for the detailed report, I'll try to reproduce it on my setup. Do you have any error in console by the way? Also, what is your flutter doctor output?

It does not show me any errors or messages on the console at all
and this is my flutter doctor :
`Doctor summary (to see all details, run flutter doctor -v):
[鈭歖 Flutter (Channel stable, v1.9.1+hotfix.2, on Microsoft Windows [Version 10.0.16299.431], locale en-US)

[鈭歖 Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[鈭歖 Android Studio (version 3.4)
[鈭歖 IntelliJ IDEA Community Edition (version 2018.3)
[!] IntelliJ IDEA Ultimate Edition (version 2018.3)
X Flutter plugin not installed; this adds Flutter specific functionality.
[鈭歖 VS Code (version 1.30.2)
[鈭歖 Connected device (1 available)

! Doctor found issues in 1 category.
`

I have identified a bug when the same image is rendered again and again in different HtmlWidget, it may be hidden on the first pass. A new version (v0.2.4+1) has been released with the fix, please try upgrading and see if it works correctly in your app @ahmadkhedr

Works perfectly...Thank you so much for quick fix and reply :hearts: :hearts:

Was this page helpful?
0 / 5 - 0 ratings