showSparkSingePicker<T> function
Future<T?>
showSparkSingePicker<T>({
- required BuildContext context,
- required List<
SparkPickerData< options,T> > - double itemHeight = 40,
- SparkPickerBuilder? itemBuilder,
- bool showBar = true,
- String cancelText = '取消',
- String confirmText = '确定',
- TextStyle? cancelStyle,
- TextStyle? confirmStyle,
- double height = 300,
- SparkPickerTitleBarBuilder? barBuilder,
- T? defaultValue,
Implementation
Future<T?> showSparkSingePicker<T>({
required BuildContext context,
required List<SparkPickerData<T>> options,
double itemHeight = 40,
SparkPickerBuilder? itemBuilder,
bool showBar = true,
String cancelText = '取消',
String confirmText = '确定',
TextStyle? cancelStyle,
TextStyle? confirmStyle,
double height = 300,
SparkPickerTitleBarBuilder? barBuilder,
T? defaultValue,
}) {
return showSparkModalSheet<T>(
context: context,
shape: _defaultPickerShape,
builder: (BuildContext _ctx) {
return _SparkMultiplePicker<T>(
options: {_sparkPickerTag: options},
itemHeight: itemHeight,
itemBuilder: itemBuilder,
showBar: showBar,
cancelStyle: cancelStyle,
cancelText: cancelText,
confirmStyle: confirmStyle,
confirmText: confirmText,
height: height,
barBuilder: barBuilder,
defaultValue:
defaultValue != null ? {_sparkPickerTag: defaultValue} : null,
onConfirm: (_result) {
Navigator.of(_ctx).pop(_result[_sparkPickerTag]);
},
onCancel: () {
Navigator.of(_ctx).pop();
},
);
},
);
}