[go: nahoru, domu]

Skip to content

Commit

Permalink
Add implementation advice to debugTypicalAncestorWidgetClass (flutter…
Browse files Browse the repository at this point in the history
  • Loading branch information
Hixie authored and LouiseHsu committed Jul 31, 2023
1 parent 76c4ac6 commit 8c0b738
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/rendering/paragraph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion packages/flutter/lib/src/widgets/framework.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/widget_span.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8c0b738

Please sign in to comment.