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.75k stars 805 forks source link

[BUG] The example app has dependency errors and build errors with 3.0.0 - beta 2 #1386

Open graemep-nz opened 7 months ago

graemep-nz commented 7 months ago

Using the latest Flutter

The example app gets dependency errors using 3.0.0 - beta 2 as below (BTW, trying to use V2.21 flutter_html also gets errors with the latest Flutter)

_Resolving dependencies... Because every version of flutter_html_all from path depends on flutter_html from hosted and example depends on flutter_html from path, flutter_html_all from path is forbidden. So, because example depends on flutter_htmlall from path, version solving failed.

The example app pubspec.yaml has this

_dependencies:
  flutter_html:
    path: ..
  flutter_html_all:
    path: ../packages/flutter_html_all_

Changing pubspec.yaml to this

_dependencies:
  flutter_html: ^3.0.0-beta.2
    # path: ..
  flutter_html_all: ^3.0.0-beta.2_

gets rid of the dependency errors but gets half a dozen errors on building that all look like this - all from gesture_detector_builder.dart

/C:/Users/.../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.6.3+1/lib/src/widgets/selection/gesture_detector_builder.dart:186:20: Error: The argument type 'void Function(TapDownDetails)' can't be assigned to the parameter type 'void Function(TapDragDownDetails)?'.
 - 'TapDownDetails' is from 'package:flutter/src/gestures/tap.dart' ('/C:/Tools/flutter/packages/flutter/lib/src/gestures/tap.dart').
 - 'TapDragDownDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/Tools/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
        onTapDown: onTapDown,

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 3.1.3 Flutter SDK 3.13.7 example 1.0.0+1 dependencies: - flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine] - flutter_html 3.0.0-beta.2 [html csslib collection list_counter flutter] - flutter_html_all 3.0.0-beta.2 [flutter html flutter_html flutter_html_audio flutter_html_iframe flutter_html_math flutter_html_svg flutter_html_table flutter_html_video] dev dependencies: - flutter_lints 2.0.3 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web] transitive dependencies: - args 2.4.2 - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - chewie 1.7.1 [cupertino_icons flutter provider video_player wakelock_plus] - chewie_audio 1.5.0 [cupertino_icons flutter video_player] - clock 1.1.1 - collection 1.17.2 - csslib 0.17.3 [source_span] - cupertino_icons 1.0.6 - dbus 0.7.8 [args ffi meta xml] - fake_async 1.3.1 [clock collection] - ffi 2.1.0 - flutter_html_audio 3.0.0-beta.2 [flutter html flutter_html video_player chewie_audio] - flutter_html_iframe 3.0.0-beta.2 [flutter html flutter_html webview_flutter] - flutter_html_math 3.0.0-beta.2 [flutter html flutter_html flutter_math_fork] - flutter_html_svg 3.0.0-beta.2 [flutter html flutter_html flutter_svg] - flutter_html_table 3.0.0-beta.2 [flutter html flutter_html flutter_layout_grid] - flutter_html_video 3.0.0-beta.2 [flutter html flutter_html video_player chewie] - flutter_layout_grid 2.0.5 [flutter collection meta quiver] - flutter_math_fork 0.6.3+1 [flutter flutter_svg provider meta collection tuple] - flutter_svg 1.1.6 [flutter meta path_drawing vector_math xml] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web] - html 0.15.4 [csslib source_span] - http 1.1.0 [async http_parser meta] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - js 0.6.7 [meta] - lints 2.1.1 - list_counter 1.0.2 - matcher 0.12.16 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.5.0 [collection] - video_player 2.7.2 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - video_player_android 2.4.10 [flutter video_player_platform_interface] - video_player_avfoundation 2.5.0 [flutter video_player_platform_interface] - video_player_platform_interface 6.2.1 [flutter plugin_platform_interface] - video_player_web 2.1.1 [flutter flutter_web_plugins video_player_platform_interface] - wakelock_plus 1.1.2 [flutter flutter_web_plugins meta wakelock_plus_platform_interface win32 dbus package_info_plus js] - wakelock_plus_platform_interface 1.1.0 [flutter plugin_platform_interface meta] - web 0.1.4-beta - webview_flutter 4.4.1 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview] - webview_flutter_android 3.12.0 [flutter webview_flutter_platform_interface] - webview_flutter_platform_interface 2.6.0 [flutter meta plugin_platform_interface] - webview_flutter_wkwebview 3.9.1 [flutter path webview_flutter_platform_interface] - win32 5.0.9 [ffi] - xml 6.3.0 [collection meta petitparser] ```

Flutter doctor

Click To Expand ``` flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.13.7, on Microsoft Windows [Version 10.0.22621.2428], locale en-NZ) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.1) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.1) [√] Android Studio (version 2022.2) [√] VS Code (version 1.78.2) [√] VS Code, 64-bit edition (version 1.83.0) [√] Connected device (3 available) [√] Network resources • No issues found! ```

graemep-nz commented 7 months ago

I was able to get rid of the build errors in 3.0.0-beta2 by changing pubspec.yaml in \hosted\pub.dev\flutter_html_math-3.0.0-beta.2 to use 0.7.1 of flutter_math_fork

dependencies: flutter_math_fork: ^0.7.1

When I was finally able to run the example app I got a weird error as below. I found that if I comment out the table extension, the error goes away and the example app works as expected

        extensions: [
        ...   
         //  const TableHtmlExtension(),  <<< comment this line to avoid the exception below

The following assertion was thrown during performLayout():
BoxConstraints forces an infinite width.

The offending constraints were: BoxConstraints(w=Infinity, 0.0<=h<=Infinity)
The relevant error-causing widget was: 
  Container Container:file:///C:/Users/gp/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_html-3.0.0-beta.2/lib/src/css_box_widget.dart:74:9```
graemep-nz commented 7 months ago

Also I'm building for a web app and running in google chrome.

rahulmitta1 commented 6 months ago

For flutter web projects, the flutter_widget_from_html package can be used.

graemep-nz commented 6 months ago

Thanks. It would be helpful if the documentation on pub.dev for the two packages referenced each other. Is there anything for desktop - Windows & Macos?

graemep-nz commented 6 months ago

Do you have any idea what is the difference between these ? https://pub.dev/packages/flutter_widget_from_html_core https://pub.dev/packages/flutter_widget_from_html They're by the same person.

rahulmitta1 commented 6 months ago

Do you have any idea what is the difference between these ? https://pub.dev/packages/flutter_widget_from_html_core https://pub.dev/packages/flutter_widget_from_html They're by the same person.

From the package's page:

The flutter_widget_from_html package supports most common HTML tags for easy usage. If you don't want to include all of its dependencies in your build, it's possible to use flutter_widget_from_html_core with a subset of the mixins to control your app size.

graemep-nz commented 6 months ago

Ah. Missed that. Thanks very much.

adilexperience commented 2 months ago

Example project still throwing dependency error, any possible fix?

Because every version of flutter_html_all from path depends on flutter_html from hosted and example depends on flutter_html from path, flutter_html_all from path is forbidden. So, because example depends on flutter_html_all from path, version solving failed.