Skip to content

Commit 044c1a8

Browse files
committed
Make WidgetPlaceholder.firstChild public
1 parent a4a9ba4 commit 044c1a8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/core/lib/src/core_helpers.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ class WidgetPlaceholder extends StatelessWidget {
9595
/// A human-readable description of this placeholder.
9696
final String? debugLabel;
9797

98+
/// The first child widget.
99+
final Widget? firstChild;
100+
98101
final List<WidgetPlaceholderBuilder> _builders;
99-
final Widget? _firstChild;
100102

101103
/// Creates a placeholder.
102104
WidgetPlaceholder({
@@ -105,13 +107,13 @@ class WidgetPlaceholder extends StatelessWidget {
105107
this.debugLabel,
106108
super.key,
107109
}) : _builders = builder != null ? [builder] : [],
108-
_firstChild = child;
110+
firstChild = child;
109111

110112
/// Whether this placeholder renders anything.
111-
bool get isEmpty => _firstChild == null && _builders.isEmpty;
113+
bool get isEmpty => firstChild == null && _builders.isEmpty;
112114

113115
@override
114-
Widget build(BuildContext context) => callBuilders(context, _firstChild);
116+
Widget build(BuildContext context) => callBuilders(context, firstChild);
115117

116118
/// Calls builder callbacks on the specified [child] widget.
117119
@protected

packages/core/lib/src/internal/core_build_tree.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ class _WidgetPlaceholderDefault extends StatelessWidget
396396
@override
397397
String? get debugLabel => null;
398398

399+
@override
400+
Widget? get firstChild => null;
401+
399402
@override
400403
bool get isEmpty => true;
401404

0 commit comments

Comments
 (0)