Skip to content

Preferences & Pickers

MiuixArrowPreference

A preference row with a trailing 10×16 right arrow icon (auto-flipped in RTL), reusing the base row's click/press semantics.

ParameterTypeDefaultDescription
titleStringrequiredRow title
titleColorMiuixBasicComponentColors?nullTitle color; falls back to MiuixBasicComponentDefaults.titleColor
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color; falls back to MiuixBasicComponentDefaults.summaryColor
startActionWidget?nullLeading content
endActionsList<Widget>?nullExtra content before the arrow
bottomActionWidget?nullBottom content below the main row
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding
onClickVoidCallback?nullTap callback; not clickable when null
holdDownStateboolfalseWhether forced into pressed state
enabledbooltrueWhether enabled

Example:

dart
MiuixArrowPreference(
  title: 'About',
  summary: 'Version, license and open source info',
  onClick: () {},
)

MiuixArrowPreferenceEndActionColors

Color configuration for the ArrowPreference trailing arrow. Switches between enabled and disabled colors based on enabled.

FieldTypeDescription
colorColorEnabled color
disabledColorColorDisabled color
MethodSignatureDescription
resolveColor resolve(bool enabled)Returns color when enabled is true, otherwise disabledColor

MiuixArrowPreferenceDefaults

Default values for ArrowPreference. Private constructor; provides only static methods.

MethodSignatureDescription
endActionColorsMiuixArrowPreferenceEndActionColors endActionColors(BuildContext context)Default colors for the trailing arrow: color is theme onSurfaceVariantActions, disabledColor is disabledOnSecondaryVariant

MiuixSwitchPreference

A preference row with a trailing MiuixSwitch; tapping the whole row toggles value and fires onChanged.

ParameterTypeDefaultDescription
valueboolrequiredCurrent switch state
onChangedValueChanged<bool>requiredState change callback
titleStringrequiredRow title
titleColorMiuixBasicComponentColors?nullTitle color; falls back to default
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color; falls back to default
startActionWidget?nullLeading content
endActionsList<Widget>?nullExtra content before the switch
bottomActionWidget?nullBottom content
switchColorsMiuixSwitchColors?nullSwitch colors; falls back to MiuixSwitchDefaults.switchColors
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding
holdDownStateboolfalseWhether forced into pressed state
enabledbooltrueWhether enabled

Example:

dart
MiuixSwitchPreference(
  title: 'Airplane mode',
  value: enabled,
  onChanged: (v) => setState(() => enabled = v),
)

MiuixCheckboxLocation

Enum of checkbox positions in MiuixCheckboxPreference. start/end are mirrored automatically under RTL.

ValueDescription
startLeading side (before title)
endTrailing side (after endActions)

MiuixCheckboxPreference

A preference row with a checkbox whose position is set by checkboxLocation; tapping the whole row toggles value and fires onChanged.

ParameterTypeDefaultDescription
titleStringrequiredRow title
valueboolrequiredCurrent checkbox state
onChangedValueChanged<bool>?requiredState change callback; non-interactive when null
titleColorMiuixBasicComponentColors?nullTitle color; falls back to default
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color; falls back to default
checkboxColorsMiuixCheckboxColors?nullCheckbox colors; falls back to MiuixCheckboxDefaults.checkboxColors
startActionWidget?nullLeading extra content (after checkbox, 5dp gap)
endActionsList<Widget>?nullTrailing extra content (before checkbox, 8dp gap)
checkboxLocationMiuixCheckboxLocationMiuixCheckboxLocation.startCheckbox position
bottomActionWidget?nullBottom content
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding
holdDownStateboolfalseWhether forced into pressed state
enabledbooltrueWhether enabled

Enum MiuixCheckboxLocation: start (leading, before title), end (trailing, after endActions).

Example:

dart
MiuixCheckboxPreference(
  title: 'Accept terms',
  value: agreed,
  onChanged: (v) => setState(() => agreed = v),
)

MiuixRadioButtonLocation

Enum of radio button positions in MiuixRadioButtonPreference. start/end are mirrored automatically under RTL.

ValueDescription
startLeading side (before title)
endTrailing side (after endActions)

MiuixRadioButtonPreference

A preference row with a radio button whose position is set by radioButtonLocation; when selected the title/summary color switches to primary, and tapping the row fires onClick with haptic feedback.

ParameterTypeDefaultDescription
titleStringrequiredRow title
selectedboolrequiredWhether in selected state
onClickVoidCallback?nullTap callback; not clickable when null
summaryString?nullRow summary
colorsMiuixRadioButtonPreferenceColors?nullTitle/summary colors; falls back to MiuixRadioButtonPreferenceDefaults.radioButtonPreferenceColors
radioButtonColorsMiuixRadioButtonColors?nullRadio button colors; falls back to MiuixRadioButtonDefaults.radioButtonColors
startActionWidget?nullLeading extra content (after radio button, 5dp gap)
endActionsList<Widget>?nullTrailing extra content (before radio button, 8dp gap)
radioButtonLocationMiuixRadioButtonLocationMiuixRadioButtonLocation.startRadio button position
bottomActionWidget?nullBottom content
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding
holdDownStateboolfalseWhether forced into pressed state
enabledbooltrueWhether enabled

Enum MiuixRadioButtonLocation: start (leading, before title), end (trailing, after endActions).

Example:

dart
MiuixRadioButtonPreference(
  title: 'Option A',
  selected: index == 0,
  onClick: () => setState(() => index = 0),
)

MiuixRadioButtonPreferenceColors

Color configuration for RadioButtonPreference title and summary. Switches between base and selected colors based on selected.

FieldTypeDescription
titleColorMiuixBasicComponentColorsUnselected title color
selectedTitleColorMiuixBasicComponentColorsSelected title color
summaryColorMiuixBasicComponentColorsUnselected summary color
selectedSummaryColorMiuixBasicComponentColorsSelected summary color
MethodSignatureDescription
resolveTitleColorMiuixBasicComponentColors resolveTitleColor(bool selected)Returns selectedTitleColor when selected is true, otherwise titleColor
resolveSummaryColorMiuixBasicComponentColors resolveSummaryColor(bool selected)Returns selectedSummaryColor when selected is true, otherwise summaryColor

MiuixRadioButtonPreferenceDefaults

Default values for RadioButtonPreference. Private constructor; provides only static methods.

MethodSignatureDescription
radioButtonPreferenceColorsMiuixRadioButtonPreferenceColors radioButtonPreferenceColors(BuildContext context)Default title/summary colors: unselected title is onBackground, unselected summary is onSurfaceVariantSummary, selected uses primary; disabled color is uniformly disabledOnSecondaryVariant

MiuixSliderPreference

A preference row with a MiuixSlider in the bottom area; the trailing area can show valueText, and a right arrow is appended when onClick is non-null. Asserts steps >= 0 and min < max.

ParameterTypeDefaultDescription
valuedoublerequiredCurrent slider value; clamped to min..max
onValueChangeValueChanged<double>requiredValue change callback
titleString?nullRow title
titleColorMiuixBasicComponentColors?nullTitle color; falls back to default
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color; falls back to default
startActionWidget?nullLeading content
valueTextString?nullCurrent value text in the trailing area
endActionsList<Widget>?nullExtra content after valueText
bottomActionWidget?nullExtra content above the slider
onClickVoidCallback?nullTap callback; appends a right arrow when non-null
holdDownStateboolfalseWhether forced into pressed state
enabledbooltrueWhether enabled
mindouble0.0Slider minimum
maxdouble1.0Slider maximum
stepsint0Discrete steps; 0 means continuous
onValueChangeFinishedVoidCallback?nullCallback when value change finishes
reverseDirectionboolfalseWhether reversed (increases right-to-left)
sliderHeightdoubleMiuixSliderDefaults.minHeight (28)Slider height
sliderColorsMiuixSliderColors?nullSlider colors; falls back to MiuixSliderDefaults.sliderColors
hapticEffectMiuixSliderHapticEffectMiuixSliderDefaults.defaultHapticEffect (edge)Haptic feedback type
showKeyPointsboolfalseWhether to show key points
keyPointsList<double>?nullCustom key points; derived from steps when null
magnetThresholddouble0.02Magnet threshold (0..1)
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding

Example:

dart
MiuixSliderPreference(
  title: 'Brightness',
  value: brightness,
  valueText: '${(brightness * 100).round()}%',
  onValueChange: (v) => setState(() => brightness = v),
)

MiuixRangeSliderPreference

A preference row with a MiuixRangeSlider in the bottom area; the trailing area can show valueText, and a right arrow is appended when onClick is non-null. Asserts steps >= 0 and min < max.

ParameterTypeDefaultDescription
startValuedoublerequiredStart value; clamped to min..max
endValuedoublerequiredEnd value; clamped to min..max
onValueChangeValueChanged<(double, double)>requiredValue change callback with (newStart, newEnd)
titleString?nullRow title
titleColorMiuixBasicComponentColors?nullTitle color
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color
startActionWidget?nullLeading content
valueTextString?nullCurrent value text in the trailing area
endActionsList<Widget>?nullExtra content in the trailing area
bottomActionWidget?nullExtra content above the slider
onClickVoidCallback?nullTap callback; appends a right arrow when non-null
holdDownStateboolfalseWhether forced into pressed state
enabledbooltrueWhether enabled
mindouble0.0Slider minimum
maxdouble1.0Slider maximum
stepsint0Discrete steps
onValueChangeFinishedVoidCallback?nullCallback when value change finishes
sliderHeightdoubleMiuixSliderDefaults.minHeight (28)Slider height
sliderColorsMiuixSliderColors?nullSlider colors
hapticEffectMiuixSliderHapticEffectMiuixSliderDefaults.defaultHapticEffect (edge)Haptic feedback type
showKeyPointsboolfalseWhether to show key points
keyPointsList<double>?nullCustom key points
magnetThresholddouble0.02Magnet threshold
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding

Example:

dart
MiuixRangeSliderPreference(
  title: 'Price range',
  startValue: lo,
  endValue: hi,
  onValueChange: (r) => setState(() { lo = r.$1; hi = r.$2; }),
)

MiuixOverlayDropdownPreference

A dropdown preference row rendered within the Scaffold; shows the selected value text and a dropdown arrow, tapping expands a dropdown popup (rendered in the root Scaffold). The default constructor takes items + selectedIndex.

ParameterTypeDefaultDescription
itemsList<String>requiredDropdown item texts
selectedIndexintrequiredCurrent selected index
titleStringrequiredRow title
titleColorMiuixBasicComponentColors?nullTitle color
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color
dropdownColorsMiuixDropdownColors?nullDropdown colors; falls back to MiuixDropdownDefaults.dropdownColors
startActionWidget?nullLeading content
bottomActionWidget?nullBottom content
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding
maxHeightdouble?nullMax popup height
enabledbooltrueWhether enabled
showValuebooltrueWhether to show the selected value text
renderInRootScaffoldbooltrueWhether to render the popup in the root Scaffold
collapseOnSelectionbool?trueWhether to collapse after selection (default ctor is true)
onExpandedChangeValueChanged<bool>?nullExpanded state change callback
onSelectedIndexChangeValueChanged<int>?nullSelected index change callback

Named constructors: .entry({required MiuixDropdownEntry entry, ...}) (single group) and .entries({required List<MiuixDropdownEntry> entries, ...}) (multi group); .entries defaults collapseOnSelection to null (auto by group count) and does not take onSelectedIndexChange.

Example:

dart
MiuixOverlayDropdownPreference(
  title: 'Language',
  items: const ['简体中文', 'English'],
  selectedIndex: langIndex,
  onSelectedIndexChange: (i) => setState(() => langIndex = i),
)

MiuixWindowDropdownPreference

A window-level dropdown preference row; behaves like MiuixOverlayDropdownPreference but the popup renders in the root Overlay, so there is no renderInRootScaffold parameter.

ParameterTypeDefaultDescription
itemsList<String>requiredDropdown item texts
selectedIndexintrequiredCurrent selected index
titleStringrequiredRow title
titleColorMiuixBasicComponentColors?nullTitle color
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color
dropdownColorsMiuixDropdownColors?nullDropdown colors; falls back to default
startActionWidget?nullLeading content
bottomActionWidget?nullBottom content
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding
maxHeightdouble?nullMax popup height
enabledbooltrueWhether enabled
showValuebooltrueWhether to show the selected value text
collapseOnSelectionbool?trueWhether to collapse after selection
onExpandedChangeValueChanged<bool>?nullExpanded state change callback
onSelectedIndexChangeValueChanged<int>?nullSelected index change callback

Named constructors: .entry (single group) and .entries (multi group, collapseOnSelection defaults to null).

Example:

dart
MiuixWindowDropdownPreference(
  title: 'Theme',
  items: const ['Light', 'Dark', 'System'],
  selectedIndex: themeIndex,
  onSelectedIndexChange: (i) => setState(() => themeIndex = i),
)

MiuixOverlaySpinnerPreference

A spinner (dropdown selection) preference row rendered within the Scaffold. Unlike Dropdown, items is a List<MiuixDropdownItem> (keeping icon/summary, etc.), and when dialogButtonString is non-null it uses dialog mode (otherwise popup mode). The default constructor takes items + selectedIndex.

ParameterTypeDefaultDescription
itemsList<MiuixDropdownItem>requiredDropdown items
selectedIndexintrequiredCurrent selected index
titleStringrequiredRow title
dialogButtonStringString?nullUses dialog mode when non-null; also the button text
titleColorMiuixBasicComponentColors?nullTitle color
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color
spinnerColorsMiuixDropdownColors?nullColors; when null, dialog uses dialogDropdownColors, popup uses dropdownColors
startActionWidget?nullLeading content
bottomActionWidget?nullBottom content
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding
maxHeightdouble?nullMax popup height
enabledbooltrueWhether enabled
showValuebooltrueWhether to show the selected value text
renderInRootScaffoldbooltrueWhether to render in the root Scaffold
collapseOnSelectionbool?nullWhether to collapse after selection
onExpandedChangeValueChanged<bool>?nullExpanded state change callback
onSelectedIndexChangeValueChanged<int>?nullSelected index change callback

Named constructors: .entry (single group, collapseOnSelection defaults to true) and .entries (multi group, defaults to null); neither takes onSelectedIndexChange.

Example:

dart
MiuixOverlaySpinnerPreference(
  title: 'Sort by',
  items: const [MiuixDropdownItem(text: 'Name'), MiuixDropdownItem(text: 'Date')],
  selectedIndex: sortIndex,
  onSelectedIndexChange: (i) => setState(() => sortIndex = i),
)

MiuixWindowSpinnerPreference

A window-level spinner preference row; behaves like MiuixOverlaySpinnerPreference but the popup renders in the root Overlay, so there is no renderInRootScaffold parameter.

ParameterTypeDefaultDescription
itemsList<MiuixDropdownItem>requiredDropdown items
selectedIndexintrequiredCurrent selected index
titleStringrequiredRow title
dialogButtonStringString?nullUses dialog mode when non-null; also the button text
titleColorMiuixBasicComponentColors?nullTitle color
summaryString?nullRow summary
summaryColorMiuixBasicComponentColors?nullSummary color
spinnerColorsMiuixDropdownColors?nullColors; falls back to defaults by mode
startActionWidget?nullLeading content
bottomActionWidget?nullBottom content
insideMarginEdgeInsetsGeometryMiuixBasicComponentDefaults.insideMarginInner padding
maxHeightdouble?nullMax popup height
enabledbooltrueWhether enabled
showValuebooltrueWhether to show the selected value text
collapseOnSelectionbool?nullWhether to collapse after selection
onExpandedChangeValueChanged<bool>?nullExpanded state change callback
onSelectedIndexChangeValueChanged<int>?nullSelected index change callback

Named constructors: .entry (single group, collapseOnSelection defaults to true) and .entries (multi group, defaults to null).

Example:

dart
MiuixWindowSpinnerPreference(
  title: 'Account',
  items: const [MiuixDropdownItem(text: 'Alice'), MiuixDropdownItem(text: 'Bob')],
  selectedIndex: 0,
  dialogButtonString: 'Cancel',
  onSelectedIndexChange: (i) {},
)

MiuixColorSpace

Enum of color spaces used by MiuixColorPicker.

ValueDescription
hsvClassic HSV
okhsvOkLab-based OkHSV, better perceptual uniformity
oklabOkLab (lightness + green-red axis + blue-yellow axis)
oklchOkLCH (lightness + chroma + hue)

MiuixColorPicker

A Miuix-style multi-color-space slider color picker; dispatches to a sub-picker based on colorSpace, with H/S/V (or the corresponding channels) plus an alpha slider.

ParameterTypeDefaultDescription
colorColorrequiredCurrent color
onColorChangedValueChanged<Color>requiredColor change callback
showPreviewbooltrueWhether to show the selected color preview bar
hapticEffectMiuixSliderHapticEffectMiuixSliderDefaults.defaultHapticEffect (edge)Slider haptic feedback type
colorSpaceMiuixColorSpaceMiuixColorSpace.hsvColor space to use

Enum MiuixColorSpace: hsv (classic HSV), okhsv (OkLab-based OkHSV, better perceptual uniformity), oklab (lightness + green-red axis + blue-yellow axis), oklch (lightness + chroma + hue).

