RatingBar
A Fluent rating bar: a row of stars to show or pick a rating.
Example:
fluent.RatingBar(value=3)
fluent.RatingBar(value=4.5, read_only=True)

Inherits: LayoutControl
Properties
autofocus- Whether this rating bar should be focused on initial display.color- The color of rated stars.icon_size- The size of each star.max- The number of stars.read_only- Whether the rating is only shown and can't be changed.spacing- The space between stars.unrated_color- The color of unrated stars.value- The rating, from0tomax.
Events
on_change- Called when the user changes the rating.
Example
Fluent RatingBar
import flet_fluent_ui as fluent
import flet as ft
def main(page: ft.Page):
page.title = "Fluent RatingBar"
def handle_change(e: ft.Event[fluent.RatingBar]):
status.value = f"You rated it {e.control.value:g} stars"
status = ft.Text("Rate this app")
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Row(
controls=[
ft.Text("Average"),
fluent.RatingBar(value=4.3, read_only=True, icon_size=16),
ft.Text("4.3"),
],
),
fluent.RatingBar(key="rating", on_change=handle_change),
status,
],
)
)
)
if __name__ == "__main__":
ft.run(main)

Properties
autofocusclass-attributeinstance-attribute
autofocus: bool = FalseWhether this rating bar should be focused on initial display.
colorclass-attributeinstance-attribute
color: ColorValue | None = NoneThe color of rated stars.
If None, the accent color of the theme is used.
read_onlyclass-attributeinstance-attribute
read_only: bool = FalseWhether the rating is only shown and can't be changed.
unrated_colorclass-attributeinstance-attribute
unrated_color: ColorValue | None = NoneThe color of unrated stars.
Events
on_changeclass-attributeinstance-attribute
on_change: ControlEventHandler[RatingBar] | None = NoneCalled when the user changes the rating.
The data property of the event handler argument
contains the new rating.