singleV2 static method

Future<SelectData?> singleV2({
  1. List<SelectData>? data,
  2. String? selectedId,
  3. required dynamic title,
  4. required dynamic context,
  5. SelectStyle? style,
  6. bool? withSearch = false,
  7. bool onlySelect = false,
  8. double? fontSize,
  9. bool isFull = false,
  10. bool fullScreen = true,
})

Implementation

static Future<SelectData?> singleV2({List<SelectData>? data, String? selectedId, required title, required context, SelectStyle? style, bool? withSearch = false, bool onlySelect = false, double? fontSize, bool isFull = false, bool fullScreen = true}) async {
  style ??= SelectStyle();
  final FocusScopeNode currentScope = FocusScope.of(context);
  if (!currentScope.hasPrimaryFocus && currentScope.hasFocus) {
    FocusManager.instance.primaryFocus!.unfocus();
  }
  await Future.delayed(Duration.zero, () async {
    return showModalBottomSheet<void>(
      isScrollControlled: true,
      backgroundColor: Colors.transparent,
      context: context,
      builder: (BuildContext context) {
        if (_selectStates.context != context) {
          _selectStates.offset = 0;
        }
        _selectStates.context = context;
        return SelectBaseV2(
          fontSize: fontSize,
          withSearch: withSearch,
          data: data ?? [],
          selectedid: selectedId,
          title: title,
          style: style!,
          isFull: isFull,
          onlySelect: onlySelect,
        );
      },
    );
  });
  return _selectedData;
}