import 'package:flutter/material.dart';
import'package:flutter_jdshop/services/ScreenAdapter.dart';
import'package:flutter_jdshop/widget/JdButton.dart';
import'package:flutter_jdshop/widget/JdText.dart';
import'package:city_pickers/city_pickers.dart';classAddressAddPage extends StatefulWidget {
AddressAddPage({Key key}) : super(key: key);
_AddressAddPageState createState()=>_AddressAddPageState();
}class _AddressAddPageState extends State{
String area= '';
@override
Widget build(BuildContext context) {returnScaffold(
appBar: AppBar(
title: Text('增加收货地址'),
),
body: Container(
child: ListView(
children:[
JdText(
text:"收货人姓名",
),
SizedBox(height:10),
JdText(
text:"收货人电话",
),
SizedBox(height:10),
Container(
padding: EdgeInsets.only(left:5),
height: ScreenAdapter.height(68),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(width:1, color: Colors.black12))),
child: InkWell(
child: Row(
children:[
Icon(Icons.add_location),this.area.length > 0
? Text("${this.area}",
style: TextStyle(color: Colors.black54))
: Text("省/市/区",
style: TextStyle(color: Colors.black54))
],
),
onTap: ()async{
Result result= awaitCityPickers.showCityPicker(
context: context,
cancelWidget:
Text('取消', style: TextStyle(color: Colors.black54)),
confirmWidget:
Text("确定", style: TextStyle(color: Colors.blue)));
setState(() {this.area =
"${result.provinceName}/${result.cityName}/${result.areaName}";
});
},
),
),
SizedBox(height:10),
JdText(
text:"详细地址",
maxLines:4,
height:200,
),
SizedBox(height:10),
RaisedButton(
child: Text("弹出省市区"),
onPressed: ()async{
Result result= awaitCityPickers.showCityPicker(
context: context,
cancelWidget:
Text('取消', style: TextStyle(color: Colors.black54)),
confirmWidget:
Text("确定", style: TextStyle(color: Colors.blue)));
},
),
SizedBox(height:40),
JdButton(
text:"增加",
color: Colors.red,
)
],
),
));
}
}