diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 10d516f594..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: cirrusci/flutter - steps: - - checkout - - run: flutter --version - - run: flutter test \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 6418d1dee6..6627ba6868 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +github: Sub6Resources patreon: # Replace with a single Patreon username open_collective: flutter_html ko_fi: # Replace with a single Ko-fi username diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..52aaf0660e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,46 @@ +--- +name: Bug report +about: Something isn't working as intended +title: "[BUG]" +labels: bug +assignees: '' + +--- + + + +**Describe the bug:** + + +**HTML to reproduce the issue:** + + +**`Html` widget configuration:** + + +**Expected behavior:** + + +**Screenshots:** + + +**Device details and Flutter/Dart/`flutter_html` versions:** + + +**Stacktrace/Logcat** + + +**Additional info:** + + +**A picture of a cute animal (not mandatory but encouraged)** + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..48d4188102 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,27 @@ +--- +name: Feature request +about: Suggest an idea for flutter_html +title: "[FEATURE]" +labels: enhancement +assignees: '' + +--- + + + +**Describe your feature request** + + +**Additional context** + + +**A picture of a cute animal (not mandatory but encouraged)** + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000000..8ecf5cff57 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,20 @@ +--- +name: Question +about: Ask a question about flutter_html +title: "[QUESTION]" +labels: question +assignees: '' + +--- + + + +Type question here. + +**A picture of a cute animal (not mandatory but encouraged)** + diff --git a/.github/flutter_html_screenshot.png b/.github/flutter_html_screenshot.png deleted file mode 100644 index dabafb0807..0000000000 Binary files a/.github/flutter_html_screenshot.png and /dev/null differ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..3bd2e1fd11 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: flutter_html tests + +on: + pull_request: + branches: [ master ] + push: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dart-lang/setup-dart@v1 + - uses: flutter-actions/setup-flutter@54feb1e258158303e041b9eaf89314dcfbf6d38a + - name: Setup Melos + run: flutter pub global activate melos + - name: Bootstrap Project + run: melos bootstrap + - name: Run Test Suite + run: flutter pub global run melos run test + - name: Compile Test Coverage Report + run: flutter pub global run melos run gen_coverage + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v5 + with: + files: coverage_report/lcov.info + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + - name: Run Dart Analysis + run: flutter pub global run melos analyze --fatal-infos + - name: Check that `dart format` has been run on every file + run: dart format -o none --set-exit-if-changed . diff --git a/.gitignore b/.gitignore index 68c69d3ef2..188d2e1fa5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,152 +1,159 @@ .DS_Store -.dart_tool/ - -.packages -.pub/ -build/ -ios/.generated/ -ios/Flutter/Generated.xcconfig -ios/Runner/GeneratedPluginRegistrant.* +# Created by https://www.gitignore.io/api/flutter +# Edit at https://www.gitignore.io/?templates=flutter ### Flutter ### +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ .flutter-plugins +.packages +.pub-cache/ +.pub/ +build/ +pubspec.lock +# Android related +**/android/**/gradle-wrapper.jar +**/android/.gradle +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +# End of https://www.gitignore.io/api/flutter + +### JetBrains+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ -# End of https://www.gitignore.io/api/flutter,android-studio - -# Created by https://www.gitignore.io/api/androidstudio - -### AndroidStudio ### -# Covers files to be ignored for android development using Android Studio. - -# Built application files -*.apk -*.ap_ - -# Files for the ART/Dalvik VM -*.dex +# Mongo Explorer plugin +.idea/**/mongoSettings.xml -# Java class files -*.class +# File-based project format +*.iws -# Generated files -bin/ -gen/ +# IntelliJ out/ -# Gradle files -.gradle -.gradle/ -build/ +# mpeltonen/sbt-idea plugin +.idea_modules/ -# Signing files -.signing/ +# JIRA plugin +atlassian-ide-plugin.xml -# Local configuration file (sdk path, etc) -local.properties +# Cursive Clojure plugin +.idea/replstate.xml -# Proguard folder generated by Eclipse -proguard/ +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties -# Log Files -*.log +# Editor-based Rest Client +.idea/httpRequests -# Android Studio -/*/build/ -/*/local.properties -/*/out -/*/*/build -/*/*/production -captures/ -.navigation/ -*.ipr -*~ -*.swp +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser -# Android Patch -gen-external-apklibs +### JetBrains+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 -# External native build folder generated in Android Studio 2.2 and later -.externalNativeBuild +.idea/ -# NDK -obj/ +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 -# IntelliJ IDEA *.iml -*.iws -/out/ - -# User-specific configurations -.idea/caches/ -.idea/libraries/ -.idea/shelf/ -.idea/workspace.xml -.idea/tasks.xml -.idea/.name -.idea/compiler.xml -.idea/copyright/profiles_settings.xml -.idea/encodings.xml +modules.xml .idea/misc.xml -.idea/modules.xml -.idea/scopes/scope_settings.xml -.idea/dictionaries -.idea/vcs.xml -.idea/jsLibraryMappings.xml -.idea/datasources.xml -.idea/dataSources.ids -.idea/sqlDataSources.xml -.idea/dynamic.xml -.idea/uiDesigner.xml -.idea/markdown-navigator.xml -.idea/markdown-navigator/ - -# OS-specific files -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -ehthumbs.db -Thumbs.db - -# Legacy Eclipse project files -.classpath -.project -.cproject -.settings/ - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.war -*.ear - -# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) -hs_err_pid* - -## Plugin-specific files: - -# mpeltonen/sbt-idea plugin -.idea_modules/ +*.ipr -# JIRA plugin -atlassian-ide-plugin.xml +# Sonarlint plugin +.idea/sonarlint -# Mongo Explorer plugin -.idea/mongoSettings.xml +# End of https://www.gitignore.io/api/flutter,jetbrains+all -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties +**/.flutter-plugins-dependencies -### AndroidStudio Patch ### +**/flutter_export_environment.sh -!/gradle/wrapper/gradle-wrapper.jar +/example/ios/Flutter/Flutter.podspec +packages/**/pubspec_overrides.yaml +./pubspec_overrides.yaml +/example/pubspec_overrides.yaml -# End of https://www.gitignore.io/api/androidstudio +coverage/ \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 30aa626c23..0000000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.metadata b/.metadata new file mode 100644 index 0000000000..45789c722a --- /dev/null +++ b/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 20e59316b8b8474554b38493b8ca888794b0234a + channel: stable + +project_type: package diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e3415bc40..13a7fda044 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,241 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +#### 3.0.0 *March 2025* + + - Graduate package to a stable release. See pre-releases prior to this version for changelog entries. + +#### 3.0.0-beta.2 *May 2023* + + - Several Breaking Changes. See the [migration guide](https://github.com/Sub6Resources/flutter_html/wiki/Migration-Guides#300) + + - **FIX**: start list items on a new line ([#1281](https://github.com/sub6resources/flutter_html/issues/1281)). ([496d1aa8](https://github.com/sub6resources/flutter_html/commit/496d1aa8e655891d2f597c5e4d7e92057801d815)) + - **FIX**: Add "display: Display.block" to table ([#1278](https://github.com/sub6resources/flutter_html/issues/1278)). ([6350f023](https://github.com/sub6resources/flutter_html/commit/6350f02354b7de601ce294123717e2051be97eee)) + - **FIX**: improve API for ExtensionContext and export marker.dart ([#1273](https://github.com/sub6resources/flutter_html/issues/1273)). ([27e33a95](https://github.com/sub6resources/flutter_html/commit/27e33a955e872d47306db9480f74f6da2e9a028a)) + - **FIX**: Cleaned up whitespace processing and added whitespace tests ([#1267](https://github.com/sub6resources/flutter_html/issues/1267)). ([cc00406b](https://github.com/sub6resources/flutter_html/commit/cc00406b1d0c115e5c66dd4bdfb40db32496f55f)) + - **FIX**: a tag should not style as link if href is not provided ([#1265](https://github.com/sub6resources/flutter_html/issues/1265)). ([d7247cb3](https://github.com/sub6resources/flutter_html/commit/d7247cb303c25d0011f85f9b2d3687924de3d83d)) + - **FEAT**: Update CssBoxWidget to handle rtl marker boxes ([#1270](https://github.com/sub6resources/flutter_html/issues/1270)). ([d7091990](https://github.com/sub6resources/flutter_html/commit/d7091990d193e892e2f782ac8d91fc0326aff4bc)) + - **FEAT**: support vertical-align in inline styles ([#1266](https://github.com/sub6resources/flutter_html/issues/1266)). ([fe896de5](https://github.com/sub6resources/flutter_html/commit/fe896de5ed8b79425bb33800a26fa4ac328057fe)) + - **FEAT**: Add WrapperExtension helper ([#1264](https://github.com/sub6resources/flutter_html/issues/1264)). ([2ffa1dda](https://github.com/sub6resources/flutter_html/commit/2ffa1ddabb3f2a660ab85c551255b89fe8a24ab5)) + + +#### 3.0.0-beta.1 - *May 2023* + + - Several Breaking Changes. See the [migration guide](https://github.com/Sub6Resources/flutter_html/wiki/Migration-Guides#300) + + - **FIX**: Aspect ratio exception when height is 0 ([#1222](https://github.com/sub6resources/flutter_html/issues/1222)). ([ed75f8fe](https://github.com/sub6resources/flutter_html/commit/ed75f8fef779e920ecc1f27719a4150a29e3ebee)) + - **FIX**: Fix issue with font scaling introduced in 3.0.0-alpha.6 ([#1173](https://github.com/sub6resources/flutter_html/issues/1173)). ([c75e0dfb](https://github.com/sub6resources/flutter_html/commit/c75e0dfb1be6cb79748f719487043d12bc330c60)) + - **FIX**: Fix various issues with list rendering. ([520ff3c3](https://github.com/sub6resources/flutter_html/commit/520ff3c326d5dc8f5a601022c2a32d58e2e83cbb)) + - **FIX**: Apply margins to properly. ([7581ea79](https://github.com/sub6resources/flutter_html/commit/7581ea798744b2830affaaf75bbdff016b03f7af)) + - **FIX**: Use enum instead of const int internally in length.dart. ([9dc7f08c](https://github.com/sub6resources/flutter_html/commit/9dc7f08ca238ff6a93314be5de716ad4e3baebb8)) + - **FIX**: Change CSSBoxWidget to CssBoxWidget. ([a62449a7](https://github.com/sub6resources/flutter_html/commit/a62449a77c18701a0faf8ffd650f9c535b2d006c)) + - **FEAT**: Support mmultiscripts. ([#1175](https://github.com/sub6resources/flutter_html/issues/1175)). ([a999a300](https://github.com/sub6resources/flutter_html/commit/a999a30027eff0aabb2825ffdbe383f9affab7f6)) + - **FEAT**: Support mfenced. ([#1174](https://github.com/sub6resources/flutter_html/issues/1174)). ([9ca23084](https://github.com/sub6resources/flutter_html/commit/9ca230848beb15332f96294083ed4989831130d7)) + - **FEAT**: Upgrade list-style-type to CSS3. ([deb726ae](https://github.com/sub6resources/flutter_html/commit/deb726ae2776f45305026c0aa081d4a5b5a1c71d)) + - **FEAT**: Support mtable, mtd, mtr for draw matrix. ([#1164](https://github.com/sub6resources/flutter_html/issues/1164)). ([e99e2cc1](https://github.com/sub6resources/flutter_html/commit/e99e2cc1553ab17b4ceff08f784e99283b28dff4)) + +## 3.0.0-alpha.6 - *September 2022* + + - **FIX** #731 Resolve newline `
` issue + - **FIX** Align the baseline of inline content with the baseline of its parent flow, even if it has padding or borders + - **FIX** Improved fontSize inheritance when cascading styles + - **FIX** `auto` margins now work for any `Display.BLOCK` element. + - **FIX** `auto` width and height is now the default, rather than `null` + - **FIX** New CSSBoxWidget that handles calculations of child sizes for a more accurate HTML/CSS layout + - **BREAKING** New `Margin`, `Height`, and `Width` classes that allow `em`, `rem`, `px`, `auto`, and `%` values to be given + - **FEAT** Negative margins are now allowed + - **FIX** Updated default `p` and `h1-6` styles to use `em` for better font scaling + - **BREAKING** Package now requires Dart sdk >= Dart 2.17 + - **FIX**: Apply margins to
properly. (7581ea79) + - **FIX**: Use enum instead of const int internally in length.dart. (9dc7f08c) + - **FIX**: Change CSSBoxWidget to CssBoxWidget. (a62449a7) + - **FIX**: fix textShadow color declaration handler. (77ffe7cb) + - **FIX**: ol use default style. (1c2412a2) + - **FIX**: Crash when a tr tag includes text node. (ba8301c9) + - **FEAT**: exposes fontFamilyFallback parameter. (1d65aafd) + +## [3.0.0-alpha.5] - June 9, 2022: +* Fixed hot reloads, thanks @arjenmels +* Fixed link taps not working +* Improvements in README + +## [3.0.0-alpha.3] - April 14, 2022: +* Fixed styling not being applied to list item markers +* [video] Fixed crash when iframe or video tags used unsupported/incorrect height or width + +## [3.0.0-alpha.2] - January 5, 2022: +* **BREAKING** Full modularization using split packages; see our upgrade guide or use flutter_html_all + +## [3.0.0-alpha.1] - December 21, 2021: +* **BREAKING** Reworked custom renders pending full modularation in 3.0.0 +* Extended support custom render when using SelectableHtml +* Updated flutter_svg to 1.0.0 +* Support flutter_webview 3.x +* Automatic disposal of video and audio controllers +* Fix block elements bottom spacing in table cells + +## [2.2.1] - December 8, 2021: +* Allow styling on ruby tags +* Allow width/height/alignment styling on table/tr/td tags +* Prevent images causing rebuilding and leaking memory +* Fixes display of list items on iOS with font weights below 400 +* Prevent crash on negative margins or paddings + +## [2.2.0] - November 29, 2021: +* Explicitly declare multiplatform support +* Extended and fixed list-style (marker) support +* Basic support for height/width css properties +* Support changing scroll physics of SelectableText.rich +* Support text transform css property +* Bumped minimum flutter_math_fork version for Flutter 2.5 compatibility +* Fix styling of iframes +* Fix nested font tag application +* Fix whitespace rendering between list items +* Prevent crash on empty
tag and tables with both colspan/rowspan +* Prevent crash on use of negative margins in css + +## [2.1.5] - October 7, 2021: +* Ignore unsupported custom style selectors when using fromCss +* Fix SVG tag usage inside tables +* Properly fix regression in usage of line breaks + +## [2.1.4] - October 3, 2021: +* Fix regression in usage of line breaks in body being stripped + +## [2.1.3] - October 1, 2021: +* Update minimum versions of dependencies for Flutter 2.5 compatibility +* Extended and fixed support for css shadow +* Fix block tags with explicit whitespace from being stripped + +## [2.1.2] - September 2, 2021: +* Allow setting selectionControls with SelectableHtml +* Fix onLinkTap not working with SelectableHtml +* Don't crash when parsing unsupported :hover +* Prevent endless loading when using animated images + +## [2.1.1] - July 28, 2021: +* Stable release with all 2.1.1-preview.X changes + +## [2.1.1-preview.0] - July 27, 2021: +* Improves hr tag support +* Fixes a leading whitespace issue +* Fixes some crashes with CSS parsing + +## [2.1.0] - June 3, 2021: +* SelectableHtml widget (supporting a subset of tags) which allow text selection +* Fixed shrinkWrap to actually shrink the horizontal space +* Support style tags to apply styling from inline css +* Support applying styles from Flutter themes +* Mouse hover on links when using Flutter Web +* Allow custom anchor link tap implementations +* Support additional list styling options +* Fix several minor whitespace issues in text flow +* Fixed specific colspan/rowspan usages in tables +* Fixed whitespace issues around images +* Swallow duplicate ids to prevent crashing the widget +* Fixes crashing tap detection when using both link and image taps +* Updates external dependencies +* Raised minimum Flutter version to 2.2.0 + +## [2.0.0] - April 29, 2021: +* Stable release with all 2.0.0-nullsafety.X changes + +## [2.0.0-nullsafety.1] - April 29, 2021: +* Support basic MathML +* Support inner links +* Supply full context tree to custom render +* Include or exclude specific tags via `tagsList` parameter +* Fixed lists not rendering correctly +* Fixes for colspans in tables +* Fixed various exceptions when using inline styles +* Fixed text decoration not cascading between parent and child +* [BREAKING] support whitelisting tags + * See the README for details on how to migrate `blacklistedElements` (deprecated) to `tagsList` +* Fixed `failed assertion` error when tap-scrolling on any link +* Updated dependencies + +## [2.0.0-nullsafety.0] - March 5, 2021: +* Nullsafety support +* Official Flutter Web support +* New features & fixes for lists: + * Support start attribute (e.g. `start="5";`) + * Support RTL direction + * Support setting padding - you can remove the starting padding if you choose + * Fixed unknown character box on iOS when font-weight is below w400 +* Upgraded link functions to provide more granular control +* Fixed errors in text-decoration parsing +* Fixed `