pubspec.yaml
city_pickers插件地址
自己用的GetBuilder页面模板
cupertino_icons: ^1.0.8
# 省市区城市选择
city_pickers: ^1.3.0
编辑地址页面:controller
class AddressEditController extends GetxController {
AddressEditController();
Future<Result?> getResult (dynamic context) async {
// 省市区3级联动:底部弹窗
Result? result = await CityPickers.showCityPicker(
context: context,
);
print('result $result');
// 省市区3级联动:整页弹窗
// Result? result = await CityPickers.showFullPageCityPicker(
// context: context,
// );
// 索引A-Z:城市选择
// Result? result = await CityPickers.showCitiesSelector(
// context: context,
// );
return result;
}
...
...
}
编辑地址页面:view
TDButton(
text: '省市区选择',
size: TDButtonSize.large,
type: TDButtonType.fill,
theme: TDButtonTheme.primary,
isBlock: true,
onTap: (){
// 弹出地区选择
controller.getResult(context);
},
),