Commit 9bcea9ecbb3feaebfb61ce3cc16e1e3783c2bc97

Authored by wdn127929
1 parent c03a4e4e

极速版

Too many changes to show.

To preserve performance only 18 of 18+ files are displayed.

... ... @@ -60,7 +60,7 @@ class Notebook {
String name;
OrderInfo orderInfo;
String nick_name;
bool issimple;
bool issimple = false;
String orderID;
String orderRID;
... ...
... ... @@ -140,7 +140,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
// userModel.initUser();
if (App.sp.getBool("isLogin") ?? false) {
Future.delayed(Duration(milliseconds: 200), () {
NavigatorUtil.goHomePage(context);
// NavigatorUtil.goHomePage(context);
NavigatorUtil.goHomePageSim(context);
});
} else {
_checkWechat();
... ...
... ... @@ -64,14 +64,14 @@ class NoteBookPageState extends State<NoteBookPage> {
StartingDayOfWeek startingDayOfWeek;
bool clearSel = false;
bool isall = true;
bool isSimple = true;
NoteBookModel noteBookModel;
@override
void initState() {
// TODO: implement initState
super.initState();
isSimple = App.sp.getBool("isSimple") ?? true;
noteBookModel.isSimple = App.sp.getBool("isSimple") ?? true;
tabIndex = widget.tabIndex;
LogUtil.v("notebook_page initState");
... ... @@ -226,7 +226,7 @@ class NoteBookPageState extends State<NoteBookPage> {
await noteBookModel.getReserveList(context, params,
needLoading: needLoading, showLoading: showLoading);
_simpleState();
// _simpleState();
}
... ... @@ -529,19 +529,7 @@ class NoteBookPageState extends State<NoteBookPage> {
// return container;
// }
_simpleState() {
if (noteBookModel.notebooks.length > 0) {
if (isSimple) {
for (Notebook item in noteBookModel.notebooks) {
item.issimple = true;
}
} else {
for (Notebook item in noteBookModel.notebooks) {
item.issimple = false;
}
}
}
}
//获取全选按钮的状态 true or false
getCheckValue() {
... ... @@ -549,12 +537,12 @@ class NoteBookPageState extends State<NoteBookPage> {
return value.issimple == false;
});
if (temp == true) {
isSimple = false;
noteBookModel.isSimple = false;
} else {
isSimple = true;
noteBookModel.isSimple = true;
}
setState(() {});
App.sp.setBool("isSimple", isSimple);
App.sp.setBool("isSimple", noteBookModel.isSimple);
}
///单个item切换模式
... ... @@ -1067,10 +1055,10 @@ class NoteBookPageState extends State<NoteBookPage> {
InkWell(
onTap: () {
setState(() {
isSimple = !isSimple;
noteBookModel.isSimple = ! noteBookModel.isSimple;
});
_simpleState();
App.sp.setBool("isSimple", isSimple);
noteBookModel.simpleState();
App.sp.setBool("isSimple", noteBookModel.isSimple);
},
child: Column(
children: [
... ... @@ -1084,7 +1072,7 @@ class NoteBookPageState extends State<NoteBookPage> {
VEmptyView(16),
Image.asset(
Utils.getImgPath(
isSimple ? 'f_swich_on' : 'f_swich_off'),
noteBookModel.isSimple ? 'f_swich_on' : 'f_swich_off'),
width: ScreenUtil().setWidth(24 * 2))
],
)),
... ...
// import 'dart:io';
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/app.dart';
// import 'package:one_key/models/get_seller_info_model.dart';
// import 'package:one_key/models/user.dart';
// import 'package:one_key/provider/create_store_model.dart';
// import 'package:one_key/provider/user_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/utils/utils.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:provider/provider.dart';
// import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
// import '../../utils/event_bus.dart';
// class CompleteCreateStorePage extends StatefulWidget {
// CompleteCreateStorePageSim({Key key}) : super(key: key);
// @override
// _CompleteCreateStorePageState createState() =>
// _CompleteCreateStorePageState();
// }
// class _CompleteCreateStorePageState extends State<CompleteCreateStorePage> {
// ///进入某个店铺
// // _loginStore(context, CheckSellerAccSunModel sunModel) {
// // UserModel userModel = Provider.of<UserModel>(context, listen: false);
// // Map<String, dynamic> seller = sunModel.toJson();
// // Map<String, dynamic> userMap = {
// // "openid": seller['uid'],
// // "account": seller['account'],
// // "role_name": seller['role_name'],
// // "sellerid": seller['id'],
// // "sellercode": seller['seller_code'],
// // "sellername": seller['sellername'],
// // "sellerphone": seller['seller_tel'],
// // "sellerAddr": '',
// // "scatter": 0,
// // "room": 0,
// // "cassette": 0,
// // "morning": "",
// // "noon": "",
// // "night": "",
// // };
// // userModel.saveUserInfo(User.fromJson(userMap));
// // userModel.getSellerInfo(
// // context,
// // {"seller_id": seller['id'], "seller_openid": seller['openid']},
// // userMap);
// // }
// ///通过sellerid获取店铺和当前登录人的基本信息
// _getSellerAndUserData() async {
// CreateStoreModel createStoreModel =
// Provider.of<CreateStoreModel>(context, listen: false);
// Map<String, String> params = {
// "sellerid": createStoreModel.storeInfo.sellerid,
// "openid": App.sp.getString("openid")
// };
// await createStoreModel.getStoreInfo(context, params);
// GetSellerInfoSunModel infoSunModel =
// await createStoreModel.getSellerById(context);
// UserModel userModel = Provider.of<UserModel>(context, listen: false);
// Map<String, dynamic> seller = infoSunModel.data.toJson();
// Map<String, dynamic> user; //= baseResp.data[0]["user"]
// App.sp.setBool("accountLogin", false);
// if (Platform.isIOS) {
// XgFlutterPlugin().stopXg();
// }
// if (App.sp.containsKey('table_list')) {
// //退出清空桌位数据
// App.sp.remove('table_list');
// }
// if (App.sp.containsKey('specid')) {
// //退出清空销售计价
// App.sp.remove('specid');
// App.sp.remove('specs');
// }
// if (App.sp.containsKey('sellerEdate')) {
// //退出清空店铺过期数据缓存
// App.sp.remove('sellerEdate');
// }
// bus.emit('refresh_token');
// Map<String, dynamic> userMap = {
// "sellerimage": seller['seller_image'],
// // "sellerphone": seller['seller_tel'],
// "sellerAddr": '',
// "scatter": 0,
// "room": 0,
// "cassette": 0,
// "openid": createStoreModel.userCreateStore.id,
// "account": createStoreModel.userCreateStore.account,
// "role_name": createStoreModel.userCreateStore.role_name,
// "sellerid": createStoreModel.userCreateStore.sellerid,
// "sellercode": createStoreModel.userCreateStore.seller_code,
// "sellername": seller['sellername'],
// "sellerphone": seller['phone'],
// "sellerAddr": '',
// "scatter": 0,
// "room": 0,
// "cassette": 0,
// "morning": "",
// "noon": "",
// "night": "",
// // 'userphone': user['phone'],
// 'token': createStoreModel.userCreateStore.user_token,
// 'nickname': createStoreModel.userCreateStore.nick_name,
// 'edate': seller['edate']
// };
// userModel.saveUserInfo(User.fromJson(userMap));
// userModel.getSellerInfo(
// context,
// {"seller_id": seller['id'], "seller_openid": seller['openid']},
// userMap);
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// backgroundColor: Colors.white,
// appBar: SystemAppBar(
// '',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(70),
// vertical: ScreenUtil().setWidth(80)),
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Image.asset(
// Utils.getImgPath('complete'),
// width: ScreenUtil().setWidth(120),
// ),
// VEmptyView(60),
// Text(
// '店铺已创建成功',
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_333333),
// ),
// VEmptyView(220),
// // RoundButton(
// // radius: ScreenUtil().setWidth(10),
// // text: '继续创建桌位',
// // fontSize: 34,
// // gradientStart: MyColours.color_2AB5B7,
// // gradientEnd: MyColours.color_2AB5B7,
// // onPressed: () {},
// // isBold: false,
// // ),
// // VEmptyView(20),
// RoundButton(
// radius: ScreenUtil().setWidth(10),
// text: '进入店铺',
// fontSize: 34,
// textColor: MyColours.color_2AB5B7,
// gradientStart: Colors.white,
// gradientEnd: Colors.white,
// borderColor: MyColours.color_2AB5B7,
// onPressed: () {
// _getSellerAndUserData();
// },
// isBold: false,
// ),
// ])))));
// }
// }
... ...
// import 'dart:io';
// import 'package:flutter/material.dart';
// import 'package:flutter_native_image/flutter_native_image.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_sim/create_store/video_widget.dart';
// import 'package:one_key/pages_sim/online_check/img_picker_widget.dart';
// import 'package:one_key/pages_sim/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/route/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 {
// CreateStorePageSim({Key key}) : super(key: key);
// @override
// _CreateStorePageState createState() => _CreateStorePageState();
// }
// class _CreateStorePageState extends State<CreateStorePage> {
// ScrollController _controller;
// List<Map> roomType = [];
// final picker = ImagePicker();
// String storeAddress = '选择地址';
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// _controller = ScrollController();
// for (int i = 0; i < 8; i++) {
// roomType.add({
// '$i': {'name': '${i + 3}人间', 'check': true}
// });
// }
// }
// List<Widget> _roomTypeWidget() {
// List<Widget> list = [];
// for (int i = 0; i < roomType.length; i++) {
// list.add(CheckboxListTile(
// value: roomType[i]['$i']['check'],
// title: Text(roomType[i]['$i']['name']),
// onChanged: (value) {
// setState(() {
// roomType[i]['$i']['check'] = !roomType[i]['$i']['check'];
// });
// }));
// }
// return list;
// }
// ///店铺电话
// Widget _storePhoneWidget() {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('2.您店铺的电话是?',
// 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,
// )
// ],
// );
// }
// Widget _storeNameWidget() {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('1.您店铺的名称是?',
// 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,
// )
// ],
// );
// }
// //查看大图
// _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.pickImage(source: imageSource);
// File compressedFile = await FlutterNativeImage.compressImage(
// pickedFile.path,
// quality: 70,
// percentage: 50);
// setState(() {
// if (pickedFile != null) {
// imgModel.file = File(pickedFile.path);
// imgModel.process = 0.01;
// } else {
// print('No image selected.');
// }
// });
// if (pickedFile != null) {
// model.imgSizeTouxiang = 76;
// model.touxiang.qiniuUrl = null;
// bool need = await Utils.sizeNeed(File(pickedFile.path));
// File file = File(pickedFile.path);
// if (need) {
// file = File(compressedFile.absolute.path);
// }
// UploadImageUtil().startUpload(context, file, title == '头像' ? 0 : 1, true,
// model, UploadType.StoreFrontUploadType);
// }
// }
// // ///门头照片
// // 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.goMapChoicePointPageSim(context);
// if (address != null) {
// setState(() {
// storeAddress = address['address'];
// // 'address':
// // 'lat':
// // 'lng
// });
// }
// }, Permission.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,
// )
// ],
// );
// }
// ///门头照片
// Widget _storeFrontPhotoWidget() {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('2.您店铺的门头照片是?',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
// VEmptyView(30),
// Consumer<UploadImageProvider>(builder: (context, model, _) {
// return ImgPickerWidget(
// scrollController: _controller,
// model: model,
// maxImageNumber: 1,
// uploadType: UploadType.StoreFrontUploadType,
// );
// })
// ],
// );
// }
// ///店铺环境
// Widget _storeEnvironmentWidget() {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('2.请上传您店铺环境的照片或者视频',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
// VEmptyView(30),
// Consumer<UploadImageProvider>(builder: (context, model, _) {
// return VideoPickerWidget(
// maxImageNumber: 9, model: model, scrollController: _controller);
// })
// ],
// );
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: SystemAppBar(
// '新建店铺',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Expanded(
// child: SingleChildScrollView(
// controller: _controller,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// // Text('1.您的店内有哪些包间类型?',
// // style: TextStyle(
// // fontSize: ScreenUtil().setSp(30),
// // fontWeight: FontWeight.bold)),
// // VEmptyView(30),
// // Column(children: _roomTypeWidget()),
// _storeNameWidget(),
// VEmptyView(30),
// _storeFrontPhotoWidget(),
// VEmptyView(30),
// _storePhoneWidget(),
// VEmptyView(30),
// _addressWidget(),
// VEmptyView(30),
// _positionWidget(),
// // VEmptyView(30),
// // _imageWidget(
// // '门头照片',
// // _uploadImageProvider.touxiang,
// // _uploadImageProvider.imgSizeTouxiang,
// // 64),
// VEmptyView(30),
// _storeEnvironmentWidget(),
// VEmptyView(30),
// ]))),
// RoundButton(
// text: '下一步',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(20),
// fontSize: 28,
// isBold: false,
// onPressed: () {
// NavigatorUtil.goCreateStorePageSim(context);
// },
// )
// ]))));
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/provider/create_store_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/utils/utils.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 EnterStoreAddressPage extends StatefulWidget {
// EnterStoreAddressPageSim({Key key}) : super(key: key);
// @override
// _EnterStoreAddressPageState createState() => _EnterStoreAddressPageState();
// }
// class _EnterStoreAddressPageState extends State<EnterStoreAddressPage> {
// String storeAddress = '请选择地图地址';
// TextEditingController _controller = TextEditingController();
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// }
// @override
// Widget build(BuildContext context) {
// CreateStoreModel createStoreModel =
// Provider.of<CreateStoreModel>(context, listen: false);
// _controller.text = createStoreModel.storeInfo?.addressDetail;
// if (createStoreModel.storeInfo?.address != null) {
// storeAddress = createStoreModel.storeInfo.address;
// }
// return Scaffold(
// backgroundColor: Colors.white,
// appBar: SystemAppBar(
// '',
// leftTitle: '上一步',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(70),
// ScreenUtil().setWidth(60), ScreenUtil().setWidth(70), 0),
// child: SingleChildScrollView(
// // controller: _controller,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('您的店铺地址在哪?',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(40),
// fontWeight: FontWeight.bold)),
// VEmptyView(100),
// InkWell(
// onTap: () {
// Utils.getPickPermission(context, () async {
// Map address =
// await NavigatorUtil.goMapChoicePointPageSim(
// context);
// if (address != null) {
// setState(() {
// storeAddress = address['address'];
// createStoreModel.storeInfo?.address =
// storeAddress;
// createStoreModel.storeInfo?.lat =
// double.parse(address['lat'].toString());
// createStoreModel.storeInfo?.lng =
// double.parse(address['lng'].toString());
// });
// }
// }, Permission.location);
// },
// child: Container(
// alignment: Alignment.centerLeft,
// width: double.infinity,
// height: ScreenUtil().setWidth(104),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10)),
// border: Border.all(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// ),
// child: Text('${storeAddress}',
// style: TextStyle(
// color: storeAddress == '请选择地图地址'
// ? MyColours.color_999999
// : MyColours.color_333333,
// fontSize: ScreenUtil().setSp(28),
// )),
// ),
// ),
// // VEmptyView(20),
// // TextField(
// // controller: _controller,
// // // textAlignVertical: TextAlignVertical.bottom,
// // maxLines: 1,
// // // //光标颜色
// // // cursorColor:
// // // widget.isSelect ? Colors.white : MyColours.color_199095,
// // //输入文本的样式
// // style: TextStyle(
// // color: MyColours.color_333333,
// // fontSize: ScreenUtil().setSp(28),
// // ),
// // // focusNode: _codeNode,
// // decoration: InputDecoration(
// // contentPadding: EdgeInsets.symmetric(
// // vertical: ScreenUtil().setWidth(32),
// // horizontal: ScreenUtil().setWidth(40)),
// // border: OutlineInputBorder(),
// // hintText: '请输入详细地址(选填)',
// // hintStyle: TextStyle(
// // color: MyColours.color_999999,
// // fontSize: ScreenUtil().setSp(28),
// // ),
// // enabledBorder: OutlineInputBorder(
// // borderSide: BorderSide(
// // color: MyColours.color_bff6f7,
// // width: ScreenUtil().setWidth(2))),
// // focusedBorder: OutlineInputBorder(
// // borderSide: BorderSide(
// // color: MyColours.color_bff6f7,
// // width: ScreenUtil().setWidth(2))),
// // ),
// // onChanged: (value) {
// // createStoreModel.storeInfo.addressDetail = value;
// // },
// // onEditingComplete: () {
// // FocusScope.of(context)
// // .requestFocus(FocusNode()); //点击空白处隐藏键盘
// // },
// // keyboardType: TextInputType.text,
// // ),
// VEmptyView(160),
// RoundButton(
// text: '下一步',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(20),
// fontSize: 28,
// isBold: false,
// onPressed: () {
// NavigatorUtil.goEnterStorePhonePageSim(context);
// // NavigatorUtil.goEnterStorePositionPageSim(context);
// },
// )
// ])))));
// ;
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/app.dart';
// import 'package:one_key/pages_sim/create_store/video_widget.dart';
// import 'package:one_key/pages_sim/online_check/img_picker_widget.dart';
// import 'package:one_key/provider/create_store_model.dart';
// import 'package:one_key/provider/upload_img_provider.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/utils/upload_image_util.dart';
// import 'package:one_key/utils/utils.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:provider/provider.dart';
// class EnterStoreEnvironmentPage extends StatefulWidget {
// EnterStoreEnvironmentPageSim({Key key}) : super(key: key);
// @override
// _EnterStoreEnvironmentPageState createState() =>
// _EnterStoreEnvironmentPageState();
// }
// class _EnterStoreEnvironmentPageState extends State<EnterStoreEnvironmentPage> {
// ScrollController _controller = ScrollController();
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// backgroundColor: Colors.white,
// appBar: SystemAppBar(
// '',
// leftTitle: '上一步',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// padding:
// EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(60)),
// child: SingleChildScrollView(
// controller: _controller,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(70)),
// child: Text('请上传店内环境照片或视频(选传)',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(40),
// fontWeight: FontWeight.bold)),
// ),
// VEmptyView(100),
// Consumer<UploadImageProvider>(
// builder: (context, model, _) {
// return VideoPickerWidget(
// maxImageNumber: 9,
// model: model,
// scrollController: _controller);
// }),
// VEmptyView(160),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(70)),
// child: RoundButton(
// text: '完成',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(20),
// fontSize: 28,
// isBold: false,
// onPressed: () {
// // _addStoreInfo();
// // NavigatorUtil.goEnterStoreAddressPageSim(
// // context);
// },
// ))
// ])))));
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/pages_sim/online_check/img_picker_widget.dart';
// import 'package:one_key/provider/upload_img_provider.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/utils/upload_image_util.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:provider/provider.dart';
// class EnterStoreFrontPhotoPage extends StatefulWidget {
// EnterStoreFrontPhotoPageSim({Key key}) : super(key: key);
// @override
// _EnterStoreFrontPhotoPageState createState() =>
// _EnterStoreFrontPhotoPageState();
// }
// class _EnterStoreFrontPhotoPageState extends State<EnterStoreFrontPhotoPage> {
// ScrollController _controller = ScrollController();
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// backgroundColor: Colors.white,
// appBar: SystemAppBar(
// '',
// leftTitle: '上一步',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(70),
// vertical: ScreenUtil().setWidth(60)),
// child: SingleChildScrollView(
// controller: _controller,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('请上传店铺的门头照片(选传)',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(40),
// fontWeight: FontWeight.bold)),
// VEmptyView(100),
// Consumer<UploadImageProvider>(
// builder: (context, model, _) {
// return ImgPickerWidget(
// scrollController: _controller,
// model: model,
// maxImageNumber: 1,
// uploadType: UploadType.StoreFrontUploadType,
// );
// }),
// VEmptyView(160),
// RoundButton(
// text: '下一步',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(20),
// fontSize: 28,
// isBold: false,
// onPressed: () {
// NavigatorUtil.goEnterStoreEnvironmentPageSim(
// context);
// },
// )
// ])))));
// ;
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/provider/create_store_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/utils/event_bus.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:provider/provider.dart';
// class EnterStoreNamePage extends StatefulWidget {
// EnterStoreNamePageSim({Key key}) : super(key: key);
// @override
// _EnterStoreNamePageState createState() => _EnterStoreNamePageState();
// }
// class _EnterStoreNamePageState extends State<EnterStoreNamePage> {
// TextEditingController _controller = TextEditingController();
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// }
// @override
// void dispose() {
// // TODO: implement dispose
// EventBus().emit('refresh_store_list');
// super.dispose();
// }
// @override
// Widget build(BuildContext context) {
// CreateStoreModel createStoreModel =
// Provider.of<CreateStoreModel>(context, listen: false);
// _controller.text = createStoreModel.storeInfo?.name;
// return Scaffold(
// backgroundColor: Colors.white,
// appBar: SystemAppBar(
// '',
// // onTap: () {
// // EventBus().emit('refresh_store_list');
// // Navigator.pop(context);
// // },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// color: Colors.white,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(70),
// vertical: ScreenUtil().setWidth(60)),
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('您的店铺名称是?',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(40),
// fontWeight: FontWeight.bold)),
// VEmptyView(100),
// TextField(
// controller: _controller,
// // textAlignVertical: TextAlignVertical.bottom,
// maxLines: 1,
// // //光标颜色
// // cursorColor:
// // widget.isSelect ? Colors.white : MyColours.color_199095,
// //输入文本的样式
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(28),
// ),
// // focusNode: _codeNode,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.symmetric(
// vertical: ScreenUtil().setWidth(32),
// horizontal: ScreenUtil().setWidth(40)),
// border: OutlineInputBorder(),
// hintText: '请输入店铺名称',
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(28),
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// ),
// onChanged: (value) {
// createStoreModel.storeInfo.name = value;
// },
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.text,
// ),
// VEmptyView(160),
// RoundButton(
// text: '下一步',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(20),
// fontSize: 28,
// isBold: false,
// onPressed: () {
// NavigatorUtil.goEnterStoreAddressPageSim(context);
// },
// )
// ])))));
// ;
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.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';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/route_handles.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/utils/utils.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:provider/provider.dart';
// class EnterStorePhonePage extends StatefulWidget {
// EnterStorePhonePageSim({Key key}) : super(key: key);
// @override
// _EnterStorePhonePageState createState() => _EnterStorePhonePageState();
// }
// class _EnterStorePhonePageState extends State<EnterStorePhonePage> {
// TextEditingController _controller = TextEditingController();
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// }
// ///添加商家信息
// _addStoreInfo() async {
// CreateStoreModel createStoreModel =
// Provider.of<CreateStoreModel>(context, listen: false);
// // UploadImageProvider uploadImageProvider =
// // Provider.of<UploadImageProvider>(context, listen: false);
// if (createStoreModel.storeInfo?.name == null ||
// createStoreModel.storeInfo?.name.trim().length == 0) {
// Utils.showToast('请填写店铺名称!');
// return;
// }
// if (createStoreModel.storeInfo?.address == null ||
// createStoreModel.storeInfo?.address.trim().length == 0) {
// Utils.showToast('请选择店铺地址!');
// return;
// }
// if (createStoreModel.storeInfo?.phone == null ||
// createStoreModel.storeInfo?.phone.trim().length == 0) {
// Utils.showToast('请填写店铺接单电话!');
// return;
// }
// Map<String, String> params = {
// "name": createStoreModel.storeInfo?.name,
// "phone": createStoreModel.storeInfo?.phone,
// "map_address": createStoreModel.storeInfo?.address,
// "long": createStoreModel.storeInfo?.lng.toString(),
// "lat": createStoreModel.storeInfo?.lat.toString(),
// };
// // print(App.sp.getString("unionid"));
// // if (uploadImageProvider.imageListFront.length > 0) {
// // params["file"] = uploadImageProvider.imageListFront[0].qiniuUrl;
// // }
// // if (uploadImageProvider.imageListDenvironment.length > 0) {
// // List<String> temp = [];
// // for (var i = 0;
// // i < uploadImageProvider.imageListDenvironment.length;
// // i++) {
// // temp.add(uploadImageProvider.imageListDenvironment[i].qiniuUrl);
// // }
// // params["image"] = Utils.listToStringEnglish(temp);
// // }
// bool success = await createStoreModel.addStoreInfo(context, params);
// if (success) {
// //跳转至完成页面
// NavigatorUtil.goCompleteStorePageSim(context);
// }
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// backgroundColor: Colors.white,
// appBar: SystemAppBar(
// '',
// leftTitle: '上一步',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// color: MyColours.color_ffffff,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(70),
// vertical: ScreenUtil().setWidth(60)),
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('确定将此电话作为接单电话吗?',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(40),
// fontWeight: FontWeight.bold)),
// VEmptyView(100),
// Consumer<CreateStoreModel>(builder: (context, model, _) {
// _controller.text = model.storeInfo?.phone;
// return TextField(
// // textAlignVertical: TextAlignVertical.bottom,
// maxLines: 1,
// controller: _controller,
// // //光标颜色
// // cursorColor:
// // widget.isSelect ? Colors.white : MyColours.color_199095,
// //输入文本的样式
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(28),
// ),
// // focusNode: _codeNode,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.symmetric(
// vertical: ScreenUtil().setWidth(32),
// horizontal: ScreenUtil().setWidth(40)),
// border: OutlineInputBorder(),
// hintText: '请输入接单电话',
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(28),
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// ),
// onChanged: (value) {
// model.storeInfo?.phone = value;
// },
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.text,
// );
// }),
// VEmptyView(160),
// RoundButton(
// text: '完成',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(20),
// fontSize: 28,
// isBold: false,
// onPressed: () {
// _addStoreInfo();
// // NavigatorUtil.goEnterStoreFrontPhotoPageSim(context);
// },
// )
// ])))));
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/provider/create_store_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_util.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:provider/provider.dart';
// class EnterStorePositionPage extends StatefulWidget {
// EnterStorePositionPageSim({Key key}) : super(key: key);
// @override
// _EnterStorePositionPageState createState() => _EnterStorePositionPageState();
// }
// class _EnterStorePositionPageState extends State<EnterStorePositionPage> {
// TextEditingController _controller = TextEditingController();
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// }
// @override
// Widget build(BuildContext context) {
// CreateStoreModel createStoreModel =
// Provider.of<CreateStoreModel>(context, listen: false);
// _controller.text = createStoreModel.storeInfo?.position;
// return Scaffold(
// backgroundColor: Colors.white,
// appBar: SystemAppBar(
// '',
// leftTitle: '上一步',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(70),
// vertical: ScreenUtil().setWidth(60)),
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('您在店铺的角色是?',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(40),
// fontWeight: FontWeight.bold)),
// VEmptyView(100),
// TextField(
// controller: _controller,
// // textAlignVertical: TextAlignVertical.bottom,
// maxLines: 1,
// // //光标颜色
// // cursorColor:
// // widget.isSelect ? Colors.white : MyColours.color_199095,
// //输入文本的样式
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(28),
// ),
// // focusNode: _codeNode,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.symmetric(
// vertical: ScreenUtil().setWidth(32),
// horizontal: ScreenUtil().setWidth(40)),
// border: OutlineInputBorder(),
// hintText: '请输入您的职位',
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(28),
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// ),
// onChanged: (value) {
// createStoreModel.storeInfo?.position = value;
// },
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.text,
// ),
// VEmptyView(160),
// RoundButton(
// text: '下一步',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(20),
// fontSize: 28,
// isBold: false,
// onPressed: () {
// NavigatorUtil.goEnterStoreTimePageSim(context);
// },
// )
// ])))));
// ;
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/provider/create_store_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_util.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:provider/provider.dart';
// class EnterStoreTimePage extends StatefulWidget {
// EnterStoreTimePageSim({Key key}) : super(key: key);
// @override
// _EnterStoreTimePageState createState() => _EnterStoreTimePageState();
// }
// class _EnterStoreTimePageState extends State<EnterStoreTimePage> {
// TextEditingController _controller = TextEditingController();
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// }
// @override
// Widget build(BuildContext context) {
// CreateStoreModel createStoreModel =
// Provider.of<CreateStoreModel>(context, listen: false);
// _controller.text = createStoreModel.storeInfo.time;
// return Scaffold(
// backgroundColor: Colors.white,
// appBar: SystemAppBar(
// '',
// leftTitle: '上一步',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: InkWell(
// onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(70),
// vertical: ScreenUtil().setWidth(60)),
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('您的店铺营业时间是?',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(40),
// fontWeight: FontWeight.bold)),
// VEmptyView(100),
// TextField(
// // textAlignVertical: TextAlignVertical.bottom,
// controller: _controller,
// maxLines: 1,
// // //光标颜色
// // cursorColor:
// // widget.isSelect ? Colors.white : MyColours.color_199095,
// //输入文本的样式
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(28),
// ),
// // focusNode: _codeNode,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.symmetric(
// vertical: ScreenUtil().setWidth(32),
// horizontal: ScreenUtil().setWidth(40)),
// border: OutlineInputBorder(),
// hintText: '请输入营业时间,如09:00-23:00',
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(28),
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2))),
// ),
// onChanged: (value) {
// createStoreModel.storeInfo.time = value;
// },
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.text,
// ),
// VEmptyView(160),
// RoundButton(
// text: '下一步',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(20),
// fontSize: 28,
// isBold: false,
// onPressed: () {
// NavigatorUtil.goEnterStorePhonePageSim(context);
// },
// )
// ])))));
// ;
// }
// }
... ...
// import 'package:amap_map_fluttify/amap_map_fluttify.dart';
// import 'package:flutter/cupertino.dart';
// import 'package:flutter/material.dart';
// import 'package:amap_search_fluttify/amap_search_fluttify.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/utils/dialog_util.dart';
// import 'package:one_key/utils/misc.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/utils/utils.dart';
// import 'package:one_key/widgets/system_app_bar.dart';
// import 'package:permission_handler/permission_handler.dart';
// // import 'package:demo/resources/custom_text_style.dart';
// // import 'package:demo/utils/misc.dart';
// // import 'package:demo/widgets/network_state/page_loading.dart';
// class MapChoicePointPage extends StatefulWidget {
// final String long;
// final String lat;
// MapChoicePointPageSim({Key key, this.long, this.lat}) : super(key: key);
// @override
// _MapChoicePointPageState createState() => _MapChoicePointPageState();
// }
// class _MapChoicePointPageState extends State<MapChoicePointPage> {
// AmapController _controller;
// List<Poi> poiList;
// static List<PoiModel> list = new List();
// static List<PoiModel> searchlist = new List();
// PoiModel poiModel;
// String keyword = "";
// String address = "";
// bool isloading = true;
// double latitude = 39.684670899;
// double longitude = 118.17630045;
// @override
// void initState() {
// super.initState();
// if (widget.long != null && widget.long != ''&&widget.long != 'null') {
// longitude = double.parse(widget.long);
// }
// if (widget.lat != null && widget.lat != ''&&widget.lat != 'null') {
// latitude = double.parse(widget.lat);
// }
// WidgetsBinding.instance.addPostFrameCallback((_) async {
// _requestLocationPermission();
// });
// }
// Future<bool> checkLocationPermission() async {
// PermissionStatus permissionStatus = await Permission.location.status;
// if (permissionStatus == PermissionStatus.granted) {
// return true;
// } else {
// return false;
// }
// }
// /// 检查权限并定
// // _getLocationPermission() async {
// // if (!(await checkPermission(Permission.location))) {
// // //没有定位权限
// // //申请定位权限
// // _requestLocationPermission();
// // } else {
// // //去定位
// // _requestLocationPermission();
// // }
// // }
// /// 获取定位权限
// _requestLocationPermission() async {
// await AmapLocation.instance.updatePrivacyShow(true);
// await AmapLocation.instance.updatePrivacyAgree(true);
// bool canLocation = false;
// if (!(await checkPermission(Permission.location))) {
// //没有定位权限
// //申请定位权限
// canLocation = await requestPermission(Permission.location);
// } else {
// canLocation = true;
// }
// // bool canLocation = await requestPermission(Permission.location);
// // 单次定位
// if (canLocation) {
// Future.delayed(Duration(milliseconds: 200), () async {
// await AmapLocation.instance.updatePrivacyShow(true);
// await AmapLocation.instance.updatePrivacyAgree(true);
// final location = await AmapLocation.instance.fetchLocation(
// // needAddress: true,
// // mode: LocationAccuracy.High,
// // timeout: Duration(seconds: 10)
// );
// if (location.city == null || location.city == '') //网络不好,定位失败
// {
// // App.sp.setString("lat", "39.684670899");
// // App.sp.setString("lng", "118.17630045");
// } else {
// if (widget.long == null || widget.long == ''||widget.long == 'null') {
// latitude = location.latLng.latitude;
// longitude = location.latLng.longitude;
// if (_controller != null) {
// _controller.setCenterCoordinate(
// LatLng(location.latLng.latitude, location.latLng.longitude));
// }
// setState(() {});
// }
// }
// });
// } else {
// //无权限
// }
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// resizeToAvoidBottomInset: false, //防止底部布局被顶起
// appBar: SystemAppBar(
// '选择位置信息',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// body: Column(
// children: <Widget>[
// Theme(
// data: new ThemeData(
// primaryColor: Color(0xFFFFCA28), hintColor: Color(0xFFFFCA28)),
// child: Container(
// color: Color(0xFFFFCA28),
// padding: EdgeInsets.all(5),
// child: Container(
// height: 36,
// margin: EdgeInsets.only(left: 5, right: 5, bottom: 5),
// child: TextField(
// style: TextStyle(fontSize: 16, letterSpacing: 1.0),
// controller: TextEditingController.fromValue(TextEditingValue(
// // 设置内容
// text: keyword,
// selection: TextSelection.fromPosition(TextPosition(
// affinity: TextAffinity.downstream,
// offset: keyword?.length ?? 0)),
// // 保持光标在最后
// )),
// decoration: InputDecoration(
// border: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(40)),
// ),
// hintText: '输入关键字',
// hintStyle:
// TextStyle(color: Color(0xFFBEBEBE), fontSize: 14),
// contentPadding:
// const EdgeInsets.symmetric(vertical: 8, horizontal: 1),
// prefixIcon: Icon(
// Icons.search,
// color: Colors.grey,
// size: 20,
// ),
// suffixIcon: IconButton(
// icon: Icon(
// Icons.clear,
// color: Colors.grey,
// size: 20,
// ),
// onPressed: () {
// keyword = "";
// setState(() {});
// },
// ),
// fillColor: Colors.white,
// filled: true,
// ),
// inputFormatters: [],
// //内容改变的回调
// onChanged: (text) {
// print('change $text');
// keyword = text;
// },
// //内容提交(按回车)的回调
// onSubmitted: (text) {
// print('submit $text');
// // 触发关闭弹出来的键盘。
// keyword = text;
// setState(() {
// isloading = true;
// FocusScope.of(context).requestFocus(FocusNode());
// });
// searchAroundAddress(text.toString());
// },
// //按回车时调用
// onEditingComplete: () {
// print('onEditingComplete');
// },
// ),
// ),
// ),
// ),
// Container(
// height: 300,
// child: Stack(
// children: <Widget>[
// AmapView(
// showZoomControl: false,
// centerCoordinate: LatLng(latitude, longitude),
// maskDelay: Duration(milliseconds: 500),
// zoomLevel: 16,
// onMapCreated: (controller) async {
// _controller = controller;
// _controller
// .setCenterCoordinate(LatLng(latitude, longitude));
// // if (await requestPermission(PermissionGroup.location)) {
// // await controller.showMyLocation(true);
// // await controller?.showLocateControl(true);
// // final latLng = await _controller?.getLocation(
// // delay: Duration(seconds: 2));
// // await enableFluttifyLog(false); // 关闭log
// // _loadData(latLng);
// // } else {
// // //无权限
// // _showLocPemWidget();
// // }
// },
// onMapMoveEnd: (MapMove move) async {
// _loadData(move.coordinate);
// },
// ),
// Center(
// child: Icon(
// Icons.place,
// size: 36.0,
// color: Color(0xFFFF0000),
// ),
// ),
// ],
// ),
// ),
// Expanded(
// flex: 1,
// child: Visibility(
// visible: !isloading,
// maintainSize: false,
// maintainSemantics: false,
// maintainInteractivity: false,
// replacement: Center(
// child: CupertinoActivityIndicator(),
// ),
// child: ListView.builder(
// itemCount: list.length,
// itemBuilder: (BuildContext context, int position) {
// print("itemBuilder" + list.length.toString());
// PoiModel item = list[position];
// return InkWell(
// child: Column(
// children: <Widget>[
// Container(
// margin:
// EdgeInsets.only(top: 8, bottom: 5, left: 10),
// child: Row(
// children: <Widget>[
// Icon(
// Icons.place,
// size: 20.0,
// color: position == 0
// ? Colors.green
// : Colors.grey,
// ),
// Expanded(
// child: Text(item.title,
// style: TextStyle(
// fontSize: 16,
// color: position == 0
// ? Colors.green
// : Color(0xFF787878))))
// ],
// ),
// ),
// Container(
// margin:
// EdgeInsets.only(top: 5, bottom: 5, left: 18),
// alignment: Alignment.centerLeft,
// child: Text(
// item.address,
// style: TextStyle(
// fontSize: 14,
// color: Color(0xFF646464),
// ),
// ),
// ),
// Divider(
// height: 1,
// )
// ],
// ),
// onTap: () async {
// // await _controller.setCenterCoordinate(
// // LatLng(item.latLng.latitude, item.latLng.longitude),
// // zoomLevel: 16);
// Navigator.pop(context, {
// 'address': item.address,
// 'lat': item.latLng.latitude.toString(),
// 'lng': item.latLng.longitude.toString()
// });
// },
// );
// }),
// ),
// ),
// ],
// ),
// );
// }
// void _loadData(LatLng latLng) async {
// setState(() {
// isloading = true;
// });
// /// 逆地理编码(坐标转地址)
// ///
// ///
// await AmapLocation.instance.updatePrivacyShow(true);
// await AmapLocation.instance.updatePrivacyAgree(true);
// ReGeocode reGeocodeList = await AmapSearch.instance.searchReGeocode(
// latLng,
// );
// // print(await reGeocodeList.toFutureString());
// address = reGeocodeList.formatAddress;
// await AmapLocation.instance.updatePrivacyShow(true);
// await AmapLocation.instance.updatePrivacyAgree(true);
// final poiList = await AmapSearch.instance.searchAround(
// latLng,
// city: "",
// );
// poiModel = new PoiModel("当前位置", address, latLng);
// list.clear();
// list.add(poiModel);
// for (var poi in poiList) {
// String title = await poi.title;
// String cityName = await poi.cityName;
// String provinceName = await poi.provinceName;
// String address = await poi.address;
// LatLng latLng = await poi.latLng;
// String bussniss = poi.businessArea;
// list.add(new PoiModel(
// title.toString(),
// provinceName.toString() +
// cityName.toString() +
// address.toString() +
// bussniss.toString(),
// latLng));
// }
// setState(() {
// isloading = false;
// });
// }
// void searchAroundAddress(String text) async {
// await AmapLocation.instance.updatePrivacyShow(true);
// await AmapLocation.instance.updatePrivacyAgree(true);
// final poiList = await AmapSearch.instance.searchKeyword(
// text,
// city: "",
// );
// list.clear();
// list.add(poiModel);
// for (var poi in poiList) {
// String title = await poi.title;
// LatLng latLng = await poi.latLng;
// String cityName = await poi.cityName;
// String provinceName = await poi.provinceName;
// String address = await poi.address;
// list.add(new PoiModel(
// title.toString(),
// provinceName.toString() + cityName.toString() + address.toString(),
// latLng));
// }
// setState(() {
// isloading = false;
// FocusScope.of(context).requestFocus(FocusNode());
// });
// }
// }
// class PoiModel {
// LatLng latLng;
// String title;
// String address;
// PoiModel(this.title, this.address, this.latLng);
// }
... ...
// import 'dart:convert';
// import 'dart:io';
// import 'dart:async';
// import 'package:cached_network_image/cached_network_image.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_ijkplayer/flutter_ijkplayer.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/models/upload_img_model.dart';
// import 'package:one_key/pages_sim/online_check/photo_view_wiget.dart';
// import 'package:one_key/pages_sim/online_check/progress.dart';
// import 'package:one_key/provider/online_check_edit_provider.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/MyDivider.dart';
// import 'package:one_key/widgets/v_empty_view.dart';
// import 'package:permission_handler/permission_handler.dart';
// import 'package:photo/photo.dart';
// import 'package:provider/provider.dart';
// import 'package:image_picker/image_picker.dart';
// import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart';
// import 'package:video_player/video_player.dart';
// import '../online_check/dispose.dart';
// import 'package:photo_manager/photo_manager.dart';
// // import 'package:video_thumbnail/video_thumbnail.dart';
// import 'package:chewie/chewie.dart';
// typedef void OnPickImageCallback(
// double maxWidth, double maxHeight, int quality);
// class VideoPickerWidget extends StatefulWidget {
// final ScrollController scrollController;
// final Color borderColor;
// final ValueChanged onChange;
// final int maxImageNumber;
// VideoPickerWidget(
// {Key key,
// this.scrollController,
// this.borderColor = Colors.blue,
// this.onChange,
// this.maxImageNumber = 5})
// : super(key: key);
// @override
// _VideoPickerWidgetState createState() => _VideoPickerWidgetState();
// }
// class _VideoPickerWidgetState extends DisposableState<VideoPickerWidget> {
// final picker = ImagePicker();
// // OnlineCheckEditProvider _onlineCheckEditProvider;
// UploadImageProvider _uploadImageProvider;
// // 用户输入的文件名
// String key;
// // 用户输入的 partSize
// int partSize = 4;
// // 用户输入的 token
// String token;
// /// storage 实例
// final Storage storage = Storage();
// // 控制器,可以用于取消任务、获取上述的状态,进度等信息
// // PutController putController = PutController();
// // 当前的任务状态
// // String thumbnailPath;
// VideoPlayerController _controller;
// Future _initializeVideoPlayerFuture;
// // 声明控制器(两个)
// VideoPlayerController videoPlayerController;
// ChewieController chewieController;
// IjkMediaController ijkMediaController = IjkMediaController();
// @override
// void initState() {
// // storage = Storage();
// // putController = PutController();
// super.initState();
// // _controller.setLooping(false);
// // 生成控制器(两个)
// }
// @override
// void dispose() {
// super.dispose();
// // 销毁播放器的控制器
// _controller.dispose();
// chewieController.dispose();
// }
// ///#相机拍照,单图选择
// Future _getFromPictureOrCamera(imageSource) async {
// final pickedFile = await picker.getVideo(
// source: imageSource, maxDuration: const Duration(seconds: 15));
// // thumbnailPath = await VideoThumbnail.thumbnailFile(
// // video: pickedFile.path,
// // imageFormat: ImageFormat.PNG,
// // maxWidth: 128,
// // quality: 25);
// // print(thumbnailPath);
// _controller = VideoPlayerController.file(File(pickedFile.path));
// _initializeVideoPlayerFuture = _controller.initialize();
// setState(() {
// if (pickedFile != null) {
// UploadImgModel imgModel = UploadImgModel();
// imgModel.file = File(pickedFile.path);
// imgModel.process = 0.01;
// _uploadImageProvider.imageList.add(imgModel);
// } else {
// print('No image selected.');
// }
// });
// if (pickedFile != null) {
// UploadImageUtil().startUpload(
// context,
// File(pickedFile.path),
// _uploadImageProvider.imageList.length - 1,
// true,
// _uploadImageProvider);
// }
// }
// ///多图片选择
// void pickAsset(PickType type, {List<AssetPathEntity> pathList}) async {
// /// context is required, other params is optional.
// List<AssetEntity> imgList = await PhotoPicker.pickAsset(
// // BuildContext required
// context: context,
// /// The following are optional parameters.
// themeColor: MyColours.color_199095,
// // the title color and bottom color
// textColor: Colors.white,
// // text color
// padding: 1.0,
// // item padding
// dividerColor: Colors.grey,
// // divider color
// disableColor: Colors.grey.shade300,
// // the check box disable color
// itemRadio: 0.88,
// // the content item radio
// maxSelected:
// widget.maxImageNumber - _uploadImageProvider.imageList.length,
// // max picker image count
// // provider: I18nProvider.english,
// provider: I18nProvider.chinese,
// // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
// rowCount: 3,
// // item row count
// thumbSize: 150,
// // preview thumb size , default is 64
// sortDelegate: SortDelegate.common,
// // default is common ,or you make custom delegate to sort your gallery
// checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(
// activeColor: MyColours.color_353535,
// unselectedColor: Colors.white,
// checkColor: MyColours.color_199095,
// ),
// // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox
// // loadingDelegate: this,
// // if you want to build custom loading widget,extends LoadingDelegate, [see example/lib/main.dart]
// badgeDelegate: const DurationBadgeDelegate(),
// // badgeDelegate to show badge widget
// pickType: type,
// photoPathList: pathList,
// );
// if (imgList == null || imgList.isEmpty) {
// print("No pick item.");
// return;
// } else {
// for (int i = 0; i < imgList.length; i++) {
// var file = await imgList[i].file;
// setState(() {
// UploadImgModel imgModel = UploadImgModel();
// imgModel.file = File(file.absolute.path);
// imgModel.process = 0.01;
// _uploadImageProvider.imageList.add(imgModel);
// });
// UploadImageUtil().startUpload(
// context,
// File(file.absolute.path),
// _uploadImageProvider.imageList.length - 1,
// false,
// _uploadImageProvider);
// // startUpload(File(file.absolute.path),
// // _uploadImageProvider.imageList.length - 1, false);
// }
// }
// }
// ///添加图片UI弹出
// Future _openModalBottomSheet(context) async {
// final option = await showModalBottomSheet(
// context: context,
// backgroundColor: Colors.transparent,
// isDismissible: false,
// builder: (BuildContext context) {
// return Container(
// // height: ScreenUtil().setWidth(180 * 2),
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(ScreenUtil().setWidth(24)),
// topRight: Radius.circular(ScreenUtil().setWidth(24)))),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// InkWell(
// onTap: () {
// Utils.getPickPermission(context, () {
// _getFromPictureOrCamera(ImageSource.camera);
// Navigator.pop(context);
// }, PermissionGroup.camera);
// },
// child: Container(
// width: double.infinity,
// height: ScreenUtil().setWidth(58 * 2),
// child: Center(
// child: Text(
// '拍摄',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_353535,
// fontWeight: FontWeight.bold),
// ),
// )),
// ),
// MyDivider(
// double.infinity,
// ScreenUtil().setWidth(2),
// color: MyColours.color_EEEEEE,
// ),
// InkWell(
// onTap: () {
// Utils.getPickPermission(context, () {
// // pickAsset(PickType.onlyVideo);
// _getFromPictureOrCamera(ImageSource.gallery);
// Navigator.pop(context);
// }, PermissionGroup.photos);
// },
// child: Container(
// width: double.infinity,
// height: ScreenUtil().setWidth(58 * 2),
// child: Center(
// child: Text(
// '从相册选择',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_353535,
// fontWeight: FontWeight.bold),
// ),
// )),
// ),
// MyDivider(
// double.infinity,
// ScreenUtil().setWidth(10),
// color: MyColours.color_EEEEEE,
// ),
// InkWell(
// onTap: () {
// Navigator.pop(context, '取消');
// },
// child: Container(
// width: double.infinity,
// height: ScreenUtil().setWidth(58 * 2),
// child: Center(
// child: Text(
// '取消',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_353535,
// fontWeight: FontWeight.bold),
// ),
// )))
// ],
// ),
// );
// });
// }
// //查看大图
// _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';
// // }
// // _controller = VideoPlayerController.network(imgs[index]);
// // chewieController = ChewieController(
// // videoPlayerController: _controller,
// // // 比例
// // // aspectRatio: 16 / 9,
// // // 自动播放
// // autoPlay: true,
// // // 循环
// // looping: true,
// // );
// ijkMediaController.setNetworkDataSource(
// imgs[index],
// autoPlay: true,
// );
// Utils.setBarStatus(false, color: Colors.black);
// dynamic result = await showGeneralDialog(
// context: context,
// barrierDismissible: false,
// barrierColor: Colors.black,
// barrierLabel:
// MaterialLocalizations.of(context).modalBarrierDismissLabel,
// transitionDuration: const Duration(milliseconds: 150),
// pageBuilder: (BuildContext context, Animation animation,
// Animation secondaryAnimation) {
// return Column(
// children: [
// Container(
// height: ScreenUtil().setWidth(100),
// color: Colors.black,
// child: Row(
// children: [
// Material(
// child: InkWell(
// onTap: () {
// Navigator.pop(context);
// },
// child: Image.asset(Utils.getImgPath('invication_back')),
// )),
// ],
// ),
// ),
// // Chewie(
// // controller: chewieController,
// // ),
// IjkPlayer(mediaController: ijkMediaController),
// ],
// );
// });
// // Utils.setBarStatus(true, color: Colors.white);
// }
// @override
// Widget build(BuildContext context) {
// _uploadImageProvider =
// Provider.of<UploadImageProvider>(context, listen: true);
// return _getGridImg(
// _uploadImageProvider.imageList.length < widget.maxImageNumber
// ? _uploadImageProvider.imageList.length + 1
// : _uploadImageProvider.imageList.length,
// context,
// _uploadImageProvider.imageList.length == widget.maxImageNumber
// ? true
// : false);
// }
// /// 九宫格
// Widget _getGridImg(count, context, isLinjie) {
// // return
// // GridView.builder(
// // controller: widget.scrollController,
// // // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
// // shrinkWrap: true,
// // itemCount: count,
// // //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
// // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// // //横轴元素个数
// // crossAxisCount: 1,
// // //纵轴间距
// // mainAxisSpacing: ScreenUtil().setWidth(30),
// // //横轴间距
// // crossAxisSpacing: ScreenUtil().setWidth(30),
// // //子组件宽高长度比例
// // // childAspectRatio: 1.0
// // ),
// // itemBuilder: (BuildContext context, int index) {
// //Widget Function(BuildContext context, int index)
// var linjie = widget.maxImageNumber;
// if (isLinjie) {
// linjie = widget.maxImageNumber - 1;
// }
// if (0 == count - 1 && 0 < linjie) {
// return InkWell(
// onTap: () {
// // 触摸收起键盘
// FocusScope.of(context).requestFocus(FocusNode());
// _openModalBottomSheet(context);
// },
// child: Container(
// width: ScreenUtil().setWidth(90 * 2),
// height: ScreenUtil().setWidth(90 * 2),
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_E0E0E0,
// width: ScreenUtil().setWidth(2)),
// ),
// child: Column(
// children: [
// VEmptyView(74),
// Image.asset(
// Utils.getImgPath('add_image'),
// width: ScreenUtil().setWidth(32),
// height: ScreenUtil().setWidth(32),
// ),
// VEmptyView(10),
// Text(
// '添加视频',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(24),
// color: MyColours.color_999999),
// )
// ],
// )),
// );
// }
// return _uploadImageProvider.imageList.length < 1
// ? Text('')
// : InkWell(
// onTap: () {
// if (_uploadImageProvider.imageList[0].process == 1) {
// _uploadImageProvider.imageQiniuUrlList = [];
// if (_uploadImageProvider.imageList[0].qiniuUrl != null) {
// for (int i = 0;
// i < _uploadImageProvider.imageList.length;
// i++) {
// _uploadImageProvider.imageQiniuUrlList
// .add(_uploadImageProvider.imageList[i].qiniuUrl);
// }
// ///没有上传完成的不可以点击
// // _showPhotoView(
// // context, 0, _uploadImageProvider.imageQiniuUrlList);
// NavigatorUtil.goPlayVideoPageSim(context,
// urlStr: _uploadImageProvider.imageQiniuUrlList[0]);
// }
// }
// },
// child: Stack(
// children: [
// Stack(
// alignment: Alignment.topRight,
// children: [
// // Image.file(
// // // _uploadImageProvider.imageList[index].file,
// // File(thumbnailPath),
// // fit: BoxFit.cover,
// // width: ScreenUtil().setWidth(100 * 2),
// // height: ScreenUtil().setWidth(100 * 2),
// // ),
// FutureBuilder(
// //显示缩略图
// future: _initializeVideoPlayerFuture,
// builder: (context, snapshot) {
// print(snapshot.connectionState);
// if (snapshot.hasError) print(snapshot.error);
// if (snapshot.connectionState == ConnectionState.done) {
// return Container(
// width: ScreenUtil().setWidth(225),
// child: AspectRatio(
// // aspectRatio: 1 / 1,
// aspectRatio: _controller.value.aspectRatio,
// child: VideoPlayer(_controller),
// ),
// );
// } else {
// return Center(
// child: CircularProgressIndicator(),
// );
// }
// },
// ),
// Offstage(
// offstage: _uploadImageProvider.imageList[0].process < 1,
// child: GestureDetector(
// child: Image.asset(
// Utils.getImgPath("delete"),
// width: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
// ),
// onTap: () {
// //点击删除按钮
// setState(() {
// _uploadImageProvider.imageList.removeWhere(
// (element) =>
// element ==
// _uploadImageProvider.imageList[0]);
// _uploadImageProvider.imageQiniuUrlList.removeWhere(
// (element) =>
// element ==
// _uploadImageProvider.imageQiniuUrlList[0]);
// });
// },
// ),
// ),
// ],
// ),
// Offstage(
// offstage: _uploadImageProvider.imageList[0].process == 1,
// child: Progress(_uploadImageProvider.imageList[0].process),
// )
// ],
// ));
// // });
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:one_key/widgets/system_app_bar.dart';
// import 'package:video_player/video_player.dart';
// class PlayVideoPage extends StatefulWidget {
// final String url;
// PlayVideoPageSim({Key key, this.url}) : super(key: key);
// @override
// _PlayVideoPageState createState() => _PlayVideoPageState();
// }
// class _PlayVideoPageState extends State<PlayVideoPage> {
// // IjkMediaController ijkMediaController = IjkMediaController();
// VideoPlayerController _controller;
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// // ijkMediaController.setNetworkDataSource(
// // widget.url,
// // autoPlay: true,
// // );
// _controller = VideoPlayerController.network(widget.url)
// ..initialize().then((_) {
// setState(() {});
// });
// _controller.play();
// _controller.setLooping(true);
// }
// @override
// void dispose() {
// super.dispose();
// _controller.dispose();
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: SystemAppBar(
// '',
// onTap: () {
// Navigator.pop(context);
// },
// ),
// // body: IjkPlayer(mediaController: ijkMediaController),
// body: Container(
// color: Colors.black,
// child: Center(
// child: _controller.value.isInitialized
// ? AspectRatio(
// aspectRatio: _controller.value.aspectRatio,
// child: VideoPlayer(_controller),
// )
// : CircularProgressIndicator(),
// ),
// ));
// }
// }
... ...
// import 'dart:io';
// import 'dart:async';
// import 'package:flutter/material.dart';
// import 'package:flutter/rendering.dart';
// import 'package:flutter_native_image/flutter_native_image.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/models/upload_img_model.dart';
// import 'package:one_key/pages_sim/online_check/photo_view_wiget.dart';
// import 'package:one_key/pages_sim/online_check/progress.dart';
// import 'package:one_key/provider/upload_img_provider.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/utils/upload_image_util.dart';
// import 'package:one_key/utils/utils.dart';
// import 'package:one_key/widgets/MyDivider.dart';
// import 'package:one_key/widgets/v_empty_view.dart';
// import 'package:permission_handler/permission_handler.dart';
// // import 'package:photo/photo.dart';
// import 'package:image_picker/image_picker.dart';
// // import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart';
// import 'package:qiniu_flutter_sdk_diox/qiniu_flutter_sdk_diox.dart';
// import 'package:wechat_assets_picker/wechat_assets_picker.dart';
// import '../online_check/dispose.dart';
// import 'package:photo_manager/photo_manager.dart';
// import 'package:video_compress/video_compress.dart';
// typedef void OnPickImageCallback(
// double maxWidth, double maxHeight, int quality);
// class VideoPickerWidget extends StatefulWidget {
// final ScrollController scrollController;
// final Color borderColor;
// final ValueChanged onChange;
// final int maxImageNumber;
// final UploadImageProvider model;
// VideoPickerWidget(
// {Key key,
// this.scrollController,
// this.borderColor = Colors.blue,
// this.onChange,
// this.maxImageNumber = 5,
// this.model})
// : super(key: key);
// @override
// _VideoPickerWidgetState createState() => _VideoPickerWidgetState();
// }
// class _VideoPickerWidgetState extends DisposableState<VideoPickerWidget> {
// final picker = ImagePicker();
// // 用户输入的文件名
// String key;
// // 用户输入的 partSize
// int partSize = 4;
// // 用户输入的 token
// String token;
// /// storage 实例
// final Storage storage = Storage();
// // 控制器,可以用于取消任务、获取上述的状态,进度等信息
// // PutController putController = PutController();
// // 当前的任务状态
// @override
// void initState() {
// super.initState();
// }
// ///#相机拍照,单图选择
// //////#相机拍照,单图选择
// Future _getImageFromPictureOrCamera(ImageSource imageSource) async {
// final pickedFile = await picker.pickImage(source: imageSource);
// // String ddd = Utils.getPicSuffix(pickedFile.path);
// // print(ddd);
// File compressedFile = await FlutterNativeImage.compressImage(
// pickedFile.path,
// quality: 70,
// percentage: 50);
// setState(() {
// if (pickedFile != null) {
// UploadImgModel imgModel = UploadImgModel();
// imgModel.file = File(pickedFile.path);
// imgModel.process = 0.01;
// imgModel.fileType = FileType.image;
// widget.model.imageListDenvironment.add(imgModel);
// } else {
// print('No image selected.');
// }
// });
// if (pickedFile != null) {
// bool need = await Utils.sizeNeed(File(pickedFile.path));
// File file = File(pickedFile.path);
// if (need) {
// file = File(compressedFile.absolute.path);
// }
// UploadImageUtil().startUpload(
// context,
// file,
// widget.model.imageListDenvironment.length - 1,
// true,
// widget.model,
// UploadType.EnvironmentUploadType);
// }
// }
// ///视频
// Future _getVideoFromPictureOrCamera(ImageSource imageSource) async {
// final pickedFile = await picker.pickVideo(
// source: imageSource, maxDuration: const Duration(seconds: 15));
// String ddd = Utils.getPicSuffix(pickedFile.path);
// print(ddd);
// await VideoCompress.setLogLevel(0);
// final info = await VideoCompress.getMediaInfo(pickedFile.path);
// String duration = '00';
// if (info != null) {
// if (info.duration > 15000 || info.duration < 11000) {
// Utils.showToast('请选择10~15s的视频');
// return;
// }
// duration = Utils.addZeroNumber((info.duration / 1000).round());
// }
// File thumbnailPath = await VideoCompress.getFileThumbnail(pickedFile.path,
// quality: 100, // default(100)
// position: -1 // default(-1)
// );
// if (pickedFile != null) {
// File compressedFile = await FlutterNativeImage.compressImage(
// pickedFile.path,
// quality: 70,
// percentage: 50);
// UploadImgModel imgModel = UploadImgModel();
// imgModel.file = File(pickedFile.path);
// imgModel.process = 0.01;
// imgModel.fileType = FileType.video;
// imgModel.thumbnailPath = thumbnailPath;
// imgModel.duration = duration;
// widget.model.imageListDenvironment.add(imgModel);
// setState(() {});
// bool need = await Utils.sizeNeed(File(pickedFile.path));
// File file = File(pickedFile.path);
// if (need) {
// file = File(compressedFile.absolute.path);
// }
// UploadImageUtil().startUpload(
// context,
// file,
// widget.model.imageListDenvironment.length - 1,
// true,
// widget.model,
// UploadType.EnvironmentUploadType);
// } else {
// print('No image selected.');
// }
// }
// ///多图片选择
// void pickAsset(RequestType type, {List<AssetPathEntity> pathList}) async {
// /// context is required, other params is optional.
// // List<AssetEntity> imgList = await PhotoPicker.pickAsset(
// // // BuildContext required
// // context: context,
// // /// The following are optional parameters.
// // themeColor: MyColours.color_199095,
// // // the title color and bottom color
// // textColor: Colors.white,
// // // text color
// // padding: 1.0,
// // // item padding
// // dividerColor: Colors.grey,
// // // divider color
// // disableColor: Colors.grey.shade300,
// // // the check box disable color
// // itemRadio: 0.88,
// // // the content item radio
// // maxSelected:
// // widget.maxImageNumber - widget.model.imageListDenvironment.length,
// // // max picker image count
// // // provider: I18nProvider.english,
// // provider: I18nProvider.chinese,
// // // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
// // rowCount: 3,
// // // item row count
// // thumbSize: 150,
// // // preview thumb size , default is 64
// // sortDelegate: SortDelegate.common,
// // // default is common ,or you make custom delegate to sort your gallery
// // checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(
// // activeColor: MyColours.color_353535,
// // unselectedColor: Colors.white,
// // checkColor: MyColours.color_199095,
// // ),
// // // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox
// // // loadingDelegate: this,
// // // if you want to build custom loading widget,extends LoadingDelegate, [see example/lib/main.dart]
// // badgeDelegate: const DurationBadgeDelegate(),
// // // badgeDelegate to show badge widget
// // pickType: type,
// // photoPathList: pathList,
// // );
// List<AssetEntity> imgList = await AssetPicker.pickAssets(context,
// pickerConfig: AssetPickerConfig(
// maxAssets: widget.maxImageNumber -
// widget.model.imageListDenvironment.length,
// // selectedAssets: assets,
// requestType: type,
// themeColor: MyColours.color_199095));
// if (imgList == null || imgList.isEmpty) {
// print("No pick item.");
// return;
// } else {
// for (int i = 0; i < imgList.length; i++) {
// var file = await imgList[i].file;
// setState(() {
// UploadImgModel imgModel = UploadImgModel();
// imgModel.file = File(file.absolute.path);
// imgModel.process = 0.01;
// imgModel.fileType = FileType.image;
// widget.model.imageListDenvironment.add(imgModel);
// });
// bool need = await Utils.sizeNeed(file);
// if (need) {
// File compressedFile = await FlutterNativeImage.compressImage(
// file.path,
// quality: 50,
// percentage: 50);
// file = File(compressedFile.absolute.path);
// }
// UploadImageUtil().startUpload(
// context,
// file,
// widget.model.imageListDenvironment.length - 1,
// false,
// widget.model,
// UploadType.EnvironmentUploadType);
// // startUpload(File(file.absolute.path),
// // _uploadImageProvider.imageListDenvironment.length - 1, false);
// }
// }
// }
// ///添加图片UI弹出
// Future _openModalBottomSheet(context, FileType fileType) async {
// final option = await showModalBottomSheet(
// context: context,
// backgroundColor: Colors.transparent,
// isDismissible: false,
// builder: (BuildContext context) {
// return Container(
// // height: ScreenUtil().setWidth(180 * 2),
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(ScreenUtil().setWidth(24)),
// topRight: Radius.circular(ScreenUtil().setWidth(24)))),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// InkWell(
// onTap: () {
// Utils.getPickPermission(context, () {
// if (fileType == FileType.image) {
// _getImageFromPictureOrCamera(ImageSource.camera);
// } else {
// _getVideoFromPictureOrCamera(ImageSource.camera);
// }
// Navigator.pop(context);
// }, Permission.camera);
// },
// child: Container(
// width: double.infinity,
// height: ScreenUtil().setWidth(58 * 2),
// child: Center(
// child: Text(
// '拍摄',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_353535,
// fontWeight: FontWeight.bold),
// ),
// )),
// ),
// MyDivider(
// double.infinity,
// ScreenUtil().setWidth(2),
// color: MyColours.color_EEEEEE,
// ),
// InkWell(
// onTap: () {
// Utils.getPickPermission(context, () {
// if (fileType == FileType.image) {
// pickAsset(RequestType.image);
// } else {
// _getVideoFromPictureOrCamera(ImageSource.gallery);
// }
// // //
// // _getFromPictureOrCamera(ImageSource.gallery);
// Navigator.pop(context);
// },
// Platform.isAndroid
// ? Permission.storage
// : Permission.photos);
// },
// child: Container(
// width: double.infinity,
// height: ScreenUtil().setWidth(58 * 2),
// child: Center(
// child: Text(
// '从相册选择',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_353535,
// fontWeight: FontWeight.bold),
// ),
// )),
// ),
// MyDivider(
// double.infinity,
// ScreenUtil().setWidth(10),
// color: MyColours.color_EEEEEE,
// ),
// InkWell(
// onTap: () {
// Navigator.pop(context, '取消');
// },
// child: Container(
// width: double.infinity,
// height: ScreenUtil().setWidth(58 * 2),
// child: Center(
// child: Text(
// '取消',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_353535,
// fontWeight: FontWeight.bold),
// ),
// )))
// ],
// ),
// );
// });
// }
// @override
// Widget build(BuildContext context) {
// return _getGridImg(
// widget.model.imageListDenvironment.length < widget.maxImageNumber
// ? widget.model.imageListDenvironment.length + 2
// : widget.model.imageListDenvironment.length,
// context,
// widget.model.imageListDenvironment.length == widget.maxImageNumber
// ? true
// : false);
// }
// //查看大图
// _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);
// }
// /// 九宫格
// Widget _getGridImg(count, context, isLinjie) {
// return Container(
// height: ScreenUtil().setWidth(90 * 2),
// child: ListView.builder(
// controller: widget.scrollController,
// // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
// shrinkWrap: true,
// itemCount: count,
// //列表高度
// itemExtent: ScreenUtil().setWidth(100 * 2),
// scrollDirection: Axis.horizontal,
// padding:
// EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(70)),
// //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
// // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// // //横轴元素个数
// // crossAxisCount: 3,
// // //纵轴间距
// // mainAxisSpacing: ScreenUtil().setWidth(30),
// // //横轴间距
// // crossAxisSpacing: ScreenUtil().setWidth(30),
// // //子组件宽高长度比例
// // childAspectRatio: 1.0),
// itemBuilder: (BuildContext context, int index) {
// var linjie = widget.maxImageNumber;
// if (isLinjie) {
// linjie = widget.maxImageNumber - 2;
// }
// if (index == count - 2 && index < linjie) {
// return InkWell(
// onTap: () {
// // 触摸收起键盘
// FocusScope.of(context).requestFocus(FocusNode());
// _openModalBottomSheet(context, FileType.image);
// },
// child: Container(
// width: ScreenUtil().setWidth(110 * 2),
// height: ScreenUtil().setWidth(90 * 2),
// margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_E0E0E0,
// width: ScreenUtil().setWidth(2)),
// ),
// child: Column(
// children: [
// VEmptyView(46),
// Image.asset(
// Utils.getImgPath('add_image'),
// width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(40),
// ),
// VEmptyView(10),
// Text(
// '上传照片',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(24),
// color: MyColours.color_999999),
// )
// ],
// )),
// );
// }
// if (index == count - 1 && index <= linjie) {
// return InkWell(
// onTap: () {
// // 触摸收起键盘
// FocusScope.of(context).requestFocus(FocusNode());
// _openModalBottomSheet(context, FileType.video);
// },
// child: Container(
// width: ScreenUtil().setWidth(110 * 2),
// height: ScreenUtil().setWidth(90 * 2),
// margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_E0E0E0,
// width: ScreenUtil().setWidth(2)),
// ),
// child: Column(
// children: [
// VEmptyView(46),
// Image.asset(
// Utils.getImgPath('add_video'),
// width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(40),
// ),
// VEmptyView(10),
// Text(
// '上传视频',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(24),
// color: MyColours.color_999999),
// )
// ],
// )),
// );
// }
// return widget.model.imageListDenvironment.length < 1
// ? Text('')
// : InkWell(
// onTap: () {
// if (widget.model.imageListDenvironment[index].process ==
// 1) {
// widget.model.imageQiniuUrlList = [];
// if (widget.model.imageListDenvironment[index]
// .qiniuUrl !=
// null) {
// if (widget.model.imageListDenvironment[index]
// .fileType ==
// FileType.image) {
// List<UploadImgModel> temp = [];
// temp.addAll(widget.model.imageListDenvironment);
// temp.removeWhere((element) =>
// element.fileType == FileType.video);
// for (int i = 0; i < temp.length; i++) {
// widget.model.imageQiniuUrlList
// .add(temp[i].qiniuUrl);
// }
// ///没有上传完成的不可以点击
// _showPhotoView(context, index,
// widget.model.imageQiniuUrlList);
// } else if (widget.model.imageListDenvironment[index]
// .fileType ==
// FileType.video) {
// NavigatorUtil.goPlayVideoPageSim(context,
// urlStr: widget.model
// .imageListDenvironment[index].qiniuUrl);
// }
// }
// }
// },
// child: Stack(
// children: [
// Stack(
// alignment: Alignment.topRight,
// children: [
// widget.model.imageListDenvironment[index]
// .fileType ==
// FileType.image
// ? Image.file(
// widget.model.imageListDenvironment[index]
// .file,
// fit: BoxFit.cover,
// width: ScreenUtil().setWidth(90 * 2),
// height: ScreenUtil().setWidth(90 * 2),
// )
// : Image.file(
// widget.model.imageListDenvironment[index]
// .thumbnailPath,
// fit: BoxFit.cover,
// width: ScreenUtil().setWidth(90 * 2),
// height: ScreenUtil().setWidth(90 * 2),
// )
// // : FutureBuilder(
// // //显示缩略图
// // future: _initializeVideoPlayerFuture,
// // builder: (context, snapshot) {
// // print(snapshot.connectionState);
// // if (snapshot.hasError)
// // print(snapshot.error);
// // if (snapshot.connectionState ==
// // ConnectionState.done) {
// // return Container(
// // // width: ScreenUtil().setWidth(225),
// // child: AspectRatio(
// // aspectRatio: 1 / 1,
// // // aspectRatio: _controller.value.aspectRatio,
// // child: VideoPlayer(_controller),
// // ),
// // );
// // } else {
// // return Center(
// // child: CircularProgressIndicator(),
// // );
// // }
// // },
// // ),
// ,
// Offstage(
// offstage: widget.model
// .imageListDenvironment[index].process <
// 1,
// child: GestureDetector(
// child: Image.asset(
// Utils.getImgPath("delete"),
// width: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
// ),
// onTap: () {
// //点击删除按钮
// setState(() {
// widget.model.imageListDenvironment
// .removeWhere((element) =>
// element ==
// widget.model
// .imageListDenvironment[
// index]);
// widget.model.imageQiniuUrlList
// .removeWhere((element) =>
// element ==
// widget.model
// .imageQiniuUrlList[index]);
// });
// },
// ),
// ),
// ],
// ),
// // Offstage(
// // offstage: widget.model.imageListDenvironment[index].process == 1,
// // child: Progress(widget.model.imageListDenvironment[index].process),
// // ),
// widget.model.imageListDenvironment[index].process == 1
// ? widget.model.imageListDenvironment[index]
// .fileType ==
// FileType.video
// ? Align(
// alignment: Alignment.center,
// child: Image.asset(
// Utils.getImgPath('play'),
// width: ScreenUtil().setWidth(60),
// ))
// : Container()
// : Progress(
// widget.model.imageListDenvironment[index]
// .process,
// size: 90.0,
// ),
// // widget.model.imageListDenvironment[index].fileType ==
// // FileType.video
// // ? Align(
// // alignment: Alignment.bottomRight,
// // child: Padding(
// // padding: EdgeInsets.only(
// // bottom: ScreenUtil().setWidth(10),
// // right: ScreenUtil().setWidth(10)),
// // child: Text(
// // '00:${widget.model.imageListDenvironment[index].duration}',
// // style: TextStyle(
// // color: MyColours.color_333333,
// // fontSize: ScreenUtil().setSp(24)),
// // )),
// // )
// // : Container()
// ],
// ));
// }));
// }
// }
... ...
import 'package:common_utils/common_utils.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_picker/Picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/filter_btn_model.dart';
import 'package:one_key/models/get_deposit_model.dart';
import 'package:one_key/route/route_handles.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../models/book_deposit_model.dart';
import '../../models/get_banquet_deposit_model.dart';
import '../../provider/feast_model.dart';
import '../../provider/notebook_detail_model.dart';
import '../../provider/user_model.dart';
import '../../res/colors.dart';
import '../../utils/MyNumberTextInputFormatter.dart';
import '../../utils/NumLengthInputFormatter.dart';
import '../../utils/dialog_util.dart';
import '../../utils/event_bus.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/h_empty_view.dart';
import '../../widgets/system_app_bar.dart';
/**
* 定金
*/
class BookDepositPageSim extends StatefulWidget {
final String rid;
final BookDepositSunModel depositSunModel;
BookDepositPageSim({Key key, this.rid, this.depositSunModel}) : super(key: key);
@override
_BookDepositPageSimState createState() => _BookDepositPageSimState();
}
class _BookDepositPageSimState extends State<BookDepositPageSim> {
String collectionP = '请选择'; //收款人
int collectionPIndex; //收款人
String paymentTime = '请选择'; //付款时间
String paymentType = '请选择'; //支付方式
List<String> payType = []; //支付方式
int payTypeIndex; //支付方式
// String depositType = '请选择'; //定金类型
// int depositTypeIndex; //定金类型
TextEditingController moneyC = TextEditingController();
FocusNode moneyF = FocusNode();
TextEditingController paymentC = TextEditingController();
FocusNode paymentF = FocusNode();
TextEditingController receiptNumberC = TextEditingController();
FocusNode receiptNumberF = FocusNode();
bool showDateSelWidget = false;
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
NotebookDetailModel detailModel;
FeastModel feastModel;
@override
void initState() {
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
payType = ['现金', '刷卡', '微信', '支付宝', '转账'];
if (widget.depositSunModel != null) {
moneyC.text = widget.depositSunModel.price;
if (widget.depositSunModel.rname != '') {
paymentC.text = widget.depositSunModel.rname;
}
if (widget.depositSunModel.pay != '') {
paymentType = widget.depositSunModel.pay;
payTypeIndex = payType.indexOf(paymentType);
}
if (widget.depositSunModel.ddateStr != '') {
paymentTime = widget.depositSunModel.ddateStr;
}
if (widget.depositSunModel.nickName != null) {
collectionP = widget.depositSunModel.nickName;
}
if (widget.depositSunModel.no != '0') {
receiptNumberC.text = widget.depositSunModel.no;
}
}
moneyF.addListener(() {
if (moneyF.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
paymentF.addListener(() {
if (moneyF.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
receiptNumberF.addListener(() {
if (moneyF.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
WidgetsBinding.instance.addPostFrameCallback((_) {
_getSellerUserBySellerid();
});
}
///获取经理数据 ---- 接单人---全部员工
_getSellerUserBySellerid() async {
await feastModel.getAuthUserLists(context);
if (widget.depositSunModel != null &&
widget.depositSunModel.nickName != null) {
List sellerList = feastModel.sellerManageList.map((item) {
return item.title;
}).toList();
collectionPIndex = sellerList.indexOf(widget.depositSunModel.nickName);
}
}
_createReserveDeposit() async {
if (moneyC.text.trim().length == 0) {
Utils.showToast('请输入金额');
return;
}
if (collectionP == '请选择' || collectionPIndex == null) {
Utils.showToast('请选择收款人');
return;
}
if (paymentTime == '请选择') {
Utils.showToast('请选择付款时间');
return;
}
if (paymentType == '请选择' || payTypeIndex == null) {
Utils.showToast('请选择支付方式');
return;
}
// if (receiptNumberC.text.trim().length == 0) {
// Utils.showToast('请输入收据编号');
// return;
// }
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'rid': widget.rid,
'price': moneyC.text,
// 'rname': paymentC.text,
'uid': collectionPIndex == null
? null
: feastModel.sellerManageList[collectionPIndex].id,
'pay_time': paymentTime == '请选择'
? null
: (DateUtil.getDateTime(paymentTime).millisecondsSinceEpoch / 1000)
.floor()
.toString(),
'pay_type': payTypeIndex == null ? null : payType[payTypeIndex],
'pay_no':
receiptNumberC.text.trim().length == 0 ? null : receiptNumberC.text,
'insert_uid': Provider.of<UserModel>(context, listen: false).user.openid
};
print(feastModel.sellerManageList[collectionPIndex].title);
bool success = await detailModel.createReserveDeposit(context, pramas);
if (success) {
Navigator.pop(context);
bus.emit('refresh_detail_deposit');
}
}
///请输入
///输入框
Widget _textfield(
String title,
String hintText,
TextEditingController editingController,
FocusNode focusNode,
String subTitle,
{TextInputType inputType = TextInputType.text}) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
// color: Colors.red,
width: ScreenUtil().setWidth(160),
height: ScreenUtil().setWidth(35),
child: Text(
title,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
),
),
HEmptyView(60),
Expanded(
child: Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: h(1), color: MyColours.color_DBDBDB))),
child: Row(
children: [
Expanded(
child: Container(
// height: ScreenUtil().setHeight(120),
height: ScreenUtil().setWidth(64),
child: TextField(
controller: editingController,
// textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
inputFormatters: title == '金额'
? [
FilteringTextInputFormatter(RegExp("[0-9.]"),
allow: true),
MyNumberTextInputFormatter(digit: 2),
]
: [],
// //光标颜色
// 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: hintText == '请输入'
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28),
),
contentPadding: EdgeInsets.zero,
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: inputType,
)),
),
Container(
child: Text(
subTitle,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28)),
),
),
],
),
))
],
),
);
}
///请选择
Widget _selectWidget(String title, String labelShow,
{GestureTapCallback onTap, bool need = true}) {
return InkWell(
onTap: onTap,
// () {
// FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
// DialogUtil.showSelectCusmanDialog(
// context,
// customerProvider.labelList.map((item) {
// return item.label;
// }).toList(), (value) {
// if (value != null) {
// setState(() {
// customerProvider.labelSelIndex =
// value.first;
// labelShow = customerProvider
// .labelList[
// customerProvider.labelSelIndex]
// .label;
// });
// }
// },
// selecteds:
// customerProvider.labelSelIndex == null
// ? []
// : [
// customerProvider.labelSelIndex
// ])
// .then((value) {});
// },
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
// color: Colors.red,
width: ScreenUtil().setWidth(160),
height: ScreenUtil().setWidth(35),
child: Text(
title,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
),
),
HEmptyView(60),
Expanded(
child: Container(
height: ScreenUtil().setWidth(64),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: Color.fromRGBO(220, 220, 220, 1)))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
labelShow,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: labelShow == '请选择'
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28),
),
)),
HEmptyView(10),
Image.asset(
Utils.getImgPath('f_arrow_down'),
width: ScreenUtil().setWidth(64),
// height: ScreenUtil().setWidth(10),
),
HEmptyView(16),
],
))),
],
),
);
}
Widget _callButton(
{GestureTapCallback onPress,
content,
hasLeftBorder = true,
isSelect = false}) {
return InkWell(
onTap: onPress,
child: Container(
height: h(48),
decoration: BoxDecoration(
color: isSelect ? MyColours.color_438E93 : MyColours.color_ffffff,
border: Border(
bottom: BorderSide(
color: MyColours.color_438E93,
width: ScreenUtil().setWidth(2)),
top: BorderSide(
color: MyColours.color_438E93,
width: ScreenUtil().setWidth(2)),
left: hasLeftBorder
? BorderSide(
color: MyColours.color_438E93,
width: ScreenUtil().setWidth(2))
: BorderSide.none,
right: BorderSide(
color: MyColours.color_438E93,
width: ScreenUtil().setWidth(2)))),
child: Align(
alignment: Alignment.center,
child: Text(
content,
style: TextStyle(
color:
isSelect ? MyColours.color_F6F6F6 : MyColours.color_438E93,
fontSize: ScreenUtil().setSp(36)),
),
),
),
);
}
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
key: scaffoldKey,
appBar: SystemAppBar(
'添加定金',
needWhite: true,
bgColor: MyColours.color_438E93,
titleColor: MyColours.color_F6F6F6,
onTap: () {
Navigator.pop(context);
},
),
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(left: w(30), right: w(13)),
child: Column(
children: [
VEmptyView(50),
_textfield('金额', '请输入', moneyC, moneyF, '元',
inputType:
TextInputType.numberWithOptions(decimal: true)),
VEmptyView(66),
// _textfield('付款人', '请输入', paymentC, paymentF, '',
// inputType: TextInputType.text),
// VEmptyView(66),
_selectWidget('收款人', collectionP, onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
feastModel.sellerManageList.map((item) {
return item.title;
}).toList(), (value) {
if (value != null) {
setState(() {
collectionPIndex = value.first;
collectionP = feastModel
.sellerManageList[collectionPIndex].title;
});
}
},
cancelText: '',
title: '选择收款人',
selecteds: collectionPIndex == null
? []
: [collectionPIndex])
.then((value) {});
}),
VEmptyView(66),
_selectWidget('付款时间', paymentTime, onTap: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = true;
DialogUtil.showPickerDateTime24Feast(
context,
scaffoldKey,
(value) {
// {'text': picker.adapter.text, 'select': selecteds}
if (value != null) {
setState(() {
print(value);
paymentTime = DateUtil.formatDateStr(value,
format: DateFormats.y_mo_d);
});
}
showDateSelWidget = false;
},
pickerDateTimeType: PickerDateTimeType.kYMD,
dateTime: DateUtil.getDateTime(paymentTime),
cancelText: '',
title: '选择付款时间',
onCancel: () {
showDateSelWidget = false;
});
}),
VEmptyView(66),
_selectWidget('支付方式', paymentType, onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(context, payType,
(value) {
if (value != null) {
setState(() {
payTypeIndex = value.first;
paymentType = payType[payTypeIndex];
});
}
},
cancelText: '',
title: '选择支付方式',
selecteds:
payTypeIndex == null ? [] : [payTypeIndex])
.then((value) {});
}),
// VEmptyView(66),
// _selectWidget('定金类型', depositType, onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
// DialogUtil.showSelectCusmanDialog(
// context,
// feastModel.depositData.map((item) {
// return item.dname;
// }).toList(), (value) {
// if (value != null) {
// setState(() {
// depositTypeIndex = value.first;
// depositType = feastModel
// .depositData[depositTypeIndex].dname;
// });
// }
// },
// cancelText: '',
// title: '选择定金类型',
// selecteds: depositTypeIndex == null
// ? []
// : [depositTypeIndex])
// .then((value) {});
// }),
VEmptyView(66),
_textfield(
'收据编号', '请输入', receiptNumberC, receiptNumberF, '',
inputType: TextInputType.text),
],
)),
)),
Container(
padding: EdgeInsets.symmetric(horizontal: w(24), vertical: w(35)),
child: Row(
children: [
RoundButton(
text: '取消',
width: w(100),
height: w(43),
radius: r(5),
fontSize: 32,
isBold: true,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
textColor: MyColours.color_438E93,
borderColor: MyColours.color_438E93,
onPressed: () {
Navigator.pop(context);
},
),
HEmptyView(24),
Expanded(
child: RoundButton(
text: '保存并返回',
height: w(43),
radius: r(5),
isBold: true,
fontSize: 32,
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
textColor: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
onPressed: () {
_createReserveDeposit();
},
)),
],
),
)
],
));
}
}
... ...
// import 'dart:html';
// import 'dart:async';
// import 'dart:convert';
import 'dart:io';
import 'package:call_log/call_log.dart';
import 'package:easy_contact_picker/easy_contact_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/marketing_center_provider.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/misc.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';
import '../../models/user_history_entity.dart';
import '../../utils/call_log_utils.dart';
import '../../utils/common_utils.dart';
import '../../utils/screen_util.dart';
import '../../widgets/MyDivider.dart';
import '../../widgets/special_text/my_extended_text_selection_controls.dart';
import 'package:flutter_picker/flutter_picker.dart' as Picker;
/**
* 填写预订联系人页面
*/
class EditReserverPageSim extends StatefulWidget {
final String rid;
final String name;
final String sex;
final bool needBtn;
final String mid;
EditReserverPageSim(this.rid, this.name, this.sex, this.mid,
{Key key, this.needBtn})
: super(key: key);
@override
_EditReserverPageSimState createState() => _EditReserverPageSimState();
}
class _EditReserverPageSimState extends State<EditReserverPageSim> {
NotebookDetailModel detailModel;
String nameStr;
FocusNode _nameNode = FocusNode();
FocusNode _phoneNode = FocusNode();
bool showPhoneHistory = false; //显示客户历史记录
EasyContactPicker _contactPicker = EasyContactPicker();
MyTextSelectionControls _myExtendedMaterialTextSelectionControls =
MyTextSelectionControls();
ScrollController _scrollCrl = ScrollController();
MarketingCenterProvider marketingCenterProvider;
@override
void initState() {
super.initState();
_myExtendedMaterialTextSelectionControls =
MyTextSelectionControls(callback: (value) {
// detailModel.phoneController.text = value;
detailModel.phoneController.value = TextEditingValue(
text: value,
selection: TextSelection.fromPosition(TextPosition(
affinity: TextAffinity.downstream,
offset: value.toString().length)));
});
WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.name != '' &&
widget.name != null &&
widget.sex != '' &&
widget.sex != null) {
nameStr = widget.name;
for (var item in detailModel.sexList) {
item['select'] = false;
if (item['code'] == widget.sex) {
item['select'] = true;
}
}
_addNameSuffix(nameStr, _nameSuffix());
setState(() {});
}
getDzSellerConf();
});
}
getDzSellerConf() async {
await marketingCenterProvider.getDzSellerConf(context);
}
_openAddressBook() async {
if (!(await checkContactPermission())) {
PermissionStatus permissionStatus = await contactPermissionStatus();
if (permissionStatus == PermissionStatus.permanentlyDenied) {
//用户选择不在弹出权限提示框
print('never');
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,
onTap: () {
openSetting();
Navigator.pop(context, '');
});
} else {
// 申请权限
bool canContacts = await requestContactPermission();
if (canContacts) {
_getContactData();
} else {
//拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,
onTap: () {
openSetting();
Navigator.pop(context, '');
});
}
}
} else {
_getContactData();
}
}
//处理在线预订
setMessageStatus() {
bus.emit("remove_untreated_message", widget.mid);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"id": widget.mid,
"status": "is_handle"
};
detailModel.setMessageStatus(context, params);
}
_getContactData() async {
Contact contact = await _contactPicker.selectContactWithNative();
setState(() {
String fullName =
contact.fullName.replaceAll(new RegExp(r"\s+\b|\b\s"), "");
String phone =
contact.phoneNumber.replaceAll(new RegExp(r"\s+\b|\b\s"), "");
if (fullName.compareTo(phone) == 0) {
fullName = '';
} else {
fullName = contact.fullName;
}
detailModel.phoneController.text =
contact.phoneNumber.replaceAll(new RegExp(r"\s+"), "");
nameStr = fullName;
// _homeEnterModel.nameController.text = fullName + _nameSuffix();
_addNameSuffix(fullName, _nameSuffix());
});
}
_addNameSuffix(String name, String suffix) {
if (name == detailModel.nameController.text &&
detailModel.nameController.text.endsWith(suffix)) {
return;
}
if (name != '') {
detailModel.nameController.text = name + suffix ?? '';
}
}
//姓名后缀
_nameSuffix() {
for (var item in detailModel.sexList) {
if (item['select'] == true) {
return item['title'];
}
}
}
Widget _callButton(
{GestureTapCallback onPress,
content,
hasLeftBorder = true,
isSelect = false}) {
return InkWell(
onTap: onPress,
child: Container(
width: ScreenUtil().setWidth(84),
height: ScreenUtil().setHeight(48),
decoration: BoxDecoration(
color: isSelect ? MyColours.color_199095 : MyColours.color_fefefe,
border: Border(
bottom: BorderSide(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2)),
top: BorderSide(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2)),
left: hasLeftBorder
? BorderSide(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2))
: BorderSide.none,
right: BorderSide(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2)))),
child: Align(
alignment: Alignment.center,
child: Text(
content,
style: TextStyle(
color: isSelect ? Colors.white : MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
),
),
),
);
}
_getCallLog() async {
List<Picker.PickerItem<dynamic>> data = [];
Iterable<CallLogEntry> result = await CallLogUtils.getCallLog(context);
if (result != null) {
detailModel.userHistorys = [];
List<CallLogEntry> object = Utils.removeDuplicates(result.toList());
detailModel.userHistorys = [];
showPhoneHistory = false;
// setState(() {});
object.forEach((element) {
detailModel.userHistorys.add(UserHistoryEntity(
'', '', element.name ?? '', '1', element.number, '', '', ''));
String title = '';
title += ' ${element.number ?? ''}';
if (element.name != null && element.name != '') {
title += ' ${element.name}';
}
String stateStr = ''; //状态
if (element.callType.name == 'incoming' ||
element.callType.name == 'wifiIncoming' ||
element.callType.name == 'answeredExternally') {
stateStr = ' 呼入';
} else if (element.callType.name == 'outgoing' ||
element.callType.name == 'wifiOutgoing' ||
element.callType.name == 'voiceMail') {
stateStr = ' 呼出';
} else if (element.callType.name == 'missed') {
stateStr = ' 未接';
} else if (element.callType.name == 'rejected') {
stateStr = ' 拒接';
} else if (element.callType.name == 'blocked') {
stateStr = ' 拦截';
}
String sunString =
Utils.formatCallLogFromMill(element.timestamp.toString());
data.add(Picker.PickerItem(
text: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
children: [
HEmptyView(30),
Text(title ?? '',
style: TextStyle(
fontSize: font(16), color: MyColours.color_515151)),
Expanded(
child: Text(stateStr ?? '',
style: TextStyle(
fontSize: font(16),
color: MyColours.color_26000000))),
],
)),
Container(
margin: EdgeInsets.only(right: w(15)),
child: Text(sunString ?? '',
style: TextStyle(
fontSize: font(16), color: MyColours.color_515151)))
],
)));
});
if (data.length > 0) {
//有记录,底部弹窗展示
// showPhoneHistory = true;
// setState(() {});
DialogUtil.showSelectCusmanWidgetDialog(context, data, (value) {
if (value != null) {
_byValueToReqeust(value[0]);
}
}, title: '从通话记录选择客人电话', selecteds: [
// _getFirSelected(hourAndMinute, data),
// _getSecSelected(hourAndMinute)
]).then((value) {
print(value);
});
} else {
Utils.showToast('暂无通话记录!');
}
}
}
_byValueToReqeust(int index) {
setState(() {
showPhoneHistory = false;
UserHistoryEntity userHistoryEntity = detailModel.userHistorys[index];
detailModel.phoneController.text =
userHistoryEntity.phone != null ? userHistoryEntity.phone : '';
for (var item in detailModel.sexList) {
item['select'] = false;
if (item['title'] == userHistoryEntity.sexStr) {
item['select'] = true;
}
}
if ((nameStr != null && nameStr != '') &&
(userHistoryEntity.rname == '' || userHistoryEntity.rname == null)) {
} else {
nameStr = userHistoryEntity.rname;
}
_addNameSuffix(userHistoryEntity.rname, _nameSuffix());
_phoneNode.unfocus();
detailModel.userHistorys.clear();
});
}
@override
Widget build(BuildContext context) {
marketingCenterProvider =
Provider.of<MarketingCenterProvider>(context, listen: true);
detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'录入预订人信息',
onTap: () {
Navigator.pop(context);
},
),
body: Container(
color: MyColours.color_ffffff,
// color: Colors.red,
child: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
if (showPhoneHistory) {
setState(() {
showPhoneHistory = false;
detailModel.userHistorys.clear();
});
}
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: Column(children: [
//第一行 顾客姓名
VEmptyView(40),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: ScreenUtil().setWidth(60),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_efefef))),
child: TextField(
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
controller: detailModel.nameController,
focusNode: _nameNode,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: "客人姓名",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
// border: InputBorder.none,
contentPadding: EdgeInsets.zero,
border: OutlineInputBorder(
borderSide: BorderSide.none),
),
onChanged: (value) {
print('ggg');
if (value.endsWith('先生') ||
value.endsWith('女士') ||
value.endsWith('公司')) {
nameStr = value.substring(
0, value.length - 2);
} else {
nameStr = value;
}
if (detailModel.phoneController.text
.length ==
0 &&
value.length > 0) {
if (marketingCenterProvider.nameSwich) {
detailModel.userHistorys = [];
setState(() {
showPhoneHistory = true;
});
Map<String, String> params = {
"keywords": value,
"sid": Provider.of<UserModel>(
context,
listen: false)
.user
.sellerid,
};
JhCommonUtils.debounce(() =>
detailModel.getUserHistorys(
context, params));
}
} else {
setState(() {
showPhoneHistory = false;
});
}
},
onEditingComplete: () {
print('fff');
_nameNode.unfocus();
// _homeEnterModel.nameController.text =
// nameStr + _nameSuffix();
_addNameSuffix(nameStr, _nameSuffix());
},
keyboardType: TextInputType.text,
),
),
),
// HEmptyView(40),
Row(
children: detailModel.sexList.map((value) {
return _callButton(
onPress: () {
for (var item in detailModel.sexList) {
item['select'] = false;
if (item['title'] == value['title']) {
item['select'] = true;
// _homeEnterModel.nameController.text =
// nameStr + item['title'];
if (nameStr != null &&
nameStr != '') {
_addNameSuffix(
nameStr, item['title']);
}
}
}
detailModel.notifyListeners();
},
content: value['title'],
hasLeftBorder: value['hasLeftBorder'],
isSelect: value['select']);
}).toList()),
],
),
// VEmptyView(30),
// MyDivider(double.infinity,
// ScreenUtil().setWidth(2),
// color:
// MyColours.color_efefef),
//电话
VEmptyView(20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: ScreenUtil().setWidth(60),
decoration: BoxDecoration(
// color: Colors.red,
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color:
MyColours.color_efefef))),
child: TextField(
selectionControls:
_myExtendedMaterialTextSelectionControls,
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
controller: detailModel.phoneController,
focusNode: _phoneNode,
// textAlignVertical: TextAlignVertical.top,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(
11) //限制长度
],
decoration: InputDecoration(
hintText: "电话",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
),
contentPadding: EdgeInsets.zero,
border: OutlineInputBorder(
borderSide: BorderSide.none),
),
onChanged: (value) {
if (value.isEmpty ||
value.length > 11) {
//内容为空,或 超过11位
setState(() {
detailModel.userHistorys.clear();
});
return;
}
if (value.isEmpty || value.length > 0) {
if (marketingCenterProvider
.phoneSwich) {
detailModel.userHistorys = [];
setState(() {
showPhoneHistory = true;
});
Map<String, String> params = {
"keywords": value,
"sid": Provider.of<UserModel>(
context,
listen: false)
.user
.sellerid,
};
JhCommonUtils.debounce(() =>
detailModel.getUserHistorys(
context, params));
}
} else {
setState(() {
showPhoneHistory = false;
});
}
},
onEditingComplete: () {
_phoneNode.unfocus();
},
onTap: () {
// setState(() {
// showPhoneHistory = true;
// });
// Future.delayed(Duration(milliseconds: 300), () {
// _controller.jumpTo(_controller.position.maxScrollExtent);
// });
},
keyboardType:
TextInputType.numberWithOptions(
decimal: true),
)),
),
// InkWell(
// onTap: () {
// _openAddressBook();
// },
// child: Container(
// width: ScreenUtil().setWidth(84) * 3,
// height: ScreenUtil().setWidth(48),
// alignment: Alignment.centerRight,
// child: Text('电话簿',
// style: TextStyle(
// color: MyColours.color_199095,
// fontSize: ScreenUtil().setSp(28),
// decoration:
// TextDecoration.underline)),
// ),
// ),
InkWell(
onTap: () async {
_openAddressBook();
// var result = await CallLogUtil.getCallLog();
// print(result);
},
child: Container(
// color: Colors.red,
width: ScreenUtil().setWidth(64) * 2,
height: ScreenUtil().setWidth(48),
alignment: Alignment.centerRight,
child: Text('电话簿',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(28),
decoration:
TextDecoration.underline)),
),
),
if (Platform.isAndroid)
Row(
children: [
HEmptyView(20),
MyDivider(1.0, ScreenUtil().setWidth(40)),
HEmptyView(20),
InkWell(
onTap: () async {
_getCallLog();
},
child: Container(
// color: Colors.red,
// width: ScreenUtil().setWidth(64) * 2,
height: ScreenUtil().setWidth(48),
alignment: Alignment.centerLeft,
child: Text('通话记录',
style: TextStyle(
color: MyColours.color_199095,
fontSize:
ScreenUtil().setSp(28),
decoration:
TextDecoration.underline)),
),
),
],
)
],
),
],
),
VEmptyView(60),
Stack(
children: [
Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(60)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
RoundButton(
text: '返回',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(180),
radius: ScreenUtil().setWidth(10),
gradientStart: MyColours.color_ffffff,
textColor: MyColours.color_333333,
borderColor: MyColours.color_199095,
gradientEnd: MyColours.color_ffffff,
onPressed: () {
// setState(() {
// nameStr = '';
// detailModel.nameController.text = '';
// detailModel.phoneController.text = '';
// });
Navigator.of(context).pop();
},
),
widget.needBtn
? RoundButton(
text: '保存并发短信',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(200),
radius: ScreenUtil().setWidth(10),
gradientStart: MyColours.color_199095,
textColor: MyColours.color_ffffff,
borderColor: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
onPressed: () async {
if (nameStr == null ||
nameStr.trim().length == 0) {
Utils.showToast('请填写客人姓名');
return;
}
if (detailModel.phoneController.text
.trim()
.length ==
0) {
Utils.showToast('请填写电话');
return;
}
if (!Utils.isInteger(detailModel
.phoneController.text
.replaceAll(' ', ''))) {
Utils.showToast('手机号错误,请修改正确');
return;
}
String sex = '1';
for (var item
in detailModel.sexList) {
if (item['select']) {
sex = item['code'];
}
}
bool sucess =
await detailModel.upReserveInfo(
context, widget.rid,
name: nameStr,
sex: sex,
phone: detailModel
.phoneController.text
.replaceAll(' ', ''),
showLoading: true);
if (sucess) {
bus.emit(
"refresh_tablemanager"); //刷新桌位
bus.emit(
"refresh_book_list"); //刷新已预订列表
bus.emit("refresh_detail");
UserModel userModel =
Provider.of<UserModel>(
context,
listen: false);
Map<String, String> params = {
"rid": widget.rid,
"sid": userModel.user.sellerid
};
CouponProvider couponProvider =
Provider.of<CouponProvider>(
context,
listen: false);
bool success =
await couponProvider
.sendSMSWxSendSms(
context, params);
print(success);
if (success) {
Navigator.of(context).pop(
detailModel
.phoneController.text);
}
}
},
)
: SizedBox(),
RoundButton(
text: widget.needBtn ? '仅保存' : '保存',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(180),
radius: ScreenUtil().setWidth(10),
gradientStart: widget.needBtn
? MyColours.color_ffffff
: MyColours.color_199095,
gradientEnd: widget.needBtn
? MyColours.color_ffffff
: MyColours.color_199095,
textColor: widget.needBtn
? MyColours.color_333333
: MyColours.color_ffffff,
borderColor: MyColours.color_199095,
onPressed: () async {
if (nameStr == null ||
nameStr.trim().length == 0) {
Utils.showToast('请填写客人姓名');
return;
}
if (detailModel.phoneController.text
.trim()
.length >
0) {
if (!Utils.isInteger(detailModel
.phoneController.text
.replaceAll(' ', ''))) {
Utils.showToast('手机号错误,请修改正确');
return;
}
}
String sex = '1';
for (var item in detailModel.sexList) {
if (item['select']) {
sex = item['code'];
}
}
bool sucess = await detailModel
.upReserveInfo(context, widget.rid,
name: nameStr,
sex: sex,
phone: detailModel
.phoneController.text
.replaceAll(' ', ''));
if (sucess) {
if (widget.mid != '' &&
widget.mid != null) {
setMessageStatus();
}
EventBus().emit(
"refresh_tablemanager"); //刷新桌位
bus.emit("refresh_book_list"); //刷新已预订列表
bus.emit("refresh_detail");
Navigator.of(context).pop(
detailModel.phoneController.text);
}
},
)
],
)),
Offstage(
offstage: !(showPhoneHistory &&
detailModel.userHistorys.length > 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.white),
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_e5e5e5,
blurRadius: ScreenUtil().setWidth(20))
]),
width: ScreenUtil().screenWidth - w(60),
// width: ScreenUtil().setWidth(350),
constraints: BoxConstraints(maxHeight: w(270)),
// width: ScreenUtil().setWidth(440),
// height: detailModel.userHistorys.length > 1
// ? ScreenUtil().setWidth(260)
// : ScreenUtil().setWidth(104),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30)),
child: Align(
alignment: Alignment.topCenter,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: Scrollbar(
isAlwaysShown: true, //设置滚动条常亮
controller:
_scrollCrl, //必须设置一个controller
///添加进度条
child: ListView.builder(
shrinkWrap: true,
controller: _scrollCrl,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
_byValueToReqeust(index);
// setState(() {
// showPhoneHistory = false;
// UserHistoryEntity
// userHistoryEntity =
// detailModel
// .userHistorys[
// index];
// if (userHistoryEntity.sex ==
// null ||
// userHistoryEntity.sex ==
// '') {
// userHistoryEntity.sex =
// '1';
// }
// detailModel.phoneController
// .text =
// userHistoryEntity
// .phone !=
// null
// ? userHistoryEntity
// .phone
// : '';
// for (var item in detailModel
// .sexList) {
// item['select'] = false;
// if (item['title'] ==
// userHistoryEntity
// .sexStr) {
// item['select'] = true;
// }
// }
// // _homeEnterModel.nameController.text =
// // _homeEnterModel
// // .userHistorys[index].rname +
// // _nameSuffix();
// _addNameSuffix(
// userHistoryEntity.rname,
// _nameSuffix());
// nameStr =
// userHistoryEntity.rname;
// _phoneNode.unfocus();
// detailModel.userHistorys
// .clear();
// });
},
child: Container(
width: double.infinity,
height: ScreenUtil()
.setWidth(102),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
bottom: (index !=
(detailModel
.userHistorys
.length -
1) &&
detailModel
.userHistorys
.length >
1)
? BorderSide(
color: MyColours
.color_e5e5e5,
width: ScreenUtil()
.setWidth(
2))
: BorderSide
.none)),
child: Align(
alignment:
Alignment.centerLeft,
child: Text(
(_nameNode.hasFocus
? (detailModel
.userHistorys[
index]
.rnameStr ==
null
? ''
: detailModel
.userHistorys[
index]
.rnameStr)
: (detailModel
.userHistorys[
index]
.phone ==
null
? ''
: detailModel
.userHistorys[
index]
.phone)) +
' ' +
(_nameNode.hasFocus
? (detailModel
.userHistorys[
index]
.phone ==
null
? ''
: detailModel
.userHistorys[
index]
.phone)
: (detailModel
.userHistorys[
index]
.rnameStr ==
null
? ''
: detailModel
.userHistorys[
index]
.rnameStr)) +
' ' +
detailModel
.userHistorys[
index]
.nickName,
style: TextStyle(
color: MyColours
.color_333333,
fontSize:
ScreenUtil()
.setSp(32)),
)),
),
);
},
itemExtent:
ScreenUtil().setWidth(104),
itemCount:
detailModel.userHistorys.length,
)))),
),
),
],
),
])))));
}
}
... ...