From f4f3795ac0d4c3dee9778419c03a2f4b2ff0a1dd Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Wed, 13 Sep 2023 02:00:38 +0700 Subject: [PATCH 1/9] Update flutter_widget_from_html@0.13.0 --- lib/src/widgets/html.dart | 19 +++--- lib/src/widgets/html/chr.dart | 2 + lib/src/widgets/html/galleria.dart | 2 + lib/src/widgets/html/lb_trigger.dart | 2 + pubspec.lock | 92 +++++++++++++++------------- pubspec.yaml | 2 +- 6 files changed, 65 insertions(+), 54 deletions(-) diff --git a/lib/src/widgets/html.dart b/lib/src/widgets/html.dart index cc095822..146bb802 100644 --- a/lib/src/widgets/html.dart +++ b/lib/src/widgets/html.dart @@ -1,3 +1,5 @@ +// ignore_for_file: avoid_renaming_method_parameters, deprecated_member_use + import 'dart:convert'; import 'package:flutter/material.dart'; @@ -140,19 +142,14 @@ class TinhteWidgetFactory extends WidgetFactory { } BuildOp get smilieOp { - return _smilieOp ??= BuildOp( - onTree: (meta, tree) { - final a = meta.element.attributes; + return _smilieOp ??= BuildOp.v1( + onParsed: (tree) { + final a = tree.element.attributes; final title = a['data-title']; - if (title == null) return; + if (title == null) return tree; final smilie = _kSmilies[title]; - if (smilie == null) return; - final parentTree = tree.parent; - if (parentTree == null) return; - - // TODO: use `replaceWith` when it comes back in v0.9 - TextBit(parentTree, smilie).insertBefore(tree); - tree.detach(); + if (smilie == null) return tree; + return tree.parent.sub()..addText(smilie); }, ); } diff --git a/lib/src/widgets/html/chr.dart b/lib/src/widgets/html/chr.dart index c66bbbba..b618d59a 100644 --- a/lib/src/widgets/html/chr.dart +++ b/lib/src/widgets/html/chr.dart @@ -1,3 +1,5 @@ +// ignore_for_file: deprecated_member_use + part of '../html.dart'; class Chr { diff --git a/lib/src/widgets/html/galleria.dart b/lib/src/widgets/html/galleria.dart index b1a8ad28..9a86ffe1 100644 --- a/lib/src/widgets/html/galleria.dart +++ b/lib/src/widgets/html/galleria.dart @@ -1,3 +1,5 @@ +// ignore_for_file: deprecated_member_use + part of '../html.dart'; const kColumns = 3; diff --git a/lib/src/widgets/html/lb_trigger.dart b/lib/src/widgets/html/lb_trigger.dart index 21277b76..13303993 100644 --- a/lib/src/widgets/html/lb_trigger.dart +++ b/lib/src/widgets/html/lb_trigger.dart @@ -1,3 +1,5 @@ +// ignore_for_file: deprecated_member_use + part of '../html.dart'; const kCaptionColor = Colors.white70; diff --git a/pubspec.lock b/pubspec.lock index f8cd062b..1b62a7cd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: _flutterfire_internals - sha256: "2e3a565cdd40b32df6ff9a0d1f16b9144fcce769455597ee9195f568ffbb3a59" + sha256: "554f148e71e9e016d9c04d4af6b103ca3f74a1ceed7d7307b70a0f41e991eb77" url: "https://pub.dev" source: hosted - version: "1.3.8" + version: "1.3.26" analyzer: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: archive - sha256: "49b1fad315e57ab0bbc15bcbb874e83116a1d78f77ebd500a4af6c9407d6b28e" + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" url: "https://pub.dev" source: hosted - version: "3.3.8" + version: "3.4.10" args: dependency: transitive description: @@ -261,10 +261,10 @@ packages: dependency: "direct main" description: name: firebase_core - sha256: "761d0a00562ba09d491eacdceaf1885df62d072c9431bf3110333e2a9904b1e1" + sha256: "67bf0d5fd78f12f51c6b54a72f6141314136a1a90e98b1b7c45e7fac883254ed" url: "https://pub.dev" source: hosted - version: "2.18.0" + version: "2.27.1" firebase_core_platform_interface: dependency: "direct main" description: @@ -277,50 +277,50 @@ packages: dependency: transitive description: name: firebase_core_web - sha256: "0631a2ec971dbc540275e2fa00c3a8a2676f0a7adbc3c197d6fba569db689d97" + sha256: "5377eaac3b9fe8aaf22638d87f92b62784f23572e132dfc029195e84d6cb37de" url: "https://pub.dev" source: hosted - version: "2.8.1" + version: "2.12.0" firebase_crashlytics: dependency: "direct main" description: name: firebase_crashlytics - sha256: "85f1098487d1b177bb4b7e0d552f57029d6964d2da665104d6299acce2f58bb6" + sha256: cf120df5b473f5f8cd24f9de663edc8aed3a1888d29d805076be0448bdee249e url: "https://pub.dev" source: hosted - version: "3.4.0" + version: "3.4.19" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: "8bdcca9109595d353b467a97278becb726286596741b9cc0ace59abf9def9645" + sha256: "99656cc39228e8f2b845cddb4d43307bb44294a03e7d00b4d8e35536889bc65c" url: "https://pub.dev" source: hosted - version: "3.6.8" + version: "3.6.26" firebase_messaging: dependency: "direct main" description: name: firebase_messaging - sha256: "26febca93007cdfd0e4684c9ca2f3e59b096d5fb39b83ae42bc9c1f726b27b0c" + sha256: "34fac43b70d5c41dc864eeb52417128da1f68b0a48604a0c56cd3190f0f609b8" url: "https://pub.dev" source: hosted - version: "14.7.0" + version: "14.7.20" firebase_messaging_platform_interface: dependency: transitive description: name: firebase_messaging_platform_interface - sha256: "049da43147b078c8d389e2c24e6acfdda96968a53da2061632bb0cb74fea92c5" + sha256: "1dcf7d0d6776396bb2e488c53b0e4cc671c45a65717a73d881e52190d23aca3c" url: "https://pub.dev" source: hosted - version: "4.5.9" + version: "4.5.28" firebase_messaging_web: dependency: transitive description: name: firebase_messaging_web - sha256: ac22d3c09949cd37d94431e7deba4e270a93e5134c4842a9d784bd884835b54b + sha256: ceabccf24d15d03c89dfd6c7eaef11c58fbf00b9c76ebc94028408943b8d2bfd url: "https://pub.dev" source: hosted - version: "3.5.9" + version: "3.7.0" flutter: dependency: "direct main" description: flutter @@ -338,10 +338,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: ad76540d21c066228ee3f9d1dad64a9f7e46530e8bb7c85011a88bc1fd874bc5 + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.0.1" flutter_localizations: dependency: "direct main" description: flutter @@ -433,18 +433,18 @@ packages: dependency: "direct main" description: name: flutter_widget_from_html - sha256: "8d2a9a7979a9c1a5d866d1f4134d2ec2cca78716c112c76803d6a552281405cc" + sha256: "7b290290bfe34fe95d8b64aa5420746e5ae214862465399c682e8da87bc1759d" url: "https://pub.dev" source: hosted - version: "0.10.6" + version: "0.13.1-alpha.2" flutter_widget_from_html_core: dependency: transitive description: name: flutter_widget_from_html_core - sha256: "22140caa191cb4bba0fe4d5e4ad875c7e8a9ba47d61517f56d733019cf76396d" + sha256: "2dba32b7dbd2134af46138f6171683aff51b888c4d0b3efe289a79e3322f172e" url: "https://pub.dev" source: hosted - version: "0.10.6" + version: "0.13.1-alpha.2" font_awesome_flutter: dependency: "direct main" description: @@ -473,50 +473,50 @@ packages: dependency: transitive description: name: fwfh_cached_network_image - sha256: "3de22aa3a6943c968e0d9fbcba4463b3dbbf7103171d62c84b6c672fb83eebdf" + sha256: "5ef697aa59ab5c5343ade651ae503fe920ad9fc5a08f42ed11b77b0bf8064664" url: "https://pub.dev" source: hosted - version: "0.7.0+7" + version: "0.13.0-alpha.1" fwfh_chewie: dependency: transitive description: name: fwfh_chewie - sha256: "0b51a1c976bb74da5e8e45d545c74cb54a7168ad3938dd77103a7aee485f55fa" + sha256: c0dbfe12f04bf54eef8e93718ae5b7f177d477513d7ed670a2d896e2bbb7e5b8 url: "https://pub.dev" source: hosted - version: "0.7.1+4" + version: "0.13.1-alpha.2" fwfh_just_audio: dependency: transitive description: name: fwfh_just_audio - sha256: "237b93a4cb9f0495a4b51940f361adda2a5abd57231dd44f07459db00144a6cd" + sha256: "7f3aa6a9a80461cea044f4d19e53175306b761c2f713ddaebdb1d5f81002f9be" url: "https://pub.dev" source: hosted - version: "0.9.0+3" + version: "0.13.1-alpha.2" fwfh_svg: dependency: transitive description: name: fwfh_svg - sha256: "3fd83926b7245d287f133a437ef430befd99d3b00ba8c600f26cc324af281f72" + sha256: a7257a6128fa2853dbb080ba1cf48a9fde3e6091ed493ea95966f9e5bdc7d841 url: "https://pub.dev" source: hosted - version: "0.8.1" + version: "0.13.1-alpha.2" fwfh_url_launcher: dependency: transitive description: name: fwfh_url_launcher - sha256: "2a526c9819f74b4106ba2fba4dac79f0082deecd8d2c7011cd0471cb710e3eff" + sha256: "5d30a71e01d9a2eb1f4b971588665d3af00f49b7b7aa307451e3e6d758995729" url: "https://pub.dev" source: hosted - version: "0.9.0+4" + version: "0.13.0-alpha.1" fwfh_webview: dependency: "direct main" description: name: fwfh_webview - sha256: "90a8dda0695403cf57abd7e8b83f6fb1f1a12933930a0bf9cac7cafb06e06a18" + sha256: "16e4d0fd65b28dd04790c355415891543f88f287cf2837d0d4d05ceefd774e8b" url: "https://pub.dev" source: hosted - version: "0.9.0+2" + version: "0.13.1-alpha.2" get_it: dependency: transitive description: @@ -1057,18 +1057,18 @@ packages: dependency: "direct main" description: name: share_plus - sha256: f86c5acc512b20e074137075824fc29e29b2cf395dcbfcc371e96e3e6290cce1 + sha256: "05ec043470319bfbabe0adbc90d3a84cbff0426b9d9f3a6e2ad3e131fa5fa629" url: "https://pub.dev" source: hosted - version: "8.0.0" + version: "8.0.2" share_plus_platform_interface: dependency: transitive description: name: share_plus_platform_interface - sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7" + sha256: "251eb156a8b5fa9ce033747d73535bf53911071f8d3b6f4f0b578505ce0d4496" url: "https://pub.dev" source: hosted - version: "3.3.0" + version: "3.4.0" shared_preferences: dependency: "direct main" description: @@ -1496,6 +1496,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" web_socket_channel: dependency: transitive description: @@ -1524,10 +1532,10 @@ packages: dependency: transitive description: name: webview_flutter_android - sha256: ddc167c6676f57c8b367d19fcbee267d6dc6adf81bd6c3cb87981d30746e0a6d + sha256: "9427774649fd3c8b7ff53523051395d13aed2ca355822b822e6493d79f5fc05a" url: "https://pub.dev" source: hosted - version: "3.10.1" + version: "3.10.0" webview_flutter_platform_interface: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f92bb936..36988c09 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: firebase_messaging: ^14.6.5 # ours - flutter_widget_from_html: ^0.10.6 + flutter_widget_from_html: ^0.13.0-alpha.4 fwfh_webview: any the_api: path: ./packages/api From 7eed8ac94badf49c689a673949c1994c6d2de009 Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Wed, 13 Sep 2023 02:00:51 +0700 Subject: [PATCH 2/9] Fix `PhotoCompare` --- lib/src/widgets/html/photo_compare.dart | 68 ++++++++++++++++--------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/lib/src/widgets/html/photo_compare.dart b/lib/src/widgets/html/photo_compare.dart index fb94fb22..15aa936c 100644 --- a/lib/src/widgets/html/photo_compare.dart +++ b/lib/src/widgets/html/photo_compare.dart @@ -8,43 +8,63 @@ class PhotoCompare { PhotoCompare(this.wf); - BuildOp get buildOp => BuildOp( + BuildOp get buildOp => BuildOp.v1( defaultStyles: (_) => {'margin': '0.5em 0'}, - onChild: (childMeta) { - if (childMeta.element.localName == 'img') { - childMeta['display'] = 'block'; + onChild: (tree, subTree) { + if (subTree.element.localName == 'img') { + subTree.register( + BuildOp.v1( + onRenderBlock: (_, placeholder) { + final child = placeholder.firstChild; + if (child != null) { + final value = tree.value<_Images>(); + if (value == null) { + tree.value(_Images([child])); + } else { + value.widgets.add(child); + } + } + return placeholder; + }, + priority: 5000000000000000, // Priority._baseBoxModel + ), + ); } }, - onWidgets: (meta, widgets) { - final images = []; - for (final widget in widgets) { - if (widget is WidgetPlaceholder) { - images.add(widget); - } - } + onParsed: (tree) { + final replacement = tree.parent.sub(); + final images = tree.value<_Images>()?.widgets; + if (images == null || images.length != 2) return tree; - if (images.length != 2) return widgets; - - final a = meta.element.attributes; + final a = tree.element.attributes; final configJson = a['data-config'] ?? ''; - if (configJson.isEmpty) return widgets; + if (configJson.isEmpty) return tree; final Map config = json.decode(configJson); final width = (config['width'] as num?)?.toDouble(); final height = (config['height'] as num?)?.toDouble(); - if (width == null || height == null) return widgets; - - return [ - _PhotoCompareWidget( - aspectRatio: width / height, - image0: images[0], - image1: images[1], - ), - ]; + if (width == null || height == null) return tree; + + return replacement + ..append( + WidgetBit.block( + tree.parent, + _PhotoCompareWidget( + aspectRatio: width / height, + image0: images[0], + image1: images[1], + ), + ), + ); }, ); } +class _Images { + final List widgets; + const _Images(this.widgets); +} + class _PhotoCompareWidget extends StatefulWidget { final double aspectRatio; final Widget image0; From 927e1a8ccc01b04285919aff501526ee2a85ef98 Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Wed, 13 Sep 2023 14:48:37 +0700 Subject: [PATCH 3/9] Fix `Galleria` --- lib/src/widgets/html/galleria.dart | 102 ++++++++++++++--------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/lib/src/widgets/html/galleria.dart b/lib/src/widgets/html/galleria.dart index 9a86ffe1..6e420d83 100644 --- a/lib/src/widgets/html/galleria.dart +++ b/lib/src/widgets/html/galleria.dart @@ -1,113 +1,113 @@ -// ignore_for_file: deprecated_member_use - part of '../html.dart'; const kColumns = 3; const kSpacing = 3.0; class Galleria { - final BuildMetadata galleryMeta; + final BuildTree galleryTree; final TinhteWidgetFactory wf; + final _items = []; final _lb = LbTrigger(); - Galleria(this.wf, this.galleryMeta); + Galleria(this.wf, this.galleryTree); BuildOp? _galleriaOp; BuildOp get op { - return _galleriaOp ??= BuildOp( + return _galleriaOp ??= BuildOp.v1( onChild: onChild, - onWidgets: onWidgets, + onRenderBlock: onRenderBlock, ); } - void onChild(BuildMetadata childMeta) { - final e = childMeta.element; - if (e.parent != galleryMeta.element) return; + void onChild(BuildTree _, BuildTree subTree) { + final e = subTree.element; + if (e.parent != galleryTree.element) return; if (e.localName != 'li') return; - - childMeta.register(_GalleriaItem(wf, this, childMeta).op); + subTree.register(_GalleriaItem(wf, this, subTree).op); } - Iterable onWidgets( - BuildMetadata _, Iterable widgets) => - [ - WidgetPlaceholder(this, - child: _GalleriaGrid(widgets.toList(growable: false))) - ]; + Widget onRenderBlock(BuildTree _, WidgetPlaceholder placeholder) => + _items.isNotEmpty ? _GalleriaGrid(_items) : placeholder; } class _GalleriaItem { - final BuildMetadata itemMeta; + final BuildTree itemTree; final Galleria galleria; final WidgetFactory wf; Widget? _description; BuildOp? _descriptionOp; String? _source; - WidgetPlaceholder? _trigger; + Widget? _trigger; BuildOp? _triggerOp; - _GalleriaItem(this.wf, this.galleria, this.itemMeta); + _GalleriaItem(this.wf, this.galleria, this.itemTree); BuildOp? _itemOp; BuildOp get op { - return _itemOp ??= BuildOp( + return _itemOp ??= BuildOp.v1( onChild: onChild, - onWidgets: onWidgets, + onRenderBlock: onRenderBlock, ); } - void onChild(BuildMetadata childMeta) { - final e = childMeta.element; - if (e.parent != itemMeta.element) return; + void onChild(BuildTree _, BuildTree subSubTree) { + final e = subSubTree.element; + if (e.parent != itemTree.element) return; switch (e.className) { case 'LbTrigger': _source ??= wf.urlFull(e.attributes['href'] ?? ''); - final triggerOp = _triggerOp ??= BuildOp( - onWidgets: (meta, widgets) { - // bypass built-in A tag handling with 0 priority - // and NOT returning anything in `onWidgets` - _trigger = wf.buildColumnPlaceholder(meta, widgets); - return []; - }, - priority: 0, + final triggerOp = _triggerOp ??= BuildOp.v1( + alwaysRenderBlock: true, + onRenderedBlock: (_, block) => _trigger = block, ); - childMeta.register(triggerOp); + subSubTree.register(triggerOp); break; case 'Tinhte_Gallery_Description': - final descriptionOp = _descriptionOp ??= BuildOp( - onWidgets: (meta, widgets) { - meta.tsb.enqueue((p, dynamic _) => p.copyWith( - style: p - .getDependency() - .textTheme - .bodySmall - ?.copyWith(color: kCaptionColor))); - _description = wf.buildColumnPlaceholder(meta, widgets); - return []; + final descriptionOp = _descriptionOp ??= BuildOp.v1( + alwaysRenderBlock: true, + onParsed: (descriptionTree) { + return descriptionTree + ..apply( + (style, context) => style.copyWith( + textStyle: Theme.of(context!) + .textTheme + .bodySmall + ?.copyWith(color: kCaptionColor), + ), + null, + ); }, + onRenderedBlock: (_, block) => _description = block, ); - childMeta.register(descriptionOp); + subSubTree.register(descriptionOp); break; } } - Iterable onWidgets( - BuildMetadata _, Iterable widgets) { + Widget onRenderBlock(BuildTree _, WidgetPlaceholder placeholder) { final scopedSource = _source; final scopedTrigger = _trigger; - if (scopedSource == null || scopedTrigger == null) return widgets; + if (scopedSource == null || scopedTrigger == null) return placeholder; final index = galleria._lb.addSource( LbTriggerSource.image(scopedSource), caption: _description, ); - scopedTrigger.wrapWith((context, child) => - galleria._lb.buildGestureDetector(context, child, index)); - return [scopedTrigger]; + galleria._items.add( + WidgetPlaceholder.lazy( + scopedTrigger, + debugLabel: '${itemTree.element.localName}--galleriaItem', + ).wrapWith( + (context, child) => + galleria._lb.buildGestureDetector(context, child, index), + ), + ); + + return widget0; } } From 7066c3c1d69139940f5c8ecf60ffb0beb7e15584 Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Wed, 13 Sep 2023 14:51:18 +0700 Subject: [PATCH 4/9] Fix `LinkExpander` --- lib/src/widgets/html/link_expander.dart | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/src/widgets/html/link_expander.dart b/lib/src/widgets/html/link_expander.dart index 7c154c73..dc3de257 100644 --- a/lib/src/widgets/html/link_expander.dart +++ b/lib/src/widgets/html/link_expander.dart @@ -1,3 +1,5 @@ +// ignore_for_file: deprecated_member_use + part of '../html.dart'; const kLinkExpanderSquareThumbnailSize = 120.0; @@ -45,8 +47,11 @@ class LinkExpander { break; case 'span': if (e.classes.contains('host')) { - childMeta.tsb.enqueue((p, dynamic _) => - p.copyWith(style: p.style.copyWith(color: Colors.grey))); + childMeta.tsb.enqueue( + (p, dynamic _) => + p.copyWith(style: p.style.copyWith(color: Colors.grey)), + null, + ); } break; } @@ -68,9 +73,10 @@ class LinkExpander { final a = meta.element.attributes; final fullUrl = wf.urlFull(a['href'] ?? ''); final onTap = fullUrl != null ? wf.gestureTapCallback(fullUrl) : null; + final recognizer = wf.buildGestureRecognizer(meta, onTap: onTap); - return WidgetPlaceholder(this) - ..wrapWith((context, previous) { + return WidgetPlaceholder( + builder: (context, previous) { final decoBox = wf.buildDecoration(meta, child, color: Theme.of(context).cardColor); if (decoBox == null) return previous; @@ -84,12 +90,13 @@ class LinkExpander { ); } - if (onTap != null) { - built = wf.buildGestureDetector(meta, built, onTap) ?? built; + if (recognizer != null) { + built = wf.buildGestureDetector(meta, built, recognizer) ?? built; } return built; - }); + }, + ); } Widget _buildSquare(Widget left, Widget right) => _buildBox( @@ -196,8 +203,7 @@ class _LinkExpanderInfo { Iterable onWidgets( BuildMetadata _, Iterable widgets) { final scopedDescription = _description; - final widget = le._info = WidgetPlaceholder<_LinkExpanderInfo>( - this, + final widget = le._info = WidgetPlaceholder( child: Padding( padding: const EdgeInsets.symmetric(vertical: kPostBodyPadding), child: LayoutBuilder( From eca5dcd4d4ce1b7aef09c7aafef7a300e63ca270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=C3=A0o=20Ho=C3=A0ng=20S=C6=A1n?= Date: Fri, 15 Sep 2023 10:46:57 +0700 Subject: [PATCH 5/9] Enable apk, ipa and macos builds --- .github/workflows/flutter.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 7f039470..39ba369f 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -47,7 +47,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} build_apk: - if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'android') || startsWith(github.ref, 'refs/heads/renovate/flutter-') }} + if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'android') || startsWith(github.ref, 'refs/heads/renovate/flutter-') || contains(github.ref, 'fwfh') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -111,7 +111,7 @@ jobs: fingerprint: build_ipa: - if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'ios') }} + if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'ios') || contains(github.ref, 'fwfh') }} runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -243,7 +243,7 @@ jobs: fingerprint: build_macos: - if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'macos') || startsWith(github.ref, 'refs/heads/renovate/flutter-') }} + if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'macos') || startsWith(github.ref, 'refs/heads/renovate/flutter-') || contains(github.ref, 'fwfh') }} runs-on: macos-latest steps: - uses: actions/checkout@v4 From 1215f371fe626ab6e6e4ef571258d81a184c26a3 Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Mon, 25 Mar 2024 21:15:22 +0700 Subject: [PATCH 6/9] Update flutter_widget_from_html@0.14.11 --- pubspec.lock | 32 ++++++++++++++++---------------- pubspec.yaml | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 1b62a7cd..8c0f2255 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -433,18 +433,18 @@ packages: dependency: "direct main" description: name: flutter_widget_from_html - sha256: "7b290290bfe34fe95d8b64aa5420746e5ae214862465399c682e8da87bc1759d" + sha256: "22c911b6ccf82b83e0c457d987bac4e703440fea0fc88dab24f4dfe995a5f33f" url: "https://pub.dev" source: hosted - version: "0.13.1-alpha.2" + version: "0.14.11" flutter_widget_from_html_core: dependency: transitive description: name: flutter_widget_from_html_core - sha256: "2dba32b7dbd2134af46138f6171683aff51b888c4d0b3efe289a79e3322f172e" + sha256: "028f4989b9ff4907466af233d50146d807772600d98a3e895662fbdb09c39225" url: "https://pub.dev" source: hosted - version: "0.13.1-alpha.2" + version: "0.14.11" font_awesome_flutter: dependency: "direct main" description: @@ -473,50 +473,50 @@ packages: dependency: transitive description: name: fwfh_cached_network_image - sha256: "5ef697aa59ab5c5343ade651ae503fe920ad9fc5a08f42ed11b77b0bf8064664" + sha256: "952aea958a5fda7d616cc297ba4bc08427e381459e75526fa375d6d8345630d3" url: "https://pub.dev" source: hosted - version: "0.13.0-alpha.1" + version: "0.14.2" fwfh_chewie: dependency: transitive description: name: fwfh_chewie - sha256: c0dbfe12f04bf54eef8e93718ae5b7f177d477513d7ed670a2d896e2bbb7e5b8 + sha256: bbb036cd322ab77dc0edd34cbbf76181681f5e414987ece38745dc4f3d7408ed url: "https://pub.dev" source: hosted - version: "0.13.1-alpha.2" + version: "0.14.7" fwfh_just_audio: dependency: transitive description: name: fwfh_just_audio - sha256: "7f3aa6a9a80461cea044f4d19e53175306b761c2f713ddaebdb1d5f81002f9be" + sha256: "4962bc59cf8bbb0a77a55ff56a7b925612b0d8263bc2ede3636b9c86113cb493" url: "https://pub.dev" source: hosted - version: "0.13.1-alpha.2" + version: "0.14.2" fwfh_svg: dependency: transitive description: name: fwfh_svg - sha256: a7257a6128fa2853dbb080ba1cf48a9fde3e6091ed493ea95966f9e5bdc7d841 + sha256: "3fd83926b7245d287f133a437ef430befd99d3b00ba8c600f26cc324af281f72" url: "https://pub.dev" source: hosted - version: "0.13.1-alpha.2" + version: "0.8.1" fwfh_url_launcher: dependency: transitive description: name: fwfh_url_launcher - sha256: "5d30a71e01d9a2eb1f4b971588665d3af00f49b7b7aa307451e3e6d758995729" + sha256: "2a526c9819f74b4106ba2fba4dac79f0082deecd8d2c7011cd0471cb710e3eff" url: "https://pub.dev" source: hosted - version: "0.13.0-alpha.1" + version: "0.9.0+4" fwfh_webview: dependency: "direct main" description: name: fwfh_webview - sha256: "16e4d0fd65b28dd04790c355415891543f88f287cf2837d0d4d05ceefd774e8b" + sha256: b828bb5ddd4361a866cdb8f1b0de4f3348f332915ecf2f4215ba17e46c656adc url: "https://pub.dev" source: hosted - version: "0.13.1-alpha.2" + version: "0.14.8" get_it: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 36988c09..e49a656c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: firebase_messaging: ^14.6.5 # ours - flutter_widget_from_html: ^0.13.0-alpha.4 + flutter_widget_from_html: ^0.14.11 fwfh_webview: any the_api: path: ./packages/api From f01a0026df41974772b255712d569843d0d39b0d Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Mon, 25 Mar 2024 21:18:01 +0700 Subject: [PATCH 7/9] Replace `BuildOp.v1` with `BuildOp` --- lib/src/widgets/html.dart | 2 +- lib/src/widgets/html/galleria.dart | 20 ++++++++++---------- lib/src/widgets/html/photo_compare.dart | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/src/widgets/html.dart b/lib/src/widgets/html.dart index 146bb802..f0ab1879 100644 --- a/lib/src/widgets/html.dart +++ b/lib/src/widgets/html.dart @@ -142,7 +142,7 @@ class TinhteWidgetFactory extends WidgetFactory { } BuildOp get smilieOp { - return _smilieOp ??= BuildOp.v1( + return _smilieOp ??= BuildOp( onParsed: (tree) { final a = tree.element.attributes; final title = a['data-title']; diff --git a/lib/src/widgets/html/galleria.dart b/lib/src/widgets/html/galleria.dart index 6e420d83..998dc877 100644 --- a/lib/src/widgets/html/galleria.dart +++ b/lib/src/widgets/html/galleria.dart @@ -14,13 +14,13 @@ class Galleria { BuildOp? _galleriaOp; BuildOp get op { - return _galleriaOp ??= BuildOp.v1( - onChild: onChild, + return _galleriaOp ??= BuildOp( + onVisitChild: onVisitChild, onRenderBlock: onRenderBlock, ); } - void onChild(BuildTree _, BuildTree subTree) { + void onVisitChild(BuildTree _, BuildTree subTree) { final e = subTree.element; if (e.parent != galleryTree.element) return; if (e.localName != 'li') return; @@ -46,33 +46,33 @@ class _GalleriaItem { BuildOp? _itemOp; BuildOp get op { - return _itemOp ??= BuildOp.v1( - onChild: onChild, + return _itemOp ??= BuildOp( + onVisitChild: onVisitChild, onRenderBlock: onRenderBlock, ); } - void onChild(BuildTree _, BuildTree subSubTree) { + void onVisitChild(BuildTree _, BuildTree subSubTree) { final e = subSubTree.element; if (e.parent != itemTree.element) return; switch (e.className) { case 'LbTrigger': _source ??= wf.urlFull(e.attributes['href'] ?? ''); - final triggerOp = _triggerOp ??= BuildOp.v1( + final triggerOp = _triggerOp ??= BuildOp( alwaysRenderBlock: true, onRenderedBlock: (_, block) => _trigger = block, ); subSubTree.register(triggerOp); break; case 'Tinhte_Gallery_Description': - final descriptionOp = _descriptionOp ??= BuildOp.v1( + final descriptionOp = _descriptionOp ??= BuildOp( alwaysRenderBlock: true, onParsed: (descriptionTree) { return descriptionTree - ..apply( + ..inheritanceResolvers.enqueue( (style, context) => style.copyWith( - textStyle: Theme.of(context!) + style: Theme.of(context!) .textTheme .bodySmall ?.copyWith(color: kCaptionColor), diff --git a/lib/src/widgets/html/photo_compare.dart b/lib/src/widgets/html/photo_compare.dart index 15aa936c..8a7e74ba 100644 --- a/lib/src/widgets/html/photo_compare.dart +++ b/lib/src/widgets/html/photo_compare.dart @@ -8,18 +8,18 @@ class PhotoCompare { PhotoCompare(this.wf); - BuildOp get buildOp => BuildOp.v1( + BuildOp get buildOp => BuildOp( defaultStyles: (_) => {'margin': '0.5em 0'}, - onChild: (tree, subTree) { + onVisitChild: (tree, subTree) { if (subTree.element.localName == 'img') { subTree.register( - BuildOp.v1( + BuildOp( onRenderBlock: (_, placeholder) { final child = placeholder.firstChild; if (child != null) { - final value = tree.value<_Images>(); + final value = tree.getNonInherited<_Images>(); if (value == null) { - tree.value(_Images([child])); + tree.setNonInherited(_Images([child])); } else { value.widgets.add(child); } @@ -33,7 +33,7 @@ class PhotoCompare { }, onParsed: (tree) { final replacement = tree.parent.sub(); - final images = tree.value<_Images>()?.widgets; + final images = tree.getNonInherited<_Images>()?.widgets; if (images == null || images.length != 2) return tree; final a = tree.element.attributes; From 61efae52ae4d9febc154fdd54d7ff253b524464d Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Mon, 25 Mar 2024 22:04:46 +0700 Subject: [PATCH 8/9] Re-implement `WidgetPlaceholder.firstChild` usage --- lib/src/widgets/html.dart | 3 +++ lib/src/widgets/html/photo_compare.dart | 17 +++++++---------- pubspec.lock | 2 +- pubspec.yaml | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/src/widgets/html.dart b/lib/src/widgets/html.dart index f0ab1879..027ab2b2 100644 --- a/lib/src/widgets/html.dart +++ b/lib/src/widgets/html.dart @@ -5,6 +5,9 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; +// ignore: implementation_imports +import 'package:flutter_widget_from_html_core/src/internal/core_ops.dart' + show Priority; import 'package:fwfh_webview/fwfh_webview.dart'; import 'package:html_unescape/html_unescape.dart'; import 'package:http/http.dart'; diff --git a/lib/src/widgets/html/photo_compare.dart b/lib/src/widgets/html/photo_compare.dart index 8a7e74ba..9f42ea82 100644 --- a/lib/src/widgets/html/photo_compare.dart +++ b/lib/src/widgets/html/photo_compare.dart @@ -15,18 +15,15 @@ class PhotoCompare { subTree.register( BuildOp( onRenderBlock: (_, placeholder) { - final child = placeholder.firstChild; - if (child != null) { - final value = tree.getNonInherited<_Images>(); - if (value == null) { - tree.setNonInherited(_Images([child])); - } else { - value.widgets.add(child); - } + final value = tree.getNonInherited<_Images>(); + if (value == null) { + tree.setNonInherited(_Images([placeholder])); + } else { + value.widgets.add(placeholder); } - return placeholder; + return widget0; }, - priority: 5000000000000000, // Priority._baseBoxModel + priority: Priority.tagImg + 1, ), ); } diff --git a/pubspec.lock b/pubspec.lock index 8c0f2255..5ef57aca 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -438,7 +438,7 @@ packages: source: hosted version: "0.14.11" flutter_widget_from_html_core: - dependency: transitive + dependency: "direct main" description: name: flutter_widget_from_html_core sha256: "028f4989b9ff4907466af233d50146d807772600d98a3e895662fbdb09c39225" diff --git a/pubspec.yaml b/pubspec.yaml index e49a656c..c0b71844 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,6 +16,7 @@ dependencies: # ours flutter_widget_from_html: ^0.14.11 + flutter_widget_from_html_core: any fwfh_webview: any the_api: path: ./packages/api From 227d0a992b537201a79006d586910099a46d5953 Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Mon, 25 Mar 2024 22:15:15 +0700 Subject: [PATCH 9/9] Revert pubspec.lock --- pubspec.lock | 60 +++++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 5ef57aca..ab89b2cc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: _flutterfire_internals - sha256: "554f148e71e9e016d9c04d4af6b103ca3f74a1ceed7d7307b70a0f41e991eb77" + sha256: "2e3a565cdd40b32df6ff9a0d1f16b9144fcce769455597ee9195f568ffbb3a59" url: "https://pub.dev" source: hosted - version: "1.3.26" + version: "1.3.8" analyzer: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: archive - sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + sha256: "49b1fad315e57ab0bbc15bcbb874e83116a1d78f77ebd500a4af6c9407d6b28e" url: "https://pub.dev" source: hosted - version: "3.4.10" + version: "3.3.8" args: dependency: transitive description: @@ -261,10 +261,10 @@ packages: dependency: "direct main" description: name: firebase_core - sha256: "67bf0d5fd78f12f51c6b54a72f6141314136a1a90e98b1b7c45e7fac883254ed" + sha256: "761d0a00562ba09d491eacdceaf1885df62d072c9431bf3110333e2a9904b1e1" url: "https://pub.dev" source: hosted - version: "2.27.1" + version: "2.18.0" firebase_core_platform_interface: dependency: "direct main" description: @@ -277,50 +277,50 @@ packages: dependency: transitive description: name: firebase_core_web - sha256: "5377eaac3b9fe8aaf22638d87f92b62784f23572e132dfc029195e84d6cb37de" + sha256: "0631a2ec971dbc540275e2fa00c3a8a2676f0a7adbc3c197d6fba569db689d97" url: "https://pub.dev" source: hosted - version: "2.12.0" + version: "2.8.1" firebase_crashlytics: dependency: "direct main" description: name: firebase_crashlytics - sha256: cf120df5b473f5f8cd24f9de663edc8aed3a1888d29d805076be0448bdee249e + sha256: "85f1098487d1b177bb4b7e0d552f57029d6964d2da665104d6299acce2f58bb6" url: "https://pub.dev" source: hosted - version: "3.4.19" + version: "3.4.0" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: "99656cc39228e8f2b845cddb4d43307bb44294a03e7d00b4d8e35536889bc65c" + sha256: "8bdcca9109595d353b467a97278becb726286596741b9cc0ace59abf9def9645" url: "https://pub.dev" source: hosted - version: "3.6.26" + version: "3.6.8" firebase_messaging: dependency: "direct main" description: name: firebase_messaging - sha256: "34fac43b70d5c41dc864eeb52417128da1f68b0a48604a0c56cd3190f0f609b8" + sha256: "26febca93007cdfd0e4684c9ca2f3e59b096d5fb39b83ae42bc9c1f726b27b0c" url: "https://pub.dev" source: hosted - version: "14.7.20" + version: "14.7.0" firebase_messaging_platform_interface: dependency: transitive description: name: firebase_messaging_platform_interface - sha256: "1dcf7d0d6776396bb2e488c53b0e4cc671c45a65717a73d881e52190d23aca3c" + sha256: "049da43147b078c8d389e2c24e6acfdda96968a53da2061632bb0cb74fea92c5" url: "https://pub.dev" source: hosted - version: "4.5.28" + version: "4.5.9" firebase_messaging_web: dependency: transitive description: name: firebase_messaging_web - sha256: ceabccf24d15d03c89dfd6c7eaef11c58fbf00b9c76ebc94028408943b8d2bfd + sha256: ac22d3c09949cd37d94431e7deba4e270a93e5134c4842a9d784bd884835b54b url: "https://pub.dev" source: hosted - version: "3.7.0" + version: "3.5.9" flutter: dependency: "direct main" description: flutter @@ -338,10 +338,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 + sha256: ad76540d21c066228ee3f9d1dad64a9f7e46530e8bb7c85011a88bc1fd874bc5 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -1057,18 +1057,18 @@ packages: dependency: "direct main" description: name: share_plus - sha256: "05ec043470319bfbabe0adbc90d3a84cbff0426b9d9f3a6e2ad3e131fa5fa629" + sha256: f86c5acc512b20e074137075824fc29e29b2cf395dcbfcc371e96e3e6290cce1 url: "https://pub.dev" source: hosted - version: "8.0.2" + version: "8.0.0" share_plus_platform_interface: dependency: transitive description: name: share_plus_platform_interface - sha256: "251eb156a8b5fa9ce033747d73535bf53911071f8d3b6f4f0b578505ce0d4496" + sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7" url: "https://pub.dev" source: hosted - version: "3.4.0" + version: "3.3.0" shared_preferences: dependency: "direct main" description: @@ -1496,14 +1496,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" - web: - dependency: transitive - description: - name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" - url: "https://pub.dev" - source: hosted - version: "0.5.1" web_socket_channel: dependency: transitive description: @@ -1532,10 +1524,10 @@ packages: dependency: transitive description: name: webview_flutter_android - sha256: "9427774649fd3c8b7ff53523051395d13aed2ca355822b822e6493d79f5fc05a" + sha256: ddc167c6676f57c8b367d19fcbee267d6dc6adf81bd6c3cb87981d30746e0a6d url: "https://pub.dev" source: hosted - version: "3.10.0" + version: "3.10.1" webview_flutter_platform_interface: dependency: transitive description: