Skip to content

Inputs

MiuixTextField

A Miuix-style text field with a floating label, an animated squircle border on focus, and leading/trailing icons.

ParameterTypeDefaultDescription
controllerTextEditingController?nullText editing controller; created internally if omitted
focusNodeFocusNode?nullFocus node; created internally if omitted
onChangedValueChanged<String>?nullCalled when the text changes
labelString''Label text (floating label)
useLabelAsPlaceholderboolfalseTreat the label as a placeholder (hidden once text is entered instead of floating)
enabledbooltrueWhether the field is enabled
readOnlyboolfalseWhether the field is read-only
textStyleTextStyle?nullText style; defaults to the theme's main style
leadingIconWidget?nullLeading icon
trailingIconWidget?nullTrailing icon
singleLineboolfalseForce a single line
maxLinesint?nullMaximum number of lines
minLinesint?nullMinimum number of lines
colorsMiuixTextFieldColors?nullColor configuration; defaults to the theme
cornerRadiusdouble16Corner radius
insideMarginEdgeInsetsEdgeInsets.all(16)Inner padding (per side)
keyboardTypeTextInputType?nullKeyboard type
textInputActionTextInputAction?nullKeyboard action button type
textCapitalizationTextCapitalizationTextCapitalization.noneText capitalization policy
onSubmittedValueChanged<String>?nullCalled when the keyboard action is triggered
obscureTextboolfalseObscure the input (password)
cursorColorColor?nullCursor color; defaults to the focused border color

Example:

dart
MiuixTextField(
  label: 'Username',
  onChanged: (v) {},
)

MiuixTextFieldColors

Color configuration for the text field. All fields are required.

ParameterTypeDefaultDescription
backgroundColorColorrequiredBackground color; resolves to theme secondaryContainer in textFieldColors
labelColorColorrequiredLabel color; resolves to theme onSecondaryContainer in textFieldColors
borderColorColorrequiredFocused border color; resolves to theme primary in textFieldColors

MiuixTextFieldDefaults

Default values for the text field. Private constructor; only static fields/methods.

ConstantValueDescription
cornerRadius16Default corner radius
insideMarginEdgeInsets.all(16)Default inner padding (horizontal/vertical)
borderWidth2Focused border width
labelFontSizeFloating10Label font size when floating
labelFontSizeNormal17Label font size when normal
Static MethodReturnsDescription
textFieldColors(BuildContext context)MiuixTextFieldColorsBuilds default color configuration from the current theme

MiuixSwitch

A Miuix-style switch with a 49x28 capsule track and a circular thumb, toggled by tap or horizontal drag.

ParameterTypeDefaultDescription
valueboolrequiredWhether the switch is on
onChangedValueChanged<bool>?requiredToggle callback; interaction is disabled when null
enabledbooltrueWhether the switch is enabled
colorsMiuixSwitchColors?nullColor configuration; defaults to the theme

Example:

dart
MiuixSwitch(
  value: isOn,
  onChanged: (v) => setState(() => isOn = v),
)

MiuixSwitchColors

Color configuration for the switch. All fields are required.

ParameterTypeDefaultDescription
checkedThumbColorColorrequiredThumb color when checked; resolves to theme onPrimary in switchColors
uncheckedThumbColorColorrequiredThumb color when unchecked; resolves to theme onSecondary
disabledCheckedThumbColorColorrequiredThumb color when disabled and checked; resolves to disabledOnPrimary
disabledUncheckedThumbColorColorrequiredThumb color when disabled and unchecked; resolves to disabledOnSecondary
checkedTrackColorColorrequiredTrack color when checked; resolves to theme primary
uncheckedTrackColorColorrequiredTrack color when unchecked; resolves to theme secondary
disabledCheckedTrackColorColorrequiredTrack color when disabled and checked; resolves to disabledPrimary
disabledUncheckedTrackColorColorrequiredTrack color when disabled and unchecked; resolves to disabledSecondary

MiuixSwitchDefaults

Default values for the switch. Private constructor; only static fields/methods.

ConstantValueDescription
trackWidth49Track width
trackHeight28Track height
thumbSize20Thumb diameter
thumbOffsetOff4Thumb offset when off
thumbOffsetOn25Thumb offset when on
thumbScaleActive1.127Thumb scale factor when pressed/hovered/dragged
Static MethodReturnsDescription
switchColors(BuildContext context)MiuixSwitchColorsBuilds default color configuration from the current theme

MiuixCheckbox

A Miuix-style checkbox with a 26dp round background and a trim-animated checkmark, supporting on/off/indeterminate states.

ParameterTypeDefaultDescription
valuebool?requiredtrue = on, false = off, null = indeterminate
onChangedValueChanged<bool?>?nullState change callback; interaction is disabled when null
enabledbooltrueWhether the checkbox is enabled
colorsMiuixCheckboxColors?nullColor configuration; defaults to the theme

Example:

dart
MiuixCheckbox(
  value: checked,
  onChanged: (v) => setState(() => checked = v ?? false),
)

MiuixCheckboxColors

Color configuration for the checkbox. All fields are required.

ParameterTypeDefaultDescription
checkedForegroundColorColorrequiredForeground (checkmark) color when checked; resolves to onPrimary in checkboxColors
uncheckedForegroundColorColorrequiredForeground color when unchecked; resolves to secondary
disabledCheckedForegroundColorColorrequiredForeground color when disabled and checked; resolves to disabledOnPrimary
disabledUncheckedForegroundColorColorrequiredForeground color when disabled and unchecked; resolves to disabledOnPrimary
checkedBackgroundColorColorrequiredBackground color when checked; resolves to primary
uncheckedBackgroundColorColorrequiredBackground color when unchecked; resolves to secondary
disabledCheckedBackgroundColorColorrequiredBackground color when disabled and checked; resolves to disabledPrimary
disabledUncheckedBackgroundColorColorrequiredBackground color when disabled and unchecked; resolves to disabledSecondary

MiuixCheckboxDefaults

Default values for the checkbox. Private constructor; only static fields/methods.

ConstantValueDescription
size26Checkbox size (width = height)
Static MethodReturnsDescription
checkboxColors(BuildContext context)MiuixCheckboxColorsBuilds default color configuration from the current theme

MiuixRadioButton

A Miuix-style radio button, 26dp, showing a trim-animated checkmark when selected (no background circle).

ParameterTypeDefaultDescription
selectedboolrequiredWhether it is selected
onChangedValueChanged<bool>?nullSelection callback (fires only on unselected-to-selected); interaction is disabled when null
enabledbooltrueWhether the radio button is enabled
colorsMiuixRadioButtonColors?nullColor configuration; defaults to the theme

Example:

dart
MiuixRadioButton(
  selected: value == 0,
  onChanged: (_) => setState(() => value = 0),
)

MiuixRadioButtonColors

Color configuration for the radio button. All fields are required.

ParameterTypeDefaultDescription
selectedColorColorrequiredColor when selected (checkmark and stroke); resolves to primary in radioButtonColors
disabledSelectedColorColorrequiredColor when disabled and selected; resolves to disabledPrimary

MiuixRadioButtonDefaults

Default values for the radio button. Private constructor; only static fields/methods.

ConstantValueDescription
size26Radio button size (width = height)
Static MethodReturnsDescription
radioButtonColors(BuildContext context)MiuixRadioButtonColorsBuilds default color configuration from the current theme

MiuixSlider

A Miuix-style horizontal slider supporting steps, key points, magnetic snapping, haptic feedback, reversed direction, and a disabled state.

ParameterTypeDefaultDescription
valuedoublerequiredCurrent value
onValueChangedValueChanged<double>?requiredValue change callback; interaction is disabled when null
enabledbooltrueWhether the slider is enabled
mindouble0.0Minimum value
maxdouble1.0Maximum value
stepsint0Number of steps (0 for continuous)
onValueChangeFinishedVoidCallback?nullCalled when the drag ends
reverseDirectionboolfalseWhether to reverse the direction
heightdoubleMiuixSliderDefaults.minHeight (28)Track height
colorsMiuixSliderColors?nullColor configuration; defaults to the theme
hapticEffectMiuixSliderHapticEffectMiuixSliderHapticEffect.edgeHaptic feedback type
showKeyPointsboolfalseWhether to show key points
keyPointsList<double>?nullCustom list of key point values
magnetThresholddouble0.02Magnetic snapping threshold

Example:

dart
MiuixSlider(
  value: progress,
  onValueChanged: (v) => setState(() => progress = v),
)

MiuixSliderColors

Color configuration for the slider. All fields are required. MiuixVerticalSlider and MiuixRangeSlider reuse this configuration.

