-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
RaisedButton highlightColor draws above background color #26180
Comments
Please add the output of A screenshot would be helpful as well. |
|
This is almost certainly caused byt he same problem in #48534 |
Or not. I'm not really sure what the bug is here. What do you expect to happen when the highlight color is (semi-)transparent? Why wouldn't the color of the button show through in such a case? |
I expect to see the button background through. Imagine this button was on top of an image. If I press the button, I want to see the background image behind the button. The red color should be gone completely when I press. Red is the color of the button in the default state. If I press it, why do I still see the default color behind? The button is mixing both colors for some reason. With the current implementation of the RaisedButton it seems impossible to achieve the effect I want. My spec says the color of the button in the pressed state should be 20% gray which is not feasible because it will be mixed with the red color when I press. Please let me know if this is still not clear. |
Perhaps I'm just missing something, but you're setting the button color to red - and then you're setting the highlight color to semi-transparent black. And it sounds like you're surprised that you're still seeing red through the semi-transparent highlight color. So we're drawing the highlight when you press, but it's transparent, so you can still see the color behind it. This all sounds like it's WAI to me. Can you share the example of an image where this isn't working out? |
@saprvade why don't you just set a boolean which checks if the button is actively beeing pressed. If true, the default button color will be transparent. By the way, you can also use FlatButton or just a custom Widget created by yourself with the help of Container or Material Widgets |
@dnfield try the button from my example and put it on top of an image. When you press it you will see dimmed solid red, instead of an image. I want to see image when I press. Sorry I can't provide an example now because this bug has been filed a year ago and I'm no longer working on this :) @Ahmadre does that actually work, setting the default color to transparent while pressed? I think I had some issues that it didn't redraw or something like that. Can't tell for sure it was a long time ago.. If you can try this workaround and it works for you then I guess we can close this. Thanks! |
Code Sample
flutter doctor -v
|
RaisedButton has been removed from the framework now, and has been been replaced by ElevatedButton. Does this issue still persist in the new API? highlightColor is no longer part of the Material Design spec, and so it dow not exist as part of the ElevatedButton ButtonStyle. |
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
It seems that the current implementation of the RaisedButton makes it impossible for me to use a transparent highlight color for the pressed state. For example:
RaisedButton(child: Text('Raised button'), color: Color(0xFFFF0000), highlightColor: Color(0x33000000), onPressed: () {})
The button is red and the highlight color here is 20% black, but if you press this button, you still see the red color behind. That means I can't have a transparent highlight color because the underlying one will mess it up. This doesn't seem to work as expected for me. Are there any workarounds to this?
The text was updated successfully, but these errors were encountered: