Skip to content

Commit

Permalink
Re-implement WidgetPlaceholder.firstChild usage
Browse files Browse the repository at this point in the history
  • Loading branch information
daohoangson committed Mar 25, 2024
1 parent f01a002 commit 61efae5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
3 changes: 3 additions & 0 deletions lib/src/widgets/html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
17 changes: 7 additions & 10 deletions lib/src/widgets/html/photo_compare.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 61efae5

Please sign in to comment.