ParameterTypeDefaultDescription
foregroundColorColorrequiredForeground color (selected segment); resolves to theme primary in sliderColors
disabledForegroundColorColorrequiredForeground color when disabled; resolves to disabledPrimarySlider
backgroundColorColorrequiredTrack background color; resolves to sliderBackground
disabledBackgroundColorColorrequiredTrack background color when disabled; resolves to disabledSecondary
thumbColorColorrequiredThumb color; resolves to onPrimary
disabledThumbColorColorrequiredThumb color when disabled; resolves to disabledOnPrimary
keyPointColorColorrequiredKey point color; resolves to sliderKeyPoint
keyPointForegroundColorColorrequiredSelected key point color; resolves to sliderKeyPointForeground

MiuixSliderDefaults

Default values for the slider. Private constructor; only static fields/methods.

ConstantValueDescription
minHeight28Minimum height (horizontal Slider/RangeSlider) or width (vertical)
keyPointRadius3.855Key point radius
defaultHapticEffectMiuixSliderHapticEffect.edgeDefault haptic feedback type
thumbScaleActive1.127Thumb scale factor when pressed/dragged/hovered
thumbRadiusRatio0.72Ratio of actual thumb radius to track radius
dragOverlayAlpha0.044Background dimming alpha while dragging
Static MethodReturnsDescription
sliderColors(BuildContext context)MiuixSliderColorsBuilds default color configuration from the current theme

MiuixVerticalSlider

A Miuix-style vertical slider; parameters largely match MiuixSlider but oriented vertically.

ParameterTypeDefaultDescription
valuedoublerequiredCurrent value
onValueChangedValueChanged<double>?requiredValue change callback; interaction is disabled when null
enabledbooltrueWhether the slider is enabled
mindouble0.0Minimum value
maxdouble1.0Maximum value
stepsint0Number of steps (0 for continuous)
onValueChangeFinishedVoidCallback?nullCalled when the drag ends
reverseDirectionboolfalseWhether to reverse the direction
widthdoubleMiuixSliderDefaults.minHeight (28)Track width
colorsMiuixSliderColors?nullColor configuration; defaults to the theme
effectboolfalseReserved parameter (no visual effect enabled upstream yet), kept for API parity
hapticEffectMiuixSliderHapticEffectMiuixSliderHapticEffect.edgeHaptic feedback type
showKeyPointsboolfalseWhether to show key points
keyPointsList<double>?nullCustom list of key point values
magnetThresholddouble0.02Magnetic snapping threshold

Example:

dart
SizedBox(
  height: 200,
  child: MiuixVerticalSlider(
    value: volume,
    onValueChanged: (v) => setState(() => volume = v),
  ),
)

MiuixRangeSlider

A Miuix-style range slider with two thumbs controlling the start and end values.

ParameterTypeDefaultDescription
startValuedoublerequiredStart value
endValuedoublerequiredEnd value
onValueChangedValueChanged<(double, double)>?requiredValue change callback (start, end); interaction is disabled when null
enabledbooltrueWhether the slider is enabled
mindouble0.0Minimum value
maxdouble1.0Maximum value
stepsint0Number of steps (0 for continuous)
onValueChangeFinishedVoidCallback?nullCalled when the drag ends
heightdoubleMiuixSliderDefaults.minHeight (28)Track height
colorsMiuixSliderColors?nullColor configuration; defaults to the theme
hapticEffectMiuixSliderHapticEffectMiuixSliderHapticEffect.edgeHaptic feedback type
showKeyPointsboolfalseWhether to show key points
keyPointsList<double>?nullCustom list of key point values
magnetThresholddouble0.02Magnetic snapping threshold

Example:

dart
MiuixRangeSlider(
  startValue: lo,
  endValue: hi,
  onValueChanged: (r) => setState(() { lo = r.$1; hi = r.$2; }),
)

MiuixSliderHapticEffect (enum)

Slider haptic feedback type.

ValueDescription
noneNo haptic feedback
edgeTriggered at the 0% and 100% endpoints
stepTriggered at step points

MiuixSearchBar

A Miuix-style search bar container. When expanded, it shows the trailing action and result content and intercepts the system back gesture to collapse first.

