Skip to content

Conversation

@maheshj01
Copy link
Member

@maheshj01 maheshj01 commented Aug 10, 2022

Pass fit property from IndexedStack to RenderIndexedStack so as to fit Children within a Stack

Fixes: #109247

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

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

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Aug 10, 2022
@maheshj01 maheshj01 closed this Aug 10, 2022
@maheshj01 maheshj01 reopened this Aug 10, 2022
@xu-baolin
Copy link
Member

Could you add clipBehavior to IndexedStack too?

@maheshj01
Copy link
Member Author

@xu-baolin sure

@maheshj01
Copy link
Member Author

Would this require any tests?

@xu-baolin
Copy link
Member

yes this needs tests.

assert(_debugCheckHasDirectionality(context));
return RenderIndexedStack(
index: index,
fit:fit,
Copy link
Member

Choose a reason for hiding this comment

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

RO should add clipBehavior too

Copy link
Member Author

Choose a reason for hiding this comment

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

added

@goderbauer goderbauer self-requested a review August 15, 2022 16:05
assert(_debugCheckHasDirectionality(context));
renderObject
..index = index
..fit = fit
Copy link
Member

Choose a reason for hiding this comment

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

updateRenderObject also needs to update the clipBehavior on the RenderObject.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Fixed.

(WidgetTester tester) async {
await tester.pumpWidget(IndexedStack(textDirection: TextDirection.ltr));
final RenderIndexedStack renderObject =
tester.allRenderObjects.whereType<RenderIndexedStack>().first;
Copy link
Member

Choose a reason for hiding this comment

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

Probably a little more idiomatic:

Suggested change
tester.allRenderObjects.whereType<RenderIndexedStack>().first;
tester.renderObject<RenderIndexedStack>(find.type(IndexedStack));

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

clipBehavior: Clip.antiAlias,
));
final RenderIndexedStack renderIndexedObject =
tester.allRenderObjects.whereType<RenderIndexedStack>().first;
Copy link
Member

Choose a reason for hiding this comment

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

same

tester.allRenderObjects.whereType<RenderIndexedStack>().first;
expect(renderIndexedObject.clipBehavior, equals(Clip.antiAlias));
});
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you also add a test for the fit property?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added, Please review.

tester.allRenderObjects.whereType<RenderIndexedStack>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));

/// Update clipBehavior to Clip.antiAlias
Copy link
Member

Choose a reason for hiding this comment

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

/// -> //

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

@xu-baolin xu-baolin left a comment

Choose a reason for hiding this comment

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

LGTM

@xu-baolin xu-baolin added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 16, 2022
@auto-submit auto-submit bot merged commit f9331e2 into master Aug 16, 2022
@auto-submit auto-submit bot deleted the indexed-fit branch August 16, 2022 12:08
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 17, 2022
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 framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IndexedStack ignores sizing param

3 participants