Skip to content

flet-lottie#

pypi downloads license

A Flet extension package for displaying Lottie animations.

It is based on the lottie Flutter package.

Platform Support#

This package supports the following platforms:

Platform Supported
Windows
macOS
Linux
iOS
Android
Web

Usage#

Installation#

To install the flet-lottie package and add it to your project dependencies:

uv add flet-lottie
pip install flet-lottie  # (1)!
  1. After this, you will have to manually add this package to your requirements.txt or pyproject.toml.
poetry add flet-lottie

Example#

main.py
import flet as ft

import flet_lottie as ftl


def main(page: ft.Page):
    page.add(
        ftl.Lottie(
            src="https://raw.githubusercontent.com/xvrh/lottie-flutter/master/example/assets/Mobilo/A.json",
            reverse=False,
            animate=True,
            error_content=ft.Placeholder(ft.Text("Error loading Lottie")),
            on_error=lambda e: print(f"Error loading Lottie: {e.data}"),
        ),
        ftl.Lottie(
            src="sample.json",
            reverse=False,
            animate=True,
            enable_merge_paths=True,
            enable_layers_opacity=True,
            error_content=ft.Placeholder(ft.Text("Error loading Lottie")),
            on_error=lambda e: print(f"Error loading Lottie: {e.data}"),
        ),
    )


ft.run(main, assets_dir="assets")