Picker class
Picker
Constructors
-
Picker({required PickerAdapter adapter, List<
PickerDelimiter> ? delimiter, List<int> ? selecteds, double height = 150.0, double itemExtent = 28.0, EdgeInsetsGeometry? columnPadding, TextStyle? textStyle, TextStyle? cancelTextStyle, TextStyle? confirmTextStyle, TextStyle? selectedTextStyle, IconThemeData? selectedIconTheme, TextAlign textAlign = TextAlign.start, TextScaler? textScaler, Widget? title, Widget? cancel, Widget? confirm, String? cancelText, String? confirmText, Color? backgroundColor, Color? containerColor, Color? headerColor, WidgetBuilder? builderHeader, bool changeToFirst = false, bool hideHeader = false, bool looping = false, bool reversedOrder = false, Decoration? headerDecoration, List<int> ? columnFlex, int smooth = 0, double magnification = 1.0, double diameterRatio = 1.1, double squeeze = 1.45, Widget selectionOverlay = const CupertinoPickerDefaultSelectionOverlay(), PickerItemBuilder? onBuilderItem, VoidCallback? onCancel, PickerSelectedCallback? onSelect, PickerConfirmBeforeCallback? onConfirmBefore, PickerConfirmCallback? onConfirm, bool printDebug = false})
Properties
- adapter ↔ PickerAdapter
-
Picker adapter, Used to provide data and generate widgets
getter/setter pair
- backgroundColor → Color?
-
final
- builderHeader → WidgetBuilder?
-
Generate a custom header, hideHeader = true
final
- cancel → Widget?
-
final
- cancelText → String?
-
final
- cancelTextStyle → TextStyle?
-
final
- changeToFirst → bool
-
When the previous level selection changes, scroll the child to the first item.
final
-
columnFlex
→ List<
int> ? -
Specify flex for each column
final
- columnPadding → EdgeInsetsGeometry?
-
final
- confirm → Widget?
-
final
- confirmText → String?
-
final
- confirmTextStyle → TextStyle?
-
final
- containerColor → Color?
-
final
-
delimiter
→ List<
PickerDelimiter> ? -
insert separator before picker columns
final
- diameterRatio → double
-
final
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- headerColor → Color?
-
final
- headerDecoration → Decoration?
-
final
- height → double
-
final
- hideHeader → bool
-
Hide head
final
- itemExtent → double
-
Height of list item
final
- looping → bool
-
List item loop
final
- magnification → double
-
final
- onBuilderItem → PickerItemBuilder?
-
Generate a custom item widget, If 'null' is returned, the default builder is used
final
- onCancel → VoidCallback?
-
final
- onConfirm → PickerConfirmCallback?
-
final
- onConfirmBefore → PickerConfirmBeforeCallback?
-
final
- onSelect → PickerSelectedCallback?
-
final
- printDebug → bool
-
final
- reversedOrder → bool
-
Show pickers in reversed order
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedIconTheme → IconThemeData?
-
final
-
selecteds
↔ List<
int> -
Index of currently selected items
getter/setter pair
- selectedTextStyle → TextStyle?
-
final
- selectionOverlay → Widget
-
A widget overlaid on the picker to highlight the currently selected entry.
final
- smooth → int
-
Delay generation for smoother animation, This is the number of milliseconds to wait. It is recommended to > = 200
final
- squeeze → double
-
final
- state → PickerWidgetState?
-
no setter
- textAlign → TextAlign
-
final
- textScaler → TextScaler?
-
Text scaling factor
final
- textStyle → TextStyle?
-
final
- title → Widget?
-
final
- widget → Widget?
-
no setter
Methods
-
doCancel(
BuildContext context) → void - 取消
-
doConfirm(
BuildContext context) → void - 确定
-
getSelectedValues(
) → List - 获取当前选择的值 Get the value of the current selection
-
makePicker(
[ThemeData? themeData, bool isModal = false, Key? key]) → Widget - 生成picker控件
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
show(
ScaffoldState state, {ThemeData? themeData, Color? backgroundColor, PickerWidgetBuilder? builder}) → void - show picker bottom sheet
-
showBottomSheet(
BuildContext context, {ThemeData? themeData, Color? backgroundColor, PickerWidgetBuilder? builder}) → void - show picker bottom sheet
-
showDialog(
BuildContext context, {bool barrierDismissible = true, Color? backgroundColor, PickerWidgetBuilder? builder, Key? key}) → Future< List< int> ?> - show dialog picker
-
showModal<
T> (BuildContext context, {ThemeData? themeData, bool isScrollControlled = false, Color? backgroundColor, PickerWidgetBuilder? builder}) → Future< T?> - Display modal picker
-
toString(
) → String -
A string representation of this object.
inherited
-
updateColumn(
int index, [bool all = false]) → void - 弹制更新指定列的内容 当 onSelect 事件中,修改了当前列前面的列的内容时,可以调用此方法来更新显示
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultTextSize → const double