Add implementation advice to debugTypicalAncestorWidgetClass (#130530)
Fixes https://github.com/flutter/flutter/issues/56500
This commit is contained in:
@@ -71,7 +71,7 @@ class TextParentData extends ParentData with ContainerParentDataMixin<RenderBox>
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() =>'widget: $span, ${offset == null ? "not laid out" : "offset: $offset"}';
|
||||
String toString() => 'widget: $span, ${offset == null ? "not laid out" : "offset: $offset"}';
|
||||
}
|
||||
|
||||
/// A mixin that provides useful default behaviors for text [RenderBox]es
|
||||
|
||||
@@ -1514,7 +1514,20 @@ abstract class ParentDataWidget<T extends ParentData> extends ProxyWidget {
|
||||
/// that [applyParentData] will write to.
|
||||
///
|
||||
/// This is only used in error messages to tell users what widget typically
|
||||
/// wraps this ParentDataWidget.
|
||||
/// wraps this [ParentDataWidget].
|
||||
///
|
||||
/// ## Implementations
|
||||
///
|
||||
/// The returned type should be a subclass of `RenderObjectWidget`.
|
||||
///
|
||||
/// ```dart
|
||||
/// @override
|
||||
/// Type get debugTypicalAncestorWidgetClass => FrogJar;
|
||||
/// ```
|
||||
///
|
||||
/// If the "typical" parent is generic (`Foo<T>`), consider specifying either
|
||||
/// a typical type argument (e.g. `Foo<int>` if `int` is typically how the
|
||||
/// type is specialized), or specifying the upper bound (e.g. `Foo<Object?>`).
|
||||
Type get debugTypicalAncestorWidgetClass;
|
||||
|
||||
Iterable<DiagnosticsNode> _debugDescribeIncorrectParentDataType({
|
||||
|
||||
@@ -290,7 +290,7 @@ class _WidgetSpanParentData extends ParentDataWidget<TextParentData> {
|
||||
}
|
||||
|
||||
@override
|
||||
Type get debugTypicalAncestorWidgetClass => RenderInlineChildrenContainerDefaults;
|
||||
Type get debugTypicalAncestorWidgetClass => RichText;
|
||||
}
|
||||
|
||||
// A RenderObjectWidget that automatically applies text scaling on inline
|
||||
|
||||
Reference in New Issue
Block a user