Commit 20613fe7ba2ad5322a7f476e76af8d90a49f24b0

Authored by wdn127929
1 parent a574b1fa

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

1 import 'package:city_pickers/city_pickers.dart'; 1 import 'package:city_pickers/city_pickers.dart';
2 import 'package:city_pickers/modal/result.dart'; 2 import 'package:city_pickers/modal/result.dart';
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
  4 +import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 5 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 import 'package:one_key/res/colors.dart'; 6 import 'package:one_key/res/colors.dart';
6 import 'package:one_key/widgets/MyDivider.dart'; 7 import 'package:one_key/widgets/MyDivider.dart';
@@ -153,167 +154,175 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> { @@ -153,167 +154,175 @@ class _CollectStoreInfoPageState extends State<CollectStoreInfoPage> {
153 Widget build(BuildContext context) { 154 Widget build(BuildContext context) {
154 collectStoreProvider = 155 collectStoreProvider =
155 Provider.of<CollectStoreProvider>(context, listen: true); 156 Provider.of<CollectStoreProvider>(context, listen: true);
156 - return Scaffold(  
157 - backgroundColor: MyColours.color_ffffff,  
158 - appBar: SystemAppBar('店铺信息'),  
159 - body: Column(  
160 - children: [  
161 - Expanded(  
162 - child: SingleChildScrollView(  
163 - child: Column( 157 + return KeyboardDismissOnTap(
  158 + child: Scaffold(
  159 + backgroundColor: MyColours.color_ffffff,
  160 + appBar: SystemAppBar('店铺信息'),
  161 + body: Column(
164 children: [ 162 children: [
165 - Container(  
166 - padding: EdgeInsets.symmetric(  
167 - horizontal: w(20), vertical: w(15)),  
168 - child: Text('在开始之前,请告诉我们关于您的一些信息,以方便专属客服给您提供周到的服务。',  
169 - style: TextStyle(  
170 - height: 1.5,  
171 - fontSize: font(16),  
172 - color: MyColours.color_000000))),  
173 - VEmptyView(40),  
174 - _textFeildWidget(nameC, '店铺名称:', '点击输入店铺名称'),  
175 - _divider(),  
176 - VEmptyView(20),  
177 - _addressWidget('店铺地址:', storeAddress, () {  
178 - //  
179 - Utils.getPickPermission(context, () async {  
180 - Map address =  
181 - await NavigatorUtil.goMapChoicePointPage(context);  
182 - if (address != null) {  
183 - setState(() {  
184 - storeAddress = address['address'];  
185 -  
186 - lat = double.parse(address['lat'].toString());  
187 - lng = double.parse(address['lng'].toString());  
188 - });  
189 - }  
190 - }, Permission.location);  
191 - }),  
192 - _divider(),  
193 - VEmptyView(20),  
194 - _textFeildWidget(phoneC, '联系电话:', '点击输入您的电话号码'),  
195 - _divider(),  
196 - VEmptyView(20),  
197 - _textFeildWidget(personC, '联系人:', '点击输入您的姓名'),  
198 - _divider(),  
199 - VEmptyView(20),  
200 - _addressWidget('城市选择:', cityString, () async {  
201 - Result result = await CityPickers.showCityPicker(  
202 - context: context,  
203 - borderRadius: r(8),  
204 - cancelWidget: Container(  
205 - padding: EdgeInsets.symmetric(  
206 - horizontal: w(20), vertical: w(20)),  
207 - child: Text(  
208 - '取消',  
209 - style: TextStyle(  
210 - color: MyColours.color_515151,  
211 - fontSize: ScreenUtil().setSp(32)),  
212 - ),  
213 - ),  
214 - confirmWidget: Container( 163 + Expanded(
  164 + child: SingleChildScrollView(
  165 + child: Column(
  166 + children: [
  167 + Container(
215 padding: EdgeInsets.symmetric( 168 padding: EdgeInsets.symmetric(
216 - horizontal: w(20), vertical: w(20)),  
217 - child: Text(  
218 - '确定',  
219 - style: TextStyle(  
220 - color: MyColours.color_438E93,  
221 - fontSize: ScreenUtil().setSp(32)),  
222 - ),  
223 - ),  
224 - theme: ThemeData(  
225 - textTheme: TextTheme(  
226 - bodyText1: TextStyle(  
227 - fontSize: font(11),  
228 - // fontWeight: FontWeight.w200,  
229 - ),  
230 - )));  
231 - print(result);  
232 - if (result != null) {  
233 - proCode = result.provinceId;  
234 - cityCode = result.cityId;  
235 - disCode = result.areaId;  
236 - cityString =  
237 - result.provinceName + result.cityName + result.areaName;  
238 - setState(() {});  
239 - }  
240 - }),  
241 - _divider(), 169 + horizontal: w(20), vertical: w(15)),
  170 + child: Text('在开始之前,请告诉我们关于您的一些信息,以方便专属客服给您提供周到的服务。',
  171 + style: TextStyle(
  172 + height: 1.5,
  173 + fontSize: font(16),
  174 + color: MyColours.color_000000))),
  175 + VEmptyView(40),
  176 + _textFeildWidget(nameC, '店铺名称:', '点击输入店铺名称'),
  177 + _divider(),
  178 + VEmptyView(20),
  179 + _addressWidget('店铺地址:', storeAddress, () {
  180 + //
  181 + FocusScope.of(context)
  182 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  183 + Utils.getPickPermission(context, () async {
  184 + Map address =
  185 + await NavigatorUtil.goMapChoicePointPage(context);
  186 + if (address != null) {
  187 + setState(() {
  188 + storeAddress = address['address'];
  189 +
  190 + lat = double.parse(address['lat'].toString());
  191 + lng = double.parse(address['lng'].toString());
  192 + });
  193 + }
  194 + }, Permission.location);
  195 + }),
  196 + _divider(),
  197 + VEmptyView(20),
  198 + _textFeildWidget(phoneC, '联系电话:', '点击输入您的电话号码'),
  199 + _divider(),
  200 + VEmptyView(20),
  201 + _textFeildWidget(personC, '联系人:', '点击输入您的姓名'),
  202 + _divider(),
  203 + VEmptyView(20),
  204 + _addressWidget('城市选择:', cityString, () async {
  205 + FocusScope.of(context)
  206 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  207 + Result result = await CityPickers.showCityPicker(
  208 + context: context,
  209 + borderRadius: r(8),
  210 + cancelWidget: Container(
  211 + padding: EdgeInsets.symmetric(
  212 + horizontal: w(20), vertical: w(20)),
  213 + child: Text(
  214 + '取消',
  215 + style: TextStyle(
  216 + color: MyColours.color_515151,
  217 + fontSize: ScreenUtil().setSp(32)),
  218 + ),
  219 + ),
  220 + confirmWidget: Container(
  221 + padding: EdgeInsets.symmetric(
  222 + horizontal: w(20), vertical: w(20)),
  223 + child: Text(
  224 + '确定',
  225 + style: TextStyle(
  226 + color: MyColours.color_438E93,
  227 + fontSize: ScreenUtil().setSp(32)),
  228 + ),
  229 + ),
  230 + theme: ThemeData(
  231 + textTheme: TextTheme(
  232 + bodyText1: TextStyle(
  233 + fontSize: font(11),
  234 + // fontWeight: FontWeight.w200,
  235 + ),
  236 + )));
  237 + print(result);
  238 + if (result != null) {
  239 + proCode = result.provinceId;
  240 + cityCode = result.cityId;
  241 + disCode = result.areaId;
  242 + cityString = result.provinceName +
  243 + result.cityName +
  244 + result.areaName;
  245 + setState(() {});
  246 + }
  247 + }),
  248 + _divider(),
  249 + ],
  250 + ))),
  251 + Container(
  252 + height: ScreenUtil().setWidth(91 * 2),
  253 + width: double.infinity,
  254 + padding: EdgeInsets.only(
  255 + top: ScreenUtil().setWidth(16 * 2),
  256 + bottom: ScreenUtil().setWidth(35 * 2),
  257 + left: ScreenUtil().setWidth(45 * 2),
  258 + right: ScreenUtil().setWidth(45 * 2),
  259 + ),
  260 + decoration: BoxDecoration(
  261 + color: MyColours.color_ffffff,
  262 + boxShadow: [
  263 + BoxShadow(
  264 + spreadRadius: ScreenUtil().setWidth(2),
  265 + color: Color.fromRGBO(0, 0, 0, 0.1),
  266 + offset: Offset(0, ScreenUtil().setWidth(-2)),
  267 + blurRadius: ScreenUtil().setWidth(8))
  268 + ],
  269 + borderRadius: BorderRadius.all(
  270 + Radius.circular(ScreenUtil().setWidth(16)),
  271 + ),
  272 + ),
  273 + child: RoundButton(
  274 + text: '提交',
  275 + height: ScreenUtil().setWidth(80),
  276 + radius: ScreenUtil().setWidth(10),
  277 + isBold: true,
  278 + fontSize: 32,
  279 + textColor: MyColours.color_F8F9FD,
  280 + onPressed: () async {
  281 + //判空
  282 + if (nameC.text.trim().length == 0) {
  283 + Utils.showToast('请输入店铺名称');
  284 + return;
  285 + }
  286 + if (storeAddress == '点击设置您的地址') {
  287 + Utils.showToast('请设置您的地址');
  288 + return;
  289 + }
  290 + if (phoneC.text.trim().length == 0) {
  291 + Utils.showToast('请输入联系电话');
  292 + return;
  293 + }
  294 + if (personC.text.trim().length == 0) {
  295 + Utils.showToast('请输入联系人');
  296 + return;
  297 + }
  298 + if (cityString == '点击设置您的城市') {
  299 + Utils.showToast('请设置您的城市');
  300 + return;
  301 + }
  302 + FocusScope.of(context)
  303 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  304 + Map<String, String> params = {
  305 + 'sellername': nameC.text,
  306 + 'map_address': storeAddress,
  307 + 'phone': phoneC.text,
  308 + 'rname': personC.text,
  309 + 'pro_code': proCode,
  310 + 'city_code': cityCode,
  311 + 'dis_code': disCode,
  312 + 'lat': lat.toString(),
  313 + 'long': lng.toString()
  314 + };
  315 + bool success = await collectStoreProvider
  316 + .setSellerCollect(context, params);
  317 + if (success) {
  318 + //成功
  319 + NavigatorUtil.goCompleteStorePage(context,
  320 + replace: true);
  321 + }
  322 + },
  323 + ),
  324 + )
242 ], 325 ],
243 - ))),  
244 - Container(  
245 - height: ScreenUtil().setWidth(91 * 2),  
246 - width: double.infinity,  
247 - padding: EdgeInsets.only(  
248 - top: ScreenUtil().setWidth(16 * 2),  
249 - bottom: ScreenUtil().setWidth(35 * 2),  
250 - left: ScreenUtil().setWidth(45 * 2),  
251 - right: ScreenUtil().setWidth(45 * 2),  
252 - ),  
253 - decoration: BoxDecoration(  
254 - color: MyColours.color_ffffff,  
255 - boxShadow: [  
256 - BoxShadow(  
257 - spreadRadius: ScreenUtil().setWidth(2),  
258 - color: Color.fromRGBO(0, 0, 0, 0.1),  
259 - offset: Offset(0, ScreenUtil().setWidth(-2)),  
260 - blurRadius: ScreenUtil().setWidth(8))  
261 - ],  
262 - borderRadius: BorderRadius.all(  
263 - Radius.circular(ScreenUtil().setWidth(16)),  
264 - ),  
265 - ),  
266 - child: RoundButton(  
267 - text: '提交',  
268 - height: ScreenUtil().setWidth(80),  
269 - radius: ScreenUtil().setWidth(10),  
270 - isBold: true,  
271 - fontSize: 32,  
272 - textColor: MyColours.color_F8F9FD,  
273 - onPressed: () async {  
274 - //判空  
275 - if (nameC.text.trim().length == 0) {  
276 - Utils.showToast('请输入店铺名称');  
277 - return;  
278 - }  
279 - if (storeAddress == '点击设置您的地址') {  
280 - Utils.showToast('请设置您的地址');  
281 - return;  
282 - }  
283 - if (phoneC.text.trim().length == 0) {  
284 - Utils.showToast('请输入联系电话');  
285 - return;  
286 - }  
287 - if (personC.text.trim().length == 0) {  
288 - Utils.showToast('请输联系人');  
289 - return;  
290 - }  
291 - if (cityString == '点击设置您的城市') {  
292 - Utils.showToast('请设置您的城市');  
293 - return;  
294 - }  
295 - FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘  
296 - Map<String, String> params = {  
297 - 'sellername': nameC.text,  
298 - 'map_address': storeAddress,  
299 - 'phone': phoneC.text,  
300 - 'rname': personC.text,  
301 - 'pro_code': proCode,  
302 - 'city_code': cityCode,  
303 - 'dis_code': disCode,  
304 - 'lat': lat.toString(),  
305 - 'long': lng.toString()  
306 - };  
307 - bool success = await collectStoreProvider.setSellerCollect(  
308 - context, params);  
309 - if (success) {  
310 - //成功  
311 - NavigatorUtil.goCompleteStorePage(context, replace: true);  
312 - }  
313 - },  
314 - ),  
315 - )  
316 - ],  
317 - )); 326 + )));
318 } 327 }
319 } 328 }