Commit 622d2b788604e17b017232569fa17ab29c653593

Authored by wdn127929
1 parent 0f83db29

个人资料页面部分

... ... @@ -198,7 +198,7 @@ class _CreateStorePageState extends State<CreateStorePage> {
}
});
if (pickedFile != null) {
model.imgSizeTouxiang = 64;
model.imgSizeTouxiang = 84;
model.touxiang.qiniuUrl = null;
UploadImageUtil().startUpload(context, File(pickedFile.path),
title == '头像' ? 0 : 1, true, model, UploadType.StoreFrontUploadType);
... ...
... ... @@ -11,6 +11,7 @@ import 'package:one_key/models/check_seller_acc_model.dart';
import 'package:one_key/models/user.dart';
import 'package:one_key/pages/create_store/create_store.dart';
import 'package:one_key/pages/login/if_need_create_store_item.dart';
import 'package:one_key/provider/base_info_provider.dart';
import 'package:one_key/provider/create_store_model.dart';
import 'package:one_key/provider/other_login_provider.dart';
import 'package:one_key/provider/user_model.dart';
... ... @@ -39,6 +40,9 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
with WidgetsBindingObserver {
ScrollController _controller = ScrollController();
OtherLoginProvider otherLoginProvider;
BaseIndoProvider _baseIndoProvider;
String phone = ''; //客户经理个人资料电话
String name = ''; //客户经理个人资料姓名
@override
void initState() {
... ... @@ -46,6 +50,7 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
WidgetsBinding.instance.addObserver(this);
WidgetsBinding.instance.addPostFrameCallback((_) {
_checkSellerAcc();
_getCustomerActivityBaseinfo();
});
bus.on("refresh_store_list", (arg) {
_checkSellerAcc();
... ... @@ -82,6 +87,23 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
}
}
_getCustomerActivityBaseinfo() async {
Map<String, String> params = {
'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
};
bool success = await _baseIndoProvider
.getCustomerActivityBaseinfo(context, params, isShowLoading: false);
if (success) {
name = _baseIndoProvider.baseInfoSunModel.name != null
? _baseIndoProvider.baseInfoSunModel.name
: '';
phone = _baseIndoProvider.baseInfoSunModel.phone != null
? _baseIndoProvider.baseInfoSunModel.phone
: '';
} else {}
}
///获取是否有店
_checkSellerAcc({showLoading = false}) async {
CreateStoreModel createStoreModel =
... ... @@ -95,6 +117,17 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
showLoading: showLoading);
}
///点击某个店铺
_clickStore(context, CheckSellerAccSunModel sunModel) {
//判断进入个人信息还是直接进入主页
if (name == '' || phone == '') {
//姓名或者电话有一个为空时,进入个人资料填写页面
NavigatorUtil.goBaseInfoPage(context);
} else {
_loginStore(context, sunModel);
}
}
///进入某个店铺
_loginStore(context, CheckSellerAccSunModel sunModel) {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
... ... @@ -126,6 +159,7 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
@override
Widget build(BuildContext context) {
otherLoginProvider = Provider.of<OtherLoginProvider>(context, listen: true);
_baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true);
return WillPopScope(
onWillPop: () async {
if (widget.changeStatus) {
... ... @@ -310,21 +344,21 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
return InkWell(
onTap: () async {
if (widget.changeStatus) {
UserModel userModel =
Provider.of<UserModel>(context,
listen: false);
bool success = await userModel
.loginOutOnly(context, {
"seller_code":
userModel.user.sellercode,
"account": userModel.user.account
});
if (success) {
_loginStore(
context, model.sellerList[index]);
}
UserModel userModel =
Provider.of<UserModel>(context,
listen: false);
bool success = await userModel
.loginOutOnly(context, {
"seller_code":
userModel.user.sellercode,
"account": userModel.user.account
});
if (success) {
_clickStore(
context, model.sellerList[index]);
}
} else {
_loginStore(
_clickStore(
context, model.sellerList[index]);
}
},
... ...
... ... @@ -169,6 +169,21 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
});
}
//获取用户信息
_getUserInfo(String access_token, String openid) async {
Response response = await DioUtil.getInstance().getDio().get(
"https://api.weixin.qq.com/sns/userinfo?access_token=$access_token&openid=$openid");
LogUtil.v('userinfo:' + response.data);
Map<String, dynamic> responseData = json.decode(response.data.toString());
if (responseData["errcode"] != null) {
App.sp.setString("headImg", '');
// Utils.showToast(responseData["errmsg"]??"登录,请稍后重试");
} else {
// App.sp.setString("nickName", responseData["nickname"]);
App.sp.setString("headImg", responseData["headimgurl"]);
}
}
///获取微信登录access_token
_getAccessToken(String code) async {
Response response = await DioUtil.getInstance().getDio().get(
... ... @@ -181,6 +196,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
} else {
App.sp.setString("openid", responseData["openid"]);
App.sp.setString("unionid", responseData["unionid"]);
await _getUserInfo(
responseData["access_token"], responseData["openid"]); //获取用户信息
//跳转至手机号绑定页面
//判断是否已经绑定手机号码 ******调用接口*******
... ...
import 'dart:io';
import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
... ... @@ -54,7 +55,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
_uploadImageProvider.touxiang.qiniuUrl = '';
_uploadImageProvider.erweima.process = 0.01;
_uploadImageProvider.erweima.qiniuUrl = '';
_uploadImageProvider.imgSizeTouxiang = 64;
_uploadImageProvider.imgSizeTouxiang = 84;
_uploadImageProvider.imgSizeErweima = 22;
_getQiniuInfo();
_getCustomerActivityBaseinfo();
... ... @@ -139,28 +140,24 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
}
///输入框
Widget _textfield(String title, String hintText,
Widget _textfield(String image, String hintText,
TextEditingController editingController, FocusNode focusNode) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
),
),
HEmptyView(80),
Container(
width: ScreenUtil().setWidth(231 * 2),
child: Image.asset(
Utils.getImgPath(image),
width: ScreenUtil().setWidth(34 * 2),
)),
HEmptyView(24),
Expanded(
child: TextField(
controller: editingController,
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.bottom,
// textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
... ... @@ -190,6 +187,17 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
},
keyboardType: TextInputType.text,
),
),
Text('修改',
style: TextStyle(
color: MyColours.color_BFC4D4,
fontSize: ScreenUtil().setSp(24),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arrow_right_new'),
// width: ScreenUtil().setWidth(16),
height: ScreenUtil().setWidth(34),
)
],
),
... ... @@ -242,10 +250,10 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
});
if (pickedFile != null) {
if (title == '头像') {
_uploadImageProvider.imgSizeTouxiang = 64;
_uploadImageProvider.imgSizeTouxiang = 84;
_uploadImageProvider.touxiang.qiniuUrl = null;
} else {
_uploadImageProvider.imgSizeErweima = 64;
_uploadImageProvider.imgSizeErweima = 76;
_uploadImageProvider.erweima.qiniuUrl = null;
}
UploadImageUtil().startUploadOnly(context, File(pickedFile.path),
... ... @@ -258,111 +266,91 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
String title, UploadImgModel model, double imgSize, double radius) {
return InkWell(
onTap: () {
Utils.getPickPermission(context, () {
_getFromPictureOrCamera(title, model, ImageSource.gallery);
}, Platform.isAndroid ? Permission.storage : Permission.photos);
},
child: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(40),
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
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 = [];
if (title == '头像') {
process = _uploadImageProvider.touxiang.process;
qiniuUrl = _uploadImageProvider.touxiang.qiniuUrl;
} else {
process = _uploadImageProvider.erweima.process;
qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
}
double process;
String qiniuUrl;
List<String> tempList = [];
if (title == '头像') {
process = _uploadImageProvider.touxiang.process;
qiniuUrl = _uploadImageProvider.touxiang.qiniuUrl;
} else {
process = _uploadImageProvider.erweima.process;
qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
}
if (qiniuUrl != null && qiniuUrl != '') {
tempList.add(qiniuUrl);
if (qiniuUrl != null && qiniuUrl != '') {
tempList.add(qiniuUrl);
///没有上传完成的不可以点击
_showPhotoView(context, 0, tempList);
} else {
Utils.getPickPermission(context, () {
_getFromPictureOrCamera(
title, model, ImageSource.gallery);
},
Platform.isAndroid
? Permission.storage
: Permission.photos);
}
},
child: ClipRRect(
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(radius)),
child: model.file == null
? model.qiniuUrl != null && model.qiniuUrl != ''
? Image.network(
model.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(
model.file,
fit: BoxFit.cover,
width: ScreenUtil().setWidth(imgSize * 2),
height: ScreenUtil().setWidth(imgSize * 2),
),
),
),
(model.file != null) &&
model.process != 1 &&
model.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(),
],
///没有上传完成的不可以点击
_showPhotoView(context, 0, tempList);
} else {
Utils.getPickPermission(context, () {
_getFromPictureOrCamera(title, model, ImageSource.gallery);
}, Platform.isAndroid ? Permission.storage : Permission.photos);
}
},
child: Stack(clipBehavior: Clip.none, children: [
Container(
width: ScreenUtil().setWidth(imgSize * 2),
height: ScreenUtil().setWidth(imgSize * 2),
margin: EdgeInsets.only(
right: ScreenUtil().setWidth(14),
),
HEmptyView(30),
Image.asset(
"assets/arr_right_gray.png",
width: ScreenUtil().setWidth(14),
height: ScreenUtil().setWidth(22),
)
],
),
));
child: ClipRRect(
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(radius)),
child: model.file == null
? model.qiniuUrl != null && model.qiniuUrl != ''
? Image.network(
model.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(
model.file,
fit: BoxFit.cover,
width: ScreenUtil().setWidth(imgSize * 2),
height: ScreenUtil().setWidth(imgSize * 2),
),
)),
// (model.file != null) && model.process != 1 && model.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(),
Positioned(
right: ScreenUtil().setWidth(-14),
top: ScreenUtil().setWidth(56),
child: InkWell(
onTap: () {
Utils.getPickPermission(context, () {
_getFromPictureOrCamera(
title, model, ImageSource.gallery);
},
Platform.isAndroid
? Permission.storage
: Permission.photos);
},
child: Image.asset(
Utils.getImgPath('base_tx'),
width: ScreenUtil().setWidth(28 * 2),
)))
]));
}
@override
... ... @@ -390,106 +378,104 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
},
child: Container(
color: MyColours.color_ffffff,
child: Column(children: [
Expanded(
child: SingleChildScrollView(
controller: _scrollController,
physics: BouncingScrollPhysics(),
child: Column(
children: [
_imageWidget(
'头像',
_uploadImageProvider.touxiang,
_uploadImageProvider.imgSizeTouxiang,
64),
VEmptyView(30),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('姓名', '请填写您的姓名',
_nameController, _nameFocusNode)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('电话', '请填写您的联系电话',
_phoneController, _phoneFocusNode)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield(
'职位',
'请填写您在餐厅中担任的职位',
_positionController,
_positionFocusNode)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(40),
// _imageWidget('微信二维码', _uploadImageProvider.erweima,
// _uploadImageProvider.imgSizeErweima, 0),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('微信号', '请填写您的微信号',
_wechatController, _wechatFocusNode)),
VEmptyView(30),
],
)),
),
VEmptyView(20),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
0,
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () {
//接口
_setCustomerActivityBaseinfo();
},
text: '保存',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
))
])))));
child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: SingleChildScrollView(
controller: _scrollController,
physics: BouncingScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
VEmptyView(66),
_imageWidget(
'头像',
_uploadImageProvider.touxiang,
_uploadImageProvider.imgSizeTouxiang,
76),
VEmptyView(26),
Text('未填写',
style: TextStyle(
fontSize: ScreenUtil().setWidth(50),
color: true
? MyColours.color_27262B
: MyColours.color_BFC4D4)),
VEmptyView(8),
Text('18739383883',
style: TextStyle(
fontSize: ScreenUtil().setWidth(30),
color: MyColours.color_BFC4D4)),
VEmptyView(80),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(48),
),
child: _textfield(
'base_name',
'您希望顾客看到的名字',
_nameController,
_nameFocusNode)),
VEmptyView(26),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield(
'base_phone',
'顾客联系您的手机号',
_phoneController,
_phoneFocusNode)),
VEmptyView(26),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield(
'base_position',
'告知顾客您的职位',
_positionController,
_positionFocusNode)),
VEmptyView(26),
// _imageWidget('微信二维码', _uploadImageProvider.erweima,
// _uploadImageProvider.imgSizeErweima, 0),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield(
'base_wechat',
'微信号方便顾客加您微信',
_wechatController,
_wechatFocusNode)),
VEmptyView(30),
],
)),
),
VEmptyView(20),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
0,
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () {
//接口
_setCustomerActivityBaseinfo();
},
text: '保存',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
))
])))));
}
}
... ...
// import 'dart:io';
// import 'package:cached_network_image/cached_network_image.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/screenutil.dart';
// import 'package:one_key/models/upload_img_model.dart';
// import 'package:one_key/models/user.dart';
// import 'package:one_key/pages/online_check/photo_view_wiget.dart';
// import 'package:one_key/pages/online_check/progress.dart';
// import 'package:one_key/provider/base_info_provider.dart';
// import 'package:one_key/provider/upload_img_provider.dart';
// import 'package:one_key/provider/user_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/utils/event_bus.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:image_picker/image_picker.dart';
// import 'package:permission_handler/permission_handler.dart';
// import 'package:provider/provider.dart';
// class BaseInfoPage extends StatefulWidget {
// BaseInfoPage({Key key}) : super(key: key);
// @override
// _BaseInfoPageState createState() => _BaseInfoPageState();
// }
// class _BaseInfoPageState extends State<BaseInfoPage> {
// ScrollController _scrollController;
// TextEditingController _nameController = TextEditingController();
// TextEditingController _phoneController = TextEditingController();
// TextEditingController _positionController = TextEditingController();
// TextEditingController _wechatController = TextEditingController();
// FocusNode _nameFocusNode = FocusNode();
// FocusNode _phoneFocusNode = FocusNode();
// FocusNode _positionFocusNode = FocusNode();
// FocusNode _wechatFocusNode = FocusNode();
// final picker = ImagePicker();
// UploadImageProvider _uploadImageProvider;
// BaseIndoProvider _baseIndoProvider;
// @override
// void initState() {
// super.initState();
// _scrollController = ScrollController();
// WidgetsBinding.instance.addPostFrameCallback((_) {
// _uploadImageProvider.touxiang.process = 0.01;
// _uploadImageProvider.touxiang.qiniuUrl = '';
// _uploadImageProvider.erweima.process = 0.01;
// _uploadImageProvider.erweima.qiniuUrl = '';
// _uploadImageProvider.imgSizeTouxiang = 64;
// _uploadImageProvider.imgSizeErweima = 22;
// _getQiniuInfo();
// _getCustomerActivityBaseinfo();
// });
// }
// _getCustomerActivityBaseinfo() async {
// Map<String, String> params = {
// 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
// "uid": Provider.of<UserModel>(context, listen: false).user.openid,
// };
// bool success =
// await _baseIndoProvider.getCustomerActivityBaseinfo(context, params);
// if (success) {
// _nameController.text = _baseIndoProvider.baseInfoSunModel.name;
// _uploadImageProvider.touxiang.qiniuUrl =
// _baseIndoProvider.baseInfoSunModel.photo;
// _uploadImageProvider.erweima.qiniuUrl =
// _baseIndoProvider.baseInfoSunModel.qrcode;
// _phoneController.text = _baseIndoProvider.baseInfoSunModel.phone;
// _wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat;
// _positionController.text = _baseIndoProvider.baseInfoSunModel.position;
// _uploadImageProvider.imgSizeErweima = 64;
// // setState(() {});
// _uploadImageProvider.notifyListeners();
// }
// }
// ///获取七牛云token
// ///
// _getQiniuInfo() async {
// await _uploadImageProvider.getQiniuInfo(context, {});
// }
// //客户经理添加/修改基本信息
// _setCustomerActivityBaseinfo() async {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// User user = Provider.of<UserModel>(context, listen: false).user;
// Map<String, String> params = {
// 'sellerid': user.sellerid,
// "uid": user.openid,
// "name": _nameController.text.trim().length == 0
// ? user.sellername
// : _nameController.text.trim(),
// "photo": _uploadImageProvider.touxiang.qiniuUrl.trim().length == 0
// ? 'http://nosqn.colorcun.com/yd_person.png'
// : _uploadImageProvider.touxiang.qiniuUrl,
// "position": _positionController.text.trim().length == 0
// ? '经理'
// : _positionController.text,
// };
// if (_phoneController.text.trim().length == 0) {
// if (user.userphone != null) {
// params['phone'] = user.userphone;
// }
// } else {
// params['phone'] = _phoneController.text.trim();
// }
// if (_wechatController.text.trim().length > 0) {
// params['wechat'] = _wechatController.text;
// }
// if (_uploadImageProvider.erweima.qiniuUrl != null &&
// _uploadImageProvider.erweima.qiniuUrl != '') {
// params['qrcode'] = _uploadImageProvider.erweima.qiniuUrl;
// }
// if (_baseIndoProvider.baseInfoSunModel != null) {
// params['id'] = _baseIndoProvider.baseInfoSunModel.id;
// }
// bool isSuccess =
// await _baseIndoProvider.setCustomerActivityBaseinfo(context, params);
// // _baseIndoProvider.baseInfoSunModel = null;
// if (isSuccess) {
// _uploadImageProvider.touxiang.file = null;
// _uploadImageProvider.erweima.file = null;
// //成功之后跳回前一个页面
// // bus.emit('refresh_coupon_list');
// Utils.showToast('保存成功');
// EventBus().emit('changeStatusColor');
// Navigator.pop(context, true);
// }
// }
// ///输入框
// Widget _textfield(String title, String hintText,
// TextEditingController editingController, FocusNode focusNode) {
// return Container(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Container(
// child: Text(
// title,
// style: TextStyle(
// color: MyColours.color_333333,
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(34)),
// ),
// ),
// HEmptyView(80),
// Container(
// width: ScreenUtil().setWidth(231 * 2),
// child: TextField(
// controller: editingController,
// textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
// maxLines: 1,
// // //光标颜色
// // cursorColor:
// // widget.isSelect ? Colors.white : MyColours.color_199095,
// //输入文本的样式
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// ),
// focusNode: focusNode,
// decoration: InputDecoration(
// border: OutlineInputBorder(borderSide: BorderSide.none),
// hintText: hintText,
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(32),
// ),
// enabledBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// focusedBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// ),
// onChanged: (value) {},
// onEditingComplete: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// 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) 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) {
// if (title == '头像') {
// _uploadImageProvider.imgSizeTouxiang = 64;
// _uploadImageProvider.touxiang.qiniuUrl = null;
// } else {
// _uploadImageProvider.imgSizeErweima = 64;
// _uploadImageProvider.erweima.qiniuUrl = null;
// }
// UploadImageUtil().startUploadOnly(context, File(pickedFile.path),
// title == '头像' ? 0 : 1, true, _uploadImageProvider);
// }
// }
// ///图片 头像和二维码
// Widget _imageWidget(
// String title, UploadImgModel model, double imgSize, double radius) {
// return InkWell(
// onTap: () {
// Utils.getPickPermission(context, () {
// _getFromPictureOrCamera(title, model, ImageSource.gallery);
// }, Platform.isAndroid ? Permission.storage : Permission.photos);
// },
// child: Container(
// margin: EdgeInsets.only(
// top: ScreenUtil().setWidth(40),
// left: ScreenUtil().setWidth(40),
// right: ScreenUtil().setWidth(40)),
// 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 = [];
// if (title == '头像') {
// process = _uploadImageProvider.touxiang.process;
// qiniuUrl = _uploadImageProvider.touxiang.qiniuUrl;
// } else {
// process = _uploadImageProvider.erweima.process;
// qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
// }
// if (qiniuUrl != null && qiniuUrl != '') {
// tempList.add(qiniuUrl);
// ///没有上传完成的不可以点击
// _showPhotoView(context, 0, tempList);
// } else {
// Utils.getPickPermission(context, () {
// _getFromPictureOrCamera(
// title, model, ImageSource.gallery);
// },
// Platform.isAndroid
// ? Permission.storage
// : Permission.photos);
// }
// },
// child: ClipRRect(
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(radius)),
// child: model.file == null
// ? model.qiniuUrl != null && model.qiniuUrl != ''
// ? Image.network(
// model.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(
// model.file,
// fit: BoxFit.cover,
// width: ScreenUtil().setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(imgSize * 2),
// ),
// ),
// ),
// (model.file != null) &&
// model.process != 1 &&
// model.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),
// )
// ],
// ),
// ));
// }
// @override
// Widget build(BuildContext context) {
// _uploadImageProvider =
// Provider.of<UploadImageProvider>(context, listen: true);
// _baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true);
// return Scaffold(
// backgroundColor: MyColours.color_fefefe,
// appBar: SystemAppBar(
// '个人信息',
// onTap: () {
// EventBus().emit('changeStatusColor');
// Navigator.of(context).pop();
// },
// ),
// body: WillPopScope(
// onWillPop: () {
// EventBus().emit('changeStatusColor');
// Navigator.of(context).pop();
// },
// child: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// color: MyColours.color_ffffff,
// child: Column(children: [
// Expanded(
// child: SingleChildScrollView(
// controller: _scrollController,
// physics: BouncingScrollPhysics(),
// child: Column(
// children: [
// _imageWidget(
// '头像',
// _uploadImageProvider.touxiang,
// _uploadImageProvider.imgSizeTouxiang,
// 64),
// VEmptyView(30),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_efefef,
// margin: EdgeInsets.only(
// left: ScreenUtil().setWidth(108 * 2),
// right: ScreenUtil().setWidth(40)),
// ),
// VEmptyView(10),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// ),
// child: _textfield('姓名', '请填写您的姓名',
// _nameController, _nameFocusNode)),
// VEmptyView(10),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_efefef,
// margin: EdgeInsets.only(
// left: ScreenUtil().setWidth(108 * 2),
// right: ScreenUtil().setWidth(40)),
// ),
// VEmptyView(10),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// ),
// child: _textfield('电话', '请填写您的联系电话',
// _phoneController, _phoneFocusNode)),
// VEmptyView(10),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_efefef,
// margin: EdgeInsets.only(
// left: ScreenUtil().setWidth(108 * 2),
// right: ScreenUtil().setWidth(40)),
// ),
// VEmptyView(10),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// ),
// child: _textfield(
// '职位',
// '请填写您在餐厅中担任的职位',
// _positionController,
// _positionFocusNode)),
// VEmptyView(10),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_efefef,
// margin: EdgeInsets.only(
// left: ScreenUtil().setWidth(108 * 2),
// right: ScreenUtil().setWidth(40)),
// ),
// VEmptyView(40),
// // _imageWidget('微信二维码', _uploadImageProvider.erweima,
// // _uploadImageProvider.imgSizeErweima, 0),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// ),
// child: _textfield('微信号', '请填写您的微信号',
// _wechatController, _wechatFocusNode)),
// VEmptyView(30),
// ],
// )),
// ),
// VEmptyView(20),
// Padding(
// padding: EdgeInsets.fromLTRB(
// ScreenUtil().setWidth(40),
// 0,
// ScreenUtil().setWidth(40),
// ScreenUtil().setWidth(40)),
// child: RoundButton(
// onPressed: () {
// //接口
// _setCustomerActivityBaseinfo();
// },
// text: '保存',
// fontSize: 34,
// isBold: false,
// height: ScreenUtil().setWidth(80),
// width: double.infinity,
// radius: ScreenUtil().setWidth(10),
// ))
// ])))));
// }
// }
... ...
... ... @@ -19,7 +19,7 @@ class UploadImageProvider extends ChangeNotifier {
UploadImgModel erweima = UploadImgModel(); //二维码
UploadImgModel mentou = UploadImgModel(); //店铺信息----门头照片
UploadImgModel dish = UploadImgModel(); //菜品
double imgSizeTouxiang = 64;
double imgSizeTouxiang = 84;
double imgSizeErweima = 22;
double imgSizeMenTou = 64;
List<UploadImgModel> imageListDenvironment = []; //环境信息列表
... ...
import 'package:flutter/material.dart';
class MyColours {
static const Color color_27262B = Color(0xff27262B);
static const Color color_BFC4D4 = Color(0xffBFC4D4);
static const Color color_C9C9C9 = Color(0xffC9C9C9);
static const Color color_F7F7F7 = Color(0xffF7F7F7);
static const Color color_A3A3A3 = Color(0xffA3A3A3);
... ...
... ... @@ -506,7 +506,9 @@ var ifNeedCreateStorePageHandler = new Handler(
FluroConvertUtils.string2bool(params["changeStatus"].first);
return ChangeNotifierProvider<OtherLoginProvider>(
create: (_) => OtherLoginProvider(),
child: IfNeedCreateStore(changeStatus: changeStatus));
child: ChangeNotifierProvider<BaseIndoProvider>(
create: (_) => BaseIndoProvider(),
child: IfNeedCreateStore(changeStatus: changeStatus)));
});
///新建店铺页面
... ...