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.

1 Answer 1

2

For me it worked that way:

image=ft.DecorationImage(
    src='assets/splash.png',
    fit=ft.ImageFit.COVER,
)
Sign up to request clarification or add additional context in comments.

1 Comment

It worked. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.