You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For anyone looking to implement something like this right away:
I have managed to do something along the lines of this from ripping the Shadow.toPaint method to achieve the following effect:
A drop-in widget and some example code can be found here: Gist
Reacted by a7medsalah, aytunc, nesscx, Gabriel Moreyra, Vlad Yaremenko, 子物, Herwindo Artono, Nony Bright O, Rodrigo Aguiar Dias, Amr ahmed and 16 more
Reacted by Gabriel Moreyra, Breno Caldeira, Amr ahmed, James Elgar, Dandi and v4g
Reacted by Gabriel Moreyra, Amr ahmed, Emmanuel Hernández, James Elgar, Breno Caldeira, Ali Alsamraay and v4g
Reacted by Gabriel Moreyra, Amr ahmed, Naveen yadav and v4g
Instead of creating a container, clipping it, and then applying a shadow to the clipper, you can create a custom-shaped container using a ShapeDecoration and apply it directly to the container.
Here is a sample code that creates a container with a notch in the top center. The shadow is directly applied to the container. The hard part for me was to create the custom path the way I want which I think you already have.
Activity
coman3 commentedon Jan 27, 2019
For anyone looking to implement something like this right away:
I have managed to do something along the lines of this from ripping the
Shadow.toPaintmethod to achieve the following effect:A drop-in widget and some example code can be found here: Gist
fzleite commentedon Jan 29, 2019
Nice. Can you share the code?
zoechi commentedon Jan 29, 2019
@fzleite see the Gist link at the end of the comment
fzleite commentedon Jan 29, 2019
It works great. Thank you
aytunch commentedon Apr 5, 2019
@coman3 Is there a way to do custom border outline following the Clipper just like you did for a shadow?
januwA commentedon Sep 5, 2019
I am also looking for a way to set the
borderRadiusfor the clipped container. 😃behnamsattar commentedon Mar 4, 2022
Instead of creating a container, clipping it, and then applying a shadow to the clipper, you can create a custom-shaped container using a ShapeDecoration and apply it directly to the container.
Here is a sample code that creates a container with a notch in the top center. The shadow is directly applied to the container. The hard part for me was to create the custom path the way I want which I think you already have.
Sample Code