-
Notifications
You must be signed in to change notification settings - Fork 14
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
Is there a way to clip the shimmer to the child below? #14
Comments
I'm assuming what you want to do is tightly wrap the shimmer animation around the child widget i.e., in this, case a CupertinoButton and I'm assuming that by overflow you mean that the Shimmer is slightly bigger than the child itself, am I right? The Shimmer widget is designed to tightly wrap around the child widget and actually does that pretty well. And I'm also assuming that this is the problem you are facing. So, the two possible solutions are:
I hope this clears up any of the doubts that you have 🙂🙂 |
Also, I would update the widget to accept a shape after my exams. So you could expect an update by the end of January! |
Yes, I am referring to child widgets with different boundary like rounded cornered button or a variable shape or an icon perhaps. I also tried using https://pub.dev/packages/shimmer This clips the boundaries correctly but it acts as a shader overlay i.e the child rendering will get completely overlayed with this. You package on the other hand just stacks the shimmer on top on the child, just the way I want. Not a problem. No hurries or worries. This is just a request and any update to it is appreciated a lot👍 |
I really like the shimmer package but I find it to be a bit complicated for someone new. An example for implementing a rounded rectangle would be: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(50)),
child: Shimmer(
enabled: isDisabled,
child: CupertinoButton(
borderRadius: BorderRadius.all(Radius.circular(50)),
color: Colors.blue[900],
disabledColor: Colors.grey,
child: Text('Login'),
onPressed: onPressed,
),
),
) This is what this would look like: I've ommitted onPressed for clarity. For custom shapes we could use: |
@dheerajbred please let me know if your issue is resolved for now!! |
Yes, ClipRRect definitely solves the issue for rounded cornered widgets👍 |
I am also interested in this feature, I will use the Clippers for now 👍 |
@Kobatsu I had planned to implement this but this turned out to be a more major modification than I had imagined it to be. And with my University and Internship going on side-by-side, I was unable to get the time to do this. This is on my todo list and will try to get this done as soon as possible |
I made some clippers in the example repo from the PR #19. Special note : ElevatedButton has extra margin, to prevent the shimmer from showing above them, we need to change the ClipRRect(
child: Shimmer(
child: ElevatedButton(
child: Text("Rounded Rectangle"),
onPressed: () {},
style: ElevatedButton.styleFrom(
// if you don't set [tapTargetSize] to shrinkWrap there will be extra margins
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32))),
),
color: Colors.red,
interval: Duration(milliseconds: 200),
),
borderRadius: BorderRadius.circular(32),
) |
ClipRRect is not working if ElevatedButton has a shadow. Then it clips the shadow away. |
Not an issue.
Is there a way to clip the shimmer to the child below? The shimmer is overflowing. Like a Cupertinobutton with shimmer
The text was updated successfully, but these errors were encountered: