Reputation: 1
In Flet of Python that uses Flutter UI controls, I used the image_src and image_fit but my terminal says they are deprecated.
ft.Container(
expand=3,
image_src="assets/splash.png",
image_fit="cover",
content=ft.Column(
alignment=ft.MainAxisAlignment.CENTER,
controls=[
ft.Icon(ft.icons.LOCK_PERSON_ROUNDED, size=100),
ft.Text(
"Welcome Back",
color=ft.colors.BLUE_900,
size=40,
weight=ft.FontWeight.BOLD,
)
]
)
),
Do you have some example using Container.image.src and Container.image.fit? So far, my program works but I have these warnings:
_src is deprecated since version 0.24.0 and will be removed in version 0.27.0. Use Container.image.src instead.
_fit is deprecated since version 0.24.0 and will be removed in version 0.27.0. Use Container.image.fit instead.
self.image_fit = image_fit
I'm new to Flet after coming from customtkinter and beeware.
I tried
ft.Container(
expand=3,
# image_src="assets/splash.png",
# image_fit="cover",
image=ft.Image(
src="assets/splash.png",
fit="cover"
),
content=ft.Column(
alignment=ft.MainAxisAlignment.CENTER,
controls=[
ft.Icon(ft.icons.LOCK_PERSON_ROUNDED, size=100),
ft.Text(
"Welcome to EyeQSoft",
color=ft.colors.BLUE_900,
size=40,
weight=ft.FontWeight.BOLD,
)
]
)
),
but the
image=ft.Image(
src="assets/splash.png",
fit="cover"
),
does not show the image.
Upvotes: 0
Views: 177
Reputation: 11
For me it worked that way:
image=ft.DecorationImage(
src='assets/splash.png',
fit=ft.ImageFit.COVER,
)
Upvotes: 1