|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
|
import 'package:one_key/models/upload_img_model.dart';
|
|
|
|
import 'package:one_key/pages/create_store/video_widget.dart';
|
|
|
|
import 'package:one_key/pages/online_check/photo_view_wiget.dart';
|
|
|
|
import 'package:one_key/provider/upload_img_provider.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/dialog_util.dart';
|
|
|
|
import 'package:one_key/utils/misc.dart';
|
|
|
|
import 'package:one_key/utils/navigator_util.dart';
|
|
|
|
import 'package:one_key/utils/upload_image_util.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/round_button.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
class CreateStorePage extends StatefulWidget {
|
|
...
|
...
|
@@ -19,6 +30,9 @@ class CreateStorePage extends StatefulWidget { |
|
|
|
class _CreateStorePageState extends State<CreateStorePage> {
|
|
|
|
ScrollController _controller;
|
|
|
|
List<Map> roomType = [];
|
|
|
|
final picker = ImagePicker();
|
|
|
|
|
|
|
|
String storeAddress = '选择地址';
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -52,7 +66,7 @@ class _CreateStorePageState extends State<CreateStorePage> { |
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('2.您的店铺名称是?',
|
|
|
|
Text('1.您的店铺名称是?',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
|
|
|
|
VEmptyView(30),
|
|
...
|
...
|
@@ -87,7 +101,239 @@ class _CreateStorePageState extends State<CreateStorePage> { |
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
//查看大图
|
|
|
|
_showPhotoView(BuildContext context, int index, List imgs,
|
|
|
|
{isShow = false, List dashName}) async {
|
|
|
|
// if (imgs.length == 1 &&
|
|
|
|
// imgs[0] ==
|
|
|
|
// 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
|
|
|
|
// imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
|
|
|
|
// }
|
|
|
|
Utils.setBarStatus(false, color: Colors.black);
|
|
|
|
dynamic result = await showGeneralDialog(
|
|
|
|
context: context,
|
|
|
|
barrierDismissible: false,
|
|
|
|
// barrierColor: Colors.red,
|
|
|
|
barrierLabel:
|
|
|
|
MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
|
transitionDuration: const Duration(milliseconds: 150),
|
|
|
|
pageBuilder: (BuildContext context, Animation animation,
|
|
|
|
Animation secondaryAnimation) {
|
|
|
|
Widget child = Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
PhotoPreview(
|
|
|
|
initialIndex: index,
|
|
|
|
photoList: imgs,
|
|
|
|
isShow: isShow,
|
|
|
|
dashName: dashName)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
return child;
|
|
|
|
});
|
|
|
|
Utils.setBarStatus(true, color: Colors.white);
|
|
|
|
}
|
|
|
|
|
|
|
|
///#相机拍照,单图选择
|
|
|
|
Future _getFromPictureOrCamera(String title, UploadImgModel imgModel,
|
|
|
|
imageSource, UploadImageProvider model) async {
|
|
|
|
final pickedFile = await picker.getImage(source: imageSource);
|
|
|
|
setState(() {
|
|
|
|
if (pickedFile != null) {
|
|
|
|
imgModel.file = File(pickedFile.path);
|
|
|
|
imgModel.process = 0.01;
|
|
|
|
} else {
|
|
|
|
print('No image selected.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (pickedFile != null) {
|
|
|
|
model.imgSizeTouxiang = 64;
|
|
|
|
model.touxiang.qiniuUrl = null;
|
|
|
|
UploadImageUtil().startUploadOnly(
|
|
|
|
context, File(pickedFile.path), title == '头像' ? 0 : 1, true, model);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ///门头照片
|
|
|
|
// Widget _imageWidget(String title, UploadImgModel uploadImgModel,
|
|
|
|
// double imgSize, double radius) {
|
|
|
|
// return Consumer<UploadImageProvider>(builder: (context, model, _) {
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// Utils.getPickPermission(context, () {
|
|
|
|
// _getFromPictureOrCamera(
|
|
|
|
// title, uploadImgModel, ImageSource.gallery, model);
|
|
|
|
// }, PermissionGroup.photos);
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
// children: [
|
|
|
|
// Text(
|
|
|
|
// title,
|
|
|
|
// textAlign: TextAlign.left,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_333333,
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// fontSize: ScreenUtil().setSp(34)),
|
|
|
|
// ),
|
|
|
|
// Spacer(),
|
|
|
|
// Stack(
|
|
|
|
// children: [
|
|
|
|
// InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// double process;
|
|
|
|
// String qiniuUrl;
|
|
|
|
// List<String> tempList = [];
|
|
|
|
|
|
|
|
// process = model.erweima.process;
|
|
|
|
// qiniuUrl = model.erweima.qiniuUrl;
|
|
|
|
|
|
|
|
// if (qiniuUrl != null && qiniuUrl != '') {
|
|
|
|
// tempList.add(qiniuUrl);
|
|
|
|
|
|
|
|
// ///没有上传完成的不可以点击
|
|
|
|
// _showPhotoView(context, 0, tempList);
|
|
|
|
// } else {
|
|
|
|
// Utils.getPickPermission(context, () {
|
|
|
|
// _getFromPictureOrCamera(title, uploadImgModel,
|
|
|
|
// ImageSource.gallery, model);
|
|
|
|
// }, PermissionGroup.photos);
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// child: ClipRRect(
|
|
|
|
// borderRadius: BorderRadius.circular(
|
|
|
|
// ScreenUtil().setWidth(radius)),
|
|
|
|
// child: uploadImgModel.file == null
|
|
|
|
// ? uploadImgModel.qiniuUrl != null &&
|
|
|
|
// uploadImgModel.qiniuUrl != ''
|
|
|
|
// ? Image.network(
|
|
|
|
// uploadImgModel.qiniuUrl,
|
|
|
|
// fit: BoxFit.cover,
|
|
|
|
// width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// )
|
|
|
|
// : Image.asset(
|
|
|
|
// Utils.getImgPath(
|
|
|
|
// title == '头像' ? 'touxiang' : 'erweima'),
|
|
|
|
// fit: BoxFit.cover,
|
|
|
|
// width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// )
|
|
|
|
// : Image.file(
|
|
|
|
// uploadImgModel.file,
|
|
|
|
// fit: BoxFit.cover,
|
|
|
|
// width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// (uploadImgModel.file != null) &&
|
|
|
|
// uploadImgModel.process != 1 &&
|
|
|
|
// uploadImgModel.process != 0.01
|
|
|
|
// ? Container(
|
|
|
|
// width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// borderRadius: BorderRadius.circular(radius),
|
|
|
|
// color: Color.fromRGBO(0, 0, 0, 0.6)),
|
|
|
|
// child: Center(
|
|
|
|
// child: Text('上传中',
|
|
|
|
// style:
|
|
|
|
// TextStyle(color: MyColours.color_999999)),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
// : Container(),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// HEmptyView(30),
|
|
|
|
// Image.asset(
|
|
|
|
// "assets/arr_right_gray.png",
|
|
|
|
// width: ScreenUtil().setWidth(14),
|
|
|
|
// height: ScreenUtil().setWidth(22),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ));
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
//店铺地址
|
|
|
|
Widget _addressWidget() {
|
|
|
|
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
Text('2.您的店铺位置在?',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
|
|
|
|
VEmptyView(30),
|
|
|
|
InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
Utils.getPickPermission(context, () async {
|
|
|
|
Map address = await NavigatorUtil.goMapChoicePointPage(context);
|
|
|
|
if (address != null) {
|
|
|
|
setState(() {
|
|
|
|
storeAddress = address['address'];
|
|
|
|
// 'address':
|
|
|
|
// 'lat':
|
|
|
|
// 'lng
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, PermissionGroup.location);
|
|
|
|
// bool canContacts =
|
|
|
|
// await requestPermission(PermissionGroup.locationWhenInUse);
|
|
|
|
// print(canContacts);
|
|
|
|
},
|
|
|
|
child: Text(storeAddress),
|
|
|
|
)
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
//职位
|
|
|
|
Widget _positionWidget() {
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('3.您在店铺中担任什么职位?',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
|
|
|
|
VEmptyView(30),
|
|
|
|
TextField(
|
|
|
|
// textAlignVertical: TextAlignVertical.bottom,
|
|
|
|
maxLines: 1,
|
|
|
|
// //光标颜色
|
|
|
|
// cursorColor:
|
|
|
|
// widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
),
|
|
|
|
// focusNode: _codeNode,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
contentPadding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(6),
|
|
|
|
horizontal: ScreenUtil().setWidth(20)),
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
hintText: '请输入职位',
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
),
|
|
|
|
// enabledBorder: new UnderlineInputBorder(
|
|
|
|
// borderSide: BorderSide.none,
|
|
|
|
// ),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: MyColours.color_199095)),
|
|
|
|
),
|
|
|
|
onChanged: (value) {},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
...
|
...
|
@@ -98,7 +344,7 @@ class _CreateStorePageState extends State<CreateStorePage> { |
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('3.请上传您店铺环境的照片或者视频',
|
|
|
|
Text('4.请上传您店铺环境的照片或者视频',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
|
|
|
|
VEmptyView(30),
|
|
...
|
...
|
@@ -134,15 +380,26 @@ class _CreateStorePageState extends State<CreateStorePage> { |
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('1.您的店内有哪些包间类型?',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
VEmptyView(30),
|
|
|
|
Column(children: _roomTypeWidget()),
|
|
|
|
// Text('1.您的店内有哪些包间类型?',
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: ScreenUtil().setSp(30),
|
|
|
|
// fontWeight: FontWeight.bold)),
|
|
|
|
// VEmptyView(30),
|
|
|
|
// Column(children: _roomTypeWidget()),
|
|
|
|
_storeNameWidget(),
|
|
|
|
VEmptyView(30),
|
|
|
|
_addressWidget(),
|
|
|
|
VEmptyView(30),
|
|
|
|
_positionWidget(),
|
|
|
|
// VEmptyView(30),
|
|
|
|
// _imageWidget(
|
|
|
|
// '门头照片',
|
|
|
|
// _uploadImageProvider.touxiang,
|
|
|
|
// _uploadImageProvider.imgSizeTouxiang,
|
|
|
|
// 64),
|
|
|
|
VEmptyView(30),
|
|
|
|
_storeEnvironmentWidget(),
|
|
|
|
|
|
|
|
VEmptyView(30),
|
|
|
|
]))),
|
|
|
|
RoundButton(
|
...
|
...
|
|