mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-03 06:00:54 +08:00
feat(add city picker demo):
This commit is contained in:
BIN
assets/app.db
BIN
assets/app.db
Binary file not shown.
@ -8,14 +8,37 @@
|
||||
//
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:city_pickers/city_pickers.dart';
|
||||
|
||||
class Demo extends StatefulWidget {
|
||||
class CityPickerDemo extends StatefulWidget {
|
||||
_Demo createState() => _Demo();
|
||||
}
|
||||
|
||||
class _Demo extends State<Demo> {
|
||||
class _Demo extends State<CityPickerDemo> {
|
||||
String _result;
|
||||
show(context) async {
|
||||
Result temp = await CityPickers.showCityPicker(
|
||||
context: context,
|
||||
// locationCode: '640221',
|
||||
height: 400,
|
||||
);
|
||||
setState(() {
|
||||
_result = "${temp.toString()}";
|
||||
});
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
return Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text("result: ${_result.toString()}"),
|
||||
RaisedButton(
|
||||
onPressed: () {this.show(context);
|
||||
},
|
||||
child: Text("select"),
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -8,14 +8,36 @@
|
||||
//
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_go/components/widget_demo.dart';
|
||||
import 'demo.dart';
|
||||
const String content0 = '''
|
||||
### **简介**
|
||||
> 显示中国的省市县地区
|
||||
通过函数 **showCityPicker** 调用, 在容器窗口上弹出遮罩层
|
||||
''';
|
||||
const String content1 = '''
|
||||
### **基本用法**
|
||||
- locationCode 初始化地区选择
|
||||
- height 弹出层高度
|
||||
- context 上下文对象
|
||||
''';
|
||||
class Demo extends StatefulWidget {
|
||||
static const String routeName = '/components/Pick/CityPicker';
|
||||
_Demo createState() => _Demo();
|
||||
}
|
||||
|
||||
class _Demo extends State<Demo> {
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
return WidgetDemo(
|
||||
title: 'CityPicker',
|
||||
codeUrl: '',
|
||||
docUrl: '',
|
||||
contentList: [
|
||||
content0,
|
||||
content1,
|
||||
CityPickerDemo()
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import 'YearPicker/index.dart' as YearPicker;
|
||||
import 'DayPicker/index.dart' as DayPicker;
|
||||
import 'MonthPicker/index.dart' as MonthPicker;
|
||||
import 'ShowdatePicker/index.dart' as ShowdatePicker;
|
||||
import 'CityPIcker/index.dart' as CityPicker;
|
||||
|
||||
List<WidgetPoint> widgetPoints = [
|
||||
WidgetPoint(
|
||||
@ -27,4 +28,10 @@ List<WidgetPoint> widgetPoints = [
|
||||
routerName: ShowdatePicker.Demo.routeName,
|
||||
buildRouter: (BuildContext context) => ShowdatePicker.Demo(),
|
||||
),
|
||||
WidgetPoint(
|
||||
name: 'CityPicker',
|
||||
routerName: CityPicker.Demo.routeName,
|
||||
buildRouter: (BuildContext context) => CityPicker.Demo(),
|
||||
),
|
||||
|
||||
];
|
||||
|
@ -31,6 +31,7 @@ dependencies:
|
||||
flutter_webview_plugin: ^0.3.0+2
|
||||
# 日期格式化
|
||||
intl: 0.15.7
|
||||
city_pickers: ^0.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Reference in New Issue
Block a user