ParameterTypeDefaultDescription
inputFieldWidgetrequiredThe input field widget (typically MiuixInputField)
onExpandedChangeValueChanged<bool>requiredCalled when the expanded state changes
contentWidgetrequiredResult content shown when expanded
insideMarginEdgeInsetsEdgeInsets.symmetric(horizontal: 12)Padding around the input field
expandedboolfalseWhether the bar is expanded
outsideEndActionWidget?nullAction widget shown at the trailing edge when expanded

Example:

dart
MiuixSearchBar(
  expanded: expanded,
  onExpandedChange: (v) => setState(() => expanded = v),
  inputField: MiuixInputField(
    query: query,
    onQueryChange: (v) => setState(() => query = v),
    onSearch: (v) {},
    expanded: expanded,
    onExpandedChange: (v) => setState(() => expanded = v),
  ),
  content: const SizedBox(),
)

MiuixSearchBarDefaults

Default values for the search bar. Private constructor; only static fields/methods.

ConstantValueDescription
insideMarginEdgeInsets.symmetric(horizontal: 12)Padding around the input field
inputFieldMinHeight45Minimum input field height
inputFieldFontSize17Input field font size
leadingIconStartPadding16Leading icon start padding
leadingIconEndPadding8Leading icon end padding
trailingIconStartPadding8Trailing icon start padding
trailingIconEndPadding16Trailing icon end padding
visibilityDurationDuration(milliseconds: 275)Expand/collapse animation duration
textFadeDurationDuration(milliseconds: 150)Text fade in/out duration

MiuixInputField

A Miuix search input field, used with MiuixSearchBar, providing a search icon, a clear button, and a placeholder label.

ParameterTypeDefaultDescription
queryStringrequiredCurrent query text
onQueryChangeValueChanged<String>requiredCalled when the query text changes
onSearchValueChanged<String>requiredCalled when the search is submitted
expandedboolrequiredWhether it is expanded (focused)
onExpandedChangeValueChanged<bool>requiredCalled when the expanded state changes
labelString''Placeholder label text
enabledbooltrueWhether the field is enabled
textStyleTextStyle?nullText style
colorColor?nullBackground color; defaults to the theme
leadingIconWidget?nullLeading icon; defaults to a search icon
trailingIconWidget?nullTrailing icon; uses a fading default clear button when null
focusNodeFocusNode?nullFocus node; created internally if omitted

Example:

dart
MiuixInputField(
  query: query,
  onQueryChange: (v) => setState(() => query = v),
  onSearch: (v) {},
  expanded: expanded,
  onExpandedChange: (v) => setState(() => expanded = v),
  label: 'Search',
)

MiuixNumberPicker

A Miuix-style vertical number picker; the center item is selected while items farther from the center fade and shrink, with wrap-around and inertial snapping.

ParameterTypeDefaultDescription
valueintrequiredCurrent value
onValueChangedValueChanged<int>?requiredValue change callback; interaction is disabled when null
enabledbooltrueWhether the picker is enabled
minint0Minimum value
maxint10Maximum value
labelString Function(int)?nullMaps a value to display text; defaults to value.toString()
visibleItemCountint5Number of visible items (must be odd and >= 3)
wrapAroundboolfalseWhether scrolling wraps around
colorsMiuixNumberPickerColors?nullColor configuration; defaults to the theme
textStyleTextStyle?nullText style; defaults to the theme's title1 style
itemHeightdoubleMiuixNumberPickerDefaults.itemHeight (45)Height of each item

Example:

dart
MiuixNumberPicker(
  value: hour,
  min: 0,
  max: 23,
  onValueChanged: (v) => setState(() => hour = v),
)

MiuixNumberPickerColors

Color configuration for the number picker. All fields are required.

ParameterTypeDefaultDescription
selectedTextColorColorrequiredText color of the selected item; resolves to theme onSurface in colors
unselectedTextColorColorrequiredText color of unselected items; resolves to onSurfaceSecondary
disabledSelectedTextColorColorrequiredText color of the selected item when disabled; resolves to disabledOnSecondary
disabledUnselectedTextColorColorrequiredText color of unselected items when disabled; resolves to disabledOnSecondary

MiuixNumberPickerDefaults

Default values for the number picker. Private constructor; only static fields/methods.

ConstantValueDescription
itemHeight45Height of each item
Static MethodReturnsDescription
colors(BuildContext context)MiuixNumberPickerColorsBuilds default color configuration from the current theme

Released under the Apache-2.0 License.