Skip to main content

Circular/radial slider control for Flet, wrapping sleek_circular_slider Flutter package

Project description

flet-circular-slider

A circular/radial slider control for Flet, wrapping the sleek_circular_slider Flutter package.

Install

pip install flet-circular-slider

Then register it as a Flet extension in your project's pyproject.toml so the Flutter widget gets compiled:

[project]
dependencies = ["flet-circular-slider>=0.1.0"]

[tool.flet.dev_packages]
flet-circular-slider = ">=0.1.0"

Then run flet build (see Building below). flet run alone won't compile extensions — you'll get "Unknown control" without a build step.

Quick Start

import flet as ft
from flet_circular_slider import FletCircularSlider

def main(page: ft.Page):
    page.bgcolor = "#1a1a2e"

    slider = FletCircularSlider(
        min=0, max=100, value=25, size=200,
        on_change=lambda e: print(int(float(e.data))),
    )
    page.add(slider)

ft.run(main)

Label Formatting

Use label_formatter to transform the numeric value into any string. The callback runs once per step at build time, so the slider displays your formatted labels (e.g. "1h 30m") instead of raw numbers.

def format_duration(minutes: float) -> str:
    m = int(minutes)
    if m == 0:
        return "0m"
    h, rem = divmod(m, 60)
    if h == 0:
        return f"{rem}m"
    return f"{h}h {rem}m" if rem else f"{h}h"

slider = FletCircularSlider(
    min=0, max=200, value=90,
    divisions=200,
    label_formatter=format_duration,
    size=280,
)

divisions controls the number of discrete steps. When label_formatter is set, it pre-computes a label for each step and sends the mapping to the Flutter side.

Examples

  • basic.py — Minimal slider with on_change event
  • advanced.py — Custom colors, geometry, labels, sizing, and all three events
  • duration_picker.py — Duration picker using label_formatter to display "1h 30m" style labels

Properties

Property Type Default Description
min float 0 Minimum value
max float 100 Maximum value
value float 50 Initial value
size float 150 Diameter in pixels
start_angle float 150 Arc start angle (degrees)
angle_range float 240 Arc total range (degrees)
counter_clockwise bool False Reverse drag direction
animation_enabled bool True Animate to initial value
progress_bar_width float size/10 Progress arc width
track_width float bar/4 Background track width
handler_size float bar/5 Drag handle size
progress_bar_start_color ColorValue purple Gradient start color
progress_bar_end_color ColorValue pink Gradient end color
track_color ColorValue light purple Track color
dot_color ColorValue white Handle dot color
shadow_color ColorValue blue Shadow color
hide_shadow bool False Remove the shadow
inner_text_color ColorValue gradient end Center text color
divisions int none Snap to N evenly-spaced steps
inner_text str raw value Center text ({value} placeholder)
top_label str none Label above center
bottom_label str none Label below center
label_formatter Callable none Callback (float) -> str to format displayed value
label_map dict none Pre-computed {value: label} map (set automatically by label_formatter)

Events

Event e.data Description
on_change current value Fires continuously while dragging
on_change_start value at drag start Fires once when drag begins
on_change_end value at drag end Fires once when drag ends

Building

Custom Flet extensions require flet build to compile Dart/Flutter code. flet run alone shows "Unknown control" because it uses a pre-built binary.

flet build web       # no extra tooling needed
flet build windows   # requires Visual Studio C++ workload
flet build apk       # Android
flet build macos     # macOS

After building, flet run works for Python-only changes. Rebuild when you change Dart code.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flet_circular_slider-0.2.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flet_circular_slider-0.2.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file flet_circular_slider-0.2.0.tar.gz.

File metadata

  • Download URL: flet_circular_slider-0.2.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Windows/11

File hashes

Hashes for flet_circular_slider-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6022dca18b553a8332c6c0faa7628e860328e088183d834582671c06ea3ed021
MD5 d014f62768112e18e031264d32d31dbf
BLAKE2b-256 be5ed08dea8a3f44b301444221e9dde652863d5ea9a58d1fefcdebb2d00d688c

See more details on using hashes here.

File details

Details for the file flet_circular_slider-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flet_circular_slider-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77cb9bea203f267913a929f49e5b5a7591c589ec9c7d5c6088a4ab253dec1e88
MD5 be191c5817cd697fcba65950b60362a3
BLAKE2b-256 cc7ba477fd87cd0a3d25bf79ee31cef3fc82bc3f5701641a79822252c374fc43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page