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 875 forks source link

[BUG] State change doesn't refresh the widget #1094

Closed DavideBicego closed 2 years ago

DavideBicego commented 2 years ago

Describe the bug: On state change there seems to not be a refresh of the widget even though the value of "data" content changes.

HTML to reproduce the issue:

No specific html string. Something simple.

Html widget configuration:

Html(
  data: "${aListOfMine[index].property}",
  style: {
    '*': Style(
      height: 24,
      fontStyle: FontStyle.italic,
      fontSize: FontSize(10),
      color: Colors.grey[600],
      alignment: Alignment.topLeft,
      margin: EdgeInsets.zero,
    )
  },
)
// I have a list
List<SomeObject> aListOfMine;

// and the state changes like
setState(() {
  aListOfMine.clear();
  aListOfMine.addAll(newListElements);
});

The state changes Expected behavior:

The widget should be refreshed to have the string change to be visible.

Device details and Flutter/Dart/flutter_html versions:

flutter_html: ^3.0.0-alpha.3

Flutter 3.0.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision cd41fdd495 (2 settimane fa) • 2022-06-08 09:52:13 -0700
Engine • revision f15f824b57
Tools • Dart 2.17.3 • DevTools 2.12.2

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-x64, locale it-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.67.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

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

Sorry no cute animals today 😞

DavideBicego commented 2 years ago

Sorry, it works on flutter_html: ^3.0.0-alpha.5!

Thanks for the great work

docaohuynh commented 2 years ago

I have got same error with version ^3.0.0-alpha.5. It is correct with version 2.2.1