|
| 1 | +import 'package:collection/collection.dart'; |
1 | 2 | import 'package:flutter/foundation.dart';
|
2 | 3 | import 'package:html/dom.dart' as dom;
|
3 | 4 | import 'package:html/parser.dart';
|
@@ -113,6 +114,20 @@ class UnimplementedBlockContentNode extends BlockContentNode
|
113 | 114 | // No ==/hashCode, because htmlNode is a whole subtree.
|
114 | 115 | }
|
115 | 116 |
|
| 117 | +class _BlockContentListNode extends DiagnosticableTree { |
| 118 | + const _BlockContentListNode(this.nodes); |
| 119 | + |
| 120 | + final List<BlockContentNode> nodes; |
| 121 | + |
| 122 | + @override |
| 123 | + String toStringShort() => 'BlockContentNode list'; |
| 124 | + |
| 125 | + @override |
| 126 | + List<DiagnosticsNode> debugDescribeChildren() { |
| 127 | + return nodes.map((node) => node.toDiagnosticsNode()).toList(); |
| 128 | + } |
| 129 | +} |
| 130 | + |
116 | 131 | /// A block content node whose children are inline content nodes.
|
117 | 132 | ///
|
118 | 133 | /// A node of this type expects a block layout context from its parent,
|
@@ -226,25 +241,12 @@ class ListNode extends BlockContentNode {
|
226 | 241 | @override
|
227 | 242 | List<DiagnosticsNode> debugDescribeChildren() {
|
228 | 243 | return items
|
229 |
| - .map((nodes) => _ListItemDiagnosticableNode(nodes).toDiagnosticsNode()) |
| 244 | + .mapIndexed((i, nodes) => |
| 245 | + _BlockContentListNode(nodes).toDiagnosticsNode(name: 'item $i')) |
230 | 246 | .toList();
|
231 | 247 | }
|
232 | 248 | }
|
233 | 249 |
|
234 |
| -class _ListItemDiagnosticableNode extends DiagnosticableTree { |
235 |
| - _ListItemDiagnosticableNode(this.nodes); |
236 |
| - |
237 |
| - final List<BlockContentNode> nodes; |
238 |
| - |
239 |
| - @override |
240 |
| - String toStringShort() => 'list item'; |
241 |
| - |
242 |
| - @override |
243 |
| - List<DiagnosticsNode> debugDescribeChildren() { |
244 |
| - return nodes.map((node) => node.toDiagnosticsNode()).toList(); |
245 |
| - } |
246 |
| -} |
247 |
| - |
248 | 250 | class QuotationNode extends BlockContentNode {
|
249 | 251 | const QuotationNode(this.nodes, {super.debugHtmlNode});
|
250 | 252 |
|
|
0 commit comments