-
Notifications
You must be signed in to change notification settings - Fork 527
ElevatedButton, FilledButton and FilledTonalButton issue on disable #1754
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
Comments
I checked the ElevatedButton code and fixed the issue: flet_core: elevated_button.py
def _before_build_command(self):
super()._before_build_command()
if self.__color is not None or self.__bgcolor is not None or self.__elevation is not None:
if self.__style is None:
self.__style = ButtonStyle()
if self.__style.color != self.__color and not self.disabled:
self.__style.color = self.__color
if self.__style.bgcolor != self.__bgcolor and not self.disabled:
self.__style.bgcolor = self.__bgcolor
if self.__style.elevation != self.__elevation:
self.__style.elevation = self.__elevation
if self.__style is not None:
self.__style.side = self._wrap_attr_dict(self.__style.side)
self.__style.shape = self._wrap_attr_dict(self.__style.shape)
self._set_attr_json("style", self.__style) I changed to: def _before_build_command(self):
super()._before_build_command()
if self.__color is not None or self.__bgcolor is not None or self.__elevation is not None:
if self.__style is None:
self.__style = ButtonStyle()
self.__style.color = self.__color if not self.disabled else None
self.__style.bgcolor = self.__bgcolor if not self.disabled else None
if self.__style.elevation != self.__elevation:
self.__style.elevation = self.__elevation
if self.__style is not None:
self.__style.side = self._wrap_attr_dict(self.__style.side)
self.__style.shape = self._wrap_attr_dict(self.__style.shape)
self._set_attr_json("style", self.__style) And it's working properly! I hope I have contributed! |
Related issue: #1503 ? |
The problem is different. In #1503 the person is disabling the column and wants the buttons inside the column to be disabled as well. |
Hi! |
Dear @FeodorFitsner : Did you see my fix here? |
@andrerotband Yes, thank you. I've modified it a little bit though: 684bf1f |
* Fix incomplete code blocks in flet_core/page.py Fix flet-dev#1734 * Fix disabled color of FilledButtons Fix flet-dev#1754 * Add `AppView` and `WebRenderer` enums to flet-pyodide * Bump pyodide to 0.24.0 * Bump Flet version to 0.10.2
Description
The code works if I leave the default button:
But if I change the color or background color of the button it has problems.
It does not change the color of the button to appear disabled
Flet version (
pip show flet
):Operating system:
Windows 10
The text was updated successfully, but these errors were encountered: