mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-15 03:04:25 +08:00
feat(add city picker demo):
This commit is contained in:
@ -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"),
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user