Skip to content

Conversation

@LongCatIsLooong
Copy link
Contributor

@LongCatIsLooong LongCatIsLooong commented Apr 5, 2024

Minor changes to make the RenderDecorator.computeBaseline change a bit easier to make. No semantic changes.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Apr 5, 2024
@LongCatIsLooong LongCatIsLooong force-pushed the input-decorator-baseline branch from 485f679 to a30b462 Compare April 5, 2024 20:20
@LongCatIsLooong LongCatIsLooong requested a review from justinmc April 5, 2024 20:44
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 as long as the Google tests pass.

Thanks for cleaning this up. _layout especially is scarily fragile. The diff was hard to read at times but overall it looks good if it passes tests.

RenderBox? get prefixIcon => childForSlot(_DecorationSlot.prefixIcon);
RenderBox? get suffixIcon => childForSlot(_DecorationSlot.suffixIcon);
RenderBox? get helperError => childForSlot(_DecorationSlot.helperError);
RenderBox get helperError => childForSlot(_DecorationSlot.helperError)!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this no longer nullable? Is this like the first one in a greater planned refactor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _layout method assumes it's non-null so I think this makes the assumption more explicit.

// This method applies layout to all of the renderers except the container.
// For convenience, the container is laid out in performLayout().
_RenderDecorationLayout _layout(BoxConstraints layoutConstraints) {
_RenderDecorationLayout _layout(BoxConstraints constraints) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems less redundant 👍

// end.
final double t = textAlignVertical.y;
return middle + (end - middle) * t;
static double _interpolateThree(double begin, double middle, double end, TextAlignVertical textAlignVertical) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to making stuff like this static.

double computeMinIntrinsicWidth(double height) {
return _minWidth(icon, height)
+ (prefixIcon != null ? 0.0 : (textDirection == TextDirection.ltr ? contentPadding.left : contentPadding.right))
+ (prefixIcon != null ? 0.0 : contentPadding.start)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call making this EdgeInsetsDirectional.

final double helperErrorBaseline = helperError.getDistanceToBaseline(TextBaseline.alphabetic)!;
final double counterBaseline = counter?.getDistanceToBaseline(TextBaseline.alphabetic)! ?? 0.0;

double start, end;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these be late final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are updated after laying out each child.

expect(intrinsicHeight, equals(height));
});

