Skip to content

Conversation

@coman3
Copy link

@coman3 coman3 commented Sep 8, 2019

Description

Adds non API breaking support for shadows to ClipPath.
Before:
image

After:
image

Related Issues

#25946 Add boxShadow to ClipPath

Tests

I added the following tests:
Append drawing shadow onto previous ClipPath painting test: 4940e77

I am unable to update the goldens for this, @Hixie can you please help me out?

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Sep 8, 2019
@Hixie
Copy link
Contributor

Hixie commented Sep 8, 2019

Shadows seem orthogonal to cilpping... shouldn't this just be a separate widget?

@coman3
Copy link
Author

coman3 commented Sep 8, 2019

Shadows seem orthogonal to clipping... shouldn't this just be a separate widget?

I definitely thought about putting this into a new widget, but the options i came up with would either:

  • have a widget that is basically a direct copy of ClipPath but with a few added properties / shadow support
  • have a widget that can only accept ClipPath / ClipRect / ClipOval / ClipRRect as a child

I was also looking at adding 'shadow' to the other Clippers but wanted to discuss how to go about it first.
How do you suggest this should be placed as a new widget / implemented differently? I was thinking we could look at adding a ClipperDecoration : Decoration class and this as a property to the 4 different clippers? (this would also add support for clip shaped borders etc)

@Hixie
Copy link
Contributor

Hixie commented Sep 9, 2019

Why not just a widget that takes a Path and draws a shadow to match that Path?

Come to think of it, does PhysicalShape address your need?

@goderbauer
Copy link
Member

Looks like PhysicalShape or PhysicalModel (for rect shapes) does exactly this? I am going to close this PR for now. Feel free to add additional details if this did not resolve your issue.

@goderbauer goderbauer closed this Sep 11, 2019
@aytunch
Copy link

aytunch commented May 26, 2020

@coman3 Could you solve this issue by using PhysicalShape or PhysicalModel as suggested? Because I could not find enough documentation and examples on those 2 classes. maybe you can help

@coman3
Copy link
Author

coman3 commented May 27, 2020

@aytunch I ended up just implmenting a wrapper widget locally. PhysicalShape or PhysicalModel did not have support for a custom shadow which was too limiting in my situation.

If you need a basic shadow, and maybe some colour use PhysicalShape, otherwise have a look at this implementation: https://gist.github.com/coman3/e631fd55cd9cdf9bd4efe8ecfdbb85a7

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants