Back to Flet

SpinKit

website/docs/controls/spinkit/index.md

0.86.0.dev13.6 KB
Original Source

import TabItem from '@theme/TabItem'; import Tabs from '@theme/Tabs'; import {CodeExample} from '@site/src/components/crocodocs';

SpinKit

30 animated loading spinner controls built on Flutter's flutter_spinkit package.

Usage

Add flet-spinkit to your project dependencies:

<Tabs groupId="uv--pip"> <TabItem value="uv" label="uv"> ```bash uv add flet-spinkit ``` </TabItem> <TabItem value="pip" label="pip"> ```bash pip install flet-spinkit # (1)! ```
  1. After this, you will have to manually add this package to your requirements.txt or pyproject.toml. </TabItem>
</Tabs>

Then import the package in your Flet app:

python
import flet_spinkit as spins

Boot screen

flet-spinkit also provides a boot screen named spinkit — an animated loader shown while your packaged app is starting up. Once flet-spinkit is a dependency, select it in pyproject.toml:

toml
[tool.flet.boot_screen]
name = "spinkit"

[tool.flet.boot_screen.spinkit]
spinner = "WanderingCubes"          # any SpinKit animation (without the "SpinKit" prefix)
spinner_color_light = "#7c4dff"
spinner_color_dark = "#b388ff"
spinner_size = 60
bgcolor_light = "#ffffff"
bgcolor_dark = "#0d0d12"
prepare_message = "Preparing your app…"
startup_message = "Starting up…"

All options are optional:

OptionDefaultDescription
spinnerWanderingCubesAny SpinKit animation, named without the SpinKit prefix (e.g. Wave, FadingCube, PouringHourGlass). Case-insensitive.
theme_modeautoauto (follow device), light, or dark.
bgcolor_light / bgcolor_darkFlet theme backgroundBackground color.
spinner_color_light / spinner_color_darkFlet theme primarySpinner color.
spinner_size60Spinner size in logical pixels.
text_color_light / text_color_darkFlet theme on-surfaceMessage text color.
prepare_messagenoneText shown while unpacking the app (Android only).
startup_messagenoneText shown while the Python runtime and app start.
fade_out_duration0Fade-out duration in milliseconds when the app becomes ready; 0 removes it instantly.

:::tip This boot screen is a complete, real-world example of the createBootScreen extension hook — see its source under flet-spinkit's src/flutter/flet_spinkit/lib/src/boot_screen.dart. :::

Examples

<CodeExample path={frontMatter.examples + '/spinkit_showcase/main.py'} language="python" />

<CodeExample path={frontMatter.examples + '/spinkit_props/main.py'} language="python" />

Available controls