Equivalent single-space widgets are also provided (same constructor params, no colorSpace): MiuixHsvColorPicker, MiuixOkHsvColorPicker, MiuixOkLabColorPicker, MiuixOkLchColorPicker.

Example:

dart
MiuixColorPicker(
  color: current,
  colorSpace: MiuixColorSpace.okhsv,
  onColorChanged: (c) => setState(() => current = c),
)

MiuixHsvColorPicker

Miuix color picker using the HSV color space. Parameters are the same as MiuixColorPicker, but without the colorSpace field; the HSV color space is fixed.

ParameterTypeDefaultDescription
colorColorrequiredCurrent color
onColorChangedValueChanged<Color>requiredColor change callback
showPreviewbooltrueWhether to show the selected color preview bar
hapticEffectMiuixSliderHapticEffectMiuixSliderDefaults.defaultHapticEffect (edge)Slider haptic feedback type

MiuixOkHsvColorPicker

Miuix color picker using the OkHSV color space. Parameters are the same as MiuixColorPicker, but without the colorSpace field; the OkHSV color space is fixed (OkLab-based, better perceptual uniformity).

ParameterTypeDefaultDescription
colorColorrequiredCurrent color
onColorChangedValueChanged<Color>requiredColor change callback
showPreviewbooltrueWhether to show the selected color preview bar
hapticEffectMiuixSliderHapticEffectMiuixSliderDefaults.defaultHapticEffect (edge)Slider haptic feedback type

MiuixOkLabColorPicker

Miuix color picker using the OkLab color space. Parameters are the same as MiuixColorPicker, but without the colorSpace field; the OkLab color space is fixed (lightness + green-red axis + blue-yellow axis).

ParameterTypeDefaultDescription
colorColorrequiredCurrent color
onColorChangedValueChanged<Color>requiredColor change callback
showPreviewbooltrueWhether to show the selected color preview bar
hapticEffectMiuixSliderHapticEffectMiuixSliderDefaults.defaultHapticEffect (edge)Slider haptic feedback type

MiuixOkLchColorPicker

Miuix color picker using the OkLch color space. Parameters are the same as MiuixColorPicker, but without the colorSpace field; the OkLch color space is fixed (lightness + chroma + hue).

ParameterTypeDefaultDescription
colorColorrequiredCurrent color
onColorChangedValueChanged<Color>requiredColor change callback
showPreviewbooltrueWhether to show the selected color preview bar
hapticEffectMiuixSliderHapticEffectMiuixSliderDefaults.defaultHapticEffect (edge)Slider haptic feedback type

MiuixColorPalette

A Miuix-style HSV grid palette; color is externally controlled, and pressing/dragging in the grid or adjusting alpha returns a new color via onColorChanged. Defaults to 7 rows, 12 hue columns plus a gray column. Asserts rows > 0, hueColumns > 0, cornerRadius >= 0, indicatorRadius >= 0.

ParameterTypeDefaultDescription
colorColorrequiredCurrent color
onColorChangedValueChanged<Color>requiredCalled on selection or alpha change
rowsintMiuixColorPaletteDefaults.rows (7)Number of color grid rows
hueColumnsintMiuixColorPaletteDefaults.hueColumns (12)Number of hue columns
includeGrayColumnboolMiuixColorPaletteDefaults.includeGrayColumn (true)Whether to append a gray column after the hue columns
showPreviewboolMiuixColorPaletteDefaults.showPreview (true)Whether to show the top color preview
cornerRadiusdoubleMiuixColorPaletteDefaults.cornerRadius (16)Grid squircle corner radius
indicatorRadiusdoubleMiuixColorPaletteDefaults.indicatorRadius (10)Selection indicator ring radius

Example:

dart
MiuixColorPalette(
  color: current,
  onColorChanged: (c) => setState(() => current = c),
)

MiuixColorPaletteDefaults

Default sizes and grid parameters for MiuixColorPalette. Private constructor; contains only static constants.

ConstantValueDescription
rows7Default number of color rows
hueColumns12Default number of hue columns
includeGrayColumntrueWhether to show the gray column by default
showPreviewtrueWhether to show the color preview by default
cornerRadius16Default corner radius of the palette grid
indicatorRadius10Default radius of the selection indicator
controlHeight26Height of the color preview and alpha slider
paletteHeight180Height of the palette grid
spacing12Vertical spacing between sub-items

Released under the Apache-2.0 License.