testWidgets('Error message for negative baseline', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added that in #74326. There used to be a helper method that lays out a child and computes its baseline, even for center aligned children. It's removed. Having negative baselines may look ugly but I don't think it asserts anymore.

@LongCatIsLooong LongCatIsLooong force-pushed the input-decorator-baseline branch from 79cfd2f to 18ace04 Compare April 6, 2024 03:25
@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 6, 2024
@auto-submit auto-submit bot merged commit 98d23f7 into flutter:master Apr 6, 2024
@LongCatIsLooong LongCatIsLooong deleted the input-decorator-baseline branch April 6, 2024 21:51
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Apr 7, 2024
flutter/flutter@477ebd8...98d23f7

2024-04-06 [email protected] Prepare for RenderDecorator.computeBaseline changes. (flutter/flutter#146363)
2024-04-06 [email protected] Roll Flutter Engine from 563bdb1d7976 to 605b3f35fa0a (1 revision) (flutter/flutter#146393)
2024-04-06 [email protected] Roll Flutter Engine from 482172d16528 to 563bdb1d7976 (1 revision) (flutter/flutter#146385)
2024-04-06 [email protected] Roll Flutter Engine from b0d7ac5425e9 to 482172d16528 (1 revision) (flutter/flutter#146382)
2024-04-06 [email protected] Roll Flutter Engine from df9f7433fc70 to b0d7ac5425e9 (2 revisions) (flutter/flutter#146377)
2024-04-06 [email protected] Roll Flutter Engine from b5039157cbc1 to df9f7433fc70 (1 revision) (flutter/flutter#146373)
2024-04-05 [email protected] Make FileSystem dependency explicit througout. (flutter/flutter#146008)
2024-04-05 [email protected] Roll Flutter Engine from 48604dfd9d49 to b5039157cbc1 (3 revisions) (flutter/flutter#146370)
2024-04-05 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.24.9 to 3.24.10 (flutter/flutter#146368)
2024-04-05 [email protected] Roll Flutter Engine from da995a1061c5 to 48604dfd9d49 (2 revisions) (flutter/flutter#146366)
2024-04-05 [email protected] Roll Flutter Engine from 6a478d6931b2 to da995a1061c5 (1 revision) (flutter/flutter#146364)
2024-04-05 [email protected] Roll Flutter Engine from 62df3bd5f681 to 6a478d6931b2 (3 revisions) (flutter/flutter#146360)
2024-04-05 [email protected] Copy part files and sourcemaps when building with dart2js. (flutter/flutter#146356)
2024-04-05 [email protected] Roll Flutter Engine from d048b9aed529 to 62df3bd5f681 (1 revision) (flutter/flutter#146357)
2024-04-05 [email protected] Reland "Bump to AGP 8.1/Gradle 8.3 (almost) everywhere" (flutter/flutter#146307)
2024-04-05 [email protected] Roll Flutter Engine from 6974dbac35a1 to d048b9aed529 (1 revision) (flutter/flutter#146355)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
Minor changes to make the `RenderDecorator.computeBaseline` change a bit easier to make. No semantic changes.
auto-submit bot pushed a commit that referenced this pull request May 2, 2024
Depends on #146363

No test because the consistency of the `computeDryBaseline` implementations is checked at paint time.
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
flutter/flutter@477ebd8...98d23f7

2024-04-06 [email protected] Prepare for RenderDecorator.computeBaseline changes. (flutter/flutter#146363)
2024-04-06 [email protected] Roll Flutter Engine from 563bdb1d7976 to 605b3f35fa0a (1 revision) (flutter/flutter#146393)
2024-04-06 [email protected] Roll Flutter Engine from 482172d16528 to 563bdb1d7976 (1 revision) (flutter/flutter#146385)
2024-04-06 [email protected] Roll Flutter Engine from b0d7ac5425e9 to 482172d16528 (1 revision) (flutter/flutter#146382)
2024-04-06 [email protected] Roll Flutter Engine from df9f7433fc70 to b0d7ac5425e9 (2 revisions) (flutter/flutter#146377)
2024-04-06 [email protected] Roll Flutter Engine from b5039157cbc1 to df9f7433fc70 (1 revision) (flutter/flutter#146373)
2024-04-05 [email protected] Make FileSystem dependency explicit througout. (flutter/flutter#146008)
2024-04-05 [email protected] Roll Flutter Engine from 48604dfd9d49 to b5039157cbc1 (3 revisions) (flutter/flutter#146370)
2024-04-05 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.24.9 to 3.24.10 (flutter/flutter#146368)
2024-04-05 [email protected] Roll Flutter Engine from da995a1061c5 to 48604dfd9d49 (2 revisions) (flutter/flutter#146366)
2024-04-05 [email protected] Roll Flutter Engine from 6a478d6931b2 to da995a1061c5 (1 revision) (flutter/flutter#146364)
2024-04-05 [email protected] Roll Flutter Engine from 62df3bd5f681 to 6a478d6931b2 (3 revisions) (flutter/flutter#146360)
2024-04-05 [email protected] Copy part files and sourcemaps when building with dart2js. (flutter/flutter#146356)
2024-04-05 [email protected] Roll Flutter Engine from d048b9aed529 to 62df3bd5f681 (1 revision) (flutter/flutter#146357)
2024-04-05 [email protected] Reland "Bump to AGP 8.1/Gradle 8.3 (almost) everywhere" (flutter/flutter#146307)
2024-04-05 [email protected] Roll Flutter Engine from 6974dbac35a1 to d048b9aed529 (1 revision) (flutter/flutter#146355)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants