daohoangson / flutter_widget_from_html

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.
https://pub.dev/packages/flutter_widget_from_html
MIT License
635 stars 235 forks source link

The html from the email will fail. #1140

Closed dhalsdyd closed 9 months ago

dhalsdyd commented 9 months ago

Steps to Reproduce

HTML ```html
```
`HtmlWidget` configuration ```dart import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; class TestPage extends StatelessWidget { const TestPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: Column( children: [ Expanded( child: HtmlWidget( """
""", onErrorBuilder: (context, element, error) { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const Text( 'Error', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), ), Text(error.toString(), style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold)), ])); }, ), ), ], )); } } ```
Tesing environment ``` [✓] Flutter (Channel stable, 3.16.2, on macOS 14.2 23C64 darwin-arm64, locale ko-Kore-KR) • Flutter version 3.16.2 on channel stable at /opt/homebrew/Caskroom/flutter/3.16.0/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 9e1c857886 (3 weeks ago), 2023-11-30 11:51:18 -0600 • Engine revision cf7a9d0800 • Dart version 3.2.2 • DevTools version 2.28.3 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/SAMSUNG/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.14.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) [✓] VS Code (version 1.85.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.78.0 [✓] Connected device (4 available) • iPhone (mobile) • 00008101-001161503CA0001E • ios • iOS 17.3 21D5026f • iPhone 15 Pro (mobile) • 643D3427-C9CD-4F34-A557-60594C55C7F8 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.2 23C64 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.109 [✓] Network resources • All expected network resources are available. ```

Expected results

image

Actual results

image image

The screen does not come up as the above error occurs.

daohoangson commented 9 months ago

I have been able to isolate the culprit to this piece of HTML

<table>
  <tr>
    <td style="font-size: 0;">
      <a href="http://domain.com" style="line-height: 24px; font-size: 12px;">Unsubscribe</a>
    </td>
  </tr>
</table>

Working on a fix for this.

daohoangson commented 9 months ago

v0.14.11 has been released with the fix for this. Please try upgrading and let me know whether it works for you.

dhalsdyd commented 9 months ago

It works well! Thank you!

daohoangson commented 9 months ago

That's great to hear. I'm closing this now.