[CP-beta]Unbreak https://github.com/flutter/flutter/pull/164034 (#167736)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? https://github.com/flutter/flutter/issues/167247 We identified a breaking change in beta, this change un-breaks it. ### Changelog Description: Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples Restore RenderConstrainedLayoutBuilder with default layoutInfo implementation to undo a breaking change. ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch) A class was renamed, which left developers with a "class not found" error as their only guide. ### Workaround: Is there a workaround for this issue? Nope. ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? Classes that mixin RenderConstrainedLayoutBuilder are no longer broken and the code can compile.
This commit is contained in:
parent
a2e3722fc6
commit
030e2a5517
@ -302,8 +302,12 @@ class _LayoutBuilderElement<LayoutInfoType> extends RenderObjectElement {
|
||||
/// Provides a [layoutCallback] implementation which, if needed, invokes
|
||||
/// [AbstractLayoutBuilder]'s builder callback.
|
||||
///
|
||||
/// Implementers must provide a [layoutInfo] implementation that is safe to
|
||||
/// access in [layoutCallback], which is called in [performLayout].
|
||||
/// Implementers can override the [layoutInfo] implementation with a value
|
||||
/// that is safe to access in [layoutCallback], which is called in
|
||||
/// [performLayout]. The default [layoutInfo] returns the incoming
|
||||
/// [Constraints].
|
||||
///
|
||||
/// This mixin replaces [RenderConstrainedLayoutBuilder].
|
||||
mixin RenderAbstractLayoutBuilderMixin<LayoutInfoType, ChildType extends RenderObject>
|
||||
on RenderObjectWithChildMixin<ChildType>, RenderObjectWithLayoutCallbackMixin {
|
||||
LayoutCallback<Constraints>? _callback;
|
||||
@ -334,11 +338,18 @@ mixin RenderAbstractLayoutBuilderMixin<LayoutInfoType, ChildType extends RenderO
|
||||
///
|
||||
/// This is typically the information that are only made available in
|
||||
/// [performLayout], which is inaccessible for regular [Builder] widget,
|
||||
/// such as the incoming [Constraints].
|
||||
/// such as the incoming [Constraints], which are the default value.
|
||||
@protected
|
||||
LayoutInfoType get layoutInfo;
|
||||
LayoutInfoType get layoutInfo => constraints as LayoutInfoType;
|
||||
}
|
||||
|
||||
/// Generic mixin for [RenderObject]s created by an [AbstractLayoutBuilder] with
|
||||
/// the the same `LayoutInfoType`.
|
||||
///
|
||||
/// Use [RenderAbstractLayoutBuilderMixin] instead, which replaces this mixin.
|
||||
typedef RenderConstrainedLayoutBuilder<LayoutInfoType, ChildType extends RenderObject> =
|
||||
RenderAbstractLayoutBuilderMixin<LayoutInfoType, ChildType>;
|
||||
|
||||
/// Builds a widget tree that can depend on the parent widget's size.
|
||||
///
|
||||
/// Similar to the [Builder] widget except that the framework calls the [builder]
|
||||
@ -476,10 +487,6 @@ class _RenderLayoutBuilder extends RenderBox
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@protected
|
||||
@override
|
||||
BoxConstraints get layoutInfo => constraints;
|
||||
}
|
||||
|
||||
FlutterErrorDetails _reportException(
|
||||
|
@ -29,7 +29,7 @@ class SliverLayoutBuilder extends ConstrainedLayoutBuilder<SliverConstraints> {
|
||||
const SliverLayoutBuilder({super.key, required super.builder});
|
||||
|
||||
@override
|
||||
RenderAbstractLayoutBuilderMixin<SliverConstraints, RenderSliver> createRenderObject(
|
||||
RenderConstrainedLayoutBuilder<SliverConstraints, RenderSliver> createRenderObject(
|
||||
BuildContext context,
|
||||
) => _RenderSliverLayoutBuilder();
|
||||
}
|
||||
@ -38,17 +38,13 @@ class _RenderSliverLayoutBuilder extends RenderSliver
|
||||
with
|
||||
RenderObjectWithChildMixin<RenderSliver>,
|
||||
RenderObjectWithLayoutCallbackMixin,
|
||||
RenderAbstractLayoutBuilderMixin<SliverConstraints, RenderSliver> {
|
||||
RenderConstrainedLayoutBuilder<SliverConstraints, RenderSliver> {
|
||||
@override
|
||||
double childMainAxisPosition(RenderObject child) {
|
||||
assert(child == this.child);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@protected
|
||||
@override
|
||||
SliverConstraints get layoutInfo => constraints;
|
||||
|
||||
@override
|
||||
void performLayout() {
|
||||
runLayoutCallback();
|
||||
|
@ -1067,10 +1067,6 @@ class _RenderSmartLayoutBuilder extends RenderProxyBox
|
||||
onChildWasPainted(extraOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
@override
|
||||
BoxConstraints get layoutInfo => constraints;
|
||||
}
|
||||
|
||||
class _LayoutSpy extends LeafRenderObjectWidget {
|
||||
|
Loading…
x
Reference in New Issue
Block a user