showPicker static method

Future<CityResult> showPicker(
  1. BuildContext context, {
  2. List? datas,
  3. TopMenuStyle? topMenuStyle,
  4. TextStyle? textStyle,
})

datas 自定义的json数据 topMenutyle 自定义顶部按钮样式等

Implementation

static Future<CityResult> showPicker(BuildContext context, {
  List? datas,
  TopMenuStyle? topMenuStyle,
  TextStyle? textStyle,
}) {
  Completer<CityResult> completer = Completer();
  showModalBottomSheet(
    context: context,
    isScrollControlled: true,
    builder: (ctx) {
      return CityPickerView(
        key: const Key('pickerkey'),
        params: datas,
        listTextStyle: textStyle,
        topMenuStyle: topMenuStyle,
        onResult: (res) {
          completer.complete(res);
        },
      );
    },
  );
  return completer.future;
}