MultipleChoiceBlockPicker
A color picker that lets users choose multiple colors from a grid of available colors.

Inherits: LayoutControl
Properties
available_colors- A list of available colors to pick from.colors- The currently selected colors.
Events
on_colors_change- Called when the picker colors are changed.
Example
import flet as ft
from flet_color_pickers import MultipleChoiceBlockPicker
def main(page: ft.Page):
page.title = "MultipleChoiceBlockPicker"
page.padding = 20
def on_colors_change(e: ft.ControlEvent):
print(f"colors: {e.data}")
dialog_picker = MultipleChoiceBlockPicker(
colors=["#03a9f4", "#4caf50"],
available_colors=[
"#f44336",
"#e91e63",
"#9c27b0",
"#3f51b5",
"#2196f3",
"#03a9f4",
"#009688",
"#4caf50",
"#ff9800",
"#795548",
],
on_colors_change=on_colors_change,
)
dialog = ft.AlertDialog(
modal=True,
title=ft.Text("Pick colors"),
content=dialog_picker,
actions=[
ft.TextButton("Close", on_click=lambda e: page.pop_dialog()),
],
)
page.add(
ft.SafeArea(
content=ft.IconButton(
icon=ft.Icons.BRUSH,
on_click=lambda e: page.show_dialog(dialog),
)
),
)
if __name__ == "__main__":
ft.run(main)
Properties
available_colorsclass-attributeinstance-attribute
available_colors: Optional[list[ColorValue]] = NoneA list of available colors to pick from.
colorsclass-attributeinstance-attribute
colors: Optional[list[ColorValue]] = NoneThe currently selected colors.
Events
on_colors_changeclass-attributeinstance-attribute
on_colors_change: Optional[ControlEventHandler[MultipleChoiceBlockPicker]] = NoneCalled when the picker colors are changed.
The data property of the event handler argument contains the list of color values as hex strings.