MaterialPicker
A material palette picker for selecting primary and shade colors, with optional shade labels.

Inherits: LayoutControl
Properties
color- The currently selected color.enable_label- Whether to show color shade labels.portrait_only- Whether to force portrait layout.
Events
on_color_change- Called when the picker color is changed.on_primary_change- Called when the primary color is changed.
Example
import flet as ft
from flet_color_pickers import MaterialPicker
def main(page: ft.Page):
page.title = "MaterialPicker"
page.padding = 20
def on_color_change(e: ft.ControlEvent):
print(f"color: {e.data}")
def on_primary_change(e: ft.ControlEvent):
print(f"primary: {e.data}")
picker = MaterialPicker(
color="#ff9800",
on_color_change=on_color_change,
on_primary_change=on_primary_change,
)
page.add(ft.SafeArea(content=picker))
if __name__ == "__main__":
ft.run(main)
Properties
colorclass-attributeinstance-attribute
color: Optional[ColorValue] = NoneThe currently selected color.
enable_labelclass-attributeinstance-attribute
enable_label: bool = FalseWhether to show color shade labels.
portrait_onlyclass-attributeinstance-attribute
portrait_only: bool = FalseWhether to force portrait layout.
Events
on_color_changeclass-attributeinstance-attribute
on_color_change: Optional[ControlEventHandler[MaterialPicker]] = NoneCalled when the picker color is changed.
The data property of the event handler argument contains the color value as a hex string.
on_primary_changeclass-attributeinstance-attribute
on_primary_change: Optional[ControlEventHandler[MaterialPicker]] = NoneCalled when the primary color is changed.
The data property of the event handler argument contains the color value as a hex string.