-
Notifications
You must be signed in to change notification settings - Fork 29.8k
add clipBehaviour to Container #43564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add clipBehaviour to Container #43564
Conversation
|
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. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Piinks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sahandevs,
Welcome! and thank you for the contribution! 🎉
This change will need a test to ensure the behavior you are adding matches expectations.
|
|
||
| /// The transformation matrix to apply before painting the container. | ||
| final Matrix4 transform; | ||
| /// clipBehaviour for [BoxDecoration.borderRadius] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: blank line above this, and a full sentence description
| /// clipBehaviour for [BoxDecoration.borderRadius] | |
| /// clipBehaviour for [BoxDecoration.borderRadius] |
|
Hi @Piinks, Thanks! I added some tests and fixed the doc. |
| final Matrix4 transform; | ||
|
|
||
| /// The clip behaviour when [BoxDecoration.borderRadius] is available. | ||
| /// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: there's a trailing whitespace here that should be removed.
|
|
||
| if (clipBehaviour != null && | ||
| clipBehaviour != Clip.none && | ||
| decoration is BoxDecoration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's strange that the clipping will only work for BoxDecorations. What about a ShapeDecoration? Or any other decoration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to access the borderRadius inside the decoration
- We can just check for BoxDecoration ( Wich will support must use cases )
- Or We can create interface like ShapeWithBorder and add it to the all decorations
- Or we can just add another property in the Container as 'borderRadius' and use that
Wich one do you think is the best? @goderbauer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should ensure that this works for all decorations. We probably need to add something to the Decoration base class to get a clipPath (similar to ShapeBorder.getOutterPath) and then use that here.
|
Hi @sahandevs, are you planning on returning to this? It looks like the analyzer has detected whitespace in your changes. |
|
@Piinks I'm waiting for @goderbauer response |
|
@goderbauer I've added getBorderRadius to Decoration class and implemented it in BoxDecoration and ShapeDecoration if this approach is OK I will add docs and some tests for it |
| this.image, | ||
| this.gradient, | ||
| this.shadows, | ||
| this.borderRadius, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a borderRadius here doesn't make much sense - especially since the class just seems to ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, a shapeDecoration should be clipped to its shape.
| /// if it is a [BoxDecoration] with definitely no [DecorationImage]). | ||
| BoxPainter createBoxPainter([ VoidCallback onChanged ]); | ||
|
|
||
| BorderRadius getBorderRadius() => null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all decorations have a border radius. This will probably have to return a more generic clip Path.
|
Also: to fix the tests you'll have to merge the latest master into your PR. |
This reverts commit 3bca73b.
This reverts commit 464a567.
This reverts commit 451a0fe.
This reverts commit f9ade49.
This reverts commit ed05f01.
This reverts commit 9981db9.
This reverts commit 2f8bed2.
This reverts commit 1b84d8a.
This reverts commit 4835e63.
This reverts commit 8749ddf.
This reverts commit a7eaf4d.
This reverts commit f208671.
This reverts commit e3b3c1e.
This reverts commit f21562f.
This reverts commit 6cd5a6c.
This reverts commit 8708598.
This reverts commit 5a146d2.
This reverts commit 08e434c.
This reverts commit fa1cfcf.
This reverts commit 25d6bd1.
This reverts commit ecf3e61.
This reverts commit b3e7ce1.
This reverts commit ec12f4c.
This reverts commit 6ed30cf.
…d a getBinaryMessenger() method. (#43202) (flutter/engine#13349) (#43562)" This reverts commit 215284f.
This reverts commit 5156a80.
Revert "Merge master"
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
|
I Created a new pull request because of the mess #44971 |
Description
added clipBehaviour to Container
i did cast the decoration to
BoxDecorationbecause i need access to the borderRadius for theClipRRectRelated Issues
resolves #14421
Checklist
///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?