-
Notifications
You must be signed in to change notification settings - Fork 449
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
Fix container.dart for issue #2628 #2701
Conversation
The Ink or InkWell widget must have a Material widget as an ancestor.
2024-02-21.10-31-55.mp4Test Code: import flet as ft
def main(page: ft.Page):
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.theme_mode = ft.ThemeMode.DARK
button = ft.Container(
bgcolor=ft.colors.GREEN,
content=ft.Icon(ft.icons.MENU_BOOK_ROUNDED, color=ft.colors.BLUE, size=30),
padding=18,
alignment=ft.alignment.center,
border_radius=20,
border=ft.Border(
top=ft.BorderSide(width=2, color=ft.colors.RED),
left=ft.BorderSide(width=2, color=ft.colors.RED),
bottom=ft.BorderSide(width=2, color=ft.colors.RED),
right=ft.BorderSide(width=2, color=ft.colors.RED),
),
shadow=ft.BoxShadow(
blur_radius=20,
color=ft.colors.YELLOW_ACCENT_700,
blur_style=ft.ShadowBlurStyle.OUTER,
),
on_click=lambda e: print("Clicked"),
ink=True,
bottom=20,
right=20,
)
simply_container = ft.Container(
bgcolor=ft.colors.with_opacity(1, ft.colors.BLACK),
height=page.height * 0.8,
width=page.width * 0.8,
bottom=20,
right=40,
)
stack = ft.Stack(controls=[simply_container, button], expand=True)
page.add(stack)
ft.app(target=main) |
Thanks @isaffathir. But each new/non-existing dart property you add should be "exposed" in Flet's python API. Just like you did in the first PR. |
i just wrap |
Thanks @isaffathir for fixing the bug and that too immediately when I mentioned you with this issue. |
Ah, i forgot to check which issue you were trying to fix. |
Flet already use InkWell on container.dart
Add more `InkWell` event in container.dart
* initial commit * add mouseCursor and delete not needed event * Update ink_well.py * Fix container.dart The Ink or InkWell widget must have a Material widget as an ancestor. * Revert change,duplicate control InkWell Flet already use InkWell on container.dart * Add on_release (Callback after click) * Add ink_color
Closes #2628
The
Ink
orInkWell
widget must have a Material widget as an ancestor.seems
container.dart
doesn't have:flet/packages/flet/lib/src/controls/container.dart
Lines 151 to 153 in fe1a4d1
so i try to wrap
InkWell
withMaterial
:https://github.com/flet-dev/flet/pull/2701/files#diff-3d2babe2e48d8eaf9b1c35294b8c498c905a03e16f8e490258b215a98e5ec568R151-R154
i also remove
Ink
cause Flet already useContainer
as parent, becauseContainer
can take aBoxDecoration
as i read thisThis is how i fix this issue, hopefully it will help.