{"id":32290645,"url":"https://github.com/xiaomsh/fluttercitypicker","last_synced_at":"2026-01-11T13:38:14.364Z","repository":{"id":49367712,"uuid":"346597314","full_name":"xiaomsh/FlutterCityPicker","owner":"xiaomsh","description":":fire::fire::fire::+1: 城市选择，地址选择，实时请求数据，多项自定义配置，仿京东样式","archived":false,"fork":false,"pushed_at":"2025-02-11T03:47:50.000Z","size":16405,"stargazers_count":35,"open_issues_count":2,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-23T02:54:26.167Z","etag":null,"topics":["address","city","citypicker","picker"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiaomsh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-11T06:10:53.000Z","updated_at":"2025-09-09T16:59:14.000Z","dependencies_parsed_at":"2023-12-08T02:30:28.910Z","dependency_job_id":"3e20fa51-d42a-498a-9695-50deeb9aa72e","html_url":"https://github.com/xiaomsh/FlutterCityPicker","commit_stats":null,"previous_names":["xiaomsh/fluttercitypicker","wenchaosong/fluttercitypicker"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/xiaomsh/FlutterCityPicker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaomsh%2FFlutterCityPicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaomsh%2FFlutterCityPicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaomsh%2FFlutterCityPicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaomsh%2FFlutterCityPicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaomsh","download_url":"https://codeload.github.com/xiaomsh/FlutterCityPicker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaomsh%2FFlutterCityPicker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280551637,"owners_count":26349597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address","city","citypicker","picker"],"created_at":"2025-10-23T02:54:48.989Z","updated_at":"2026-01-11T13:38:14.359Z","avatar_url":"https://github.com/xiaomsh.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 地址选择器\n\n[![](https://img.shields.io/pub/v/flutter_city_picker.svg?color=blue)](https://pub.dev/packages/flutter_city_picker)\n[![](https://img.shields.io/github/last-commit/wenchaosong/FlutterCityPicker?color=yellow)](https://github.com/wenchaosong/FlutterCityPicker)\n\n由于地址选择的数据来源会更新，为了统一，在后台配置一份城市数据，前端获取，否则各个平台都配置一份数据，维护会很麻烦，而且有可能每个平台城市的数据结构都不一样。\n本库就是由此而来，数据从后台实时获取，只要解析成固定的数据结构就可以\n\n新版本 2.2.0 支持读取本地文件，但是不建议，因为会增加包体积，而且还要维护，因为有人提的多，所以在此给个 demo\n\n### Demo\n[web 预览](https://xiaomsh.github.io/FlutterCityPicker/)\n\n[![](https://img.shields.io/badge/click_to_download_APK-FlutterCityPicker-ff69b4)](https://github.com/wenchaosong/FlutterCityPicker/releases/download/v2.1.1/app-release.apk)\n\n![效果示例](https://img.alicdn.com/imgextra/i4/2315514881/O1CN01Y3VhZC1lvXyQ1bV6n_!!2315514881.gif)\n\n#### 导入方式\n\n```\ndependencies:\n    flutter_city_picker: ^2.2.0\n```\n\n#### 使用方法\n\n1. 简单使用\n\n```\n    CityPicker.show(context: context, cityPickerListener: this);\n```\n\n2. 多配置的使用\n\n```\n    CityPicker.show(\n          context: context,\n          // 动画控制器\n          animController: _animationController,\n          // 背景透明度\n          opacity: 0.5,\n          // 点击外部是否消失\n          dismissible: true,\n          // 高度\n          height: 400,\n          // 标题高度\n          titleHeight: 50,\n          // 顶部圆角\n          corner: 20,\n          // 背景颜色\n          backgroundColor: Colors.white\n          // 距离左边的间距\n          paddingLeft: 15,\n          // 标题组件\n          titleWidget: Container(\n            padding: EdgeInsets.only(left: 15),\n            child: Text(\n              '请选择地址',\n              style: TextStyle(\n                color: Colors.black54,\n                fontSize: 18,\n                fontWeight: FontWeight.bold,\n              ),\n            ),\n          ),\n          // 选择文字\n          selectText: \"请选择\",\n          // 关闭图标组件\n          closeWidget: Icon(Icons.close),\n          // tab 高度\n          tabHeight: 40,\n          // 是否显示指示器\n          showTabIndicator: _showTabIndicator,\n          // tab 间隔\n          tabPadding: 15,\n          // tab 指示器颜色\n          tabIndicatorColor: Theme.of(context).primaryColor,\n          // tab 指示器高度\n          tabIndicatorHeight: 2,\n          // tab 字体大小\n          labelTextSize: 15,\n          // tab 选中的字体颜色\n          selectedLabelColor: Theme.of(context).primaryColor,\n          // tab 未选中的字体颜色\n          unselectedLabelColor: Colors.black54,\n          // 列表 item 头部高度\n          itemHeadHeight: 30,\n          // 列表 item 头部背景颜色\n          itemHeadBackgroundColor: Colors.white,\n          // 列表 item 头部分割线颜色\n          itemHeadLineColor: Colors.black,\n          // 列表 item 头部分割线高度\n          itemHeadLineHeight: 0.1,\n          // 列表 item 头部文字样式\n          itemHeadTextStyle: TextStyle(fontSize: 15, color: Colors.black),\n          // 列表 item 高度\n          itemHeight: 40,\n          // 索引组件宽度\n          indexBarWidth: 28,\n          // 索引组件 item 高度\n          indexBarItemHeight: 20,\n          // 索引组件背景颜色\n          indexBarBackgroundColor: Colors.black12,\n          // 索引组件文字样式\n          indexBarTextStyle: TextStyle(fontSize: 14, color: Colors.black54),\n          // 列表选中的图标组件\n          itemSelectedIconWidget:\n              Icon(Icons.done, color: Theme.of(context).primaryColor, size: 16),\n          // 列表选中的文字样式\n          itemSelectedTextStyle: TextStyle(\n              fontSize: 14,\n              fontWeight: FontWeight.bold,\n              color: Theme.of(context).primaryColor),\n          // 列表未选中的文字样式\n          itemUnSelectedTextStyle: TextStyle(fontSize: 14, color: Colors.black54),\n          // 初始默认地址\n          initialAddress: _selectedAddress,\n          cityPickerListener: this,\n        );\n```\n\n3. 监听事件\n\n```\n    \u003c你的组件\u003e implements CityPickerListener\n\n    @override\n    Future\u003cList\u003cT\u003e\u003e onDataLoad(int index, T data) async {\n      return 返回城市数据;\n    }\n\n    @override\n    void onFinish(List\u003cT\u003e data) {\n      // 最终回调，返回省市区的代码和名称\n    }\n```\n\n#### 待优化\n\n无\n\n欢迎提 PR 或者 ISSUE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaomsh%2Ffluttercitypicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaomsh%2Ffluttercitypicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaomsh%2Ffluttercitypicker/lists"}