Commit 20613fe7ba2ad5322a7f476e76af8d90a49f24b0

Authored by wdn127929
1 parent a574b1fa

店铺信息收集 && 模块过期限制

import 'package:city_pickers/city_pickers.dart';
import 'package:city_pickers/modal/result.dart';
import 'package:flutter/material.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/MyDivider.dart';
... ... @@ -153,167 +154,175 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
Widget build(BuildContext context) {
collectStoreProvider =
Provider.of<CollectStoreProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('店铺信息'),
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
return KeyboardDismissOnTap(
child: Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('店铺信息'),
body: Column(
children: [
Container(
padding: EdgeInsets.symmetric(
horizontal: w(20), vertical: w(15)),
child: Text('在开始之前,请告诉我们关于您的一些信息,以方便专属客服给您提供周到的服务。',
style: TextStyle(
height: 1.5,
fontSize: font(16),
color: MyColours.color_000000))),
VEmptyView(40),
_textFeildWidget(nameC, '店铺名称:', '点击输入店铺名称'),
_divider(),
VEmptyView(20),
_addressWidget('店铺地址:', storeAddress, () {
//
Utils.getPickPermission(context, () async {
Map address =
await NavigatorUtil.goMapChoicePointPage(context);
if (address != null) {
setState(() {
storeAddress = address['address'];
lat = double.parse(address['lat'].toString());
lng = double.parse(address['lng'].toString());
});
}
}, Permission.location);
}),
_divider(),
VEmptyView(20),
_textFeildWidget(phoneC, '联系电话:', '点击输入您的电话号码'),
_divider(),
VEmptyView(20),
_textFeildWidget(personC, '联系人:', '点击输入您的姓名'),
_divider(),
VEmptyView(20),
_addressWidget('城市选择:', cityString, () async {
Result result = await CityPickers.showCityPicker(
context: context,
borderRadius: r(8),
cancelWidget: Container(
padding: EdgeInsets.symmetric(
horizontal: w(20), vertical: w(20)),
child: Text(
'取消',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
confirmWidget: Container(
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(
horizontal: w(20), vertical: w(20)),
child: Text(
'确定',
style: TextStyle(
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(32)),
),
),
theme: ThemeData(
textTheme: TextTheme(
bodyText1: TextStyle(
fontSize: font(11),
// fontWeight: FontWeight.w200,
),
)));
print(result);
if (result != null) {
proCode = result.provinceId;
cityCode = result.cityId;
disCode = result.areaId;
cityString =
result.provinceName + result.cityName + result.areaName;
setState(() {});
}
}),
_divider(),
horizontal: w(20), vertical: w(15)),
child: Text('在开始之前,请告诉我们关于您的一些信息,以方便专属客服给您提供周到的服务。',
style: TextStyle(
height: 1.5,
fontSize: font(16),
color: MyColours.color_000000))),
VEmptyView(40),
_textFeildWidget(nameC, '店铺名称:', '点击输入店铺名称'),
_divider(),
VEmptyView(20),
_addressWidget('店铺地址:', storeAddress, () {
//
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
Utils.getPickPermission(context, () async {
Map address =
await NavigatorUtil.goMapChoicePointPage(context);
if (address != null) {
setState(() {
storeAddress = address['address'];
lat = double.parse(address['lat'].toString());
lng = double.parse(address['lng'].toString());
});
}
}, Permission.location);
}),
_divider(),
VEmptyView(20),
_textFeildWidget(phoneC, '联系电话:', '点击输入您的电话号码'),
_divider(),
VEmptyView(20),
_textFeildWidget(personC, '联系人:', '点击输入您的姓名'),
_divider(),
VEmptyView(20),
_addressWidget('城市选择:', cityString, () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
Result result = await CityPickers.showCityPicker(
context: context,
borderRadius: r(8),
cancelWidget: Container(
padding: EdgeInsets.symmetric(
horizontal: w(20), vertical: w(20)),
child: Text(
'取消',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
confirmWidget: Container(
padding: EdgeInsets.symmetric(
horizontal: w(20), vertical: w(20)),
child: Text(
'确定',
style: TextStyle(
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(32)),
),
),
theme: ThemeData(
textTheme: TextTheme(
bodyText1: TextStyle(
fontSize: font(11),
// fontWeight: FontWeight.w200,
),
)));
print(result);
if (result != null) {
proCode = result.provinceId;
cityCode = result.cityId;
disCode = result.areaId;
cityString = result.provinceName +
result.cityName +
result.areaName;
setState(() {});
}
}),
_divider(),
],
))),
Container(
height: ScreenUtil().setWidth(91 * 2),
width: double.infinity,
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(16 * 2),
bottom: ScreenUtil().setWidth(35 * 2),
left: ScreenUtil().setWidth(45 * 2),
right: ScreenUtil().setWidth(45 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1),
offset: Offset(0, ScreenUtil().setWidth(-2)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
child: RoundButton(
text: '提交',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(10),
isBold: true,
fontSize: 32,
textColor: MyColours.color_F8F9FD,
onPressed: () async {
//判空
if (nameC.text.trim().length == 0) {
Utils.showToast('请输入店铺名称');
return;
}
if (storeAddress == '点击设置您的地址') {
Utils.showToast('请设置您的地址');
return;
}
if (phoneC.text.trim().length == 0) {
Utils.showToast('请输入联系电话');
return;
}
if (personC.text.trim().length == 0) {
Utils.showToast('请输入联系人');
return;
}
if (cityString == '点击设置您的城市') {
Utils.showToast('请设置您的城市');
return;
}
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
Map<String, String> params = {
'sellername': nameC.text,
'map_address': storeAddress,
'phone': phoneC.text,
'rname': personC.text,
'pro_code': proCode,
'city_code': cityCode,
'dis_code': disCode,
'lat': lat.toString(),
'long': lng.toString()
};
bool success = await collectStoreProvider
.setSellerCollect(context, params);
if (success) {
//成功
NavigatorUtil.goCompleteStorePage(context,
replace: true);
}
},
),
)
],
))),
Container(
height: ScreenUtil().setWidth(91 * 2),
width: double.infinity,
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(16 * 2),
bottom: ScreenUtil().setWidth(35 * 2),
left: ScreenUtil().setWidth(45 * 2),
right: ScreenUtil().setWidth(45 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1),
offset: Offset(0, ScreenUtil().setWidth(-2)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
child: RoundButton(
text: '提交',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(10),
isBold: true,
fontSize: 32,
textColor: MyColours.color_F8F9FD,
onPressed: () async {
//判空
if (nameC.text.trim().length == 0) {
Utils.showToast('请输入店铺名称');
return;
}
if (storeAddress == '点击设置您的地址') {
Utils.showToast('请设置您的地址');
return;
}
if (phoneC.text.trim().length == 0) {
Utils.showToast('请输入联系电话');
return;
}
if (personC.text.trim().length == 0) {
Utils.showToast('请输联系人');
return;
}
if (cityString == '点击设置您的城市') {
Utils.showToast('请设置您的城市');
return;
}
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
Map<String, String> params = {
'sellername': nameC.text,
'map_address': storeAddress,
'phone': phoneC.text,
'rname': personC.text,
'pro_code': proCode,
'city_code': cityCode,
'dis_code': disCode,
'lat': lat.toString(),
'long': lng.toString()
};
bool success = await collectStoreProvider.setSellerCollect(
context, params);
if (success) {
//成功
NavigatorUtil.goCompleteStorePage(context, replace: true);
}
},
),
)
],
));
)));
}
}
... ...