Showing
18 changed files
with
4796 additions
and
25 deletions
Too many changes to show.
To preserve performance only 18 of 18+ files are displayed.
| @@ -60,7 +60,7 @@ class Notebook { | @@ -60,7 +60,7 @@ class Notebook { | ||
| 60 | String name; | 60 | String name; |
| 61 | OrderInfo orderInfo; | 61 | OrderInfo orderInfo; |
| 62 | String nick_name; | 62 | String nick_name; |
| 63 | - bool issimple; | 63 | + bool issimple = false; |
| 64 | 64 | ||
| 65 | String orderID; | 65 | String orderID; |
| 66 | String orderRID; | 66 | String orderRID; |
| @@ -140,7 +140,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { | @@ -140,7 +140,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { | ||
| 140 | // userModel.initUser(); | 140 | // userModel.initUser(); |
| 141 | if (App.sp.getBool("isLogin") ?? false) { | 141 | if (App.sp.getBool("isLogin") ?? false) { |
| 142 | Future.delayed(Duration(milliseconds: 200), () { | 142 | Future.delayed(Duration(milliseconds: 200), () { |
| 143 | - NavigatorUtil.goHomePage(context); | 143 | + // NavigatorUtil.goHomePage(context); |
| 144 | + NavigatorUtil.goHomePageSim(context); | ||
| 144 | }); | 145 | }); |
| 145 | } else { | 146 | } else { |
| 146 | _checkWechat(); | 147 | _checkWechat(); |
| @@ -64,14 +64,14 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -64,14 +64,14 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 64 | StartingDayOfWeek startingDayOfWeek; | 64 | StartingDayOfWeek startingDayOfWeek; |
| 65 | bool clearSel = false; | 65 | bool clearSel = false; |
| 66 | bool isall = true; | 66 | bool isall = true; |
| 67 | - bool isSimple = true; | 67 | + |
| 68 | NoteBookModel noteBookModel; | 68 | NoteBookModel noteBookModel; |
| 69 | 69 | ||
| 70 | @override | 70 | @override |
| 71 | void initState() { | 71 | void initState() { |
| 72 | // TODO: implement initState | 72 | // TODO: implement initState |
| 73 | super.initState(); | 73 | super.initState(); |
| 74 | - isSimple = App.sp.getBool("isSimple") ?? true; | 74 | + noteBookModel.isSimple = App.sp.getBool("isSimple") ?? true; |
| 75 | tabIndex = widget.tabIndex; | 75 | tabIndex = widget.tabIndex; |
| 76 | LogUtil.v("notebook_page initState"); | 76 | LogUtil.v("notebook_page initState"); |
| 77 | 77 | ||
| @@ -226,7 +226,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -226,7 +226,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 226 | 226 | ||
| 227 | await noteBookModel.getReserveList(context, params, | 227 | await noteBookModel.getReserveList(context, params, |
| 228 | needLoading: needLoading, showLoading: showLoading); | 228 | needLoading: needLoading, showLoading: showLoading); |
| 229 | - _simpleState(); | 229 | + // _simpleState(); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | 232 | ||
| @@ -529,19 +529,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -529,19 +529,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 529 | // return container; | 529 | // return container; |
| 530 | // } | 530 | // } |
| 531 | 531 | ||
| 532 | - _simpleState() { | ||
| 533 | - if (noteBookModel.notebooks.length > 0) { | ||
| 534 | - if (isSimple) { | ||
| 535 | - for (Notebook item in noteBookModel.notebooks) { | ||
| 536 | - item.issimple = true; | ||
| 537 | - } | ||
| 538 | - } else { | ||
| 539 | - for (Notebook item in noteBookModel.notebooks) { | ||
| 540 | - item.issimple = false; | ||
| 541 | - } | ||
| 542 | - } | ||
| 543 | - } | ||
| 544 | - } | 532 | + |
| 545 | 533 | ||
| 546 | //获取全选按钮的状态 true or false | 534 | //获取全选按钮的状态 true or false |
| 547 | getCheckValue() { | 535 | getCheckValue() { |
| @@ -549,12 +537,12 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -549,12 +537,12 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 549 | return value.issimple == false; | 537 | return value.issimple == false; |
| 550 | }); | 538 | }); |
| 551 | if (temp == true) { | 539 | if (temp == true) { |
| 552 | - isSimple = false; | 540 | + noteBookModel.isSimple = false; |
| 553 | } else { | 541 | } else { |
| 554 | - isSimple = true; | 542 | + noteBookModel.isSimple = true; |
| 555 | } | 543 | } |
| 556 | setState(() {}); | 544 | setState(() {}); |
| 557 | - App.sp.setBool("isSimple", isSimple); | 545 | + App.sp.setBool("isSimple", noteBookModel.isSimple); |
| 558 | } | 546 | } |
| 559 | 547 | ||
| 560 | ///单个item切换模式 | 548 | ///单个item切换模式 |
| @@ -1067,10 +1055,10 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -1067,10 +1055,10 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 1067 | InkWell( | 1055 | InkWell( |
| 1068 | onTap: () { | 1056 | onTap: () { |
| 1069 | setState(() { | 1057 | setState(() { |
| 1070 | - isSimple = !isSimple; | 1058 | + noteBookModel.isSimple = ! noteBookModel.isSimple; |
| 1071 | }); | 1059 | }); |
| 1072 | - _simpleState(); | ||
| 1073 | - App.sp.setBool("isSimple", isSimple); | 1060 | + noteBookModel.simpleState(); |
| 1061 | + App.sp.setBool("isSimple", noteBookModel.isSimple); | ||
| 1074 | }, | 1062 | }, |
| 1075 | child: Column( | 1063 | child: Column( |
| 1076 | children: [ | 1064 | children: [ |
| @@ -1084,7 +1072,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -1084,7 +1072,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 1084 | VEmptyView(16), | 1072 | VEmptyView(16), |
| 1085 | Image.asset( | 1073 | Image.asset( |
| 1086 | Utils.getImgPath( | 1074 | Utils.getImgPath( |
| 1087 | - isSimple ? 'f_swich_on' : 'f_swich_off'), | 1075 | + noteBookModel.isSimple ? 'f_swich_on' : 'f_swich_off'), |
| 1088 | width: ScreenUtil().setWidth(24 * 2)) | 1076 | width: ScreenUtil().setWidth(24 * 2)) |
| 1089 | ], | 1077 | ], |
| 1090 | )), | 1078 | )), |
| 1 | +// import 'dart:io'; | ||
| 2 | + | ||
| 3 | +// import 'package:flutter/material.dart'; | ||
| 4 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 5 | +// import 'package:one_key/app.dart'; | ||
| 6 | +// import 'package:one_key/models/get_seller_info_model.dart'; | ||
| 7 | +// import 'package:one_key/models/user.dart'; | ||
| 8 | +// import 'package:one_key/provider/create_store_model.dart'; | ||
| 9 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 10 | +// import 'package:one_key/res/colors.dart'; | ||
| 11 | +// import 'package:one_key/utils/utils.dart'; | ||
| 12 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 13 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 14 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 15 | +// import 'package:provider/provider.dart'; | ||
| 16 | +// import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; | ||
| 17 | + | ||
| 18 | +// import '../../utils/event_bus.dart'; | ||
| 19 | + | ||
| 20 | +// class CompleteCreateStorePage extends StatefulWidget { | ||
| 21 | +// CompleteCreateStorePageSim({Key key}) : super(key: key); | ||
| 22 | + | ||
| 23 | +// @override | ||
| 24 | +// _CompleteCreateStorePageState createState() => | ||
| 25 | +// _CompleteCreateStorePageState(); | ||
| 26 | +// } | ||
| 27 | + | ||
| 28 | +// class _CompleteCreateStorePageState extends State<CompleteCreateStorePage> { | ||
| 29 | +// ///进入某个店铺 | ||
| 30 | +// // _loginStore(context, CheckSellerAccSunModel sunModel) { | ||
| 31 | +// // UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 32 | +// // Map<String, dynamic> seller = sunModel.toJson(); | ||
| 33 | +// // Map<String, dynamic> userMap = { | ||
| 34 | +// // "openid": seller['uid'], | ||
| 35 | +// // "account": seller['account'], | ||
| 36 | +// // "role_name": seller['role_name'], | ||
| 37 | +// // "sellerid": seller['id'], | ||
| 38 | +// // "sellercode": seller['seller_code'], | ||
| 39 | +// // "sellername": seller['sellername'], | ||
| 40 | +// // "sellerphone": seller['seller_tel'], | ||
| 41 | +// // "sellerAddr": '', | ||
| 42 | +// // "scatter": 0, | ||
| 43 | +// // "room": 0, | ||
| 44 | +// // "cassette": 0, | ||
| 45 | +// // "morning": "", | ||
| 46 | +// // "noon": "", | ||
| 47 | +// // "night": "", | ||
| 48 | +// // }; | ||
| 49 | +// // userModel.saveUserInfo(User.fromJson(userMap)); | ||
| 50 | +// // userModel.getSellerInfo( | ||
| 51 | +// // context, | ||
| 52 | +// // {"seller_id": seller['id'], "seller_openid": seller['openid']}, | ||
| 53 | +// // userMap); | ||
| 54 | +// // } | ||
| 55 | + | ||
| 56 | +// ///通过sellerid获取店铺和当前登录人的基本信息 | ||
| 57 | +// _getSellerAndUserData() async { | ||
| 58 | +// CreateStoreModel createStoreModel = | ||
| 59 | +// Provider.of<CreateStoreModel>(context, listen: false); | ||
| 60 | +// Map<String, String> params = { | ||
| 61 | +// "sellerid": createStoreModel.storeInfo.sellerid, | ||
| 62 | +// "openid": App.sp.getString("openid") | ||
| 63 | +// }; | ||
| 64 | + | ||
| 65 | +// await createStoreModel.getStoreInfo(context, params); | ||
| 66 | +// GetSellerInfoSunModel infoSunModel = | ||
| 67 | +// await createStoreModel.getSellerById(context); | ||
| 68 | +// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 69 | +// Map<String, dynamic> seller = infoSunModel.data.toJson(); | ||
| 70 | +// Map<String, dynamic> user; //= baseResp.data[0]["user"] | ||
| 71 | + | ||
| 72 | +// App.sp.setBool("accountLogin", false); | ||
| 73 | +// if (Platform.isIOS) { | ||
| 74 | +// XgFlutterPlugin().stopXg(); | ||
| 75 | +// } | ||
| 76 | +// if (App.sp.containsKey('table_list')) { | ||
| 77 | +// //退出清空桌位数据 | ||
| 78 | +// App.sp.remove('table_list'); | ||
| 79 | +// } | ||
| 80 | +// if (App.sp.containsKey('specid')) { | ||
| 81 | +// //退出清空销售计价 | ||
| 82 | +// App.sp.remove('specid'); | ||
| 83 | +// App.sp.remove('specs'); | ||
| 84 | +// } | ||
| 85 | +// if (App.sp.containsKey('sellerEdate')) { | ||
| 86 | +// //退出清空店铺过期数据缓存 | ||
| 87 | +// App.sp.remove('sellerEdate'); | ||
| 88 | +// } | ||
| 89 | +// bus.emit('refresh_token'); | ||
| 90 | +// Map<String, dynamic> userMap = { | ||
| 91 | +// "sellerimage": seller['seller_image'], | ||
| 92 | + | ||
| 93 | +// // "sellerphone": seller['seller_tel'], | ||
| 94 | +// "sellerAddr": '', | ||
| 95 | +// "scatter": 0, | ||
| 96 | +// "room": 0, | ||
| 97 | +// "cassette": 0, | ||
| 98 | +// "openid": createStoreModel.userCreateStore.id, | ||
| 99 | +// "account": createStoreModel.userCreateStore.account, | ||
| 100 | +// "role_name": createStoreModel.userCreateStore.role_name, | ||
| 101 | +// "sellerid": createStoreModel.userCreateStore.sellerid, | ||
| 102 | +// "sellercode": createStoreModel.userCreateStore.seller_code, | ||
| 103 | +// "sellername": seller['sellername'], | ||
| 104 | +// "sellerphone": seller['phone'], | ||
| 105 | +// "sellerAddr": '', | ||
| 106 | +// "scatter": 0, | ||
| 107 | +// "room": 0, | ||
| 108 | +// "cassette": 0, | ||
| 109 | +// "morning": "", | ||
| 110 | +// "noon": "", | ||
| 111 | +// "night": "", | ||
| 112 | +// // 'userphone': user['phone'], | ||
| 113 | +// 'token': createStoreModel.userCreateStore.user_token, | ||
| 114 | +// 'nickname': createStoreModel.userCreateStore.nick_name, | ||
| 115 | +// 'edate': seller['edate'] | ||
| 116 | +// }; | ||
| 117 | + | ||
| 118 | +// userModel.saveUserInfo(User.fromJson(userMap)); | ||
| 119 | +// userModel.getSellerInfo( | ||
| 120 | +// context, | ||
| 121 | +// {"seller_id": seller['id'], "seller_openid": seller['openid']}, | ||
| 122 | +// userMap); | ||
| 123 | +// } | ||
| 124 | + | ||
| 125 | +// @override | ||
| 126 | +// Widget build(BuildContext context) { | ||
| 127 | +// return Scaffold( | ||
| 128 | +// backgroundColor: Colors.white, | ||
| 129 | +// appBar: SystemAppBar( | ||
| 130 | +// '', | ||
| 131 | +// onTap: () { | ||
| 132 | +// Navigator.pop(context); | ||
| 133 | +// }, | ||
| 134 | +// ), | ||
| 135 | +// body: InkWell( | ||
| 136 | +// onTap: () { | ||
| 137 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 138 | +// }, | ||
| 139 | +// child: Container( | ||
| 140 | +// padding: EdgeInsets.symmetric( | ||
| 141 | +// horizontal: ScreenUtil().setWidth(70), | ||
| 142 | +// vertical: ScreenUtil().setWidth(80)), | ||
| 143 | +// child: SingleChildScrollView( | ||
| 144 | +// child: Column( | ||
| 145 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 146 | +// children: [ | ||
| 147 | +// Image.asset( | ||
| 148 | +// Utils.getImgPath('complete'), | ||
| 149 | +// width: ScreenUtil().setWidth(120), | ||
| 150 | +// ), | ||
| 151 | +// VEmptyView(60), | ||
| 152 | +// Text( | ||
| 153 | +// '店铺已创建成功', | ||
| 154 | +// style: TextStyle( | ||
| 155 | +// fontWeight: FontWeight.bold, | ||
| 156 | +// fontSize: ScreenUtil().setSp(32), | ||
| 157 | +// color: MyColours.color_333333), | ||
| 158 | +// ), | ||
| 159 | +// VEmptyView(220), | ||
| 160 | +// // RoundButton( | ||
| 161 | +// // radius: ScreenUtil().setWidth(10), | ||
| 162 | +// // text: '继续创建桌位', | ||
| 163 | +// // fontSize: 34, | ||
| 164 | +// // gradientStart: MyColours.color_2AB5B7, | ||
| 165 | +// // gradientEnd: MyColours.color_2AB5B7, | ||
| 166 | +// // onPressed: () {}, | ||
| 167 | +// // isBold: false, | ||
| 168 | +// // ), | ||
| 169 | +// // VEmptyView(20), | ||
| 170 | +// RoundButton( | ||
| 171 | +// radius: ScreenUtil().setWidth(10), | ||
| 172 | +// text: '进入店铺', | ||
| 173 | +// fontSize: 34, | ||
| 174 | +// textColor: MyColours.color_2AB5B7, | ||
| 175 | +// gradientStart: Colors.white, | ||
| 176 | +// gradientEnd: Colors.white, | ||
| 177 | +// borderColor: MyColours.color_2AB5B7, | ||
| 178 | +// onPressed: () { | ||
| 179 | +// _getSellerAndUserData(); | ||
| 180 | +// }, | ||
| 181 | +// isBold: false, | ||
| 182 | +// ), | ||
| 183 | +// ]))))); | ||
| 184 | +// } | ||
| 185 | +// } |
lib/pages_sim/create_store/create_store.dart
0 → 100644
| 1 | +// import 'dart:io'; | ||
| 2 | + | ||
| 3 | +// import 'package:flutter/material.dart'; | ||
| 4 | +// import 'package:flutter_native_image/flutter_native_image.dart'; | ||
| 5 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 6 | +// import 'package:image_picker/image_picker.dart'; | ||
| 7 | +// import 'package:one_key/models/upload_img_model.dart'; | ||
| 8 | +// import 'package:one_key/pages_sim/create_store/video_widget.dart'; | ||
| 9 | +// import 'package:one_key/pages_sim/online_check/img_picker_widget.dart'; | ||
| 10 | +// import 'package:one_key/pages_sim/online_check/photo_view_wiget.dart'; | ||
| 11 | +// import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 12 | +// import 'package:one_key/res/colors.dart'; | ||
| 13 | +// import 'package:one_key/utils/dialog_util.dart'; | ||
| 14 | +// import 'package:one_key/utils/misc.dart'; | ||
| 15 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 16 | +// import 'package:one_key/utils/upload_image_util.dart'; | ||
| 17 | +// import 'package:one_key/utils/utils.dart'; | ||
| 18 | +// import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 19 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 20 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 21 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 22 | +// import 'package:permission_handler/permission_handler.dart'; | ||
| 23 | +// import 'package:provider/provider.dart'; | ||
| 24 | + | ||
| 25 | +// class CreateStorePage extends StatefulWidget { | ||
| 26 | +// CreateStorePageSim({Key key}) : super(key: key); | ||
| 27 | + | ||
| 28 | +// @override | ||
| 29 | +// _CreateStorePageState createState() => _CreateStorePageState(); | ||
| 30 | +// } | ||
| 31 | + | ||
| 32 | +// class _CreateStorePageState extends State<CreateStorePage> { | ||
| 33 | +// ScrollController _controller; | ||
| 34 | +// List<Map> roomType = []; | ||
| 35 | +// final picker = ImagePicker(); | ||
| 36 | + | ||
| 37 | +// String storeAddress = '选择地址'; | ||
| 38 | + | ||
| 39 | +// @override | ||
| 40 | +// void initState() { | ||
| 41 | +// // TODO: implement initState | ||
| 42 | +// super.initState(); | ||
| 43 | +// _controller = ScrollController(); | ||
| 44 | +// for (int i = 0; i < 8; i++) { | ||
| 45 | +// roomType.add({ | ||
| 46 | +// '$i': {'name': '${i + 3}人间', 'check': true} | ||
| 47 | +// }); | ||
| 48 | +// } | ||
| 49 | +// } | ||
| 50 | + | ||
| 51 | +// List<Widget> _roomTypeWidget() { | ||
| 52 | +// List<Widget> list = []; | ||
| 53 | +// for (int i = 0; i < roomType.length; i++) { | ||
| 54 | +// list.add(CheckboxListTile( | ||
| 55 | +// value: roomType[i]['$i']['check'], | ||
| 56 | +// title: Text(roomType[i]['$i']['name']), | ||
| 57 | +// onChanged: (value) { | ||
| 58 | +// setState(() { | ||
| 59 | +// roomType[i]['$i']['check'] = !roomType[i]['$i']['check']; | ||
| 60 | +// }); | ||
| 61 | +// })); | ||
| 62 | +// } | ||
| 63 | +// return list; | ||
| 64 | +// } | ||
| 65 | + | ||
| 66 | +// ///店铺电话 | ||
| 67 | +// Widget _storePhoneWidget() { | ||
| 68 | +// return Column( | ||
| 69 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 70 | +// children: [ | ||
| 71 | +// Text('2.您店铺的电话是?', | ||
| 72 | +// style: TextStyle( | ||
| 73 | +// fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)), | ||
| 74 | +// VEmptyView(30), | ||
| 75 | +// TextField( | ||
| 76 | +// // textAlignVertical: TextAlignVertical.bottom, | ||
| 77 | +// maxLines: 1, | ||
| 78 | +// // //光标颜色 | ||
| 79 | +// // cursorColor: | ||
| 80 | +// // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 81 | +// //输入文本的样式 | ||
| 82 | +// style: TextStyle( | ||
| 83 | +// fontSize: ScreenUtil().setSp(28), | ||
| 84 | +// ), | ||
| 85 | +// // focusNode: _codeNode, | ||
| 86 | +// decoration: InputDecoration( | ||
| 87 | +// contentPadding: EdgeInsets.symmetric( | ||
| 88 | +// vertical: ScreenUtil().setWidth(6), | ||
| 89 | +// horizontal: ScreenUtil().setWidth(20)), | ||
| 90 | +// border: OutlineInputBorder(), | ||
| 91 | +// hintText: '请输入店铺接单电话', | ||
| 92 | +// hintStyle: TextStyle( | ||
| 93 | +// color: MyColours.color_999999, | ||
| 94 | +// fontSize: ScreenUtil().setSp(28), | ||
| 95 | +// ), | ||
| 96 | +// // enabledBorder: new UnderlineInputBorder( | ||
| 97 | +// // borderSide: BorderSide.none, | ||
| 98 | +// // ), | ||
| 99 | +// focusedBorder: OutlineInputBorder( | ||
| 100 | +// borderSide: BorderSide(color: MyColours.color_199095)), | ||
| 101 | +// ), | ||
| 102 | +// onChanged: (value) {}, | ||
| 103 | +// onEditingComplete: () { | ||
| 104 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 105 | +// }, | ||
| 106 | +// keyboardType: TextInputType.text, | ||
| 107 | +// ) | ||
| 108 | +// ], | ||
| 109 | +// ); | ||
| 110 | +// } | ||
| 111 | + | ||
| 112 | +// Widget _storeNameWidget() { | ||
| 113 | +// return Column( | ||
| 114 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 115 | +// children: [ | ||
| 116 | +// Text('1.您店铺的名称是?', | ||
| 117 | +// style: TextStyle( | ||
| 118 | +// fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)), | ||
| 119 | +// VEmptyView(30), | ||
| 120 | +// TextField( | ||
| 121 | +// // textAlignVertical: TextAlignVertical.bottom, | ||
| 122 | +// maxLines: 1, | ||
| 123 | +// // //光标颜色 | ||
| 124 | +// // cursorColor: | ||
| 125 | +// // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 126 | +// //输入文本的样式 | ||
| 127 | +// style: TextStyle( | ||
| 128 | +// fontSize: ScreenUtil().setSp(28), | ||
| 129 | +// ), | ||
| 130 | +// // focusNode: _codeNode, | ||
| 131 | +// decoration: InputDecoration( | ||
| 132 | +// contentPadding: EdgeInsets.symmetric( | ||
| 133 | +// vertical: ScreenUtil().setWidth(6), | ||
| 134 | +// horizontal: ScreenUtil().setWidth(20)), | ||
| 135 | +// border: OutlineInputBorder(), | ||
| 136 | +// hintText: '请输入店铺名称', | ||
| 137 | +// hintStyle: TextStyle( | ||
| 138 | +// color: MyColours.color_999999, | ||
| 139 | +// fontSize: ScreenUtil().setSp(28), | ||
| 140 | +// ), | ||
| 141 | +// // enabledBorder: new UnderlineInputBorder( | ||
| 142 | +// // borderSide: BorderSide.none, | ||
| 143 | +// // ), | ||
| 144 | +// focusedBorder: OutlineInputBorder( | ||
| 145 | +// borderSide: BorderSide(color: MyColours.color_199095)), | ||
| 146 | +// ), | ||
| 147 | +// onChanged: (value) {}, | ||
| 148 | +// onEditingComplete: () { | ||
| 149 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 150 | +// }, | ||
| 151 | +// keyboardType: TextInputType.text, | ||
| 152 | +// ) | ||
| 153 | +// ], | ||
| 154 | +// ); | ||
| 155 | +// } | ||
| 156 | + | ||
| 157 | +// //查看大图 | ||
| 158 | +// _showPhotoView(BuildContext context, int index, List imgs, | ||
| 159 | +// {isShow = false, List dashName}) async { | ||
| 160 | +// // if (imgs.length == 1 && | ||
| 161 | +// // imgs[0] == | ||
| 162 | +// // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') { | ||
| 163 | +// // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png'; | ||
| 164 | +// // } | ||
| 165 | +// Utils.setBarStatus(false, color: Colors.black); | ||
| 166 | +// dynamic result = await showGeneralDialog( | ||
| 167 | +// context: context, | ||
| 168 | +// barrierDismissible: false, | ||
| 169 | +// // barrierColor: Colors.red, | ||
| 170 | +// barrierLabel: | ||
| 171 | +// MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 172 | +// transitionDuration: const Duration(milliseconds: 150), | ||
| 173 | +// pageBuilder: (BuildContext context, Animation animation, | ||
| 174 | +// Animation secondaryAnimation) { | ||
| 175 | +// Widget child = Stack( | ||
| 176 | +// children: <Widget>[ | ||
| 177 | +// PhotoPreview( | ||
| 178 | +// initialIndex: index, | ||
| 179 | +// photoList: imgs, | ||
| 180 | +// isShow: isShow, | ||
| 181 | +// dashName: dashName) | ||
| 182 | +// ], | ||
| 183 | +// ); | ||
| 184 | +// return child; | ||
| 185 | +// }); | ||
| 186 | +// Utils.setBarStatus(true, color: Colors.white); | ||
| 187 | +// } | ||
| 188 | + | ||
| 189 | +// ///#相机拍照,单图选择 | ||
| 190 | +// Future _getFromPictureOrCamera(String title, UploadImgModel imgModel, | ||
| 191 | +// imageSource, UploadImageProvider model) async { | ||
| 192 | +// final pickedFile = await picker.pickImage(source: imageSource); | ||
| 193 | +// File compressedFile = await FlutterNativeImage.compressImage( | ||
| 194 | +// pickedFile.path, | ||
| 195 | +// quality: 70, | ||
| 196 | +// percentage: 50); | ||
| 197 | +// setState(() { | ||
| 198 | +// if (pickedFile != null) { | ||
| 199 | +// imgModel.file = File(pickedFile.path); | ||
| 200 | +// imgModel.process = 0.01; | ||
| 201 | +// } else { | ||
| 202 | +// print('No image selected.'); | ||
| 203 | +// } | ||
| 204 | +// }); | ||
| 205 | +// if (pickedFile != null) { | ||
| 206 | +// model.imgSizeTouxiang = 76; | ||
| 207 | +// model.touxiang.qiniuUrl = null; | ||
| 208 | +// bool need = await Utils.sizeNeed(File(pickedFile.path)); | ||
| 209 | +// File file = File(pickedFile.path); | ||
| 210 | +// if (need) { | ||
| 211 | +// file = File(compressedFile.absolute.path); | ||
| 212 | +// } | ||
| 213 | +// UploadImageUtil().startUpload(context, file, title == '头像' ? 0 : 1, true, | ||
| 214 | +// model, UploadType.StoreFrontUploadType); | ||
| 215 | +// } | ||
| 216 | +// } | ||
| 217 | + | ||
| 218 | +// // ///门头照片 | ||
| 219 | +// // Widget _imageWidget(String title, UploadImgModel uploadImgModel, | ||
| 220 | +// // double imgSize, double radius) { | ||
| 221 | +// // return Consumer<UploadImageProvider>(builder: (context, model, _) { | ||
| 222 | +// // return InkWell( | ||
| 223 | +// // onTap: () { | ||
| 224 | +// // Utils.getPickPermission(context, () { | ||
| 225 | +// // _getFromPictureOrCamera( | ||
| 226 | +// // title, uploadImgModel, ImageSource.gallery, model); | ||
| 227 | +// // }, PermissionGroup.photos); | ||
| 228 | +// // }, | ||
| 229 | +// // child: Container( | ||
| 230 | +// // height: ScreenUtil().setWidth(imgSize * 2), | ||
| 231 | +// // child: Row( | ||
| 232 | +// // mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 233 | +// // children: [ | ||
| 234 | +// // Text( | ||
| 235 | +// // title, | ||
| 236 | +// // textAlign: TextAlign.left, | ||
| 237 | +// // style: TextStyle( | ||
| 238 | +// // color: MyColours.color_333333, | ||
| 239 | +// // fontWeight: FontWeight.bold, | ||
| 240 | +// // fontSize: ScreenUtil().setSp(34)), | ||
| 241 | +// // ), | ||
| 242 | +// // Spacer(), | ||
| 243 | +// // Stack( | ||
| 244 | +// // children: [ | ||
| 245 | +// // InkWell( | ||
| 246 | +// // onTap: () { | ||
| 247 | +// // double process; | ||
| 248 | +// // String qiniuUrl; | ||
| 249 | +// // List<String> tempList = []; | ||
| 250 | + | ||
| 251 | +// // process = model.erweima.process; | ||
| 252 | +// // qiniuUrl = model.erweima.qiniuUrl; | ||
| 253 | + | ||
| 254 | +// // if (qiniuUrl != null && qiniuUrl != '') { | ||
| 255 | +// // tempList.add(qiniuUrl); | ||
| 256 | + | ||
| 257 | +// // ///没有上传完成的不可以点击 | ||
| 258 | +// // _showPhotoView(context, 0, tempList); | ||
| 259 | +// // } else { | ||
| 260 | +// // Utils.getPickPermission(context, () { | ||
| 261 | +// // _getFromPictureOrCamera(title, uploadImgModel, | ||
| 262 | +// // ImageSource.gallery, model); | ||
| 263 | +// // }, PermissionGroup.photos); | ||
| 264 | +// // } | ||
| 265 | +// // }, | ||
| 266 | +// // child: ClipRRect( | ||
| 267 | +// // borderRadius: BorderRadius.circular( | ||
| 268 | +// // ScreenUtil().setWidth(radius)), | ||
| 269 | +// // child: uploadImgModel.file == null | ||
| 270 | +// // ? uploadImgModel.qiniuUrl != null && | ||
| 271 | +// // uploadImgModel.qiniuUrl != '' | ||
| 272 | +// // ? Image.network( | ||
| 273 | +// // uploadImgModel.qiniuUrl, | ||
| 274 | +// // fit: BoxFit.cover, | ||
| 275 | +// // width: ScreenUtil().setWidth(imgSize * 2), | ||
| 276 | +// // height: ScreenUtil().setWidth(imgSize * 2), | ||
| 277 | +// // ) | ||
| 278 | +// // : Image.asset( | ||
| 279 | +// // Utils.getImgPath( | ||
| 280 | +// // title == '头像' ? 'touxiang' : 'erweima'), | ||
| 281 | +// // fit: BoxFit.cover, | ||
| 282 | +// // width: ScreenUtil().setWidth(imgSize * 2), | ||
| 283 | +// // height: ScreenUtil().setWidth(imgSize * 2), | ||
| 284 | +// // ) | ||
| 285 | +// // : Image.file( | ||
| 286 | +// // uploadImgModel.file, | ||
| 287 | +// // fit: BoxFit.cover, | ||
| 288 | +// // width: ScreenUtil().setWidth(imgSize * 2), | ||
| 289 | +// // height: ScreenUtil().setWidth(imgSize * 2), | ||
| 290 | +// // ), | ||
| 291 | +// // ), | ||
| 292 | +// // ), | ||
| 293 | +// // (uploadImgModel.file != null) && | ||
| 294 | +// // uploadImgModel.process != 1 && | ||
| 295 | +// // uploadImgModel.process != 0.01 | ||
| 296 | +// // ? Container( | ||
| 297 | +// // width: ScreenUtil().setWidth(imgSize * 2), | ||
| 298 | +// // height: ScreenUtil().setWidth(imgSize * 2), | ||
| 299 | +// // decoration: BoxDecoration( | ||
| 300 | +// // borderRadius: BorderRadius.circular(radius), | ||
| 301 | +// // color: Color.fromRGBO(0, 0, 0, 0.6)), | ||
| 302 | +// // child: Center( | ||
| 303 | +// // child: Text('上传中', | ||
| 304 | +// // style: | ||
| 305 | +// // TextStyle(color: MyColours.color_999999)), | ||
| 306 | +// // ), | ||
| 307 | +// // ) | ||
| 308 | +// // : Container(), | ||
| 309 | +// // ], | ||
| 310 | +// // ), | ||
| 311 | +// // HEmptyView(30), | ||
| 312 | +// // Image.asset( | ||
| 313 | +// // "assets/arr_right_gray.png", | ||
| 314 | +// // width: ScreenUtil().setWidth(14), | ||
| 315 | +// // height: ScreenUtil().setWidth(22), | ||
| 316 | +// // ) | ||
| 317 | +// // ], | ||
| 318 | +// // ), | ||
| 319 | +// // )); | ||
| 320 | +// // }); | ||
| 321 | +// // } | ||
| 322 | + | ||
| 323 | +// //店铺地址 | ||
| 324 | +// Widget _addressWidget() { | ||
| 325 | +// return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ | ||
| 326 | +// Text('2.您的店铺位置在?', | ||
| 327 | +// style: TextStyle( | ||
| 328 | +// fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)), | ||
| 329 | +// VEmptyView(30), | ||
| 330 | +// InkWell( | ||
| 331 | +// onTap: () async { | ||
| 332 | +// Utils.getPickPermission(context, () async { | ||
| 333 | +// Map address = await NavigatorUtil.goMapChoicePointPageSim(context); | ||
| 334 | +// if (address != null) { | ||
| 335 | +// setState(() { | ||
| 336 | +// storeAddress = address['address']; | ||
| 337 | +// // 'address': | ||
| 338 | +// // 'lat': | ||
| 339 | +// // 'lng | ||
| 340 | +// }); | ||
| 341 | +// } | ||
| 342 | +// }, Permission.location); | ||
| 343 | +// // bool canContacts = | ||
| 344 | +// // await requestPermission(PermissionGroup.locationWhenInUse); | ||
| 345 | +// // print(canContacts); | ||
| 346 | +// }, | ||
| 347 | +// child: Text(storeAddress), | ||
| 348 | +// ) | ||
| 349 | +// ]); | ||
| 350 | +// } | ||
| 351 | + | ||
| 352 | +// //职位 | ||
| 353 | +// Widget _positionWidget() { | ||
| 354 | +// return Column( | ||
| 355 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 356 | +// children: [ | ||
| 357 | +// Text('3.您在店铺中担任什么职位?', | ||
| 358 | +// style: TextStyle( | ||
| 359 | +// fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)), | ||
| 360 | +// VEmptyView(30), | ||
| 361 | +// TextField( | ||
| 362 | +// // textAlignVertical: TextAlignVertical.bottom, | ||
| 363 | +// maxLines: 1, | ||
| 364 | +// // //光标颜色 | ||
| 365 | +// // cursorColor: | ||
| 366 | +// // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 367 | +// //输入文本的样式 | ||
| 368 | +// style: TextStyle( | ||
| 369 | +// fontSize: ScreenUtil().setSp(28), | ||
| 370 | +// ), | ||
| 371 | +// // focusNode: _codeNode, | ||
| 372 | +// decoration: InputDecoration( | ||
| 373 | +// contentPadding: EdgeInsets.symmetric( | ||
| 374 | +// vertical: ScreenUtil().setWidth(6), | ||
| 375 | +// horizontal: ScreenUtil().setWidth(20)), | ||
| 376 | +// border: OutlineInputBorder(), | ||
| 377 | +// hintText: '请输入职位', | ||
| 378 | +// hintStyle: TextStyle( | ||
| 379 | +// color: MyColours.color_999999, | ||
| 380 | +// fontSize: ScreenUtil().setSp(28), | ||
| 381 | +// ), | ||
| 382 | +// // enabledBorder: new UnderlineInputBorder( | ||
| 383 | +// // borderSide: BorderSide.none, | ||
| 384 | +// // ), | ||
| 385 | +// focusedBorder: OutlineInputBorder( | ||
| 386 | +// borderSide: BorderSide(color: MyColours.color_199095)), | ||
| 387 | +// ), | ||
| 388 | +// onChanged: (value) {}, | ||
| 389 | +// onEditingComplete: () { | ||
| 390 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 391 | +// }, | ||
| 392 | +// keyboardType: TextInputType.text, | ||
| 393 | +// ) | ||
| 394 | +// ], | ||
| 395 | +// ); | ||
| 396 | +// } | ||
| 397 | + | ||
| 398 | +// ///门头照片 | ||
| 399 | +// Widget _storeFrontPhotoWidget() { | ||
| 400 | +// return Column( | ||
| 401 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 402 | +// children: [ | ||
| 403 | +// Text('2.您店铺的门头照片是?', | ||
| 404 | +// style: TextStyle( | ||
| 405 | +// fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)), | ||
| 406 | +// VEmptyView(30), | ||
| 407 | +// Consumer<UploadImageProvider>(builder: (context, model, _) { | ||
| 408 | +// return ImgPickerWidget( | ||
| 409 | +// scrollController: _controller, | ||
| 410 | +// model: model, | ||
| 411 | +// maxImageNumber: 1, | ||
| 412 | +// uploadType: UploadType.StoreFrontUploadType, | ||
| 413 | +// ); | ||
| 414 | +// }) | ||
| 415 | +// ], | ||
| 416 | +// ); | ||
| 417 | +// } | ||
| 418 | + | ||
| 419 | +// ///店铺环境 | ||
| 420 | +// Widget _storeEnvironmentWidget() { | ||
| 421 | +// return Column( | ||
| 422 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 423 | +// children: [ | ||
| 424 | +// Text('2.请上传您店铺环境的照片或者视频', | ||
| 425 | +// style: TextStyle( | ||
| 426 | +// fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)), | ||
| 427 | +// VEmptyView(30), | ||
| 428 | +// Consumer<UploadImageProvider>(builder: (context, model, _) { | ||
| 429 | +// return VideoPickerWidget( | ||
| 430 | +// maxImageNumber: 9, model: model, scrollController: _controller); | ||
| 431 | +// }) | ||
| 432 | +// ], | ||
| 433 | +// ); | ||
| 434 | +// } | ||
| 435 | + | ||
| 436 | +// @override | ||
| 437 | +// Widget build(BuildContext context) { | ||
| 438 | +// return Scaffold( | ||
| 439 | +// appBar: SystemAppBar( | ||
| 440 | +// '新建店铺', | ||
| 441 | +// onTap: () { | ||
| 442 | +// Navigator.pop(context); | ||
| 443 | +// }, | ||
| 444 | +// ), | ||
| 445 | +// body: InkWell( | ||
| 446 | +// onTap: () { | ||
| 447 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 448 | +// }, | ||
| 449 | +// child: Container( | ||
| 450 | +// padding: EdgeInsets.all(ScreenUtil().setWidth(40)), | ||
| 451 | +// child: Column( | ||
| 452 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 453 | +// children: [ | ||
| 454 | +// Expanded( | ||
| 455 | +// child: SingleChildScrollView( | ||
| 456 | +// controller: _controller, | ||
| 457 | +// child: Column( | ||
| 458 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 459 | +// children: [ | ||
| 460 | +// // Text('1.您的店内有哪些包间类型?', | ||
| 461 | +// // style: TextStyle( | ||
| 462 | +// // fontSize: ScreenUtil().setSp(30), | ||
| 463 | +// // fontWeight: FontWeight.bold)), | ||
| 464 | +// // VEmptyView(30), | ||
| 465 | +// // Column(children: _roomTypeWidget()), | ||
| 466 | +// _storeNameWidget(), | ||
| 467 | +// VEmptyView(30), | ||
| 468 | +// _storeFrontPhotoWidget(), | ||
| 469 | +// VEmptyView(30), | ||
| 470 | +// _storePhoneWidget(), | ||
| 471 | +// VEmptyView(30), | ||
| 472 | +// _addressWidget(), | ||
| 473 | +// VEmptyView(30), | ||
| 474 | +// _positionWidget(), | ||
| 475 | +// // VEmptyView(30), | ||
| 476 | +// // _imageWidget( | ||
| 477 | +// // '门头照片', | ||
| 478 | +// // _uploadImageProvider.touxiang, | ||
| 479 | +// // _uploadImageProvider.imgSizeTouxiang, | ||
| 480 | +// // 64), | ||
| 481 | +// VEmptyView(30), | ||
| 482 | +// _storeEnvironmentWidget(), | ||
| 483 | + | ||
| 484 | +// VEmptyView(30), | ||
| 485 | +// ]))), | ||
| 486 | +// RoundButton( | ||
| 487 | +// text: '下一步', | ||
| 488 | +// gradientStart: MyColours.color_199095, | ||
| 489 | +// gradientEnd: MyColours.color_199095, | ||
| 490 | +// // borderColor: MyColours.color_999999, | ||
| 491 | +// radius: ScreenUtil().setWidth(20), | ||
| 492 | +// fontSize: 28, | ||
| 493 | +// isBold: false, | ||
| 494 | +// onPressed: () { | ||
| 495 | +// NavigatorUtil.goCreateStorePageSim(context); | ||
| 496 | +// }, | ||
| 497 | +// ) | ||
| 498 | +// ])))); | ||
| 499 | +// } | ||
| 500 | +// } |
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +// import 'package:one_key/provider/create_store_model.dart'; | ||
| 4 | +// import 'package:one_key/res/colors.dart'; | ||
| 5 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 6 | +// import 'package:one_key/utils/utils.dart'; | ||
| 7 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 8 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 9 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 10 | +// import 'package:permission_handler/permission_handler.dart'; | ||
| 11 | +// import 'package:provider/provider.dart'; | ||
| 12 | + | ||
| 13 | +// class EnterStoreAddressPage extends StatefulWidget { | ||
| 14 | +// EnterStoreAddressPageSim({Key key}) : super(key: key); | ||
| 15 | + | ||
| 16 | +// @override | ||
| 17 | +// _EnterStoreAddressPageState createState() => _EnterStoreAddressPageState(); | ||
| 18 | +// } | ||
| 19 | + | ||
| 20 | +// class _EnterStoreAddressPageState extends State<EnterStoreAddressPage> { | ||
| 21 | +// String storeAddress = '请选择地图地址'; | ||
| 22 | +// TextEditingController _controller = TextEditingController(); | ||
| 23 | + | ||
| 24 | +// @override | ||
| 25 | +// void initState() { | ||
| 26 | +// // TODO: implement initState | ||
| 27 | +// super.initState(); | ||
| 28 | +// } | ||
| 29 | + | ||
| 30 | +// @override | ||
| 31 | +// Widget build(BuildContext context) { | ||
| 32 | +// CreateStoreModel createStoreModel = | ||
| 33 | +// Provider.of<CreateStoreModel>(context, listen: false); | ||
| 34 | +// _controller.text = createStoreModel.storeInfo?.addressDetail; | ||
| 35 | +// if (createStoreModel.storeInfo?.address != null) { | ||
| 36 | +// storeAddress = createStoreModel.storeInfo.address; | ||
| 37 | +// } | ||
| 38 | + | ||
| 39 | +// return Scaffold( | ||
| 40 | +// backgroundColor: Colors.white, | ||
| 41 | +// appBar: SystemAppBar( | ||
| 42 | +// '', | ||
| 43 | +// leftTitle: '上一步', | ||
| 44 | +// onTap: () { | ||
| 45 | +// Navigator.pop(context); | ||
| 46 | +// }, | ||
| 47 | +// ), | ||
| 48 | +// body: InkWell( | ||
| 49 | +// onTap: () { | ||
| 50 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 51 | +// }, | ||
| 52 | +// child: Container( | ||
| 53 | +// padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(70), | ||
| 54 | +// ScreenUtil().setWidth(60), ScreenUtil().setWidth(70), 0), | ||
| 55 | +// child: SingleChildScrollView( | ||
| 56 | +// // controller: _controller, | ||
| 57 | +// child: Column( | ||
| 58 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 59 | +// children: [ | ||
| 60 | +// Text('您的店铺地址在哪?', | ||
| 61 | +// style: TextStyle( | ||
| 62 | +// color: MyColours.color_333333, | ||
| 63 | +// fontSize: ScreenUtil().setSp(40), | ||
| 64 | +// fontWeight: FontWeight.bold)), | ||
| 65 | +// VEmptyView(100), | ||
| 66 | +// InkWell( | ||
| 67 | +// onTap: () { | ||
| 68 | +// Utils.getPickPermission(context, () async { | ||
| 69 | +// Map address = | ||
| 70 | +// await NavigatorUtil.goMapChoicePointPageSim( | ||
| 71 | +// context); | ||
| 72 | +// if (address != null) { | ||
| 73 | +// setState(() { | ||
| 74 | +// storeAddress = address['address']; | ||
| 75 | +// createStoreModel.storeInfo?.address = | ||
| 76 | +// storeAddress; | ||
| 77 | +// createStoreModel.storeInfo?.lat = | ||
| 78 | +// double.parse(address['lat'].toString()); | ||
| 79 | +// createStoreModel.storeInfo?.lng = | ||
| 80 | +// double.parse(address['lng'].toString()); | ||
| 81 | +// }); | ||
| 82 | +// } | ||
| 83 | +// }, Permission.location); | ||
| 84 | +// }, | ||
| 85 | +// child: Container( | ||
| 86 | +// alignment: Alignment.centerLeft, | ||
| 87 | +// width: double.infinity, | ||
| 88 | +// height: ScreenUtil().setWidth(104), | ||
| 89 | +// decoration: BoxDecoration( | ||
| 90 | +// borderRadius: BorderRadius.circular( | ||
| 91 | +// ScreenUtil().setWidth(10)), | ||
| 92 | +// border: Border.all( | ||
| 93 | +// color: MyColours.color_bff6f7, | ||
| 94 | +// width: ScreenUtil().setWidth(2))), | ||
| 95 | +// padding: EdgeInsets.symmetric( | ||
| 96 | +// horizontal: ScreenUtil().setWidth(40), | ||
| 97 | +// ), | ||
| 98 | +// child: Text('${storeAddress}', | ||
| 99 | +// style: TextStyle( | ||
| 100 | +// color: storeAddress == '请选择地图地址' | ||
| 101 | +// ? MyColours.color_999999 | ||
| 102 | +// : MyColours.color_333333, | ||
| 103 | +// fontSize: ScreenUtil().setSp(28), | ||
| 104 | +// )), | ||
| 105 | +// ), | ||
| 106 | +// ), | ||
| 107 | +// // VEmptyView(20), | ||
| 108 | +// // TextField( | ||
| 109 | +// // controller: _controller, | ||
| 110 | +// // // textAlignVertical: TextAlignVertical.bottom, | ||
| 111 | +// // maxLines: 1, | ||
| 112 | +// // // //光标颜色 | ||
| 113 | +// // // cursorColor: | ||
| 114 | +// // // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 115 | +// // //输入文本的样式 | ||
| 116 | +// // style: TextStyle( | ||
| 117 | +// // color: MyColours.color_333333, | ||
| 118 | +// // fontSize: ScreenUtil().setSp(28), | ||
| 119 | +// // ), | ||
| 120 | +// // // focusNode: _codeNode, | ||
| 121 | +// // decoration: InputDecoration( | ||
| 122 | +// // contentPadding: EdgeInsets.symmetric( | ||
| 123 | +// // vertical: ScreenUtil().setWidth(32), | ||
| 124 | +// // horizontal: ScreenUtil().setWidth(40)), | ||
| 125 | +// // border: OutlineInputBorder(), | ||
| 126 | +// // hintText: '请输入详细地址(选填)', | ||
| 127 | +// // hintStyle: TextStyle( | ||
| 128 | +// // color: MyColours.color_999999, | ||
| 129 | +// // fontSize: ScreenUtil().setSp(28), | ||
| 130 | +// // ), | ||
| 131 | +// // enabledBorder: OutlineInputBorder( | ||
| 132 | +// // borderSide: BorderSide( | ||
| 133 | +// // color: MyColours.color_bff6f7, | ||
| 134 | +// // width: ScreenUtil().setWidth(2))), | ||
| 135 | +// // focusedBorder: OutlineInputBorder( | ||
| 136 | +// // borderSide: BorderSide( | ||
| 137 | +// // color: MyColours.color_bff6f7, | ||
| 138 | +// // width: ScreenUtil().setWidth(2))), | ||
| 139 | +// // ), | ||
| 140 | +// // onChanged: (value) { | ||
| 141 | +// // createStoreModel.storeInfo.addressDetail = value; | ||
| 142 | +// // }, | ||
| 143 | +// // onEditingComplete: () { | ||
| 144 | +// // FocusScope.of(context) | ||
| 145 | +// // .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 146 | +// // }, | ||
| 147 | +// // keyboardType: TextInputType.text, | ||
| 148 | +// // ), | ||
| 149 | +// VEmptyView(160), | ||
| 150 | +// RoundButton( | ||
| 151 | +// text: '下一步', | ||
| 152 | +// gradientStart: MyColours.color_199095, | ||
| 153 | +// gradientEnd: MyColours.color_199095, | ||
| 154 | +// // borderColor: MyColours.color_999999, | ||
| 155 | +// radius: ScreenUtil().setWidth(20), | ||
| 156 | +// fontSize: 28, | ||
| 157 | +// isBold: false, | ||
| 158 | +// onPressed: () { | ||
| 159 | +// NavigatorUtil.goEnterStorePhonePageSim(context); | ||
| 160 | +// // NavigatorUtil.goEnterStorePositionPageSim(context); | ||
| 161 | +// }, | ||
| 162 | +// ) | ||
| 163 | +// ]))))); | ||
| 164 | +// ; | ||
| 165 | +// } | ||
| 166 | +// } |
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +// import 'package:one_key/app.dart'; | ||
| 4 | +// import 'package:one_key/pages_sim/create_store/video_widget.dart'; | ||
| 5 | +// import 'package:one_key/pages_sim/online_check/img_picker_widget.dart'; | ||
| 6 | +// import 'package:one_key/provider/create_store_model.dart'; | ||
| 7 | +// import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 8 | +// import 'package:one_key/res/colors.dart'; | ||
| 9 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 10 | +// import 'package:one_key/utils/upload_image_util.dart'; | ||
| 11 | +// import 'package:one_key/utils/utils.dart'; | ||
| 12 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 13 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 14 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 15 | +// import 'package:provider/provider.dart'; | ||
| 16 | + | ||
| 17 | +// class EnterStoreEnvironmentPage extends StatefulWidget { | ||
| 18 | +// EnterStoreEnvironmentPageSim({Key key}) : super(key: key); | ||
| 19 | + | ||
| 20 | +// @override | ||
| 21 | +// _EnterStoreEnvironmentPageState createState() => | ||
| 22 | +// _EnterStoreEnvironmentPageState(); | ||
| 23 | +// } | ||
| 24 | + | ||
| 25 | +// class _EnterStoreEnvironmentPageState extends State<EnterStoreEnvironmentPage> { | ||
| 26 | +// ScrollController _controller = ScrollController(); | ||
| 27 | + | ||
| 28 | +// @override | ||
| 29 | +// Widget build(BuildContext context) { | ||
| 30 | +// return Scaffold( | ||
| 31 | +// backgroundColor: Colors.white, | ||
| 32 | +// appBar: SystemAppBar( | ||
| 33 | +// '', | ||
| 34 | +// leftTitle: '上一步', | ||
| 35 | +// onTap: () { | ||
| 36 | +// Navigator.pop(context); | ||
| 37 | +// }, | ||
| 38 | +// ), | ||
| 39 | +// body: InkWell( | ||
| 40 | +// onTap: () { | ||
| 41 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 42 | +// }, | ||
| 43 | +// child: Container( | ||
| 44 | +// padding: | ||
| 45 | +// EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(60)), | ||
| 46 | +// child: SingleChildScrollView( | ||
| 47 | +// controller: _controller, | ||
| 48 | +// child: Column( | ||
| 49 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 50 | +// children: [ | ||
| 51 | +// Padding( | ||
| 52 | +// padding: EdgeInsets.symmetric( | ||
| 53 | +// horizontal: ScreenUtil().setWidth(70)), | ||
| 54 | +// child: Text('请上传店内环境照片或视频(选传)', | ||
| 55 | +// style: TextStyle( | ||
| 56 | +// color: MyColours.color_333333, | ||
| 57 | +// fontSize: ScreenUtil().setSp(40), | ||
| 58 | +// fontWeight: FontWeight.bold)), | ||
| 59 | +// ), | ||
| 60 | +// VEmptyView(100), | ||
| 61 | +// Consumer<UploadImageProvider>( | ||
| 62 | +// builder: (context, model, _) { | ||
| 63 | +// return VideoPickerWidget( | ||
| 64 | +// maxImageNumber: 9, | ||
| 65 | +// model: model, | ||
| 66 | +// scrollController: _controller); | ||
| 67 | +// }), | ||
| 68 | +// VEmptyView(160), | ||
| 69 | +// Padding( | ||
| 70 | +// padding: EdgeInsets.symmetric( | ||
| 71 | +// horizontal: ScreenUtil().setWidth(70)), | ||
| 72 | +// child: RoundButton( | ||
| 73 | +// text: '完成', | ||
| 74 | +// gradientStart: MyColours.color_199095, | ||
| 75 | +// gradientEnd: MyColours.color_199095, | ||
| 76 | +// // borderColor: MyColours.color_999999, | ||
| 77 | +// radius: ScreenUtil().setWidth(20), | ||
| 78 | +// fontSize: 28, | ||
| 79 | +// isBold: false, | ||
| 80 | +// onPressed: () { | ||
| 81 | +// // _addStoreInfo(); | ||
| 82 | +// // NavigatorUtil.goEnterStoreAddressPageSim( | ||
| 83 | +// // context); | ||
| 84 | +// }, | ||
| 85 | +// )) | ||
| 86 | +// ]))))); | ||
| 87 | +// } | ||
| 88 | +// } |
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +// import 'package:one_key/pages_sim/online_check/img_picker_widget.dart'; | ||
| 4 | +// import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 5 | +// import 'package:one_key/res/colors.dart'; | ||
| 6 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 7 | +// import 'package:one_key/utils/upload_image_util.dart'; | ||
| 8 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 9 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 10 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 11 | +// import 'package:provider/provider.dart'; | ||
| 12 | + | ||
| 13 | +// class EnterStoreFrontPhotoPage extends StatefulWidget { | ||
| 14 | +// EnterStoreFrontPhotoPageSim({Key key}) : super(key: key); | ||
| 15 | + | ||
| 16 | +// @override | ||
| 17 | +// _EnterStoreFrontPhotoPageState createState() => | ||
| 18 | +// _EnterStoreFrontPhotoPageState(); | ||
| 19 | +// } | ||
| 20 | + | ||
| 21 | +// class _EnterStoreFrontPhotoPageState extends State<EnterStoreFrontPhotoPage> { | ||
| 22 | +// ScrollController _controller = ScrollController(); | ||
| 23 | +// @override | ||
| 24 | +// Widget build(BuildContext context) { | ||
| 25 | +// return Scaffold( | ||
| 26 | +// backgroundColor: Colors.white, | ||
| 27 | +// appBar: SystemAppBar( | ||
| 28 | +// '', | ||
| 29 | +// leftTitle: '上一步', | ||
| 30 | +// onTap: () { | ||
| 31 | +// Navigator.pop(context); | ||
| 32 | +// }, | ||
| 33 | +// ), | ||
| 34 | +// body: InkWell( | ||
| 35 | +// onTap: () { | ||
| 36 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 37 | +// }, | ||
| 38 | +// child: Container( | ||
| 39 | +// padding: EdgeInsets.symmetric( | ||
| 40 | +// horizontal: ScreenUtil().setWidth(70), | ||
| 41 | +// vertical: ScreenUtil().setWidth(60)), | ||
| 42 | +// child: SingleChildScrollView( | ||
| 43 | +// controller: _controller, | ||
| 44 | +// child: Column( | ||
| 45 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 46 | +// children: [ | ||
| 47 | +// Text('请上传店铺的门头照片(选传)', | ||
| 48 | +// style: TextStyle( | ||
| 49 | +// color: MyColours.color_333333, | ||
| 50 | +// fontSize: ScreenUtil().setSp(40), | ||
| 51 | +// fontWeight: FontWeight.bold)), | ||
| 52 | +// VEmptyView(100), | ||
| 53 | +// Consumer<UploadImageProvider>( | ||
| 54 | +// builder: (context, model, _) { | ||
| 55 | +// return ImgPickerWidget( | ||
| 56 | +// scrollController: _controller, | ||
| 57 | +// model: model, | ||
| 58 | +// maxImageNumber: 1, | ||
| 59 | +// uploadType: UploadType.StoreFrontUploadType, | ||
| 60 | +// ); | ||
| 61 | +// }), | ||
| 62 | +// VEmptyView(160), | ||
| 63 | +// RoundButton( | ||
| 64 | +// text: '下一步', | ||
| 65 | +// gradientStart: MyColours.color_199095, | ||
| 66 | +// gradientEnd: MyColours.color_199095, | ||
| 67 | +// // borderColor: MyColours.color_999999, | ||
| 68 | +// radius: ScreenUtil().setWidth(20), | ||
| 69 | +// fontSize: 28, | ||
| 70 | +// isBold: false, | ||
| 71 | +// onPressed: () { | ||
| 72 | +// NavigatorUtil.goEnterStoreEnvironmentPageSim( | ||
| 73 | +// context); | ||
| 74 | +// }, | ||
| 75 | +// ) | ||
| 76 | +// ]))))); | ||
| 77 | +// ; | ||
| 78 | +// } | ||
| 79 | +// } |
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +// import 'package:one_key/provider/create_store_model.dart'; | ||
| 4 | +// import 'package:one_key/res/colors.dart'; | ||
| 5 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 6 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 7 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 8 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 9 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 10 | +// import 'package:provider/provider.dart'; | ||
| 11 | + | ||
| 12 | +// class EnterStoreNamePage extends StatefulWidget { | ||
| 13 | +// EnterStoreNamePageSim({Key key}) : super(key: key); | ||
| 14 | + | ||
| 15 | +// @override | ||
| 16 | +// _EnterStoreNamePageState createState() => _EnterStoreNamePageState(); | ||
| 17 | +// } | ||
| 18 | + | ||
| 19 | +// class _EnterStoreNamePageState extends State<EnterStoreNamePage> { | ||
| 20 | +// TextEditingController _controller = TextEditingController(); | ||
| 21 | + | ||
| 22 | +// @override | ||
| 23 | +// void initState() { | ||
| 24 | +// // TODO: implement initState | ||
| 25 | +// super.initState(); | ||
| 26 | +// } | ||
| 27 | + | ||
| 28 | +// @override | ||
| 29 | +// void dispose() { | ||
| 30 | +// // TODO: implement dispose | ||
| 31 | +// EventBus().emit('refresh_store_list'); | ||
| 32 | +// super.dispose(); | ||
| 33 | +// } | ||
| 34 | + | ||
| 35 | +// @override | ||
| 36 | +// Widget build(BuildContext context) { | ||
| 37 | +// CreateStoreModel createStoreModel = | ||
| 38 | +// Provider.of<CreateStoreModel>(context, listen: false); | ||
| 39 | +// _controller.text = createStoreModel.storeInfo?.name; | ||
| 40 | +// return Scaffold( | ||
| 41 | +// backgroundColor: Colors.white, | ||
| 42 | +// appBar: SystemAppBar( | ||
| 43 | +// '', | ||
| 44 | +// // onTap: () { | ||
| 45 | +// // EventBus().emit('refresh_store_list'); | ||
| 46 | +// // Navigator.pop(context); | ||
| 47 | +// // }, | ||
| 48 | +// ), | ||
| 49 | +// body: InkWell( | ||
| 50 | +// onTap: () { | ||
| 51 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 52 | +// }, | ||
| 53 | +// child: Container( | ||
| 54 | +// color: Colors.white, | ||
| 55 | +// padding: EdgeInsets.symmetric( | ||
| 56 | +// horizontal: ScreenUtil().setWidth(70), | ||
| 57 | +// vertical: ScreenUtil().setWidth(60)), | ||
| 58 | +// child: SingleChildScrollView( | ||
| 59 | +// child: Column( | ||
| 60 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 61 | +// children: [ | ||
| 62 | +// Text('您的店铺名称是?', | ||
| 63 | +// style: TextStyle( | ||
| 64 | +// color: MyColours.color_333333, | ||
| 65 | +// fontSize: ScreenUtil().setSp(40), | ||
| 66 | +// fontWeight: FontWeight.bold)), | ||
| 67 | +// VEmptyView(100), | ||
| 68 | +// TextField( | ||
| 69 | +// controller: _controller, | ||
| 70 | +// // textAlignVertical: TextAlignVertical.bottom, | ||
| 71 | +// maxLines: 1, | ||
| 72 | +// // //光标颜色 | ||
| 73 | +// // cursorColor: | ||
| 74 | +// // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 75 | +// //输入文本的样式 | ||
| 76 | +// style: TextStyle( | ||
| 77 | +// color: MyColours.color_333333, | ||
| 78 | +// fontSize: ScreenUtil().setSp(28), | ||
| 79 | +// ), | ||
| 80 | +// // focusNode: _codeNode, | ||
| 81 | +// decoration: InputDecoration( | ||
| 82 | +// contentPadding: EdgeInsets.symmetric( | ||
| 83 | +// vertical: ScreenUtil().setWidth(32), | ||
| 84 | +// horizontal: ScreenUtil().setWidth(40)), | ||
| 85 | +// border: OutlineInputBorder(), | ||
| 86 | +// hintText: '请输入店铺名称', | ||
| 87 | +// hintStyle: TextStyle( | ||
| 88 | +// color: MyColours.color_999999, | ||
| 89 | +// fontSize: ScreenUtil().setSp(28), | ||
| 90 | +// ), | ||
| 91 | +// enabledBorder: OutlineInputBorder( | ||
| 92 | +// borderSide: BorderSide( | ||
| 93 | +// color: MyColours.color_bff6f7, | ||
| 94 | +// width: ScreenUtil().setWidth(2))), | ||
| 95 | +// focusedBorder: OutlineInputBorder( | ||
| 96 | +// borderSide: BorderSide( | ||
| 97 | +// color: MyColours.color_bff6f7, | ||
| 98 | +// width: ScreenUtil().setWidth(2))), | ||
| 99 | +// ), | ||
| 100 | +// onChanged: (value) { | ||
| 101 | +// createStoreModel.storeInfo.name = value; | ||
| 102 | +// }, | ||
| 103 | +// onEditingComplete: () { | ||
| 104 | +// FocusScope.of(context) | ||
| 105 | +// .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 106 | +// }, | ||
| 107 | +// keyboardType: TextInputType.text, | ||
| 108 | +// ), | ||
| 109 | +// VEmptyView(160), | ||
| 110 | +// RoundButton( | ||
| 111 | +// text: '下一步', | ||
| 112 | +// gradientStart: MyColours.color_199095, | ||
| 113 | +// gradientEnd: MyColours.color_199095, | ||
| 114 | +// // borderColor: MyColours.color_999999, | ||
| 115 | +// radius: ScreenUtil().setWidth(20), | ||
| 116 | +// fontSize: 28, | ||
| 117 | +// isBold: false, | ||
| 118 | +// onPressed: () { | ||
| 119 | +// NavigatorUtil.goEnterStoreAddressPageSim(context); | ||
| 120 | +// }, | ||
| 121 | +// ) | ||
| 122 | +// ]))))); | ||
| 123 | +// ; | ||
| 124 | +// } | ||
| 125 | +// } |
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +// import 'package:one_key/provider/create_store_model.dart'; | ||
| 4 | +// import 'package:one_key/provider/other_login_provider.dart'; | ||
| 5 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 6 | +// import 'package:one_key/res/colors.dart'; | ||
| 7 | +// import 'package:one_key/route/route_handles.dart'; | ||
| 8 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 9 | +// import 'package:one_key/utils/utils.dart'; | ||
| 10 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 11 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 12 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 13 | +// import 'package:provider/provider.dart'; | ||
| 14 | + | ||
| 15 | +// class EnterStorePhonePage extends StatefulWidget { | ||
| 16 | +// EnterStorePhonePageSim({Key key}) : super(key: key); | ||
| 17 | + | ||
| 18 | +// @override | ||
| 19 | +// _EnterStorePhonePageState createState() => _EnterStorePhonePageState(); | ||
| 20 | +// } | ||
| 21 | + | ||
| 22 | +// class _EnterStorePhonePageState extends State<EnterStorePhonePage> { | ||
| 23 | +// TextEditingController _controller = TextEditingController(); | ||
| 24 | + | ||
| 25 | +// @override | ||
| 26 | +// void initState() { | ||
| 27 | +// // TODO: implement initState | ||
| 28 | +// super.initState(); | ||
| 29 | +// } | ||
| 30 | + | ||
| 31 | +// ///添加商家信息 | ||
| 32 | +// _addStoreInfo() async { | ||
| 33 | +// CreateStoreModel createStoreModel = | ||
| 34 | +// Provider.of<CreateStoreModel>(context, listen: false); | ||
| 35 | +// // UploadImageProvider uploadImageProvider = | ||
| 36 | +// // Provider.of<UploadImageProvider>(context, listen: false); | ||
| 37 | +// if (createStoreModel.storeInfo?.name == null || | ||
| 38 | +// createStoreModel.storeInfo?.name.trim().length == 0) { | ||
| 39 | +// Utils.showToast('请填写店铺名称!'); | ||
| 40 | +// return; | ||
| 41 | +// } | ||
| 42 | +// if (createStoreModel.storeInfo?.address == null || | ||
| 43 | +// createStoreModel.storeInfo?.address.trim().length == 0) { | ||
| 44 | +// Utils.showToast('请选择店铺地址!'); | ||
| 45 | +// return; | ||
| 46 | +// } | ||
| 47 | +// if (createStoreModel.storeInfo?.phone == null || | ||
| 48 | +// createStoreModel.storeInfo?.phone.trim().length == 0) { | ||
| 49 | +// Utils.showToast('请填写店铺接单电话!'); | ||
| 50 | +// return; | ||
| 51 | +// } | ||
| 52 | +// Map<String, String> params = { | ||
| 53 | +// "name": createStoreModel.storeInfo?.name, | ||
| 54 | +// "phone": createStoreModel.storeInfo?.phone, | ||
| 55 | +// "map_address": createStoreModel.storeInfo?.address, | ||
| 56 | +// "long": createStoreModel.storeInfo?.lng.toString(), | ||
| 57 | +// "lat": createStoreModel.storeInfo?.lat.toString(), | ||
| 58 | +// }; | ||
| 59 | +// // print(App.sp.getString("unionid")); | ||
| 60 | +// // if (uploadImageProvider.imageListFront.length > 0) { | ||
| 61 | +// // params["file"] = uploadImageProvider.imageListFront[0].qiniuUrl; | ||
| 62 | +// // } | ||
| 63 | +// // if (uploadImageProvider.imageListDenvironment.length > 0) { | ||
| 64 | +// // List<String> temp = []; | ||
| 65 | +// // for (var i = 0; | ||
| 66 | +// // i < uploadImageProvider.imageListDenvironment.length; | ||
| 67 | +// // i++) { | ||
| 68 | +// // temp.add(uploadImageProvider.imageListDenvironment[i].qiniuUrl); | ||
| 69 | +// // } | ||
| 70 | +// // params["image"] = Utils.listToStringEnglish(temp); | ||
| 71 | +// // } | ||
| 72 | +// bool success = await createStoreModel.addStoreInfo(context, params); | ||
| 73 | +// if (success) { | ||
| 74 | +// //跳转至完成页面 | ||
| 75 | +// NavigatorUtil.goCompleteStorePageSim(context); | ||
| 76 | +// } | ||
| 77 | +// } | ||
| 78 | + | ||
| 79 | +// @override | ||
| 80 | +// Widget build(BuildContext context) { | ||
| 81 | +// return Scaffold( | ||
| 82 | +// backgroundColor: Colors.white, | ||
| 83 | +// appBar: SystemAppBar( | ||
| 84 | +// '', | ||
| 85 | +// leftTitle: '上一步', | ||
| 86 | +// onTap: () { | ||
| 87 | +// Navigator.pop(context); | ||
| 88 | +// }, | ||
| 89 | +// ), | ||
| 90 | +// body: InkWell( | ||
| 91 | +// onTap: () { | ||
| 92 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 93 | +// }, | ||
| 94 | +// child: Container( | ||
| 95 | +// color: MyColours.color_ffffff, | ||
| 96 | +// padding: EdgeInsets.symmetric( | ||
| 97 | +// horizontal: ScreenUtil().setWidth(70), | ||
| 98 | +// vertical: ScreenUtil().setWidth(60)), | ||
| 99 | +// child: SingleChildScrollView( | ||
| 100 | +// child: Column( | ||
| 101 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 102 | +// children: [ | ||
| 103 | +// Text('确定将此电话作为接单电话吗?', | ||
| 104 | +// style: TextStyle( | ||
| 105 | +// color: MyColours.color_333333, | ||
| 106 | +// fontSize: ScreenUtil().setSp(40), | ||
| 107 | +// fontWeight: FontWeight.bold)), | ||
| 108 | +// VEmptyView(100), | ||
| 109 | +// Consumer<CreateStoreModel>(builder: (context, model, _) { | ||
| 110 | +// _controller.text = model.storeInfo?.phone; | ||
| 111 | +// return TextField( | ||
| 112 | +// // textAlignVertical: TextAlignVertical.bottom, | ||
| 113 | +// maxLines: 1, | ||
| 114 | +// controller: _controller, | ||
| 115 | +// // //光标颜色 | ||
| 116 | +// // cursorColor: | ||
| 117 | +// // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 118 | +// //输入文本的样式 | ||
| 119 | +// style: TextStyle( | ||
| 120 | +// color: MyColours.color_333333, | ||
| 121 | +// fontSize: ScreenUtil().setSp(28), | ||
| 122 | +// ), | ||
| 123 | +// // focusNode: _codeNode, | ||
| 124 | +// decoration: InputDecoration( | ||
| 125 | +// contentPadding: EdgeInsets.symmetric( | ||
| 126 | +// vertical: ScreenUtil().setWidth(32), | ||
| 127 | +// horizontal: ScreenUtil().setWidth(40)), | ||
| 128 | +// border: OutlineInputBorder(), | ||
| 129 | +// hintText: '请输入接单电话', | ||
| 130 | +// hintStyle: TextStyle( | ||
| 131 | +// color: MyColours.color_999999, | ||
| 132 | +// fontSize: ScreenUtil().setSp(28), | ||
| 133 | +// ), | ||
| 134 | +// enabledBorder: OutlineInputBorder( | ||
| 135 | +// borderSide: BorderSide( | ||
| 136 | +// color: MyColours.color_bff6f7, | ||
| 137 | +// width: ScreenUtil().setWidth(2))), | ||
| 138 | +// focusedBorder: OutlineInputBorder( | ||
| 139 | +// borderSide: BorderSide( | ||
| 140 | +// color: MyColours.color_bff6f7, | ||
| 141 | +// width: ScreenUtil().setWidth(2))), | ||
| 142 | +// ), | ||
| 143 | +// onChanged: (value) { | ||
| 144 | +// model.storeInfo?.phone = value; | ||
| 145 | +// }, | ||
| 146 | +// onEditingComplete: () { | ||
| 147 | +// FocusScope.of(context) | ||
| 148 | +// .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 149 | +// }, | ||
| 150 | +// keyboardType: TextInputType.text, | ||
| 151 | +// ); | ||
| 152 | +// }), | ||
| 153 | +// VEmptyView(160), | ||
| 154 | +// RoundButton( | ||
| 155 | +// text: '完成', | ||
| 156 | +// gradientStart: MyColours.color_199095, | ||
| 157 | +// gradientEnd: MyColours.color_199095, | ||
| 158 | +// // borderColor: MyColours.color_999999, | ||
| 159 | +// radius: ScreenUtil().setWidth(20), | ||
| 160 | +// fontSize: 28, | ||
| 161 | +// isBold: false, | ||
| 162 | +// onPressed: () { | ||
| 163 | +// _addStoreInfo(); | ||
| 164 | +// // NavigatorUtil.goEnterStoreFrontPhotoPageSim(context); | ||
| 165 | +// }, | ||
| 166 | +// ) | ||
| 167 | +// ]))))); | ||
| 168 | +// } | ||
| 169 | +// } |
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +// import 'package:one_key/provider/create_store_model.dart'; | ||
| 4 | +// import 'package:one_key/res/colors.dart'; | ||
| 5 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 6 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 7 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 8 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 9 | +// import 'package:provider/provider.dart'; | ||
| 10 | + | ||
| 11 | +// class EnterStorePositionPage extends StatefulWidget { | ||
| 12 | +// EnterStorePositionPageSim({Key key}) : super(key: key); | ||
| 13 | + | ||
| 14 | +// @override | ||
| 15 | +// _EnterStorePositionPageState createState() => _EnterStorePositionPageState(); | ||
| 16 | +// } | ||
| 17 | + | ||
| 18 | +// class _EnterStorePositionPageState extends State<EnterStorePositionPage> { | ||
| 19 | +// TextEditingController _controller = TextEditingController(); | ||
| 20 | + | ||
| 21 | +// @override | ||
| 22 | +// void initState() { | ||
| 23 | +// // TODO: implement initState | ||
| 24 | +// super.initState(); | ||
| 25 | +// } | ||
| 26 | + | ||
| 27 | +// @override | ||
| 28 | +// Widget build(BuildContext context) { | ||
| 29 | +// CreateStoreModel createStoreModel = | ||
| 30 | +// Provider.of<CreateStoreModel>(context, listen: false); | ||
| 31 | +// _controller.text = createStoreModel.storeInfo?.position; | ||
| 32 | +// return Scaffold( | ||
| 33 | +// backgroundColor: Colors.white, | ||
| 34 | +// appBar: SystemAppBar( | ||
| 35 | +// '', | ||
| 36 | +// leftTitle: '上一步', | ||
| 37 | +// onTap: () { | ||
| 38 | +// Navigator.pop(context); | ||
| 39 | +// }, | ||
| 40 | +// ), | ||
| 41 | +// body: InkWell( | ||
| 42 | +// onTap: () { | ||
| 43 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 44 | +// }, | ||
| 45 | +// child: Container( | ||
| 46 | +// padding: EdgeInsets.symmetric( | ||
| 47 | +// horizontal: ScreenUtil().setWidth(70), | ||
| 48 | +// vertical: ScreenUtil().setWidth(60)), | ||
| 49 | +// child: SingleChildScrollView( | ||
| 50 | +// child: Column( | ||
| 51 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 52 | +// children: [ | ||
| 53 | +// Text('您在店铺的角色是?', | ||
| 54 | +// style: TextStyle( | ||
| 55 | +// color: MyColours.color_333333, | ||
| 56 | +// fontSize: ScreenUtil().setSp(40), | ||
| 57 | +// fontWeight: FontWeight.bold)), | ||
| 58 | +// VEmptyView(100), | ||
| 59 | +// TextField( | ||
| 60 | +// controller: _controller, | ||
| 61 | +// // textAlignVertical: TextAlignVertical.bottom, | ||
| 62 | +// maxLines: 1, | ||
| 63 | +// // //光标颜色 | ||
| 64 | +// // cursorColor: | ||
| 65 | +// // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 66 | +// //输入文本的样式 | ||
| 67 | +// style: TextStyle( | ||
| 68 | +// color: MyColours.color_333333, | ||
| 69 | +// fontSize: ScreenUtil().setSp(28), | ||
| 70 | +// ), | ||
| 71 | +// // focusNode: _codeNode, | ||
| 72 | +// decoration: InputDecoration( | ||
| 73 | +// contentPadding: EdgeInsets.symmetric( | ||
| 74 | +// vertical: ScreenUtil().setWidth(32), | ||
| 75 | +// horizontal: ScreenUtil().setWidth(40)), | ||
| 76 | +// border: OutlineInputBorder(), | ||
| 77 | +// hintText: '请输入您的职位', | ||
| 78 | +// hintStyle: TextStyle( | ||
| 79 | +// color: MyColours.color_999999, | ||
| 80 | +// fontSize: ScreenUtil().setSp(28), | ||
| 81 | +// ), | ||
| 82 | +// enabledBorder: OutlineInputBorder( | ||
| 83 | +// borderSide: BorderSide( | ||
| 84 | +// color: MyColours.color_bff6f7, | ||
| 85 | +// width: ScreenUtil().setWidth(2))), | ||
| 86 | +// focusedBorder: OutlineInputBorder( | ||
| 87 | +// borderSide: BorderSide( | ||
| 88 | +// color: MyColours.color_bff6f7, | ||
| 89 | +// width: ScreenUtil().setWidth(2))), | ||
| 90 | +// ), | ||
| 91 | +// onChanged: (value) { | ||
| 92 | +// createStoreModel.storeInfo?.position = value; | ||
| 93 | +// }, | ||
| 94 | +// onEditingComplete: () { | ||
| 95 | +// FocusScope.of(context) | ||
| 96 | +// .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 97 | +// }, | ||
| 98 | +// keyboardType: TextInputType.text, | ||
| 99 | +// ), | ||
| 100 | +// VEmptyView(160), | ||
| 101 | +// RoundButton( | ||
| 102 | +// text: '下一步', | ||
| 103 | +// gradientStart: MyColours.color_199095, | ||
| 104 | +// gradientEnd: MyColours.color_199095, | ||
| 105 | +// // borderColor: MyColours.color_999999, | ||
| 106 | +// radius: ScreenUtil().setWidth(20), | ||
| 107 | +// fontSize: 28, | ||
| 108 | +// isBold: false, | ||
| 109 | +// onPressed: () { | ||
| 110 | +// NavigatorUtil.goEnterStoreTimePageSim(context); | ||
| 111 | +// }, | ||
| 112 | +// ) | ||
| 113 | +// ]))))); | ||
| 114 | +// ; | ||
| 115 | +// } | ||
| 116 | +// } |
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +// import 'package:one_key/provider/create_store_model.dart'; | ||
| 4 | +// import 'package:one_key/res/colors.dart'; | ||
| 5 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 6 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 7 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 8 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 9 | +// import 'package:provider/provider.dart'; | ||
| 10 | + | ||
| 11 | +// class EnterStoreTimePage extends StatefulWidget { | ||
| 12 | +// EnterStoreTimePageSim({Key key}) : super(key: key); | ||
| 13 | + | ||
| 14 | +// @override | ||
| 15 | +// _EnterStoreTimePageState createState() => _EnterStoreTimePageState(); | ||
| 16 | +// } | ||
| 17 | + | ||
| 18 | +// class _EnterStoreTimePageState extends State<EnterStoreTimePage> { | ||
| 19 | +// TextEditingController _controller = TextEditingController(); | ||
| 20 | + | ||
| 21 | +// @override | ||
| 22 | +// void initState() { | ||
| 23 | +// // TODO: implement initState | ||
| 24 | +// super.initState(); | ||
| 25 | +// } | ||
| 26 | + | ||
| 27 | +// @override | ||
| 28 | +// Widget build(BuildContext context) { | ||
| 29 | +// CreateStoreModel createStoreModel = | ||
| 30 | +// Provider.of<CreateStoreModel>(context, listen: false); | ||
| 31 | +// _controller.text = createStoreModel.storeInfo.time; | ||
| 32 | +// return Scaffold( | ||
| 33 | +// backgroundColor: Colors.white, | ||
| 34 | +// appBar: SystemAppBar( | ||
| 35 | +// '', | ||
| 36 | +// leftTitle: '上一步', | ||
| 37 | +// onTap: () { | ||
| 38 | +// Navigator.pop(context); | ||
| 39 | +// }, | ||
| 40 | +// ), | ||
| 41 | +// body: InkWell( | ||
| 42 | +// onTap: () { | ||
| 43 | +// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 44 | +// }, | ||
| 45 | +// child: Container( | ||
| 46 | +// padding: EdgeInsets.symmetric( | ||
| 47 | +// horizontal: ScreenUtil().setWidth(70), | ||
| 48 | +// vertical: ScreenUtil().setWidth(60)), | ||
| 49 | +// child: SingleChildScrollView( | ||
| 50 | +// child: Column( | ||
| 51 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 52 | +// children: [ | ||
| 53 | +// Text('您的店铺营业时间是?', | ||
| 54 | +// style: TextStyle( | ||
| 55 | +// color: MyColours.color_333333, | ||
| 56 | +// fontSize: ScreenUtil().setSp(40), | ||
| 57 | +// fontWeight: FontWeight.bold)), | ||
| 58 | +// VEmptyView(100), | ||
| 59 | +// TextField( | ||
| 60 | +// // textAlignVertical: TextAlignVertical.bottom, | ||
| 61 | +// controller: _controller, | ||
| 62 | +// maxLines: 1, | ||
| 63 | +// // //光标颜色 | ||
| 64 | +// // cursorColor: | ||
| 65 | +// // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 66 | +// //输入文本的样式 | ||
| 67 | +// style: TextStyle( | ||
| 68 | +// color: MyColours.color_333333, | ||
| 69 | +// fontSize: ScreenUtil().setSp(28), | ||
| 70 | +// ), | ||
| 71 | +// // focusNode: _codeNode, | ||
| 72 | +// decoration: InputDecoration( | ||
| 73 | +// contentPadding: EdgeInsets.symmetric( | ||
| 74 | +// vertical: ScreenUtil().setWidth(32), | ||
| 75 | +// horizontal: ScreenUtil().setWidth(40)), | ||
| 76 | +// border: OutlineInputBorder(), | ||
| 77 | +// hintText: '请输入营业时间,如09:00-23:00', | ||
| 78 | +// hintStyle: TextStyle( | ||
| 79 | +// color: MyColours.color_999999, | ||
| 80 | +// fontSize: ScreenUtil().setSp(28), | ||
| 81 | +// ), | ||
| 82 | +// enabledBorder: OutlineInputBorder( | ||
| 83 | +// borderSide: BorderSide( | ||
| 84 | +// color: MyColours.color_bff6f7, | ||
| 85 | +// width: ScreenUtil().setWidth(2))), | ||
| 86 | +// focusedBorder: OutlineInputBorder( | ||
| 87 | +// borderSide: BorderSide( | ||
| 88 | +// color: MyColours.color_bff6f7, | ||
| 89 | +// width: ScreenUtil().setWidth(2))), | ||
| 90 | +// ), | ||
| 91 | +// onChanged: (value) { | ||
| 92 | +// createStoreModel.storeInfo.time = value; | ||
| 93 | +// }, | ||
| 94 | +// onEditingComplete: () { | ||
| 95 | +// FocusScope.of(context) | ||
| 96 | +// .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 97 | +// }, | ||
| 98 | +// keyboardType: TextInputType.text, | ||
| 99 | +// ), | ||
| 100 | +// VEmptyView(160), | ||
| 101 | +// RoundButton( | ||
| 102 | +// text: '下一步', | ||
| 103 | +// gradientStart: MyColours.color_199095, | ||
| 104 | +// gradientEnd: MyColours.color_199095, | ||
| 105 | +// // borderColor: MyColours.color_999999, | ||
| 106 | +// radius: ScreenUtil().setWidth(20), | ||
| 107 | +// fontSize: 28, | ||
| 108 | +// isBold: false, | ||
| 109 | +// onPressed: () { | ||
| 110 | +// NavigatorUtil.goEnterStorePhonePageSim(context); | ||
| 111 | +// }, | ||
| 112 | +// ) | ||
| 113 | +// ]))))); | ||
| 114 | +// ; | ||
| 115 | +// } | ||
| 116 | +// } |
| 1 | +// import 'package:amap_map_fluttify/amap_map_fluttify.dart'; | ||
| 2 | +// import 'package:flutter/cupertino.dart'; | ||
| 3 | + | ||
| 4 | +// import 'package:flutter/material.dart'; | ||
| 5 | +// import 'package:amap_search_fluttify/amap_search_fluttify.dart'; | ||
| 6 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 7 | +// import 'package:one_key/utils/dialog_util.dart'; | ||
| 8 | +// import 'package:one_key/utils/misc.dart'; | ||
| 9 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 10 | +// import 'package:one_key/utils/utils.dart'; | ||
| 11 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 12 | +// import 'package:permission_handler/permission_handler.dart'; | ||
| 13 | +// // import 'package:demo/resources/custom_text_style.dart'; | ||
| 14 | +// // import 'package:demo/utils/misc.dart'; | ||
| 15 | + | ||
| 16 | +// // import 'package:demo/widgets/network_state/page_loading.dart'; | ||
| 17 | + | ||
| 18 | +// class MapChoicePointPage extends StatefulWidget { | ||
| 19 | +// final String long; | ||
| 20 | +// final String lat; | ||
| 21 | +// MapChoicePointPageSim({Key key, this.long, this.lat}) : super(key: key); | ||
| 22 | + | ||
| 23 | +// @override | ||
| 24 | +// _MapChoicePointPageState createState() => _MapChoicePointPageState(); | ||
| 25 | +// } | ||
| 26 | + | ||
| 27 | +// class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 28 | +// AmapController _controller; | ||
| 29 | +// List<Poi> poiList; | ||
| 30 | +// static List<PoiModel> list = new List(); | ||
| 31 | +// static List<PoiModel> searchlist = new List(); | ||
| 32 | +// PoiModel poiModel; | ||
| 33 | +// String keyword = ""; | ||
| 34 | +// String address = ""; | ||
| 35 | +// bool isloading = true; | ||
| 36 | + | ||
| 37 | +// double latitude = 39.684670899; | ||
| 38 | +// double longitude = 118.17630045; | ||
| 39 | + | ||
| 40 | +// @override | ||
| 41 | +// void initState() { | ||
| 42 | +// super.initState(); | ||
| 43 | + | ||
| 44 | +// if (widget.long != null && widget.long != ''&&widget.long != 'null') { | ||
| 45 | +// longitude = double.parse(widget.long); | ||
| 46 | +// } | ||
| 47 | +// if (widget.lat != null && widget.lat != ''&&widget.lat != 'null') { | ||
| 48 | +// latitude = double.parse(widget.lat); | ||
| 49 | +// } | ||
| 50 | + | ||
| 51 | +// WidgetsBinding.instance.addPostFrameCallback((_) async { | ||
| 52 | +// _requestLocationPermission(); | ||
| 53 | +// }); | ||
| 54 | +// } | ||
| 55 | + | ||
| 56 | +// Future<bool> checkLocationPermission() async { | ||
| 57 | +// PermissionStatus permissionStatus = await Permission.location.status; | ||
| 58 | +// if (permissionStatus == PermissionStatus.granted) { | ||
| 59 | +// return true; | ||
| 60 | +// } else { | ||
| 61 | +// return false; | ||
| 62 | +// } | ||
| 63 | +// } | ||
| 64 | + | ||
| 65 | +// /// 检查权限并定 | ||
| 66 | +// // _getLocationPermission() async { | ||
| 67 | +// // if (!(await checkPermission(Permission.location))) { | ||
| 68 | +// // //没有定位权限 | ||
| 69 | + | ||
| 70 | +// // //申请定位权限 | ||
| 71 | +// // _requestLocationPermission(); | ||
| 72 | +// // } else { | ||
| 73 | +// // //去定位 | ||
| 74 | +// // _requestLocationPermission(); | ||
| 75 | +// // } | ||
| 76 | +// // } | ||
| 77 | + | ||
| 78 | +// /// 获取定位权限 | ||
| 79 | +// _requestLocationPermission() async { | ||
| 80 | +// await AmapLocation.instance.updatePrivacyShow(true); | ||
| 81 | +// await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 82 | +// bool canLocation = false; | ||
| 83 | + | ||
| 84 | +// if (!(await checkPermission(Permission.location))) { | ||
| 85 | +// //没有定位权限 | ||
| 86 | + | ||
| 87 | +// //申请定位权限 | ||
| 88 | +// canLocation = await requestPermission(Permission.location); | ||
| 89 | +// } else { | ||
| 90 | +// canLocation = true; | ||
| 91 | +// } | ||
| 92 | +// // bool canLocation = await requestPermission(Permission.location); | ||
| 93 | +// // 单次定位 | ||
| 94 | +// if (canLocation) { | ||
| 95 | +// Future.delayed(Duration(milliseconds: 200), () async { | ||
| 96 | +// await AmapLocation.instance.updatePrivacyShow(true); | ||
| 97 | +// await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 98 | +// final location = await AmapLocation.instance.fetchLocation( | ||
| 99 | +// // needAddress: true, | ||
| 100 | +// // mode: LocationAccuracy.High, | ||
| 101 | +// // timeout: Duration(seconds: 10) | ||
| 102 | +// ); | ||
| 103 | + | ||
| 104 | +// if (location.city == null || location.city == '') //网络不好,定位失败 | ||
| 105 | +// { | ||
| 106 | +// // App.sp.setString("lat", "39.684670899"); | ||
| 107 | +// // App.sp.setString("lng", "118.17630045"); | ||
| 108 | + | ||
| 109 | +// } else { | ||
| 110 | +// if (widget.long == null || widget.long == ''||widget.long == 'null') { | ||
| 111 | +// latitude = location.latLng.latitude; | ||
| 112 | +// longitude = location.latLng.longitude; | ||
| 113 | +// if (_controller != null) { | ||
| 114 | +// _controller.setCenterCoordinate( | ||
| 115 | +// LatLng(location.latLng.latitude, location.latLng.longitude)); | ||
| 116 | +// } | ||
| 117 | + | ||
| 118 | +// setState(() {}); | ||
| 119 | +// } | ||
| 120 | +// } | ||
| 121 | +// }); | ||
| 122 | +// } else { | ||
| 123 | +// //无权限 | ||
| 124 | + | ||
| 125 | +// } | ||
| 126 | +// } | ||
| 127 | + | ||
| 128 | +// @override | ||
| 129 | +// Widget build(BuildContext context) { | ||
| 130 | +// return Scaffold( | ||
| 131 | +// resizeToAvoidBottomInset: false, //防止底部布局被顶起 | ||
| 132 | +// appBar: SystemAppBar( | ||
| 133 | +// '选择位置信息', | ||
| 134 | +// onTap: () { | ||
| 135 | +// Navigator.pop(context); | ||
| 136 | +// }, | ||
| 137 | +// ), | ||
| 138 | + | ||
| 139 | +// body: Column( | ||
| 140 | +// children: <Widget>[ | ||
| 141 | +// Theme( | ||
| 142 | +// data: new ThemeData( | ||
| 143 | +// primaryColor: Color(0xFFFFCA28), hintColor: Color(0xFFFFCA28)), | ||
| 144 | +// child: Container( | ||
| 145 | +// color: Color(0xFFFFCA28), | ||
| 146 | +// padding: EdgeInsets.all(5), | ||
| 147 | +// child: Container( | ||
| 148 | +// height: 36, | ||
| 149 | +// margin: EdgeInsets.only(left: 5, right: 5, bottom: 5), | ||
| 150 | +// child: TextField( | ||
| 151 | +// style: TextStyle(fontSize: 16, letterSpacing: 1.0), | ||
| 152 | +// controller: TextEditingController.fromValue(TextEditingValue( | ||
| 153 | +// // 设置内容 | ||
| 154 | +// text: keyword, | ||
| 155 | +// selection: TextSelection.fromPosition(TextPosition( | ||
| 156 | +// affinity: TextAffinity.downstream, | ||
| 157 | +// offset: keyword?.length ?? 0)), | ||
| 158 | +// // 保持光标在最后 | ||
| 159 | +// )), | ||
| 160 | +// decoration: InputDecoration( | ||
| 161 | +// border: OutlineInputBorder( | ||
| 162 | +// borderRadius: BorderRadius.all(Radius.circular(40)), | ||
| 163 | +// ), | ||
| 164 | +// hintText: '输入关键字', | ||
| 165 | +// hintStyle: | ||
| 166 | +// TextStyle(color: Color(0xFFBEBEBE), fontSize: 14), | ||
| 167 | +// contentPadding: | ||
| 168 | +// const EdgeInsets.symmetric(vertical: 8, horizontal: 1), | ||
| 169 | +// prefixIcon: Icon( | ||
| 170 | +// Icons.search, | ||
| 171 | +// color: Colors.grey, | ||
| 172 | +// size: 20, | ||
| 173 | +// ), | ||
| 174 | +// suffixIcon: IconButton( | ||
| 175 | +// icon: Icon( | ||
| 176 | +// Icons.clear, | ||
| 177 | +// color: Colors.grey, | ||
| 178 | +// size: 20, | ||
| 179 | +// ), | ||
| 180 | +// onPressed: () { | ||
| 181 | +// keyword = ""; | ||
| 182 | +// setState(() {}); | ||
| 183 | +// }, | ||
| 184 | +// ), | ||
| 185 | +// fillColor: Colors.white, | ||
| 186 | +// filled: true, | ||
| 187 | +// ), | ||
| 188 | + | ||
| 189 | +// inputFormatters: [], | ||
| 190 | +// //内容改变的回调 | ||
| 191 | +// onChanged: (text) { | ||
| 192 | +// print('change $text'); | ||
| 193 | +// keyword = text; | ||
| 194 | +// }, | ||
| 195 | +// //内容提交(按回车)的回调 | ||
| 196 | +// onSubmitted: (text) { | ||
| 197 | +// print('submit $text'); | ||
| 198 | +// // 触发关闭弹出来的键盘。 | ||
| 199 | +// keyword = text; | ||
| 200 | +// setState(() { | ||
| 201 | +// isloading = true; | ||
| 202 | +// FocusScope.of(context).requestFocus(FocusNode()); | ||
| 203 | +// }); | ||
| 204 | + | ||
| 205 | +// searchAroundAddress(text.toString()); | ||
| 206 | +// }, | ||
| 207 | +// //按回车时调用 | ||
| 208 | +// onEditingComplete: () { | ||
| 209 | +// print('onEditingComplete'); | ||
| 210 | +// }, | ||
| 211 | +// ), | ||
| 212 | +// ), | ||
| 213 | +// ), | ||
| 214 | +// ), | ||
| 215 | +// Container( | ||
| 216 | +// height: 300, | ||
| 217 | +// child: Stack( | ||
| 218 | +// children: <Widget>[ | ||
| 219 | +// AmapView( | ||
| 220 | +// showZoomControl: false, | ||
| 221 | +// centerCoordinate: LatLng(latitude, longitude), | ||
| 222 | +// maskDelay: Duration(milliseconds: 500), | ||
| 223 | +// zoomLevel: 16, | ||
| 224 | +// onMapCreated: (controller) async { | ||
| 225 | +// _controller = controller; | ||
| 226 | +// _controller | ||
| 227 | +// .setCenterCoordinate(LatLng(latitude, longitude)); | ||
| 228 | +// // if (await requestPermission(PermissionGroup.location)) { | ||
| 229 | +// // await controller.showMyLocation(true); | ||
| 230 | +// // await controller?.showLocateControl(true); | ||
| 231 | +// // final latLng = await _controller?.getLocation( | ||
| 232 | +// // delay: Duration(seconds: 2)); | ||
| 233 | +// // await enableFluttifyLog(false); // 关闭log | ||
| 234 | +// // _loadData(latLng); | ||
| 235 | +// // } else { | ||
| 236 | +// // //无权限 | ||
| 237 | +// // _showLocPemWidget(); | ||
| 238 | +// // } | ||
| 239 | +// }, | ||
| 240 | +// onMapMoveEnd: (MapMove move) async { | ||
| 241 | +// _loadData(move.coordinate); | ||
| 242 | +// }, | ||
| 243 | +// ), | ||
| 244 | +// Center( | ||
| 245 | +// child: Icon( | ||
| 246 | +// Icons.place, | ||
| 247 | +// size: 36.0, | ||
| 248 | +// color: Color(0xFFFF0000), | ||
| 249 | +// ), | ||
| 250 | +// ), | ||
| 251 | +// ], | ||
| 252 | +// ), | ||
| 253 | +// ), | ||
| 254 | +// Expanded( | ||
| 255 | +// flex: 1, | ||
| 256 | +// child: Visibility( | ||
| 257 | +// visible: !isloading, | ||
| 258 | +// maintainSize: false, | ||
| 259 | +// maintainSemantics: false, | ||
| 260 | +// maintainInteractivity: false, | ||
| 261 | +// replacement: Center( | ||
| 262 | +// child: CupertinoActivityIndicator(), | ||
| 263 | +// ), | ||
| 264 | +// child: ListView.builder( | ||
| 265 | +// itemCount: list.length, | ||
| 266 | +// itemBuilder: (BuildContext context, int position) { | ||
| 267 | +// print("itemBuilder" + list.length.toString()); | ||
| 268 | +// PoiModel item = list[position]; | ||
| 269 | +// return InkWell( | ||
| 270 | +// child: Column( | ||
| 271 | +// children: <Widget>[ | ||
| 272 | +// Container( | ||
| 273 | +// margin: | ||
| 274 | +// EdgeInsets.only(top: 8, bottom: 5, left: 10), | ||
| 275 | +// child: Row( | ||
| 276 | +// children: <Widget>[ | ||
| 277 | +// Icon( | ||
| 278 | +// Icons.place, | ||
| 279 | +// size: 20.0, | ||
| 280 | +// color: position == 0 | ||
| 281 | +// ? Colors.green | ||
| 282 | +// : Colors.grey, | ||
| 283 | +// ), | ||
| 284 | +// Expanded( | ||
| 285 | +// child: Text(item.title, | ||
| 286 | +// style: TextStyle( | ||
| 287 | +// fontSize: 16, | ||
| 288 | +// color: position == 0 | ||
| 289 | +// ? Colors.green | ||
| 290 | +// : Color(0xFF787878)))) | ||
| 291 | +// ], | ||
| 292 | +// ), | ||
| 293 | +// ), | ||
| 294 | +// Container( | ||
| 295 | +// margin: | ||
| 296 | +// EdgeInsets.only(top: 5, bottom: 5, left: 18), | ||
| 297 | +// alignment: Alignment.centerLeft, | ||
| 298 | +// child: Text( | ||
| 299 | +// item.address, | ||
| 300 | +// style: TextStyle( | ||
| 301 | +// fontSize: 14, | ||
| 302 | +// color: Color(0xFF646464), | ||
| 303 | +// ), | ||
| 304 | +// ), | ||
| 305 | +// ), | ||
| 306 | +// Divider( | ||
| 307 | +// height: 1, | ||
| 308 | +// ) | ||
| 309 | +// ], | ||
| 310 | +// ), | ||
| 311 | +// onTap: () async { | ||
| 312 | +// // await _controller.setCenterCoordinate( | ||
| 313 | +// // LatLng(item.latLng.latitude, item.latLng.longitude), | ||
| 314 | +// // zoomLevel: 16); | ||
| 315 | +// Navigator.pop(context, { | ||
| 316 | +// 'address': item.address, | ||
| 317 | +// 'lat': item.latLng.latitude.toString(), | ||
| 318 | +// 'lng': item.latLng.longitude.toString() | ||
| 319 | +// }); | ||
| 320 | +// }, | ||
| 321 | +// ); | ||
| 322 | +// }), | ||
| 323 | +// ), | ||
| 324 | +// ), | ||
| 325 | +// ], | ||
| 326 | +// ), | ||
| 327 | +// ); | ||
| 328 | +// } | ||
| 329 | + | ||
| 330 | +// void _loadData(LatLng latLng) async { | ||
| 331 | +// setState(() { | ||
| 332 | +// isloading = true; | ||
| 333 | +// }); | ||
| 334 | + | ||
| 335 | +// /// 逆地理编码(坐标转地址) | ||
| 336 | +// /// | ||
| 337 | +// /// | ||
| 338 | +// await AmapLocation.instance.updatePrivacyShow(true); | ||
| 339 | +// await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 340 | +// ReGeocode reGeocodeList = await AmapSearch.instance.searchReGeocode( | ||
| 341 | +// latLng, | ||
| 342 | +// ); | ||
| 343 | + | ||
| 344 | +// // print(await reGeocodeList.toFutureString()); | ||
| 345 | +// address = reGeocodeList.formatAddress; | ||
| 346 | + | ||
| 347 | +// await AmapLocation.instance.updatePrivacyShow(true); | ||
| 348 | +// await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 349 | +// final poiList = await AmapSearch.instance.searchAround( | ||
| 350 | +// latLng, | ||
| 351 | +// city: "", | ||
| 352 | +// ); | ||
| 353 | + | ||
| 354 | +// poiModel = new PoiModel("当前位置", address, latLng); | ||
| 355 | +// list.clear(); | ||
| 356 | +// list.add(poiModel); | ||
| 357 | +// for (var poi in poiList) { | ||
| 358 | +// String title = await poi.title; | ||
| 359 | +// String cityName = await poi.cityName; | ||
| 360 | +// String provinceName = await poi.provinceName; | ||
| 361 | +// String address = await poi.address; | ||
| 362 | +// LatLng latLng = await poi.latLng; | ||
| 363 | +// String bussniss = poi.businessArea; | ||
| 364 | + | ||
| 365 | +// list.add(new PoiModel( | ||
| 366 | +// title.toString(), | ||
| 367 | +// provinceName.toString() + | ||
| 368 | +// cityName.toString() + | ||
| 369 | +// address.toString() + | ||
| 370 | +// bussniss.toString(), | ||
| 371 | +// latLng)); | ||
| 372 | +// } | ||
| 373 | + | ||
| 374 | +// setState(() { | ||
| 375 | +// isloading = false; | ||
| 376 | +// }); | ||
| 377 | +// } | ||
| 378 | + | ||
| 379 | +// void searchAroundAddress(String text) async { | ||
| 380 | +// await AmapLocation.instance.updatePrivacyShow(true); | ||
| 381 | +// await AmapLocation.instance.updatePrivacyAgree(true); | ||
| 382 | +// final poiList = await AmapSearch.instance.searchKeyword( | ||
| 383 | +// text, | ||
| 384 | +// city: "", | ||
| 385 | +// ); | ||
| 386 | + | ||
| 387 | +// list.clear(); | ||
| 388 | +// list.add(poiModel); | ||
| 389 | +// for (var poi in poiList) { | ||
| 390 | +// String title = await poi.title; | ||
| 391 | +// LatLng latLng = await poi.latLng; | ||
| 392 | +// String cityName = await poi.cityName; | ||
| 393 | +// String provinceName = await poi.provinceName; | ||
| 394 | +// String address = await poi.address; | ||
| 395 | +// list.add(new PoiModel( | ||
| 396 | +// title.toString(), | ||
| 397 | +// provinceName.toString() + cityName.toString() + address.toString(), | ||
| 398 | +// latLng)); | ||
| 399 | +// } | ||
| 400 | +// setState(() { | ||
| 401 | +// isloading = false; | ||
| 402 | +// FocusScope.of(context).requestFocus(FocusNode()); | ||
| 403 | +// }); | ||
| 404 | +// } | ||
| 405 | +// } | ||
| 406 | + | ||
| 407 | +// class PoiModel { | ||
| 408 | +// LatLng latLng; | ||
| 409 | +// String title; | ||
| 410 | +// String address; | ||
| 411 | + | ||
| 412 | +// PoiModel(this.title, this.address, this.latLng); | ||
| 413 | +// } |
| 1 | +// import 'dart:convert'; | ||
| 2 | + | ||
| 3 | +// import 'dart:io'; | ||
| 4 | +// import 'dart:async'; | ||
| 5 | + | ||
| 6 | +// import 'package:cached_network_image/cached_network_image.dart'; | ||
| 7 | +// import 'package:flutter/material.dart'; | ||
| 8 | +// import 'package:flutter_ijkplayer/flutter_ijkplayer.dart'; | ||
| 9 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 10 | +// import 'package:one_key/models/upload_img_model.dart'; | ||
| 11 | +// import 'package:one_key/pages_sim/online_check/photo_view_wiget.dart'; | ||
| 12 | +// import 'package:one_key/pages_sim/online_check/progress.dart'; | ||
| 13 | + | ||
| 14 | +// import 'package:one_key/provider/online_check_edit_provider.dart'; | ||
| 15 | +// import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 16 | +// import 'package:one_key/res/colors.dart'; | ||
| 17 | +// import 'package:one_key/utils/dialog_util.dart'; | ||
| 18 | +// import 'package:one_key/utils/misc.dart'; | ||
| 19 | +// import 'package:one_key/utils/navigator_util.dart'; | ||
| 20 | +// import 'package:one_key/utils/upload_image_util.dart'; | ||
| 21 | +// import 'package:one_key/utils/utils.dart'; | ||
| 22 | +// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 23 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 24 | +// import 'package:permission_handler/permission_handler.dart'; | ||
| 25 | +// import 'package:photo/photo.dart'; | ||
| 26 | +// import 'package:provider/provider.dart'; | ||
| 27 | + | ||
| 28 | +// import 'package:image_picker/image_picker.dart'; | ||
| 29 | +// import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart'; | ||
| 30 | +// import 'package:video_player/video_player.dart'; | ||
| 31 | +// import '../online_check/dispose.dart'; | ||
| 32 | +// import 'package:photo_manager/photo_manager.dart'; | ||
| 33 | +// // import 'package:video_thumbnail/video_thumbnail.dart'; | ||
| 34 | +// import 'package:chewie/chewie.dart'; | ||
| 35 | + | ||
| 36 | +// typedef void OnPickImageCallback( | ||
| 37 | +// double maxWidth, double maxHeight, int quality); | ||
| 38 | + | ||
| 39 | +// class VideoPickerWidget extends StatefulWidget { | ||
| 40 | +// final ScrollController scrollController; | ||
| 41 | +// final Color borderColor; | ||
| 42 | +// final ValueChanged onChange; | ||
| 43 | +// final int maxImageNumber; | ||
| 44 | +// VideoPickerWidget( | ||
| 45 | +// {Key key, | ||
| 46 | +// this.scrollController, | ||
| 47 | +// this.borderColor = Colors.blue, | ||
| 48 | +// this.onChange, | ||
| 49 | +// this.maxImageNumber = 5}) | ||
| 50 | +// : super(key: key); | ||
| 51 | + | ||
| 52 | +// @override | ||
| 53 | +// _VideoPickerWidgetState createState() => _VideoPickerWidgetState(); | ||
| 54 | +// } | ||
| 55 | + | ||
| 56 | +// class _VideoPickerWidgetState extends DisposableState<VideoPickerWidget> { | ||
| 57 | +// final picker = ImagePicker(); | ||
| 58 | +// // OnlineCheckEditProvider _onlineCheckEditProvider; | ||
| 59 | +// UploadImageProvider _uploadImageProvider; | ||
| 60 | + | ||
| 61 | +// // 用户输入的文件名 | ||
| 62 | +// String key; | ||
| 63 | +// // 用户输入的 partSize | ||
| 64 | +// int partSize = 4; | ||
| 65 | +// // 用户输入的 token | ||
| 66 | +// String token; | ||
| 67 | + | ||
| 68 | +// /// storage 实例 | ||
| 69 | +// final Storage storage = Storage(); | ||
| 70 | +// // 控制器,可以用于取消任务、获取上述的状态,进度等信息 | ||
| 71 | +// // PutController putController = PutController(); | ||
| 72 | +// // 当前的任务状态 | ||
| 73 | + | ||
| 74 | +// // String thumbnailPath; | ||
| 75 | +// VideoPlayerController _controller; | ||
| 76 | +// Future _initializeVideoPlayerFuture; | ||
| 77 | + | ||
| 78 | +// // 声明控制器(两个) | ||
| 79 | +// VideoPlayerController videoPlayerController; | ||
| 80 | +// ChewieController chewieController; | ||
| 81 | +// IjkMediaController ijkMediaController = IjkMediaController(); | ||
| 82 | + | ||
| 83 | +// @override | ||
| 84 | +// void initState() { | ||
| 85 | +// // storage = Storage(); | ||
| 86 | +// // putController = PutController(); | ||
| 87 | +// super.initState(); | ||
| 88 | + | ||
| 89 | +// // _controller.setLooping(false); | ||
| 90 | +// // 生成控制器(两个) | ||
| 91 | +// } | ||
| 92 | + | ||
| 93 | +// @override | ||
| 94 | +// void dispose() { | ||
| 95 | +// super.dispose(); | ||
| 96 | +// // 销毁播放器的控制器 | ||
| 97 | +// _controller.dispose(); | ||
| 98 | +// chewieController.dispose(); | ||
| 99 | +// } | ||
| 100 | + | ||
| 101 | +// ///#相机拍照,单图选择 | ||
| 102 | +// Future _getFromPictureOrCamera(imageSource) async { | ||
| 103 | +// final pickedFile = await picker.getVideo( | ||
| 104 | +// source: imageSource, maxDuration: const Duration(seconds: 15)); | ||
| 105 | +// // thumbnailPath = await VideoThumbnail.thumbnailFile( | ||
| 106 | +// // video: pickedFile.path, | ||
| 107 | +// // imageFormat: ImageFormat.PNG, | ||
| 108 | +// // maxWidth: 128, | ||
| 109 | +// // quality: 25); | ||
| 110 | + | ||
| 111 | +// // print(thumbnailPath); | ||
| 112 | +// _controller = VideoPlayerController.file(File(pickedFile.path)); | ||
| 113 | +// _initializeVideoPlayerFuture = _controller.initialize(); | ||
| 114 | +// setState(() { | ||
| 115 | +// if (pickedFile != null) { | ||
| 116 | +// UploadImgModel imgModel = UploadImgModel(); | ||
| 117 | +// imgModel.file = File(pickedFile.path); | ||
| 118 | +// imgModel.process = 0.01; | ||
| 119 | +// _uploadImageProvider.imageList.add(imgModel); | ||
| 120 | +// } else { | ||
| 121 | +// print('No image selected.'); | ||
| 122 | +// } | ||
| 123 | +// }); | ||
| 124 | +// if (pickedFile != null) { | ||
| 125 | +// UploadImageUtil().startUpload( | ||
| 126 | +// context, | ||
| 127 | +// File(pickedFile.path), | ||
| 128 | +// _uploadImageProvider.imageList.length - 1, | ||
| 129 | +// true, | ||
| 130 | +// _uploadImageProvider); | ||
| 131 | +// } | ||
| 132 | +// } | ||
| 133 | + | ||
| 134 | +// ///多图片选择 | ||
| 135 | +// void pickAsset(PickType type, {List<AssetPathEntity> pathList}) async { | ||
| 136 | +// /// context is required, other params is optional. | ||
| 137 | +// List<AssetEntity> imgList = await PhotoPicker.pickAsset( | ||
| 138 | +// // BuildContext required | ||
| 139 | +// context: context, | ||
| 140 | + | ||
| 141 | +// /// The following are optional parameters. | ||
| 142 | +// themeColor: MyColours.color_199095, | ||
| 143 | +// // the title color and bottom color | ||
| 144 | +// textColor: Colors.white, | ||
| 145 | +// // text color | ||
| 146 | +// padding: 1.0, | ||
| 147 | +// // item padding | ||
| 148 | +// dividerColor: Colors.grey, | ||
| 149 | +// // divider color | ||
| 150 | +// disableColor: Colors.grey.shade300, | ||
| 151 | +// // the check box disable color | ||
| 152 | +// itemRadio: 0.88, | ||
| 153 | +// // the content item radio | ||
| 154 | +// maxSelected: | ||
| 155 | +// widget.maxImageNumber - _uploadImageProvider.imageList.length, | ||
| 156 | +// // max picker image count | ||
| 157 | +// // provider: I18nProvider.english, | ||
| 158 | +// provider: I18nProvider.chinese, | ||
| 159 | +// // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider() | ||
| 160 | +// rowCount: 3, | ||
| 161 | +// // item row count | ||
| 162 | +// thumbSize: 150, | ||
| 163 | +// // preview thumb size , default is 64 | ||
| 164 | +// sortDelegate: SortDelegate.common, | ||
| 165 | +// // default is common ,or you make custom delegate to sort your gallery | ||
| 166 | +// checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate( | ||
| 167 | +// activeColor: MyColours.color_353535, | ||
| 168 | +// unselectedColor: Colors.white, | ||
| 169 | +// checkColor: MyColours.color_199095, | ||
| 170 | +// ), | ||
| 171 | +// // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox | ||
| 172 | +// // loadingDelegate: this, | ||
| 173 | +// // if you want to build custom loading widget,extends LoadingDelegate, [see example/lib/main.dart] | ||
| 174 | +// badgeDelegate: const DurationBadgeDelegate(), | ||
| 175 | +// // badgeDelegate to show badge widget | ||
| 176 | +// pickType: type, | ||
| 177 | +// photoPathList: pathList, | ||
| 178 | +// ); | ||
| 179 | +// if (imgList == null || imgList.isEmpty) { | ||
| 180 | +// print("No pick item."); | ||
| 181 | +// return; | ||
| 182 | +// } else { | ||
| 183 | +// for (int i = 0; i < imgList.length; i++) { | ||
| 184 | +// var file = await imgList[i].file; | ||
| 185 | +// setState(() { | ||
| 186 | +// UploadImgModel imgModel = UploadImgModel(); | ||
| 187 | +// imgModel.file = File(file.absolute.path); | ||
| 188 | +// imgModel.process = 0.01; | ||
| 189 | +// _uploadImageProvider.imageList.add(imgModel); | ||
| 190 | +// }); | ||
| 191 | +// UploadImageUtil().startUpload( | ||
| 192 | +// context, | ||
| 193 | +// File(file.absolute.path), | ||
| 194 | +// _uploadImageProvider.imageList.length - 1, | ||
| 195 | +// false, | ||
| 196 | +// _uploadImageProvider); | ||
| 197 | +// // startUpload(File(file.absolute.path), | ||
| 198 | +// // _uploadImageProvider.imageList.length - 1, false); | ||
| 199 | +// } | ||
| 200 | +// } | ||
| 201 | +// } | ||
| 202 | + | ||
| 203 | +// ///添加图片UI弹出 | ||
| 204 | +// Future _openModalBottomSheet(context) async { | ||
| 205 | +// final option = await showModalBottomSheet( | ||
| 206 | +// context: context, | ||
| 207 | +// backgroundColor: Colors.transparent, | ||
| 208 | +// isDismissible: false, | ||
| 209 | +// builder: (BuildContext context) { | ||
| 210 | +// return Container( | ||
| 211 | +// // height: ScreenUtil().setWidth(180 * 2), | ||
| 212 | +// decoration: BoxDecoration( | ||
| 213 | +// color: MyColours.color_ffffff, | ||
| 214 | +// borderRadius: BorderRadius.only( | ||
| 215 | +// topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 216 | +// topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 217 | +// child: Column( | ||
| 218 | +// mainAxisSize: MainAxisSize.min, | ||
| 219 | +// children: <Widget>[ | ||
| 220 | +// InkWell( | ||
| 221 | +// onTap: () { | ||
| 222 | +// Utils.getPickPermission(context, () { | ||
| 223 | +// _getFromPictureOrCamera(ImageSource.camera); | ||
| 224 | +// Navigator.pop(context); | ||
| 225 | +// }, PermissionGroup.camera); | ||
| 226 | +// }, | ||
| 227 | +// child: Container( | ||
| 228 | +// width: double.infinity, | ||
| 229 | +// height: ScreenUtil().setWidth(58 * 2), | ||
| 230 | +// child: Center( | ||
| 231 | +// child: Text( | ||
| 232 | +// '拍摄', | ||
| 233 | +// style: TextStyle( | ||
| 234 | +// fontSize: ScreenUtil().setSp(32), | ||
| 235 | +// color: MyColours.color_353535, | ||
| 236 | +// fontWeight: FontWeight.bold), | ||
| 237 | +// ), | ||
| 238 | +// )), | ||
| 239 | +// ), | ||
| 240 | +// MyDivider( | ||
| 241 | +// double.infinity, | ||
| 242 | +// ScreenUtil().setWidth(2), | ||
| 243 | +// color: MyColours.color_EEEEEE, | ||
| 244 | +// ), | ||
| 245 | +// InkWell( | ||
| 246 | +// onTap: () { | ||
| 247 | +// Utils.getPickPermission(context, () { | ||
| 248 | +// // pickAsset(PickType.onlyVideo); | ||
| 249 | +// _getFromPictureOrCamera(ImageSource.gallery); | ||
| 250 | +// Navigator.pop(context); | ||
| 251 | +// }, PermissionGroup.photos); | ||
| 252 | +// }, | ||
| 253 | +// child: Container( | ||
| 254 | +// width: double.infinity, | ||
| 255 | +// height: ScreenUtil().setWidth(58 * 2), | ||
| 256 | +// child: Center( | ||
| 257 | +// child: Text( | ||
| 258 | +// '从相册选择', | ||
| 259 | +// style: TextStyle( | ||
| 260 | +// fontSize: ScreenUtil().setSp(32), | ||
| 261 | +// color: MyColours.color_353535, | ||
| 262 | +// fontWeight: FontWeight.bold), | ||
| 263 | +// ), | ||
| 264 | +// )), | ||
| 265 | +// ), | ||
| 266 | +// MyDivider( | ||
| 267 | +// double.infinity, | ||
| 268 | +// ScreenUtil().setWidth(10), | ||
| 269 | +// color: MyColours.color_EEEEEE, | ||
| 270 | +// ), | ||
| 271 | +// InkWell( | ||
| 272 | +// onTap: () { | ||
| 273 | +// Navigator.pop(context, '取消'); | ||
| 274 | +// }, | ||
| 275 | +// child: Container( | ||
| 276 | +// width: double.infinity, | ||
| 277 | +// height: ScreenUtil().setWidth(58 * 2), | ||
| 278 | +// child: Center( | ||
| 279 | +// child: Text( | ||
| 280 | +// '取消', | ||
| 281 | +// style: TextStyle( | ||
| 282 | +// fontSize: ScreenUtil().setSp(32), | ||
| 283 | +// color: MyColours.color_353535, | ||
| 284 | +// fontWeight: FontWeight.bold), | ||
| 285 | +// ), | ||
| 286 | +// ))) | ||
| 287 | +// ], | ||
| 288 | +// ), | ||
| 289 | +// ); | ||
| 290 | +// }); | ||
| 291 | +// } | ||
| 292 | + | ||
| 293 | +// //查看大图 | ||
| 294 | +// _showPhotoView(BuildContext context, int index, List imgs, | ||
| 295 | +// {isShow = false, List dashName}) async { | ||
| 296 | +// // if (imgs.length == 1 && | ||
| 297 | +// // imgs[0] == | ||
| 298 | +// // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') { | ||
| 299 | +// // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png'; | ||
| 300 | +// // } | ||
| 301 | +// // _controller = VideoPlayerController.network(imgs[index]); | ||
| 302 | +// // chewieController = ChewieController( | ||
| 303 | +// // videoPlayerController: _controller, | ||
| 304 | +// // // 比例 | ||
| 305 | +// // // aspectRatio: 16 / 9, | ||
| 306 | +// // // 自动播放 | ||
| 307 | +// // autoPlay: true, | ||
| 308 | +// // // 循环 | ||
| 309 | +// // looping: true, | ||
| 310 | +// // ); | ||
| 311 | + | ||
| 312 | +// ijkMediaController.setNetworkDataSource( | ||
| 313 | +// imgs[index], | ||
| 314 | +// autoPlay: true, | ||
| 315 | +// ); | ||
| 316 | +// Utils.setBarStatus(false, color: Colors.black); | ||
| 317 | +// dynamic result = await showGeneralDialog( | ||
| 318 | +// context: context, | ||
| 319 | +// barrierDismissible: false, | ||
| 320 | +// barrierColor: Colors.black, | ||
| 321 | +// barrierLabel: | ||
| 322 | +// MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 323 | +// transitionDuration: const Duration(milliseconds: 150), | ||
| 324 | +// pageBuilder: (BuildContext context, Animation animation, | ||
| 325 | +// Animation secondaryAnimation) { | ||
| 326 | +// return Column( | ||
| 327 | +// children: [ | ||
| 328 | +// Container( | ||
| 329 | +// height: ScreenUtil().setWidth(100), | ||
| 330 | +// color: Colors.black, | ||
| 331 | +// child: Row( | ||
| 332 | +// children: [ | ||
| 333 | +// Material( | ||
| 334 | +// child: InkWell( | ||
| 335 | +// onTap: () { | ||
| 336 | +// Navigator.pop(context); | ||
| 337 | +// }, | ||
| 338 | +// child: Image.asset(Utils.getImgPath('invication_back')), | ||
| 339 | +// )), | ||
| 340 | +// ], | ||
| 341 | +// ), | ||
| 342 | +// ), | ||
| 343 | + | ||
| 344 | +// // Chewie( | ||
| 345 | +// // controller: chewieController, | ||
| 346 | +// // ), | ||
| 347 | +// IjkPlayer(mediaController: ijkMediaController), | ||
| 348 | +// ], | ||
| 349 | +// ); | ||
| 350 | +// }); | ||
| 351 | +// // Utils.setBarStatus(true, color: Colors.white); | ||
| 352 | +// } | ||
| 353 | + | ||
| 354 | +// @override | ||
| 355 | +// Widget build(BuildContext context) { | ||
| 356 | +// _uploadImageProvider = | ||
| 357 | +// Provider.of<UploadImageProvider>(context, listen: true); | ||
| 358 | +// return _getGridImg( | ||
| 359 | +// _uploadImageProvider.imageList.length < widget.maxImageNumber | ||
| 360 | +// ? _uploadImageProvider.imageList.length + 1 | ||
| 361 | +// : _uploadImageProvider.imageList.length, | ||
| 362 | +// context, | ||
| 363 | +// _uploadImageProvider.imageList.length == widget.maxImageNumber | ||
| 364 | +// ? true | ||
| 365 | +// : false); | ||
| 366 | +// } | ||
| 367 | + | ||
| 368 | +// /// 九宫格 | ||
| 369 | +// Widget _getGridImg(count, context, isLinjie) { | ||
| 370 | +// // return | ||
| 371 | +// // GridView.builder( | ||
| 372 | +// // controller: widget.scrollController, | ||
| 373 | +// // // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)), | ||
| 374 | +// // shrinkWrap: true, | ||
| 375 | +// // itemCount: count, | ||
| 376 | +// // //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget | ||
| 377 | +// // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | ||
| 378 | +// // //横轴元素个数 | ||
| 379 | +// // crossAxisCount: 1, | ||
| 380 | +// // //纵轴间距 | ||
| 381 | +// // mainAxisSpacing: ScreenUtil().setWidth(30), | ||
| 382 | +// // //横轴间距 | ||
| 383 | +// // crossAxisSpacing: ScreenUtil().setWidth(30), | ||
| 384 | +// // //子组件宽高长度比例 | ||
| 385 | +// // // childAspectRatio: 1.0 | ||
| 386 | +// // ), | ||
| 387 | +// // itemBuilder: (BuildContext context, int index) { | ||
| 388 | +// //Widget Function(BuildContext context, int index) | ||
| 389 | +// var linjie = widget.maxImageNumber; | ||
| 390 | +// if (isLinjie) { | ||
| 391 | +// linjie = widget.maxImageNumber - 1; | ||
| 392 | +// } | ||
| 393 | +// if (0 == count - 1 && 0 < linjie) { | ||
| 394 | +// return InkWell( | ||
| 395 | +// onTap: () { | ||
| 396 | +// // 触摸收起键盘 | ||
| 397 | +// FocusScope.of(context).requestFocus(FocusNode()); | ||
| 398 | +// _openModalBottomSheet(context); | ||
| 399 | +// }, | ||
| 400 | +// child: Container( | ||
| 401 | +// width: ScreenUtil().setWidth(90 * 2), | ||
| 402 | +// height: ScreenUtil().setWidth(90 * 2), | ||
| 403 | +// decoration: BoxDecoration( | ||
| 404 | +// border: Border.all( | ||
| 405 | +// color: MyColours.color_E0E0E0, | ||
| 406 | +// width: ScreenUtil().setWidth(2)), | ||
| 407 | +// ), | ||
| 408 | +// child: Column( | ||
| 409 | +// children: [ | ||
| 410 | +// VEmptyView(74), | ||
| 411 | +// Image.asset( | ||
| 412 | +// Utils.getImgPath('add_image'), | ||
| 413 | +// width: ScreenUtil().setWidth(32), | ||
| 414 | +// height: ScreenUtil().setWidth(32), | ||
| 415 | +// ), | ||
| 416 | +// VEmptyView(10), | ||
| 417 | +// Text( | ||
| 418 | +// '添加视频', | ||
| 419 | +// style: TextStyle( | ||
| 420 | +// fontSize: ScreenUtil().setSp(24), | ||
| 421 | +// color: MyColours.color_999999), | ||
| 422 | +// ) | ||
| 423 | +// ], | ||
| 424 | +// )), | ||
| 425 | +// ); | ||
| 426 | +// } | ||
| 427 | +// return _uploadImageProvider.imageList.length < 1 | ||
| 428 | +// ? Text('') | ||
| 429 | +// : InkWell( | ||
| 430 | +// onTap: () { | ||
| 431 | +// if (_uploadImageProvider.imageList[0].process == 1) { | ||
| 432 | +// _uploadImageProvider.imageQiniuUrlList = []; | ||
| 433 | +// if (_uploadImageProvider.imageList[0].qiniuUrl != null) { | ||
| 434 | +// for (int i = 0; | ||
| 435 | +// i < _uploadImageProvider.imageList.length; | ||
| 436 | +// i++) { | ||
| 437 | +// _uploadImageProvider.imageQiniuUrlList | ||
| 438 | +// .add(_uploadImageProvider.imageList[i].qiniuUrl); | ||
| 439 | +// } | ||
| 440 | + | ||
| 441 | +// ///没有上传完成的不可以点击 | ||
| 442 | +// // _showPhotoView( | ||
| 443 | +// // context, 0, _uploadImageProvider.imageQiniuUrlList); | ||
| 444 | +// NavigatorUtil.goPlayVideoPageSim(context, | ||
| 445 | +// urlStr: _uploadImageProvider.imageQiniuUrlList[0]); | ||
| 446 | +// } | ||
| 447 | +// } | ||
| 448 | +// }, | ||
| 449 | +// child: Stack( | ||
| 450 | +// children: [ | ||
| 451 | +// Stack( | ||
| 452 | +// alignment: Alignment.topRight, | ||
| 453 | +// children: [ | ||
| 454 | +// // Image.file( | ||
| 455 | +// // // _uploadImageProvider.imageList[index].file, | ||
| 456 | +// // File(thumbnailPath), | ||
| 457 | +// // fit: BoxFit.cover, | ||
| 458 | +// // width: ScreenUtil().setWidth(100 * 2), | ||
| 459 | +// // height: ScreenUtil().setWidth(100 * 2), | ||
| 460 | +// // ), | ||
| 461 | +// FutureBuilder( | ||
| 462 | +// //显示缩略图 | ||
| 463 | +// future: _initializeVideoPlayerFuture, | ||
| 464 | +// builder: (context, snapshot) { | ||
| 465 | +// print(snapshot.connectionState); | ||
| 466 | +// if (snapshot.hasError) print(snapshot.error); | ||
| 467 | +// if (snapshot.connectionState == ConnectionState.done) { | ||
| 468 | +// return Container( | ||
| 469 | +// width: ScreenUtil().setWidth(225), | ||
| 470 | +// child: AspectRatio( | ||
| 471 | +// // aspectRatio: 1 / 1, | ||
| 472 | +// aspectRatio: _controller.value.aspectRatio, | ||
| 473 | +// child: VideoPlayer(_controller), | ||
| 474 | +// ), | ||
| 475 | +// ); | ||
| 476 | +// } else { | ||
| 477 | +// return Center( | ||
| 478 | +// child: CircularProgressIndicator(), | ||
| 479 | +// ); | ||
| 480 | +// } | ||
| 481 | +// }, | ||
| 482 | +// ), | ||
| 483 | + | ||
| 484 | +// Offstage( | ||
| 485 | +// offstage: _uploadImageProvider.imageList[0].process < 1, | ||
| 486 | +// child: GestureDetector( | ||
| 487 | +// child: Image.asset( | ||
| 488 | +// Utils.getImgPath("delete"), | ||
| 489 | +// width: ScreenUtil().setWidth(40), | ||
| 490 | +// height: ScreenUtil().setWidth(40), | ||
| 491 | +// ), | ||
| 492 | +// onTap: () { | ||
| 493 | +// //点击删除按钮 | ||
| 494 | +// setState(() { | ||
| 495 | +// _uploadImageProvider.imageList.removeWhere( | ||
| 496 | +// (element) => | ||
| 497 | +// element == | ||
| 498 | +// _uploadImageProvider.imageList[0]); | ||
| 499 | +// _uploadImageProvider.imageQiniuUrlList.removeWhere( | ||
| 500 | +// (element) => | ||
| 501 | +// element == | ||
| 502 | +// _uploadImageProvider.imageQiniuUrlList[0]); | ||
| 503 | +// }); | ||
| 504 | +// }, | ||
| 505 | +// ), | ||
| 506 | +// ), | ||
| 507 | +// ], | ||
| 508 | +// ), | ||
| 509 | +// Offstage( | ||
| 510 | +// offstage: _uploadImageProvider.imageList[0].process == 1, | ||
| 511 | +// child: Progress(_uploadImageProvider.imageList[0].process), | ||
| 512 | +// ) | ||
| 513 | +// ], | ||
| 514 | +// )); | ||
| 515 | +// // }); | ||
| 516 | +// } | ||
| 517 | +// } |
lib/pages_sim/create_store/play_video.dart
0 → 100644
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | + | ||
| 3 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 4 | +// import 'package:video_player/video_player.dart'; | ||
| 5 | + | ||
| 6 | +// class PlayVideoPage extends StatefulWidget { | ||
| 7 | +// final String url; | ||
| 8 | +// PlayVideoPageSim({Key key, this.url}) : super(key: key); | ||
| 9 | + | ||
| 10 | +// @override | ||
| 11 | +// _PlayVideoPageState createState() => _PlayVideoPageState(); | ||
| 12 | +// } | ||
| 13 | + | ||
| 14 | +// class _PlayVideoPageState extends State<PlayVideoPage> { | ||
| 15 | +// // IjkMediaController ijkMediaController = IjkMediaController(); | ||
| 16 | + | ||
| 17 | +// VideoPlayerController _controller; | ||
| 18 | +// @override | ||
| 19 | +// void initState() { | ||
| 20 | +// // TODO: implement initState | ||
| 21 | +// super.initState(); | ||
| 22 | +// // ijkMediaController.setNetworkDataSource( | ||
| 23 | +// // widget.url, | ||
| 24 | +// // autoPlay: true, | ||
| 25 | +// // ); | ||
| 26 | +// _controller = VideoPlayerController.network(widget.url) | ||
| 27 | +// ..initialize().then((_) { | ||
| 28 | +// setState(() {}); | ||
| 29 | +// }); | ||
| 30 | +// _controller.play(); | ||
| 31 | +// _controller.setLooping(true); | ||
| 32 | +// } | ||
| 33 | + | ||
| 34 | +// @override | ||
| 35 | +// void dispose() { | ||
| 36 | +// super.dispose(); | ||
| 37 | +// _controller.dispose(); | ||
| 38 | +// } | ||
| 39 | + | ||
| 40 | +// @override | ||
| 41 | +// Widget build(BuildContext context) { | ||
| 42 | +// return Scaffold( | ||
| 43 | +// appBar: SystemAppBar( | ||
| 44 | +// '', | ||
| 45 | +// onTap: () { | ||
| 46 | +// Navigator.pop(context); | ||
| 47 | +// }, | ||
| 48 | +// ), | ||
| 49 | +// // body: IjkPlayer(mediaController: ijkMediaController), | ||
| 50 | +// body: Container( | ||
| 51 | +// color: Colors.black, | ||
| 52 | +// child: Center( | ||
| 53 | +// child: _controller.value.isInitialized | ||
| 54 | +// ? AspectRatio( | ||
| 55 | +// aspectRatio: _controller.value.aspectRatio, | ||
| 56 | +// child: VideoPlayer(_controller), | ||
| 57 | +// ) | ||
| 58 | +// : CircularProgressIndicator(), | ||
| 59 | +// ), | ||
| 60 | +// )); | ||
| 61 | +// } | ||
| 62 | +// } |
lib/pages_sim/create_store/video_widget.dart
0 → 100644
| 1 | +// import 'dart:io'; | ||
| 2 | +// import 'dart:async'; | ||
| 3 | + | ||
| 4 | +// import 'package:flutter/material.dart'; | ||
| 5 | +// import 'package:flutter/rendering.dart'; | ||
| 6 | +// import 'package:flutter_native_image/flutter_native_image.dart'; | ||
| 7 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 8 | +// import 'package:one_key/models/upload_img_model.dart'; | ||
| 9 | +// import 'package:one_key/pages_sim/online_check/photo_view_wiget.dart'; | ||
| 10 | +// import 'package:one_key/pages_sim/online_check/progress.dart'; | ||
| 11 | + | ||
| 12 | +// import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 13 | +// import 'package:one_key/res/colors.dart'; | ||
| 14 | + | ||
| 15 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 16 | +// import 'package:one_key/utils/upload_image_util.dart'; | ||
| 17 | +// import 'package:one_key/utils/utils.dart'; | ||
| 18 | +// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 19 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 20 | +// import 'package:permission_handler/permission_handler.dart'; | ||
| 21 | +// // import 'package:photo/photo.dart'; | ||
| 22 | + | ||
| 23 | +// import 'package:image_picker/image_picker.dart'; | ||
| 24 | +// // import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart'; | ||
| 25 | +// import 'package:qiniu_flutter_sdk_diox/qiniu_flutter_sdk_diox.dart'; | ||
| 26 | +// import 'package:wechat_assets_picker/wechat_assets_picker.dart'; | ||
| 27 | +// import '../online_check/dispose.dart'; | ||
| 28 | +// import 'package:photo_manager/photo_manager.dart'; | ||
| 29 | +// import 'package:video_compress/video_compress.dart'; | ||
| 30 | + | ||
| 31 | +// typedef void OnPickImageCallback( | ||
| 32 | +// double maxWidth, double maxHeight, int quality); | ||
| 33 | + | ||
| 34 | +// class VideoPickerWidget extends StatefulWidget { | ||
| 35 | +// final ScrollController scrollController; | ||
| 36 | +// final Color borderColor; | ||
| 37 | +// final ValueChanged onChange; | ||
| 38 | +// final int maxImageNumber; | ||
| 39 | +// final UploadImageProvider model; | ||
| 40 | +// VideoPickerWidget( | ||
| 41 | +// {Key key, | ||
| 42 | +// this.scrollController, | ||
| 43 | +// this.borderColor = Colors.blue, | ||
| 44 | +// this.onChange, | ||
| 45 | +// this.maxImageNumber = 5, | ||
| 46 | +// this.model}) | ||
| 47 | +// : super(key: key); | ||
| 48 | + | ||
| 49 | +// @override | ||
| 50 | +// _VideoPickerWidgetState createState() => _VideoPickerWidgetState(); | ||
| 51 | +// } | ||
| 52 | + | ||
| 53 | +// class _VideoPickerWidgetState extends DisposableState<VideoPickerWidget> { | ||
| 54 | +// final picker = ImagePicker(); | ||
| 55 | + | ||
| 56 | +// // 用户输入的文件名 | ||
| 57 | +// String key; | ||
| 58 | +// // 用户输入的 partSize | ||
| 59 | +// int partSize = 4; | ||
| 60 | +// // 用户输入的 token | ||
| 61 | +// String token; | ||
| 62 | + | ||
| 63 | +// /// storage 实例 | ||
| 64 | +// final Storage storage = Storage(); | ||
| 65 | +// // 控制器,可以用于取消任务、获取上述的状态,进度等信息 | ||
| 66 | +// // PutController putController = PutController(); | ||
| 67 | +// // 当前的任务状态 | ||
| 68 | + | ||
| 69 | +// @override | ||
| 70 | +// void initState() { | ||
| 71 | +// super.initState(); | ||
| 72 | +// } | ||
| 73 | + | ||
| 74 | +// ///#相机拍照,单图选择 | ||
| 75 | +// //////#相机拍照,单图选择 | ||
| 76 | +// Future _getImageFromPictureOrCamera(ImageSource imageSource) async { | ||
| 77 | +// final pickedFile = await picker.pickImage(source: imageSource); | ||
| 78 | +// // String ddd = Utils.getPicSuffix(pickedFile.path); | ||
| 79 | +// // print(ddd); | ||
| 80 | +// File compressedFile = await FlutterNativeImage.compressImage( | ||
| 81 | +// pickedFile.path, | ||
| 82 | +// quality: 70, | ||
| 83 | +// percentage: 50); | ||
| 84 | +// setState(() { | ||
| 85 | +// if (pickedFile != null) { | ||
| 86 | +// UploadImgModel imgModel = UploadImgModel(); | ||
| 87 | +// imgModel.file = File(pickedFile.path); | ||
| 88 | +// imgModel.process = 0.01; | ||
| 89 | +// imgModel.fileType = FileType.image; | ||
| 90 | +// widget.model.imageListDenvironment.add(imgModel); | ||
| 91 | +// } else { | ||
| 92 | +// print('No image selected.'); | ||
| 93 | +// } | ||
| 94 | +// }); | ||
| 95 | +// if (pickedFile != null) { | ||
| 96 | +// bool need = await Utils.sizeNeed(File(pickedFile.path)); | ||
| 97 | +// File file = File(pickedFile.path); | ||
| 98 | +// if (need) { | ||
| 99 | +// file = File(compressedFile.absolute.path); | ||
| 100 | +// } | ||
| 101 | +// UploadImageUtil().startUpload( | ||
| 102 | +// context, | ||
| 103 | +// file, | ||
| 104 | +// widget.model.imageListDenvironment.length - 1, | ||
| 105 | +// true, | ||
| 106 | +// widget.model, | ||
| 107 | +// UploadType.EnvironmentUploadType); | ||
| 108 | +// } | ||
| 109 | +// } | ||
| 110 | + | ||
| 111 | +// ///视频 | ||
| 112 | +// Future _getVideoFromPictureOrCamera(ImageSource imageSource) async { | ||
| 113 | +// final pickedFile = await picker.pickVideo( | ||
| 114 | +// source: imageSource, maxDuration: const Duration(seconds: 15)); | ||
| 115 | +// String ddd = Utils.getPicSuffix(pickedFile.path); | ||
| 116 | +// print(ddd); | ||
| 117 | +// await VideoCompress.setLogLevel(0); | ||
| 118 | +// final info = await VideoCompress.getMediaInfo(pickedFile.path); | ||
| 119 | +// String duration = '00'; | ||
| 120 | +// if (info != null) { | ||
| 121 | +// if (info.duration > 15000 || info.duration < 11000) { | ||
| 122 | +// Utils.showToast('请选择10~15s的视频'); | ||
| 123 | +// return; | ||
| 124 | +// } | ||
| 125 | +// duration = Utils.addZeroNumber((info.duration / 1000).round()); | ||
| 126 | +// } | ||
| 127 | +// File thumbnailPath = await VideoCompress.getFileThumbnail(pickedFile.path, | ||
| 128 | +// quality: 100, // default(100) | ||
| 129 | +// position: -1 // default(-1) | ||
| 130 | +// ); | ||
| 131 | + | ||
| 132 | +// if (pickedFile != null) { | ||
| 133 | +// File compressedFile = await FlutterNativeImage.compressImage( | ||
| 134 | +// pickedFile.path, | ||
| 135 | +// quality: 70, | ||
| 136 | +// percentage: 50); | ||
| 137 | +// UploadImgModel imgModel = UploadImgModel(); | ||
| 138 | +// imgModel.file = File(pickedFile.path); | ||
| 139 | +// imgModel.process = 0.01; | ||
| 140 | +// imgModel.fileType = FileType.video; | ||
| 141 | +// imgModel.thumbnailPath = thumbnailPath; | ||
| 142 | +// imgModel.duration = duration; | ||
| 143 | +// widget.model.imageListDenvironment.add(imgModel); | ||
| 144 | +// setState(() {}); | ||
| 145 | +// bool need = await Utils.sizeNeed(File(pickedFile.path)); | ||
| 146 | +// File file = File(pickedFile.path); | ||
| 147 | +// if (need) { | ||
| 148 | +// file = File(compressedFile.absolute.path); | ||
| 149 | +// } | ||
| 150 | +// UploadImageUtil().startUpload( | ||
| 151 | +// context, | ||
| 152 | +// file, | ||
| 153 | +// widget.model.imageListDenvironment.length - 1, | ||
| 154 | +// true, | ||
| 155 | +// widget.model, | ||
| 156 | +// UploadType.EnvironmentUploadType); | ||
| 157 | +// } else { | ||
| 158 | +// print('No image selected.'); | ||
| 159 | +// } | ||
| 160 | +// } | ||
| 161 | + | ||
| 162 | +// ///多图片选择 | ||
| 163 | +// void pickAsset(RequestType type, {List<AssetPathEntity> pathList}) async { | ||
| 164 | +// /// context is required, other params is optional. | ||
| 165 | +// // List<AssetEntity> imgList = await PhotoPicker.pickAsset( | ||
| 166 | +// // // BuildContext required | ||
| 167 | +// // context: context, | ||
| 168 | + | ||
| 169 | +// // /// The following are optional parameters. | ||
| 170 | +// // themeColor: MyColours.color_199095, | ||
| 171 | +// // // the title color and bottom color | ||
| 172 | +// // textColor: Colors.white, | ||
| 173 | +// // // text color | ||
| 174 | +// // padding: 1.0, | ||
| 175 | +// // // item padding | ||
| 176 | +// // dividerColor: Colors.grey, | ||
| 177 | +// // // divider color | ||
| 178 | +// // disableColor: Colors.grey.shade300, | ||
| 179 | +// // // the check box disable color | ||
| 180 | +// // itemRadio: 0.88, | ||
| 181 | +// // // the content item radio | ||
| 182 | +// // maxSelected: | ||
| 183 | +// // widget.maxImageNumber - widget.model.imageListDenvironment.length, | ||
| 184 | +// // // max picker image count | ||
| 185 | +// // // provider: I18nProvider.english, | ||
| 186 | +// // provider: I18nProvider.chinese, | ||
| 187 | +// // // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider() | ||
| 188 | +// // rowCount: 3, | ||
| 189 | +// // // item row count | ||
| 190 | +// // thumbSize: 150, | ||
| 191 | +// // // preview thumb size , default is 64 | ||
| 192 | +// // sortDelegate: SortDelegate.common, | ||
| 193 | +// // // default is common ,or you make custom delegate to sort your gallery | ||
| 194 | +// // checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate( | ||
| 195 | +// // activeColor: MyColours.color_353535, | ||
| 196 | +// // unselectedColor: Colors.white, | ||
| 197 | +// // checkColor: MyColours.color_199095, | ||
| 198 | +// // ), | ||
| 199 | +// // // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox | ||
| 200 | +// // // loadingDelegate: this, | ||
| 201 | +// // // if you want to build custom loading widget,extends LoadingDelegate, [see example/lib/main.dart] | ||
| 202 | +// // badgeDelegate: const DurationBadgeDelegate(), | ||
| 203 | +// // // badgeDelegate to show badge widget | ||
| 204 | +// // pickType: type, | ||
| 205 | +// // photoPathList: pathList, | ||
| 206 | +// // ); | ||
| 207 | +// List<AssetEntity> imgList = await AssetPicker.pickAssets(context, | ||
| 208 | +// pickerConfig: AssetPickerConfig( | ||
| 209 | +// maxAssets: widget.maxImageNumber - | ||
| 210 | +// widget.model.imageListDenvironment.length, | ||
| 211 | +// // selectedAssets: assets, | ||
| 212 | +// requestType: type, | ||
| 213 | +// themeColor: MyColours.color_199095)); | ||
| 214 | +// if (imgList == null || imgList.isEmpty) { | ||
| 215 | +// print("No pick item."); | ||
| 216 | +// return; | ||
| 217 | +// } else { | ||
| 218 | +// for (int i = 0; i < imgList.length; i++) { | ||
| 219 | +// var file = await imgList[i].file; | ||
| 220 | +// setState(() { | ||
| 221 | +// UploadImgModel imgModel = UploadImgModel(); | ||
| 222 | +// imgModel.file = File(file.absolute.path); | ||
| 223 | +// imgModel.process = 0.01; | ||
| 224 | +// imgModel.fileType = FileType.image; | ||
| 225 | +// widget.model.imageListDenvironment.add(imgModel); | ||
| 226 | +// }); | ||
| 227 | + | ||
| 228 | +// bool need = await Utils.sizeNeed(file); | ||
| 229 | + | ||
| 230 | +// if (need) { | ||
| 231 | +// File compressedFile = await FlutterNativeImage.compressImage( | ||
| 232 | +// file.path, | ||
| 233 | +// quality: 50, | ||
| 234 | +// percentage: 50); | ||
| 235 | +// file = File(compressedFile.absolute.path); | ||
| 236 | +// } | ||
| 237 | +// UploadImageUtil().startUpload( | ||
| 238 | +// context, | ||
| 239 | +// file, | ||
| 240 | +// widget.model.imageListDenvironment.length - 1, | ||
| 241 | +// false, | ||
| 242 | +// widget.model, | ||
| 243 | +// UploadType.EnvironmentUploadType); | ||
| 244 | +// // startUpload(File(file.absolute.path), | ||
| 245 | +// // _uploadImageProvider.imageListDenvironment.length - 1, false); | ||
| 246 | +// } | ||
| 247 | +// } | ||
| 248 | +// } | ||
| 249 | + | ||
| 250 | +// ///添加图片UI弹出 | ||
| 251 | +// Future _openModalBottomSheet(context, FileType fileType) async { | ||
| 252 | +// final option = await showModalBottomSheet( | ||
| 253 | +// context: context, | ||
| 254 | +// backgroundColor: Colors.transparent, | ||
| 255 | +// isDismissible: false, | ||
| 256 | +// builder: (BuildContext context) { | ||
| 257 | +// return Container( | ||
| 258 | +// // height: ScreenUtil().setWidth(180 * 2), | ||
| 259 | +// decoration: BoxDecoration( | ||
| 260 | +// color: MyColours.color_ffffff, | ||
| 261 | +// borderRadius: BorderRadius.only( | ||
| 262 | +// topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 263 | +// topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 264 | +// child: Column( | ||
| 265 | +// mainAxisSize: MainAxisSize.min, | ||
| 266 | +// children: <Widget>[ | ||
| 267 | +// InkWell( | ||
| 268 | +// onTap: () { | ||
| 269 | +// Utils.getPickPermission(context, () { | ||
| 270 | +// if (fileType == FileType.image) { | ||
| 271 | +// _getImageFromPictureOrCamera(ImageSource.camera); | ||
| 272 | +// } else { | ||
| 273 | +// _getVideoFromPictureOrCamera(ImageSource.camera); | ||
| 274 | +// } | ||
| 275 | + | ||
| 276 | +// Navigator.pop(context); | ||
| 277 | +// }, Permission.camera); | ||
| 278 | +// }, | ||
| 279 | +// child: Container( | ||
| 280 | +// width: double.infinity, | ||
| 281 | +// height: ScreenUtil().setWidth(58 * 2), | ||
| 282 | +// child: Center( | ||
| 283 | +// child: Text( | ||
| 284 | +// '拍摄', | ||
| 285 | +// style: TextStyle( | ||
| 286 | +// fontSize: ScreenUtil().setSp(32), | ||
| 287 | +// color: MyColours.color_353535, | ||
| 288 | +// fontWeight: FontWeight.bold), | ||
| 289 | +// ), | ||
| 290 | +// )), | ||
| 291 | +// ), | ||
| 292 | +// MyDivider( | ||
| 293 | +// double.infinity, | ||
| 294 | +// ScreenUtil().setWidth(2), | ||
| 295 | +// color: MyColours.color_EEEEEE, | ||
| 296 | +// ), | ||
| 297 | +// InkWell( | ||
| 298 | +// onTap: () { | ||
| 299 | +// Utils.getPickPermission(context, () { | ||
| 300 | +// if (fileType == FileType.image) { | ||
| 301 | +// pickAsset(RequestType.image); | ||
| 302 | +// } else { | ||
| 303 | +// _getVideoFromPictureOrCamera(ImageSource.gallery); | ||
| 304 | +// } | ||
| 305 | +// // // | ||
| 306 | +// // _getFromPictureOrCamera(ImageSource.gallery); | ||
| 307 | +// Navigator.pop(context); | ||
| 308 | +// }, | ||
| 309 | +// Platform.isAndroid | ||
| 310 | +// ? Permission.storage | ||
| 311 | +// : Permission.photos); | ||
| 312 | +// }, | ||
| 313 | +// child: Container( | ||
| 314 | +// width: double.infinity, | ||
| 315 | +// height: ScreenUtil().setWidth(58 * 2), | ||
| 316 | +// child: Center( | ||
| 317 | +// child: Text( | ||
| 318 | +// '从相册选择', | ||
| 319 | +// style: TextStyle( | ||
| 320 | +// fontSize: ScreenUtil().setSp(32), | ||
| 321 | +// color: MyColours.color_353535, | ||
| 322 | +// fontWeight: FontWeight.bold), | ||
| 323 | +// ), | ||
| 324 | +// )), | ||
| 325 | +// ), | ||
| 326 | +// MyDivider( | ||
| 327 | +// double.infinity, | ||
| 328 | +// ScreenUtil().setWidth(10), | ||
| 329 | +// color: MyColours.color_EEEEEE, | ||
| 330 | +// ), | ||
| 331 | +// InkWell( | ||
| 332 | +// onTap: () { | ||
| 333 | +// Navigator.pop(context, '取消'); | ||
| 334 | +// }, | ||
| 335 | +// child: Container( | ||
| 336 | +// width: double.infinity, | ||
| 337 | +// height: ScreenUtil().setWidth(58 * 2), | ||
| 338 | +// child: Center( | ||
| 339 | +// child: Text( | ||
| 340 | +// '取消', | ||
| 341 | +// style: TextStyle( | ||
| 342 | +// fontSize: ScreenUtil().setSp(32), | ||
| 343 | +// color: MyColours.color_353535, | ||
| 344 | +// fontWeight: FontWeight.bold), | ||
| 345 | +// ), | ||
| 346 | +// ))) | ||
| 347 | +// ], | ||
| 348 | +// ), | ||
| 349 | +// ); | ||
| 350 | +// }); | ||
| 351 | +// } | ||
| 352 | + | ||
| 353 | +// @override | ||
| 354 | +// Widget build(BuildContext context) { | ||
| 355 | +// return _getGridImg( | ||
| 356 | +// widget.model.imageListDenvironment.length < widget.maxImageNumber | ||
| 357 | +// ? widget.model.imageListDenvironment.length + 2 | ||
| 358 | +// : widget.model.imageListDenvironment.length, | ||
| 359 | +// context, | ||
| 360 | +// widget.model.imageListDenvironment.length == widget.maxImageNumber | ||
| 361 | +// ? true | ||
| 362 | +// : false); | ||
| 363 | +// } | ||
| 364 | + | ||
| 365 | +// //查看大图 | ||
| 366 | +// _showPhotoView(BuildContext context, int index, List imgs, | ||
| 367 | +// {isShow = false, List dashName}) async { | ||
| 368 | +// // if (imgs.length == 1 && | ||
| 369 | +// // imgs[0] == | ||
| 370 | +// // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') { | ||
| 371 | +// // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png'; | ||
| 372 | +// // } | ||
| 373 | +// Utils.setBarStatus(false, color: Colors.black); | ||
| 374 | +// dynamic result = await showGeneralDialog( | ||
| 375 | +// context: context, | ||
| 376 | +// barrierDismissible: false, | ||
| 377 | +// // barrierColor: Colors.red, | ||
| 378 | +// barrierLabel: | ||
| 379 | +// MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 380 | +// transitionDuration: const Duration(milliseconds: 150), | ||
| 381 | +// pageBuilder: (BuildContext context, Animation animation, | ||
| 382 | +// Animation secondaryAnimation) { | ||
| 383 | +// Widget child = Stack( | ||
| 384 | +// children: <Widget>[ | ||
| 385 | +// PhotoPreview( | ||
| 386 | +// initialIndex: index, | ||
| 387 | +// photoList: imgs, | ||
| 388 | +// isShow: isShow, | ||
| 389 | +// dashName: dashName) | ||
| 390 | +// ], | ||
| 391 | +// ); | ||
| 392 | +// return child; | ||
| 393 | +// }); | ||
| 394 | +// Utils.setBarStatus(true, color: Colors.white); | ||
| 395 | +// } | ||
| 396 | + | ||
| 397 | +// /// 九宫格 | ||
| 398 | +// Widget _getGridImg(count, context, isLinjie) { | ||
| 399 | +// return Container( | ||
| 400 | +// height: ScreenUtil().setWidth(90 * 2), | ||
| 401 | +// child: ListView.builder( | ||
| 402 | +// controller: widget.scrollController, | ||
| 403 | +// // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)), | ||
| 404 | +// shrinkWrap: true, | ||
| 405 | +// itemCount: count, | ||
| 406 | +// //列表高度 | ||
| 407 | +// itemExtent: ScreenUtil().setWidth(100 * 2), | ||
| 408 | +// scrollDirection: Axis.horizontal, | ||
| 409 | +// padding: | ||
| 410 | +// EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(70)), | ||
| 411 | +// //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget | ||
| 412 | +// // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | ||
| 413 | +// // //横轴元素个数 | ||
| 414 | +// // crossAxisCount: 3, | ||
| 415 | +// // //纵轴间距 | ||
| 416 | +// // mainAxisSpacing: ScreenUtil().setWidth(30), | ||
| 417 | +// // //横轴间距 | ||
| 418 | +// // crossAxisSpacing: ScreenUtil().setWidth(30), | ||
| 419 | +// // //子组件宽高长度比例 | ||
| 420 | +// // childAspectRatio: 1.0), | ||
| 421 | +// itemBuilder: (BuildContext context, int index) { | ||
| 422 | +// var linjie = widget.maxImageNumber; | ||
| 423 | +// if (isLinjie) { | ||
| 424 | +// linjie = widget.maxImageNumber - 2; | ||
| 425 | +// } | ||
| 426 | +// if (index == count - 2 && index < linjie) { | ||
| 427 | +// return InkWell( | ||
| 428 | +// onTap: () { | ||
| 429 | +// // 触摸收起键盘 | ||
| 430 | +// FocusScope.of(context).requestFocus(FocusNode()); | ||
| 431 | +// _openModalBottomSheet(context, FileType.image); | ||
| 432 | +// }, | ||
| 433 | +// child: Container( | ||
| 434 | +// width: ScreenUtil().setWidth(110 * 2), | ||
| 435 | +// height: ScreenUtil().setWidth(90 * 2), | ||
| 436 | +// margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)), | ||
| 437 | +// decoration: BoxDecoration( | ||
| 438 | +// border: Border.all( | ||
| 439 | +// color: MyColours.color_E0E0E0, | ||
| 440 | +// width: ScreenUtil().setWidth(2)), | ||
| 441 | +// ), | ||
| 442 | +// child: Column( | ||
| 443 | +// children: [ | ||
| 444 | +// VEmptyView(46), | ||
| 445 | +// Image.asset( | ||
| 446 | +// Utils.getImgPath('add_image'), | ||
| 447 | +// width: ScreenUtil().setWidth(44), | ||
| 448 | +// height: ScreenUtil().setWidth(40), | ||
| 449 | +// ), | ||
| 450 | +// VEmptyView(10), | ||
| 451 | +// Text( | ||
| 452 | +// '上传照片', | ||
| 453 | +// style: TextStyle( | ||
| 454 | +// fontSize: ScreenUtil().setSp(24), | ||
| 455 | +// color: MyColours.color_999999), | ||
| 456 | +// ) | ||
| 457 | +// ], | ||
| 458 | +// )), | ||
| 459 | +// ); | ||
| 460 | +// } | ||
| 461 | +// if (index == count - 1 && index <= linjie) { | ||
| 462 | +// return InkWell( | ||
| 463 | +// onTap: () { | ||
| 464 | +// // 触摸收起键盘 | ||
| 465 | +// FocusScope.of(context).requestFocus(FocusNode()); | ||
| 466 | +// _openModalBottomSheet(context, FileType.video); | ||
| 467 | +// }, | ||
| 468 | +// child: Container( | ||
| 469 | +// width: ScreenUtil().setWidth(110 * 2), | ||
| 470 | +// height: ScreenUtil().setWidth(90 * 2), | ||
| 471 | +// margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)), | ||
| 472 | +// decoration: BoxDecoration( | ||
| 473 | +// border: Border.all( | ||
| 474 | +// color: MyColours.color_E0E0E0, | ||
| 475 | +// width: ScreenUtil().setWidth(2)), | ||
| 476 | +// ), | ||
| 477 | +// child: Column( | ||
| 478 | +// children: [ | ||
| 479 | +// VEmptyView(46), | ||
| 480 | +// Image.asset( | ||
| 481 | +// Utils.getImgPath('add_video'), | ||
| 482 | +// width: ScreenUtil().setWidth(44), | ||
| 483 | +// height: ScreenUtil().setWidth(40), | ||
| 484 | +// ), | ||
| 485 | +// VEmptyView(10), | ||
| 486 | +// Text( | ||
| 487 | +// '上传视频', | ||
| 488 | +// style: TextStyle( | ||
| 489 | +// fontSize: ScreenUtil().setSp(24), | ||
| 490 | +// color: MyColours.color_999999), | ||
| 491 | +// ) | ||
| 492 | +// ], | ||
| 493 | +// )), | ||
| 494 | +// ); | ||
| 495 | +// } | ||
| 496 | + | ||
| 497 | +// return widget.model.imageListDenvironment.length < 1 | ||
| 498 | +// ? Text('') | ||
| 499 | +// : InkWell( | ||
| 500 | +// onTap: () { | ||
| 501 | +// if (widget.model.imageListDenvironment[index].process == | ||
| 502 | +// 1) { | ||
| 503 | +// widget.model.imageQiniuUrlList = []; | ||
| 504 | +// if (widget.model.imageListDenvironment[index] | ||
| 505 | +// .qiniuUrl != | ||
| 506 | +// null) { | ||
| 507 | +// if (widget.model.imageListDenvironment[index] | ||
| 508 | +// .fileType == | ||
| 509 | +// FileType.image) { | ||
| 510 | +// List<UploadImgModel> temp = []; | ||
| 511 | +// temp.addAll(widget.model.imageListDenvironment); | ||
| 512 | +// temp.removeWhere((element) => | ||
| 513 | +// element.fileType == FileType.video); | ||
| 514 | +// for (int i = 0; i < temp.length; i++) { | ||
| 515 | +// widget.model.imageQiniuUrlList | ||
| 516 | +// .add(temp[i].qiniuUrl); | ||
| 517 | +// } | ||
| 518 | + | ||
| 519 | +// ///没有上传完成的不可以点击 | ||
| 520 | +// _showPhotoView(context, index, | ||
| 521 | +// widget.model.imageQiniuUrlList); | ||
| 522 | +// } else if (widget.model.imageListDenvironment[index] | ||
| 523 | +// .fileType == | ||
| 524 | +// FileType.video) { | ||
| 525 | +// NavigatorUtil.goPlayVideoPageSim(context, | ||
| 526 | +// urlStr: widget.model | ||
| 527 | +// .imageListDenvironment[index].qiniuUrl); | ||
| 528 | +// } | ||
| 529 | +// } | ||
| 530 | +// } | ||
| 531 | +// }, | ||
| 532 | +// child: Stack( | ||
| 533 | +// children: [ | ||
| 534 | +// Stack( | ||
| 535 | +// alignment: Alignment.topRight, | ||
| 536 | +// children: [ | ||
| 537 | +// widget.model.imageListDenvironment[index] | ||
| 538 | +// .fileType == | ||
| 539 | +// FileType.image | ||
| 540 | +// ? Image.file( | ||
| 541 | +// widget.model.imageListDenvironment[index] | ||
| 542 | +// .file, | ||
| 543 | +// fit: BoxFit.cover, | ||
| 544 | +// width: ScreenUtil().setWidth(90 * 2), | ||
| 545 | +// height: ScreenUtil().setWidth(90 * 2), | ||
| 546 | +// ) | ||
| 547 | +// : Image.file( | ||
| 548 | +// widget.model.imageListDenvironment[index] | ||
| 549 | +// .thumbnailPath, | ||
| 550 | +// fit: BoxFit.cover, | ||
| 551 | +// width: ScreenUtil().setWidth(90 * 2), | ||
| 552 | +// height: ScreenUtil().setWidth(90 * 2), | ||
| 553 | +// ) | ||
| 554 | +// // : FutureBuilder( | ||
| 555 | +// // //显示缩略图 | ||
| 556 | +// // future: _initializeVideoPlayerFuture, | ||
| 557 | +// // builder: (context, snapshot) { | ||
| 558 | +// // print(snapshot.connectionState); | ||
| 559 | +// // if (snapshot.hasError) | ||
| 560 | +// // print(snapshot.error); | ||
| 561 | +// // if (snapshot.connectionState == | ||
| 562 | +// // ConnectionState.done) { | ||
| 563 | +// // return Container( | ||
| 564 | +// // // width: ScreenUtil().setWidth(225), | ||
| 565 | +// // child: AspectRatio( | ||
| 566 | +// // aspectRatio: 1 / 1, | ||
| 567 | + | ||
| 568 | +// // // aspectRatio: _controller.value.aspectRatio, | ||
| 569 | +// // child: VideoPlayer(_controller), | ||
| 570 | +// // ), | ||
| 571 | +// // ); | ||
| 572 | +// // } else { | ||
| 573 | +// // return Center( | ||
| 574 | +// // child: CircularProgressIndicator(), | ||
| 575 | +// // ); | ||
| 576 | +// // } | ||
| 577 | +// // }, | ||
| 578 | +// // ), | ||
| 579 | +// , | ||
| 580 | +// Offstage( | ||
| 581 | +// offstage: widget.model | ||
| 582 | +// .imageListDenvironment[index].process < | ||
| 583 | +// 1, | ||
| 584 | +// child: GestureDetector( | ||
| 585 | +// child: Image.asset( | ||
| 586 | +// Utils.getImgPath("delete"), | ||
| 587 | +// width: ScreenUtil().setWidth(40), | ||
| 588 | +// height: ScreenUtil().setWidth(40), | ||
| 589 | +// ), | ||
| 590 | +// onTap: () { | ||
| 591 | +// //点击删除按钮 | ||
| 592 | +// setState(() { | ||
| 593 | +// widget.model.imageListDenvironment | ||
| 594 | +// .removeWhere((element) => | ||
| 595 | +// element == | ||
| 596 | +// widget.model | ||
| 597 | +// .imageListDenvironment[ | ||
| 598 | +// index]); | ||
| 599 | +// widget.model.imageQiniuUrlList | ||
| 600 | +// .removeWhere((element) => | ||
| 601 | +// element == | ||
| 602 | +// widget.model | ||
| 603 | +// .imageQiniuUrlList[index]); | ||
| 604 | +// }); | ||
| 605 | +// }, | ||
| 606 | +// ), | ||
| 607 | +// ), | ||
| 608 | +// ], | ||
| 609 | +// ), | ||
| 610 | +// // Offstage( | ||
| 611 | +// // offstage: widget.model.imageListDenvironment[index].process == 1, | ||
| 612 | +// // child: Progress(widget.model.imageListDenvironment[index].process), | ||
| 613 | +// // ), | ||
| 614 | +// widget.model.imageListDenvironment[index].process == 1 | ||
| 615 | +// ? widget.model.imageListDenvironment[index] | ||
| 616 | +// .fileType == | ||
| 617 | +// FileType.video | ||
| 618 | +// ? Align( | ||
| 619 | +// alignment: Alignment.center, | ||
| 620 | +// child: Image.asset( | ||
| 621 | +// Utils.getImgPath('play'), | ||
| 622 | +// width: ScreenUtil().setWidth(60), | ||
| 623 | +// )) | ||
| 624 | +// : Container() | ||
| 625 | +// : Progress( | ||
| 626 | +// widget.model.imageListDenvironment[index] | ||
| 627 | +// .process, | ||
| 628 | +// size: 90.0, | ||
| 629 | +// ), | ||
| 630 | +// // widget.model.imageListDenvironment[index].fileType == | ||
| 631 | +// // FileType.video | ||
| 632 | +// // ? Align( | ||
| 633 | +// // alignment: Alignment.bottomRight, | ||
| 634 | +// // child: Padding( | ||
| 635 | +// // padding: EdgeInsets.only( | ||
| 636 | +// // bottom: ScreenUtil().setWidth(10), | ||
| 637 | +// // right: ScreenUtil().setWidth(10)), | ||
| 638 | +// // child: Text( | ||
| 639 | +// // '00:${widget.model.imageListDenvironment[index].duration}', | ||
| 640 | +// // style: TextStyle( | ||
| 641 | +// // color: MyColours.color_333333, | ||
| 642 | +// // fontSize: ScreenUtil().setSp(24)), | ||
| 643 | +// // )), | ||
| 644 | +// // ) | ||
| 645 | +// // : Container() | ||
| 646 | +// ], | ||
| 647 | +// )); | ||
| 648 | +// })); | ||
| 649 | +// } | ||
| 650 | +// } |
lib/pages_sim/detail/book_deposit_page.dart
0 → 100644
| 1 | +import 'package:common_utils/common_utils.dart'; | ||
| 2 | +import 'package:flutter/gestures.dart'; | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter/services.dart'; | ||
| 5 | +import 'package:flutter_picker/Picker.dart'; | ||
| 6 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 7 | +import 'package:one_key/models/filter_btn_model.dart'; | ||
| 8 | +import 'package:one_key/models/get_deposit_model.dart'; | ||
| 9 | +import 'package:one_key/route/route_handles.dart'; | ||
| 10 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 11 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 12 | +import 'package:provider/provider.dart'; | ||
| 13 | + | ||
| 14 | +import '../../models/book_deposit_model.dart'; | ||
| 15 | +import '../../models/get_banquet_deposit_model.dart'; | ||
| 16 | +import '../../provider/feast_model.dart'; | ||
| 17 | +import '../../provider/notebook_detail_model.dart'; | ||
| 18 | +import '../../provider/user_model.dart'; | ||
| 19 | +import '../../res/colors.dart'; | ||
| 20 | +import '../../utils/MyNumberTextInputFormatter.dart'; | ||
| 21 | +import '../../utils/NumLengthInputFormatter.dart'; | ||
| 22 | +import '../../utils/dialog_util.dart'; | ||
| 23 | +import '../../utils/event_bus.dart'; | ||
| 24 | +import '../../utils/screen_util.dart'; | ||
| 25 | +import '../../utils/utils.dart'; | ||
| 26 | +import '../../widgets/h_empty_view.dart'; | ||
| 27 | +import '../../widgets/system_app_bar.dart'; | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * 定金 | ||
| 31 | + */ | ||
| 32 | +class BookDepositPageSim extends StatefulWidget { | ||
| 33 | + final String rid; | ||
| 34 | + final BookDepositSunModel depositSunModel; | ||
| 35 | + BookDepositPageSim({Key key, this.rid, this.depositSunModel}) : super(key: key); | ||
| 36 | + | ||
| 37 | + @override | ||
| 38 | + _BookDepositPageSimState createState() => _BookDepositPageSimState(); | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +class _BookDepositPageSimState extends State<BookDepositPageSim> { | ||
| 42 | + String collectionP = '请选择'; //收款人 | ||
| 43 | + int collectionPIndex; //收款人 | ||
| 44 | + String paymentTime = '请选择'; //付款时间 | ||
| 45 | + String paymentType = '请选择'; //支付方式 | ||
| 46 | + List<String> payType = []; //支付方式 | ||
| 47 | + int payTypeIndex; //支付方式 | ||
| 48 | + // String depositType = '请选择'; //定金类型 | ||
| 49 | + // int depositTypeIndex; //定金类型 | ||
| 50 | + | ||
| 51 | + TextEditingController moneyC = TextEditingController(); | ||
| 52 | + FocusNode moneyF = FocusNode(); | ||
| 53 | + TextEditingController paymentC = TextEditingController(); | ||
| 54 | + FocusNode paymentF = FocusNode(); | ||
| 55 | + TextEditingController receiptNumberC = TextEditingController(); | ||
| 56 | + FocusNode receiptNumberF = FocusNode(); | ||
| 57 | + bool showDateSelWidget = false; | ||
| 58 | + final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); | ||
| 59 | + | ||
| 60 | + NotebookDetailModel detailModel; | ||
| 61 | + | ||
| 62 | + FeastModel feastModel; | ||
| 63 | + | ||
| 64 | + @override | ||
| 65 | + void initState() { | ||
| 66 | + super.initState(); | ||
| 67 | + | ||
| 68 | + Utils.changeStatusColor(color: MyColours.color_438E93); | ||
| 69 | + payType = ['现金', '刷卡', '微信', '支付宝', '转账']; | ||
| 70 | + if (widget.depositSunModel != null) { | ||
| 71 | + moneyC.text = widget.depositSunModel.price; | ||
| 72 | + | ||
| 73 | + if (widget.depositSunModel.rname != '') { | ||
| 74 | + paymentC.text = widget.depositSunModel.rname; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + if (widget.depositSunModel.pay != '') { | ||
| 78 | + paymentType = widget.depositSunModel.pay; | ||
| 79 | + payTypeIndex = payType.indexOf(paymentType); | ||
| 80 | + } | ||
| 81 | + if (widget.depositSunModel.ddateStr != '') { | ||
| 82 | + paymentTime = widget.depositSunModel.ddateStr; | ||
| 83 | + } | ||
| 84 | + if (widget.depositSunModel.nickName != null) { | ||
| 85 | + collectionP = widget.depositSunModel.nickName; | ||
| 86 | + } | ||
| 87 | + if (widget.depositSunModel.no != '0') { | ||
| 88 | + receiptNumberC.text = widget.depositSunModel.no; | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + moneyF.addListener(() { | ||
| 93 | + if (moneyF.hasFocus) { | ||
| 94 | + //有焦点 | ||
| 95 | + if (showDateSelWidget) { | ||
| 96 | + Navigator.pop(context); | ||
| 97 | + showDateSelWidget = false; | ||
| 98 | + } | ||
| 99 | + } else { | ||
| 100 | + //失去焦点 | ||
| 101 | + // _editingController.text = ''; | ||
| 102 | + } | ||
| 103 | + }); | ||
| 104 | + paymentF.addListener(() { | ||
| 105 | + if (moneyF.hasFocus) { | ||
| 106 | + //有焦点 | ||
| 107 | + if (showDateSelWidget) { | ||
| 108 | + Navigator.pop(context); | ||
| 109 | + showDateSelWidget = false; | ||
| 110 | + } | ||
| 111 | + } else { | ||
| 112 | + //失去焦点 | ||
| 113 | + // _editingController.text = ''; | ||
| 114 | + } | ||
| 115 | + }); | ||
| 116 | + receiptNumberF.addListener(() { | ||
| 117 | + if (moneyF.hasFocus) { | ||
| 118 | + //有焦点 | ||
| 119 | + if (showDateSelWidget) { | ||
| 120 | + Navigator.pop(context); | ||
| 121 | + showDateSelWidget = false; | ||
| 122 | + } | ||
| 123 | + } else { | ||
| 124 | + //失去焦点 | ||
| 125 | + // _editingController.text = ''; | ||
| 126 | + } | ||
| 127 | + }); | ||
| 128 | + | ||
| 129 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 130 | + _getSellerUserBySellerid(); | ||
| 131 | + }); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + ///获取经理数据 ---- 接单人---全部员工 | ||
| 135 | + | ||
| 136 | + _getSellerUserBySellerid() async { | ||
| 137 | + await feastModel.getAuthUserLists(context); | ||
| 138 | + if (widget.depositSunModel != null && | ||
| 139 | + widget.depositSunModel.nickName != null) { | ||
| 140 | + List sellerList = feastModel.sellerManageList.map((item) { | ||
| 141 | + return item.title; | ||
| 142 | + }).toList(); | ||
| 143 | + collectionPIndex = sellerList.indexOf(widget.depositSunModel.nickName); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + _createReserveDeposit() async { | ||
| 148 | + if (moneyC.text.trim().length == 0) { | ||
| 149 | + Utils.showToast('请输入金额'); | ||
| 150 | + return; | ||
| 151 | + } | ||
| 152 | + if (collectionP == '请选择' || collectionPIndex == null) { | ||
| 153 | + Utils.showToast('请选择收款人'); | ||
| 154 | + return; | ||
| 155 | + } | ||
| 156 | + if (paymentTime == '请选择') { | ||
| 157 | + Utils.showToast('请选择付款时间'); | ||
| 158 | + return; | ||
| 159 | + } | ||
| 160 | + if (paymentType == '请选择' || payTypeIndex == null) { | ||
| 161 | + Utils.showToast('请选择支付方式'); | ||
| 162 | + return; | ||
| 163 | + } | ||
| 164 | + // if (receiptNumberC.text.trim().length == 0) { | ||
| 165 | + // Utils.showToast('请输入收据编号'); | ||
| 166 | + // return; | ||
| 167 | + // } | ||
| 168 | + Map<String, String> pramas = { | ||
| 169 | + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 170 | + 'rid': widget.rid, | ||
| 171 | + 'price': moneyC.text, | ||
| 172 | + // 'rname': paymentC.text, | ||
| 173 | + 'uid': collectionPIndex == null | ||
| 174 | + ? null | ||
| 175 | + : feastModel.sellerManageList[collectionPIndex].id, | ||
| 176 | + 'pay_time': paymentTime == '请选择' | ||
| 177 | + ? null | ||
| 178 | + : (DateUtil.getDateTime(paymentTime).millisecondsSinceEpoch / 1000) | ||
| 179 | + .floor() | ||
| 180 | + .toString(), | ||
| 181 | + 'pay_type': payTypeIndex == null ? null : payType[payTypeIndex], | ||
| 182 | + | ||
| 183 | + 'pay_no': | ||
| 184 | + receiptNumberC.text.trim().length == 0 ? null : receiptNumberC.text, | ||
| 185 | + 'insert_uid': Provider.of<UserModel>(context, listen: false).user.openid | ||
| 186 | + }; | ||
| 187 | + print(feastModel.sellerManageList[collectionPIndex].title); | ||
| 188 | + bool success = await detailModel.createReserveDeposit(context, pramas); | ||
| 189 | + if (success) { | ||
| 190 | + Navigator.pop(context); | ||
| 191 | + bus.emit('refresh_detail_deposit'); | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + ///请输入 | ||
| 196 | + ///输入框 | ||
| 197 | + Widget _textfield( | ||
| 198 | + String title, | ||
| 199 | + String hintText, | ||
| 200 | + TextEditingController editingController, | ||
| 201 | + FocusNode focusNode, | ||
| 202 | + String subTitle, | ||
| 203 | + {TextInputType inputType = TextInputType.text}) { | ||
| 204 | + return Container( | ||
| 205 | + child: Row( | ||
| 206 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 207 | + children: [ | ||
| 208 | + Container( | ||
| 209 | + // color: Colors.red, | ||
| 210 | + width: ScreenUtil().setWidth(160), | ||
| 211 | + height: ScreenUtil().setWidth(35), | ||
| 212 | + child: Text( | ||
| 213 | + title, | ||
| 214 | + style: TextStyle( | ||
| 215 | + fontSize: ScreenUtil().setSp(28), | ||
| 216 | + color: MyColours.color_515151), | ||
| 217 | + ), | ||
| 218 | + ), | ||
| 219 | + HEmptyView(60), | ||
| 220 | + Expanded( | ||
| 221 | + child: Container( | ||
| 222 | + decoration: BoxDecoration( | ||
| 223 | + border: Border( | ||
| 224 | + bottom: BorderSide( | ||
| 225 | + width: h(1), color: MyColours.color_DBDBDB))), | ||
| 226 | + child: Row( | ||
| 227 | + children: [ | ||
| 228 | + Expanded( | ||
| 229 | + child: Container( | ||
| 230 | + // height: ScreenUtil().setHeight(120), | ||
| 231 | + height: ScreenUtil().setWidth(64), | ||
| 232 | + child: TextField( | ||
| 233 | + controller: editingController, | ||
| 234 | + // textAlign: TextAlign.right, | ||
| 235 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 236 | + maxLines: 1, | ||
| 237 | + | ||
| 238 | + inputFormatters: title == '金额' | ||
| 239 | + ? [ | ||
| 240 | + FilteringTextInputFormatter(RegExp("[0-9.]"), | ||
| 241 | + allow: true), | ||
| 242 | + MyNumberTextInputFormatter(digit: 2), | ||
| 243 | + ] | ||
| 244 | + : [], | ||
| 245 | + | ||
| 246 | + // //光标颜色 | ||
| 247 | + // cursorColor: | ||
| 248 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 249 | + //输入文本的样式 | ||
| 250 | + style: TextStyle( | ||
| 251 | + fontSize: ScreenUtil().setSp(32), | ||
| 252 | + ), | ||
| 253 | + focusNode: focusNode, | ||
| 254 | + decoration: InputDecoration( | ||
| 255 | + border: | ||
| 256 | + OutlineInputBorder(borderSide: BorderSide.none), | ||
| 257 | + hintText: hintText, | ||
| 258 | + hintStyle: TextStyle( | ||
| 259 | + color: hintText == '请输入' | ||
| 260 | + ? MyColours.color_999999 | ||
| 261 | + : MyColours.color_515151, | ||
| 262 | + fontSize: ScreenUtil().setSp(28), | ||
| 263 | + ), | ||
| 264 | + contentPadding: EdgeInsets.zero, | ||
| 265 | + ), | ||
| 266 | + onChanged: (value) {}, | ||
| 267 | + onEditingComplete: () { | ||
| 268 | + FocusScope.of(context) | ||
| 269 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 270 | + }, | ||
| 271 | + keyboardType: inputType, | ||
| 272 | + )), | ||
| 273 | + ), | ||
| 274 | + Container( | ||
| 275 | + child: Text( | ||
| 276 | + subTitle, | ||
| 277 | + style: TextStyle( | ||
| 278 | + color: MyColours.color_515151, | ||
| 279 | + fontSize: ScreenUtil().setSp(28)), | ||
| 280 | + ), | ||
| 281 | + ), | ||
| 282 | + ], | ||
| 283 | + ), | ||
| 284 | + )) | ||
| 285 | + ], | ||
| 286 | + ), | ||
| 287 | + ); | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + ///请选择 | ||
| 291 | + Widget _selectWidget(String title, String labelShow, | ||
| 292 | + {GestureTapCallback onTap, bool need = true}) { | ||
| 293 | + return InkWell( | ||
| 294 | + onTap: onTap, | ||
| 295 | + // () { | ||
| 296 | + // FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 | ||
| 297 | + // DialogUtil.showSelectCusmanDialog( | ||
| 298 | + // context, | ||
| 299 | + // customerProvider.labelList.map((item) { | ||
| 300 | + // return item.label; | ||
| 301 | + // }).toList(), (value) { | ||
| 302 | + // if (value != null) { | ||
| 303 | + // setState(() { | ||
| 304 | + // customerProvider.labelSelIndex = | ||
| 305 | + // value.first; | ||
| 306 | + // labelShow = customerProvider | ||
| 307 | + // .labelList[ | ||
| 308 | + // customerProvider.labelSelIndex] | ||
| 309 | + // .label; | ||
| 310 | + // }); | ||
| 311 | + // } | ||
| 312 | + // }, | ||
| 313 | + // selecteds: | ||
| 314 | + // customerProvider.labelSelIndex == null | ||
| 315 | + // ? [] | ||
| 316 | + // : [ | ||
| 317 | + // customerProvider.labelSelIndex | ||
| 318 | + // ]) | ||
| 319 | + // .then((value) {}); | ||
| 320 | + // }, | ||
| 321 | + child: Row( | ||
| 322 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 323 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 324 | + children: [ | ||
| 325 | + Container( | ||
| 326 | + // color: Colors.red, | ||
| 327 | + width: ScreenUtil().setWidth(160), | ||
| 328 | + height: ScreenUtil().setWidth(35), | ||
| 329 | + child: Text( | ||
| 330 | + title, | ||
| 331 | + style: TextStyle( | ||
| 332 | + fontSize: ScreenUtil().setSp(28), | ||
| 333 | + color: MyColours.color_515151), | ||
| 334 | + ), | ||
| 335 | + ), | ||
| 336 | + HEmptyView(60), | ||
| 337 | + Expanded( | ||
| 338 | + child: Container( | ||
| 339 | + height: ScreenUtil().setWidth(64), | ||
| 340 | + decoration: BoxDecoration( | ||
| 341 | + border: Border( | ||
| 342 | + bottom: BorderSide( | ||
| 343 | + width: ScreenUtil().setWidth(2), | ||
| 344 | + color: Color.fromRGBO(220, 220, 220, 1)))), | ||
| 345 | + child: Row( | ||
| 346 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 347 | + children: [ | ||
| 348 | + Expanded( | ||
| 349 | + child: Text( | ||
| 350 | + labelShow, | ||
| 351 | + overflow: TextOverflow.ellipsis, | ||
| 352 | + style: TextStyle( | ||
| 353 | + color: labelShow == '请选择' | ||
| 354 | + ? MyColours.color_999999 | ||
| 355 | + : MyColours.color_515151, | ||
| 356 | + fontSize: ScreenUtil().setSp(28), | ||
| 357 | + ), | ||
| 358 | + )), | ||
| 359 | + HEmptyView(10), | ||
| 360 | + Image.asset( | ||
| 361 | + Utils.getImgPath('f_arrow_down'), | ||
| 362 | + width: ScreenUtil().setWidth(64), | ||
| 363 | + // height: ScreenUtil().setWidth(10), | ||
| 364 | + ), | ||
| 365 | + HEmptyView(16), | ||
| 366 | + ], | ||
| 367 | + ))), | ||
| 368 | + ], | ||
| 369 | + ), | ||
| 370 | + ); | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + Widget _callButton( | ||
| 374 | + {GestureTapCallback onPress, | ||
| 375 | + content, | ||
| 376 | + hasLeftBorder = true, | ||
| 377 | + isSelect = false}) { | ||
| 378 | + return InkWell( | ||
| 379 | + onTap: onPress, | ||
| 380 | + child: Container( | ||
| 381 | + height: h(48), | ||
| 382 | + decoration: BoxDecoration( | ||
| 383 | + color: isSelect ? MyColours.color_438E93 : MyColours.color_ffffff, | ||
| 384 | + border: Border( | ||
| 385 | + bottom: BorderSide( | ||
| 386 | + color: MyColours.color_438E93, | ||
| 387 | + width: ScreenUtil().setWidth(2)), | ||
| 388 | + top: BorderSide( | ||
| 389 | + color: MyColours.color_438E93, | ||
| 390 | + width: ScreenUtil().setWidth(2)), | ||
| 391 | + left: hasLeftBorder | ||
| 392 | + ? BorderSide( | ||
| 393 | + color: MyColours.color_438E93, | ||
| 394 | + width: ScreenUtil().setWidth(2)) | ||
| 395 | + : BorderSide.none, | ||
| 396 | + right: BorderSide( | ||
| 397 | + color: MyColours.color_438E93, | ||
| 398 | + width: ScreenUtil().setWidth(2)))), | ||
| 399 | + child: Align( | ||
| 400 | + alignment: Alignment.center, | ||
| 401 | + child: Text( | ||
| 402 | + content, | ||
| 403 | + style: TextStyle( | ||
| 404 | + color: | ||
| 405 | + isSelect ? MyColours.color_F6F6F6 : MyColours.color_438E93, | ||
| 406 | + fontSize: ScreenUtil().setSp(36)), | ||
| 407 | + ), | ||
| 408 | + ), | ||
| 409 | + ), | ||
| 410 | + ); | ||
| 411 | + } | ||
| 412 | + | ||
| 413 | + @override | ||
| 414 | + Widget build(BuildContext context) { | ||
| 415 | + feastModel = Provider.of<FeastModel>(context, listen: true); | ||
| 416 | + | ||
| 417 | + detailModel = Provider.of<NotebookDetailModel>(context, listen: true); | ||
| 418 | + return Scaffold( | ||
| 419 | + backgroundColor: MyColours.color_ffffff, | ||
| 420 | + key: scaffoldKey, | ||
| 421 | + appBar: SystemAppBar( | ||
| 422 | + '添加定金', | ||
| 423 | + needWhite: true, | ||
| 424 | + bgColor: MyColours.color_438E93, | ||
| 425 | + titleColor: MyColours.color_F6F6F6, | ||
| 426 | + onTap: () { | ||
| 427 | + Navigator.pop(context); | ||
| 428 | + }, | ||
| 429 | + ), | ||
| 430 | + body: Column( | ||
| 431 | + children: [ | ||
| 432 | + Expanded( | ||
| 433 | + child: SingleChildScrollView( | ||
| 434 | + child: Padding( | ||
| 435 | + padding: EdgeInsets.only(left: w(30), right: w(13)), | ||
| 436 | + child: Column( | ||
| 437 | + children: [ | ||
| 438 | + VEmptyView(50), | ||
| 439 | + _textfield('金额', '请输入', moneyC, moneyF, '元', | ||
| 440 | + inputType: | ||
| 441 | + TextInputType.numberWithOptions(decimal: true)), | ||
| 442 | + VEmptyView(66), | ||
| 443 | + // _textfield('付款人', '请输入', paymentC, paymentF, '', | ||
| 444 | + // inputType: TextInputType.text), | ||
| 445 | + // VEmptyView(66), | ||
| 446 | + _selectWidget('收款人', collectionP, onTap: () { | ||
| 447 | + FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 | ||
| 448 | + DialogUtil.showSelectCusmanDialog( | ||
| 449 | + context, | ||
| 450 | + feastModel.sellerManageList.map((item) { | ||
| 451 | + return item.title; | ||
| 452 | + }).toList(), (value) { | ||
| 453 | + if (value != null) { | ||
| 454 | + setState(() { | ||
| 455 | + collectionPIndex = value.first; | ||
| 456 | + collectionP = feastModel | ||
| 457 | + .sellerManageList[collectionPIndex].title; | ||
| 458 | + }); | ||
| 459 | + } | ||
| 460 | + }, | ||
| 461 | + cancelText: '', | ||
| 462 | + title: '选择收款人', | ||
| 463 | + selecteds: collectionPIndex == null | ||
| 464 | + ? [] | ||
| 465 | + : [collectionPIndex]) | ||
| 466 | + .then((value) {}); | ||
| 467 | + }), | ||
| 468 | + VEmptyView(66), | ||
| 469 | + _selectWidget('付款时间', paymentTime, onTap: () { | ||
| 470 | + FocusScope.of(context) | ||
| 471 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 472 | + //弹出时间选择器 | ||
| 473 | + // showPickerDateTime(context); | ||
| 474 | + showDateSelWidget = true; | ||
| 475 | + DialogUtil.showPickerDateTime24Feast( | ||
| 476 | + context, | ||
| 477 | + scaffoldKey, | ||
| 478 | + (value) { | ||
| 479 | + // {'text': picker.adapter.text, 'select': selecteds} | ||
| 480 | + if (value != null) { | ||
| 481 | + setState(() { | ||
| 482 | + print(value); | ||
| 483 | + paymentTime = DateUtil.formatDateStr(value, | ||
| 484 | + format: DateFormats.y_mo_d); | ||
| 485 | + }); | ||
| 486 | + } | ||
| 487 | + showDateSelWidget = false; | ||
| 488 | + }, | ||
| 489 | + pickerDateTimeType: PickerDateTimeType.kYMD, | ||
| 490 | + dateTime: DateUtil.getDateTime(paymentTime), | ||
| 491 | + cancelText: '', | ||
| 492 | + title: '选择付款时间', | ||
| 493 | + onCancel: () { | ||
| 494 | + showDateSelWidget = false; | ||
| 495 | + }); | ||
| 496 | + }), | ||
| 497 | + VEmptyView(66), | ||
| 498 | + _selectWidget('支付方式', paymentType, onTap: () { | ||
| 499 | + FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 | ||
| 500 | + DialogUtil.showSelectCusmanDialog(context, payType, | ||
| 501 | + (value) { | ||
| 502 | + if (value != null) { | ||
| 503 | + setState(() { | ||
| 504 | + payTypeIndex = value.first; | ||
| 505 | + paymentType = payType[payTypeIndex]; | ||
| 506 | + }); | ||
| 507 | + } | ||
| 508 | + }, | ||
| 509 | + cancelText: '', | ||
| 510 | + title: '选择支付方式', | ||
| 511 | + selecteds: | ||
| 512 | + payTypeIndex == null ? [] : [payTypeIndex]) | ||
| 513 | + .then((value) {}); | ||
| 514 | + }), | ||
| 515 | + // VEmptyView(66), | ||
| 516 | + // _selectWidget('定金类型', depositType, onTap: () { | ||
| 517 | + // FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 | ||
| 518 | + // DialogUtil.showSelectCusmanDialog( | ||
| 519 | + // context, | ||
| 520 | + // feastModel.depositData.map((item) { | ||
| 521 | + // return item.dname; | ||
| 522 | + // }).toList(), (value) { | ||
| 523 | + // if (value != null) { | ||
| 524 | + // setState(() { | ||
| 525 | + // depositTypeIndex = value.first; | ||
| 526 | + // depositType = feastModel | ||
| 527 | + // .depositData[depositTypeIndex].dname; | ||
| 528 | + // }); | ||
| 529 | + // } | ||
| 530 | + // }, | ||
| 531 | + // cancelText: '', | ||
| 532 | + // title: '选择定金类型', | ||
| 533 | + // selecteds: depositTypeIndex == null | ||
| 534 | + // ? [] | ||
| 535 | + // : [depositTypeIndex]) | ||
| 536 | + // .then((value) {}); | ||
| 537 | + // }), | ||
| 538 | + VEmptyView(66), | ||
| 539 | + _textfield( | ||
| 540 | + '收据编号', '请输入', receiptNumberC, receiptNumberF, '', | ||
| 541 | + inputType: TextInputType.text), | ||
| 542 | + ], | ||
| 543 | + )), | ||
| 544 | + )), | ||
| 545 | + Container( | ||
| 546 | + padding: EdgeInsets.symmetric(horizontal: w(24), vertical: w(35)), | ||
| 547 | + child: Row( | ||
| 548 | + children: [ | ||
| 549 | + RoundButton( | ||
| 550 | + text: '取消', | ||
| 551 | + width: w(100), | ||
| 552 | + height: w(43), | ||
| 553 | + radius: r(5), | ||
| 554 | + fontSize: 32, | ||
| 555 | + isBold: true, | ||
| 556 | + gradientStart: MyColours.color_ffffff, | ||
| 557 | + gradientEnd: MyColours.color_ffffff, | ||
| 558 | + textColor: MyColours.color_438E93, | ||
| 559 | + borderColor: MyColours.color_438E93, | ||
| 560 | + onPressed: () { | ||
| 561 | + Navigator.pop(context); | ||
| 562 | + }, | ||
| 563 | + ), | ||
| 564 | + HEmptyView(24), | ||
| 565 | + Expanded( | ||
| 566 | + child: RoundButton( | ||
| 567 | + text: '保存并返回', | ||
| 568 | + height: w(43), | ||
| 569 | + radius: r(5), | ||
| 570 | + isBold: true, | ||
| 571 | + fontSize: 32, | ||
| 572 | + gradientStart: MyColours.color_438E93, | ||
| 573 | + gradientEnd: MyColours.color_438E93, | ||
| 574 | + textColor: MyColours.color_ffffff, | ||
| 575 | + borderColor: MyColours.color_438E93, | ||
| 576 | + onPressed: () { | ||
| 577 | + _createReserveDeposit(); | ||
| 578 | + }, | ||
| 579 | + )), | ||
| 580 | + ], | ||
| 581 | + ), | ||
| 582 | + ) | ||
| 583 | + ], | ||
| 584 | + )); | ||
| 585 | + } | ||
| 586 | +} |
lib/pages_sim/detail/edit_reserver_page.dart
0 → 100644
| 1 | +// import 'dart:html'; | ||
| 2 | + | ||
| 3 | +// import 'dart:async'; | ||
| 4 | +// import 'dart:convert'; | ||
| 5 | +import 'dart:io'; | ||
| 6 | + | ||
| 7 | +import 'package:call_log/call_log.dart'; | ||
| 8 | +import 'package:easy_contact_picker/easy_contact_picker.dart'; | ||
| 9 | +import 'package:flutter/material.dart'; | ||
| 10 | +import 'package:flutter/services.dart'; | ||
| 11 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 12 | +import 'package:one_key/provider/coupon_provider.dart'; | ||
| 13 | +import 'package:one_key/provider/marketing_center_provider.dart'; | ||
| 14 | +import 'package:one_key/provider/notebook_detail_model.dart'; | ||
| 15 | +import 'package:one_key/provider/user_model.dart'; | ||
| 16 | +import 'package:one_key/res/colors.dart'; | ||
| 17 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 18 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 19 | +import 'package:one_key/utils/misc.dart'; | ||
| 20 | +import 'package:one_key/utils/utils.dart'; | ||
| 21 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 22 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 23 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 24 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 25 | +import 'package:permission_handler/permission_handler.dart'; | ||
| 26 | +import 'package:provider/provider.dart'; | ||
| 27 | + | ||
| 28 | +import '../../models/user_history_entity.dart'; | ||
| 29 | +import '../../utils/call_log_utils.dart'; | ||
| 30 | +import '../../utils/common_utils.dart'; | ||
| 31 | +import '../../utils/screen_util.dart'; | ||
| 32 | +import '../../widgets/MyDivider.dart'; | ||
| 33 | +import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | ||
| 34 | +import 'package:flutter_picker/flutter_picker.dart' as Picker; | ||
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * 填写预订联系人页面 | ||
| 38 | + */ | ||
| 39 | +class EditReserverPageSim extends StatefulWidget { | ||
| 40 | + final String rid; | ||
| 41 | + final String name; | ||
| 42 | + final String sex; | ||
| 43 | + final bool needBtn; | ||
| 44 | + final String mid; | ||
| 45 | + EditReserverPageSim(this.rid, this.name, this.sex, this.mid, | ||
| 46 | + {Key key, this.needBtn}) | ||
| 47 | + : super(key: key); | ||
| 48 | + | ||
| 49 | + @override | ||
| 50 | + _EditReserverPageSimState createState() => _EditReserverPageSimState(); | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +class _EditReserverPageSimState extends State<EditReserverPageSim> { | ||
| 54 | + NotebookDetailModel detailModel; | ||
| 55 | + String nameStr; | ||
| 56 | + FocusNode _nameNode = FocusNode(); | ||
| 57 | + FocusNode _phoneNode = FocusNode(); | ||
| 58 | + bool showPhoneHistory = false; //显示客户历史记录 | ||
| 59 | + EasyContactPicker _contactPicker = EasyContactPicker(); | ||
| 60 | + | ||
| 61 | + MyTextSelectionControls _myExtendedMaterialTextSelectionControls = | ||
| 62 | + MyTextSelectionControls(); | ||
| 63 | + | ||
| 64 | + ScrollController _scrollCrl = ScrollController(); | ||
| 65 | + | ||
| 66 | + MarketingCenterProvider marketingCenterProvider; | ||
| 67 | + | ||
| 68 | + @override | ||
| 69 | + void initState() { | ||
| 70 | + super.initState(); | ||
| 71 | + _myExtendedMaterialTextSelectionControls = | ||
| 72 | + MyTextSelectionControls(callback: (value) { | ||
| 73 | + // detailModel.phoneController.text = value; | ||
| 74 | + detailModel.phoneController.value = TextEditingValue( | ||
| 75 | + text: value, | ||
| 76 | + selection: TextSelection.fromPosition(TextPosition( | ||
| 77 | + affinity: TextAffinity.downstream, | ||
| 78 | + offset: value.toString().length))); | ||
| 79 | + }); | ||
| 80 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 81 | + if (widget.name != '' && | ||
| 82 | + widget.name != null && | ||
| 83 | + widget.sex != '' && | ||
| 84 | + widget.sex != null) { | ||
| 85 | + nameStr = widget.name; | ||
| 86 | + for (var item in detailModel.sexList) { | ||
| 87 | + item['select'] = false; | ||
| 88 | + if (item['code'] == widget.sex) { | ||
| 89 | + item['select'] = true; | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | + _addNameSuffix(nameStr, _nameSuffix()); | ||
| 93 | + setState(() {}); | ||
| 94 | + } | ||
| 95 | + getDzSellerConf(); | ||
| 96 | + }); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + getDzSellerConf() async { | ||
| 100 | + await marketingCenterProvider.getDzSellerConf(context); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + _openAddressBook() async { | ||
| 104 | + if (!(await checkContactPermission())) { | ||
| 105 | + PermissionStatus permissionStatus = await contactPermissionStatus(); | ||
| 106 | + if (permissionStatus == PermissionStatus.permanentlyDenied) { | ||
| 107 | + //用户选择不在弹出权限提示框 | ||
| 108 | + print('never'); | ||
| 109 | + DialogUtil.openAlertDialog( | ||
| 110 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0, | ||
| 111 | + onTap: () { | ||
| 112 | + openSetting(); | ||
| 113 | + Navigator.pop(context, ''); | ||
| 114 | + }); | ||
| 115 | + } else { | ||
| 116 | + // 申请权限 | ||
| 117 | + bool canContacts = await requestContactPermission(); | ||
| 118 | + if (canContacts) { | ||
| 119 | + _getContactData(); | ||
| 120 | + } else { | ||
| 121 | + //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处 | ||
| 122 | + DialogUtil.openAlertDialog( | ||
| 123 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0, | ||
| 124 | + onTap: () { | ||
| 125 | + openSetting(); | ||
| 126 | + Navigator.pop(context, ''); | ||
| 127 | + }); | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + } else { | ||
| 131 | + _getContactData(); | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + //处理在线预订 | ||
| 136 | + setMessageStatus() { | ||
| 137 | + bus.emit("remove_untreated_message", widget.mid); | ||
| 138 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 139 | + Map<String, String> params = { | ||
| 140 | + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 141 | + "id": widget.mid, | ||
| 142 | + "status": "is_handle" | ||
| 143 | + }; | ||
| 144 | + detailModel.setMessageStatus(context, params); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + _getContactData() async { | ||
| 148 | + Contact contact = await _contactPicker.selectContactWithNative(); | ||
| 149 | + setState(() { | ||
| 150 | + String fullName = | ||
| 151 | + contact.fullName.replaceAll(new RegExp(r"\s+\b|\b\s"), ""); | ||
| 152 | + String phone = | ||
| 153 | + contact.phoneNumber.replaceAll(new RegExp(r"\s+\b|\b\s"), ""); | ||
| 154 | + if (fullName.compareTo(phone) == 0) { | ||
| 155 | + fullName = ''; | ||
| 156 | + } else { | ||
| 157 | + fullName = contact.fullName; | ||
| 158 | + } | ||
| 159 | + detailModel.phoneController.text = | ||
| 160 | + contact.phoneNumber.replaceAll(new RegExp(r"\s+"), ""); | ||
| 161 | + nameStr = fullName; | ||
| 162 | + // _homeEnterModel.nameController.text = fullName + _nameSuffix(); | ||
| 163 | + _addNameSuffix(fullName, _nameSuffix()); | ||
| 164 | + }); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + _addNameSuffix(String name, String suffix) { | ||
| 168 | + if (name == detailModel.nameController.text && | ||
| 169 | + detailModel.nameController.text.endsWith(suffix)) { | ||
| 170 | + return; | ||
| 171 | + } | ||
| 172 | + if (name != '') { | ||
| 173 | + detailModel.nameController.text = name + suffix ?? ''; | ||
| 174 | + } | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + //姓名后缀 | ||
| 178 | + _nameSuffix() { | ||
| 179 | + for (var item in detailModel.sexList) { | ||
| 180 | + if (item['select'] == true) { | ||
| 181 | + return item['title']; | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + Widget _callButton( | ||
| 187 | + {GestureTapCallback onPress, | ||
| 188 | + content, | ||
| 189 | + hasLeftBorder = true, | ||
| 190 | + isSelect = false}) { | ||
| 191 | + return InkWell( | ||
| 192 | + onTap: onPress, | ||
| 193 | + child: Container( | ||
| 194 | + width: ScreenUtil().setWidth(84), | ||
| 195 | + height: ScreenUtil().setHeight(48), | ||
| 196 | + decoration: BoxDecoration( | ||
| 197 | + color: isSelect ? MyColours.color_199095 : MyColours.color_fefefe, | ||
| 198 | + border: Border( | ||
| 199 | + bottom: BorderSide( | ||
| 200 | + color: MyColours.color_6AB6B9, | ||
| 201 | + width: ScreenUtil().setWidth(2)), | ||
| 202 | + top: BorderSide( | ||
| 203 | + color: MyColours.color_6AB6B9, | ||
| 204 | + width: ScreenUtil().setWidth(2)), | ||
| 205 | + left: hasLeftBorder | ||
| 206 | + ? BorderSide( | ||
| 207 | + color: MyColours.color_6AB6B9, | ||
| 208 | + width: ScreenUtil().setWidth(2)) | ||
| 209 | + : BorderSide.none, | ||
| 210 | + right: BorderSide( | ||
| 211 | + color: MyColours.color_6AB6B9, | ||
| 212 | + width: ScreenUtil().setWidth(2)))), | ||
| 213 | + child: Align( | ||
| 214 | + alignment: Alignment.center, | ||
| 215 | + child: Text( | ||
| 216 | + content, | ||
| 217 | + style: TextStyle( | ||
| 218 | + color: isSelect ? Colors.white : MyColours.color_353535, | ||
| 219 | + fontSize: ScreenUtil().setSp(28)), | ||
| 220 | + ), | ||
| 221 | + ), | ||
| 222 | + ), | ||
| 223 | + ); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + _getCallLog() async { | ||
| 227 | + List<Picker.PickerItem<dynamic>> data = []; | ||
| 228 | + | ||
| 229 | + Iterable<CallLogEntry> result = await CallLogUtils.getCallLog(context); | ||
| 230 | + if (result != null) { | ||
| 231 | + detailModel.userHistorys = []; | ||
| 232 | + | ||
| 233 | + List<CallLogEntry> object = Utils.removeDuplicates(result.toList()); | ||
| 234 | + | ||
| 235 | + detailModel.userHistorys = []; | ||
| 236 | + showPhoneHistory = false; | ||
| 237 | + // setState(() {}); | ||
| 238 | + | ||
| 239 | + object.forEach((element) { | ||
| 240 | + detailModel.userHistorys.add(UserHistoryEntity( | ||
| 241 | + '', '', element.name ?? '', '1', element.number, '', '', '')); | ||
| 242 | + | ||
| 243 | + String title = ''; | ||
| 244 | + title += ' ${element.number ?? ''}'; | ||
| 245 | + if (element.name != null && element.name != '') { | ||
| 246 | + title += ' ${element.name}'; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + String stateStr = ''; //状态 | ||
| 250 | + | ||
| 251 | + if (element.callType.name == 'incoming' || | ||
| 252 | + element.callType.name == 'wifiIncoming' || | ||
| 253 | + element.callType.name == 'answeredExternally') { | ||
| 254 | + stateStr = ' 呼入'; | ||
| 255 | + } else if (element.callType.name == 'outgoing' || | ||
| 256 | + element.callType.name == 'wifiOutgoing' || | ||
| 257 | + element.callType.name == 'voiceMail') { | ||
| 258 | + stateStr = ' 呼出'; | ||
| 259 | + } else if (element.callType.name == 'missed') { | ||
| 260 | + stateStr = ' 未接'; | ||
| 261 | + } else if (element.callType.name == 'rejected') { | ||
| 262 | + stateStr = ' 拒接'; | ||
| 263 | + } else if (element.callType.name == 'blocked') { | ||
| 264 | + stateStr = ' 拦截'; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + String sunString = | ||
| 268 | + Utils.formatCallLogFromMill(element.timestamp.toString()); | ||
| 269 | + | ||
| 270 | + data.add(Picker.PickerItem( | ||
| 271 | + text: Row( | ||
| 272 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 273 | + children: [ | ||
| 274 | + Expanded( | ||
| 275 | + child: Row( | ||
| 276 | + children: [ | ||
| 277 | + HEmptyView(30), | ||
| 278 | + Text(title ?? '', | ||
| 279 | + style: TextStyle( | ||
| 280 | + fontSize: font(16), color: MyColours.color_515151)), | ||
| 281 | + Expanded( | ||
| 282 | + child: Text(stateStr ?? '', | ||
| 283 | + style: TextStyle( | ||
| 284 | + fontSize: font(16), | ||
| 285 | + color: MyColours.color_26000000))), | ||
| 286 | + ], | ||
| 287 | + )), | ||
| 288 | + Container( | ||
| 289 | + margin: EdgeInsets.only(right: w(15)), | ||
| 290 | + child: Text(sunString ?? '', | ||
| 291 | + style: TextStyle( | ||
| 292 | + fontSize: font(16), color: MyColours.color_515151))) | ||
| 293 | + ], | ||
| 294 | + ))); | ||
| 295 | + }); | ||
| 296 | + if (data.length > 0) { | ||
| 297 | + //有记录,底部弹窗展示 | ||
| 298 | + // showPhoneHistory = true; | ||
| 299 | + // setState(() {}); | ||
| 300 | + DialogUtil.showSelectCusmanWidgetDialog(context, data, (value) { | ||
| 301 | + if (value != null) { | ||
| 302 | + _byValueToReqeust(value[0]); | ||
| 303 | + } | ||
| 304 | + }, title: '从通话记录选择客人电话', selecteds: [ | ||
| 305 | + // _getFirSelected(hourAndMinute, data), | ||
| 306 | + // _getSecSelected(hourAndMinute) | ||
| 307 | + ]).then((value) { | ||
| 308 | + print(value); | ||
| 309 | + }); | ||
| 310 | + } else { | ||
| 311 | + Utils.showToast('暂无通话记录!'); | ||
| 312 | + } | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + _byValueToReqeust(int index) { | ||
| 317 | + setState(() { | ||
| 318 | + showPhoneHistory = false; | ||
| 319 | + UserHistoryEntity userHistoryEntity = detailModel.userHistorys[index]; | ||
| 320 | + detailModel.phoneController.text = | ||
| 321 | + userHistoryEntity.phone != null ? userHistoryEntity.phone : ''; | ||
| 322 | + for (var item in detailModel.sexList) { | ||
| 323 | + item['select'] = false; | ||
| 324 | + if (item['title'] == userHistoryEntity.sexStr) { | ||
| 325 | + item['select'] = true; | ||
| 326 | + } | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + if ((nameStr != null && nameStr != '') && | ||
| 330 | + (userHistoryEntity.rname == '' || userHistoryEntity.rname == null)) { | ||
| 331 | + } else { | ||
| 332 | + nameStr = userHistoryEntity.rname; | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + _addNameSuffix(userHistoryEntity.rname, _nameSuffix()); | ||
| 336 | + | ||
| 337 | + _phoneNode.unfocus(); | ||
| 338 | + detailModel.userHistorys.clear(); | ||
| 339 | + }); | ||
| 340 | + } | ||
| 341 | + | ||
| 342 | + @override | ||
| 343 | + Widget build(BuildContext context) { | ||
| 344 | + marketingCenterProvider = | ||
| 345 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 346 | + detailModel = Provider.of<NotebookDetailModel>(context, listen: true); | ||
| 347 | + return Scaffold( | ||
| 348 | + backgroundColor: MyColours.color_ffffff, | ||
| 349 | + appBar: SystemAppBar( | ||
| 350 | + '录入预订人信息', | ||
| 351 | + onTap: () { | ||
| 352 | + Navigator.pop(context); | ||
| 353 | + }, | ||
| 354 | + ), | ||
| 355 | + body: Container( | ||
| 356 | + color: MyColours.color_ffffff, | ||
| 357 | + // color: Colors.red, | ||
| 358 | + child: InkWell( | ||
| 359 | + onTap: () { | ||
| 360 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 361 | + if (showPhoneHistory) { | ||
| 362 | + setState(() { | ||
| 363 | + showPhoneHistory = false; | ||
| 364 | + detailModel.userHistorys.clear(); | ||
| 365 | + }); | ||
| 366 | + } | ||
| 367 | + }, | ||
| 368 | + child: Padding( | ||
| 369 | + padding: EdgeInsets.symmetric( | ||
| 370 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 371 | + child: Column(children: [ | ||
| 372 | + //第一行 顾客姓名 | ||
| 373 | + | ||
| 374 | + VEmptyView(40), | ||
| 375 | + | ||
| 376 | + Column( | ||
| 377 | + children: [ | ||
| 378 | + Row( | ||
| 379 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 380 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 381 | + children: [ | ||
| 382 | + Expanded( | ||
| 383 | + child: Container( | ||
| 384 | + height: ScreenUtil().setWidth(60), | ||
| 385 | + decoration: BoxDecoration( | ||
| 386 | + border: Border( | ||
| 387 | + bottom: BorderSide( | ||
| 388 | + width: ScreenUtil().setWidth(2), | ||
| 389 | + color: MyColours.color_efefef))), | ||
| 390 | + child: TextField( | ||
| 391 | + maxLines: 1, | ||
| 392 | + | ||
| 393 | + //输入文本的样式 | ||
| 394 | + style: TextStyle( | ||
| 395 | + fontSize: ScreenUtil().setSp(30), | ||
| 396 | + color: MyColours.color_353535), | ||
| 397 | + controller: detailModel.nameController, | ||
| 398 | + focusNode: _nameNode, | ||
| 399 | + // textAlignVertical: TextAlignVertical.top, | ||
| 400 | + decoration: InputDecoration( | ||
| 401 | + hintText: "客人姓名", | ||
| 402 | + hintStyle: TextStyle( | ||
| 403 | + color: MyColours.color_999999, | ||
| 404 | + fontSize: ScreenUtil().setSp(30), | ||
| 405 | + ), | ||
| 406 | + // contentPadding: | ||
| 407 | + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 408 | + // border: InputBorder.none, | ||
| 409 | + contentPadding: EdgeInsets.zero, | ||
| 410 | + border: OutlineInputBorder( | ||
| 411 | + borderSide: BorderSide.none), | ||
| 412 | + ), | ||
| 413 | + onChanged: (value) { | ||
| 414 | + print('ggg'); | ||
| 415 | + if (value.endsWith('先生') || | ||
| 416 | + value.endsWith('女士') || | ||
| 417 | + value.endsWith('公司')) { | ||
| 418 | + nameStr = value.substring( | ||
| 419 | + 0, value.length - 2); | ||
| 420 | + } else { | ||
| 421 | + nameStr = value; | ||
| 422 | + } | ||
| 423 | + | ||
| 424 | + if (detailModel.phoneController.text | ||
| 425 | + .length == | ||
| 426 | + 0 && | ||
| 427 | + value.length > 0) { | ||
| 428 | + if (marketingCenterProvider.nameSwich) { | ||
| 429 | + detailModel.userHistorys = []; | ||
| 430 | + setState(() { | ||
| 431 | + showPhoneHistory = true; | ||
| 432 | + }); | ||
| 433 | + Map<String, String> params = { | ||
| 434 | + "keywords": value, | ||
| 435 | + "sid": Provider.of<UserModel>( | ||
| 436 | + context, | ||
| 437 | + listen: false) | ||
| 438 | + .user | ||
| 439 | + .sellerid, | ||
| 440 | + }; | ||
| 441 | + JhCommonUtils.debounce(() => | ||
| 442 | + detailModel.getUserHistorys( | ||
| 443 | + context, params)); | ||
| 444 | + } | ||
| 445 | + } else { | ||
| 446 | + setState(() { | ||
| 447 | + showPhoneHistory = false; | ||
| 448 | + }); | ||
| 449 | + } | ||
| 450 | + }, | ||
| 451 | + onEditingComplete: () { | ||
| 452 | + print('fff'); | ||
| 453 | + _nameNode.unfocus(); | ||
| 454 | + // _homeEnterModel.nameController.text = | ||
| 455 | + // nameStr + _nameSuffix(); | ||
| 456 | + _addNameSuffix(nameStr, _nameSuffix()); | ||
| 457 | + }, | ||
| 458 | + keyboardType: TextInputType.text, | ||
| 459 | + ), | ||
| 460 | + ), | ||
| 461 | + ), | ||
| 462 | + // HEmptyView(40), | ||
| 463 | + Row( | ||
| 464 | + children: detailModel.sexList.map((value) { | ||
| 465 | + return _callButton( | ||
| 466 | + onPress: () { | ||
| 467 | + for (var item in detailModel.sexList) { | ||
| 468 | + item['select'] = false; | ||
| 469 | + if (item['title'] == value['title']) { | ||
| 470 | + item['select'] = true; | ||
| 471 | + // _homeEnterModel.nameController.text = | ||
| 472 | + // nameStr + item['title']; | ||
| 473 | + if (nameStr != null && | ||
| 474 | + nameStr != '') { | ||
| 475 | + _addNameSuffix( | ||
| 476 | + nameStr, item['title']); | ||
| 477 | + } | ||
| 478 | + } | ||
| 479 | + } | ||
| 480 | + detailModel.notifyListeners(); | ||
| 481 | + }, | ||
| 482 | + content: value['title'], | ||
| 483 | + hasLeftBorder: value['hasLeftBorder'], | ||
| 484 | + isSelect: value['select']); | ||
| 485 | + }).toList()), | ||
| 486 | + ], | ||
| 487 | + ), | ||
| 488 | + // VEmptyView(30), | ||
| 489 | + // MyDivider(double.infinity, | ||
| 490 | + // ScreenUtil().setWidth(2), | ||
| 491 | + // color: | ||
| 492 | + // MyColours.color_efefef), | ||
| 493 | + //电话 | ||
| 494 | + VEmptyView(20), | ||
| 495 | + | ||
| 496 | + Row( | ||
| 497 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 498 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 499 | + children: [ | ||
| 500 | + Expanded( | ||
| 501 | + child: Container( | ||
| 502 | + height: ScreenUtil().setWidth(60), | ||
| 503 | + decoration: BoxDecoration( | ||
| 504 | + // color: Colors.red, | ||
| 505 | + border: Border( | ||
| 506 | + bottom: BorderSide( | ||
| 507 | + width: ScreenUtil().setWidth(2), | ||
| 508 | + color: | ||
| 509 | + MyColours.color_efefef))), | ||
| 510 | + child: TextField( | ||
| 511 | + selectionControls: | ||
| 512 | + _myExtendedMaterialTextSelectionControls, | ||
| 513 | + maxLines: 1, | ||
| 514 | + //输入文本的样式 | ||
| 515 | + style: TextStyle( | ||
| 516 | + fontSize: ScreenUtil().setSp(30), | ||
| 517 | + color: MyColours.color_353535), | ||
| 518 | + controller: detailModel.phoneController, | ||
| 519 | + focusNode: _phoneNode, | ||
| 520 | + // textAlignVertical: TextAlignVertical.top, | ||
| 521 | + inputFormatters: <TextInputFormatter>[ | ||
| 522 | + LengthLimitingTextInputFormatter( | ||
| 523 | + 11) //限制长度 | ||
| 524 | + ], | ||
| 525 | + decoration: InputDecoration( | ||
| 526 | + hintText: "电话", | ||
| 527 | + hintStyle: TextStyle( | ||
| 528 | + color: MyColours.color_999999, | ||
| 529 | + fontSize: ScreenUtil().setSp(30), | ||
| 530 | + ), | ||
| 531 | + contentPadding: EdgeInsets.zero, | ||
| 532 | + border: OutlineInputBorder( | ||
| 533 | + borderSide: BorderSide.none), | ||
| 534 | + ), | ||
| 535 | + onChanged: (value) { | ||
| 536 | + if (value.isEmpty || | ||
| 537 | + value.length > 11) { | ||
| 538 | + //内容为空,或 超过11位 | ||
| 539 | + setState(() { | ||
| 540 | + detailModel.userHistorys.clear(); | ||
| 541 | + }); | ||
| 542 | + return; | ||
| 543 | + } | ||
| 544 | + | ||
| 545 | + if (value.isEmpty || value.length > 0) { | ||
| 546 | + if (marketingCenterProvider | ||
| 547 | + .phoneSwich) { | ||
| 548 | + detailModel.userHistorys = []; | ||
| 549 | + setState(() { | ||
| 550 | + showPhoneHistory = true; | ||
| 551 | + }); | ||
| 552 | + Map<String, String> params = { | ||
| 553 | + "keywords": value, | ||
| 554 | + "sid": Provider.of<UserModel>( | ||
| 555 | + context, | ||
| 556 | + listen: false) | ||
| 557 | + .user | ||
| 558 | + .sellerid, | ||
| 559 | + }; | ||
| 560 | + JhCommonUtils.debounce(() => | ||
| 561 | + detailModel.getUserHistorys( | ||
| 562 | + context, params)); | ||
| 563 | + } | ||
| 564 | + } else { | ||
| 565 | + setState(() { | ||
| 566 | + showPhoneHistory = false; | ||
| 567 | + }); | ||
| 568 | + } | ||
| 569 | + }, | ||
| 570 | + onEditingComplete: () { | ||
| 571 | + _phoneNode.unfocus(); | ||
| 572 | + }, | ||
| 573 | + onTap: () { | ||
| 574 | + // setState(() { | ||
| 575 | + // showPhoneHistory = true; | ||
| 576 | + // }); | ||
| 577 | + // Future.delayed(Duration(milliseconds: 300), () { | ||
| 578 | + // _controller.jumpTo(_controller.position.maxScrollExtent); | ||
| 579 | + // }); | ||
| 580 | + }, | ||
| 581 | + keyboardType: | ||
| 582 | + TextInputType.numberWithOptions( | ||
| 583 | + decimal: true), | ||
| 584 | + )), | ||
| 585 | + ), | ||
| 586 | + // InkWell( | ||
| 587 | + // onTap: () { | ||
| 588 | + // _openAddressBook(); | ||
| 589 | + // }, | ||
| 590 | + // child: Container( | ||
| 591 | + // width: ScreenUtil().setWidth(84) * 3, | ||
| 592 | + // height: ScreenUtil().setWidth(48), | ||
| 593 | + // alignment: Alignment.centerRight, | ||
| 594 | + // child: Text('电话簿', | ||
| 595 | + // style: TextStyle( | ||
| 596 | + // color: MyColours.color_199095, | ||
| 597 | + // fontSize: ScreenUtil().setSp(28), | ||
| 598 | + // decoration: | ||
| 599 | + // TextDecoration.underline)), | ||
| 600 | + // ), | ||
| 601 | + // ), | ||
| 602 | + InkWell( | ||
| 603 | + onTap: () async { | ||
| 604 | + _openAddressBook(); | ||
| 605 | + // var result = await CallLogUtil.getCallLog(); | ||
| 606 | + // print(result); | ||
| 607 | + }, | ||
| 608 | + child: Container( | ||
| 609 | + // color: Colors.red, | ||
| 610 | + width: ScreenUtil().setWidth(64) * 2, | ||
| 611 | + height: ScreenUtil().setWidth(48), | ||
| 612 | + alignment: Alignment.centerRight, | ||
| 613 | + child: Text('电话簿', | ||
| 614 | + style: TextStyle( | ||
| 615 | + color: MyColours.color_199095, | ||
| 616 | + fontSize: ScreenUtil().setSp(28), | ||
| 617 | + decoration: | ||
| 618 | + TextDecoration.underline)), | ||
| 619 | + ), | ||
| 620 | + ), | ||
| 621 | + | ||
| 622 | + if (Platform.isAndroid) | ||
| 623 | + Row( | ||
| 624 | + children: [ | ||
| 625 | + HEmptyView(20), | ||
| 626 | + MyDivider(1.0, ScreenUtil().setWidth(40)), | ||
| 627 | + HEmptyView(20), | ||
| 628 | + InkWell( | ||
| 629 | + onTap: () async { | ||
| 630 | + _getCallLog(); | ||
| 631 | + }, | ||
| 632 | + child: Container( | ||
| 633 | + // color: Colors.red, | ||
| 634 | + // width: ScreenUtil().setWidth(64) * 2, | ||
| 635 | + height: ScreenUtil().setWidth(48), | ||
| 636 | + alignment: Alignment.centerLeft, | ||
| 637 | + child: Text('通话记录', | ||
| 638 | + style: TextStyle( | ||
| 639 | + color: MyColours.color_199095, | ||
| 640 | + fontSize: | ||
| 641 | + ScreenUtil().setSp(28), | ||
| 642 | + decoration: | ||
| 643 | + TextDecoration.underline)), | ||
| 644 | + ), | ||
| 645 | + ), | ||
| 646 | + ], | ||
| 647 | + ) | ||
| 648 | + ], | ||
| 649 | + ), | ||
| 650 | + ], | ||
| 651 | + ), | ||
| 652 | + VEmptyView(60), | ||
| 653 | + Stack( | ||
| 654 | + children: [ | ||
| 655 | + Padding( | ||
| 656 | + padding: EdgeInsets.only( | ||
| 657 | + top: ScreenUtil().setWidth(60)), | ||
| 658 | + child: Row( | ||
| 659 | + mainAxisAlignment: | ||
| 660 | + MainAxisAlignment.spaceEvenly, | ||
| 661 | + children: [ | ||
| 662 | + RoundButton( | ||
| 663 | + text: '返回', | ||
| 664 | + fontSize: 28, | ||
| 665 | + isBold: false, | ||
| 666 | + height: ScreenUtil().setWidth(70), | ||
| 667 | + width: ScreenUtil().setWidth(180), | ||
| 668 | + radius: ScreenUtil().setWidth(10), | ||
| 669 | + gradientStart: MyColours.color_ffffff, | ||
| 670 | + textColor: MyColours.color_333333, | ||
| 671 | + borderColor: MyColours.color_199095, | ||
| 672 | + gradientEnd: MyColours.color_ffffff, | ||
| 673 | + onPressed: () { | ||
| 674 | + // setState(() { | ||
| 675 | + // nameStr = ''; | ||
| 676 | + // detailModel.nameController.text = ''; | ||
| 677 | + // detailModel.phoneController.text = ''; | ||
| 678 | + // }); | ||
| 679 | + Navigator.of(context).pop(); | ||
| 680 | + }, | ||
| 681 | + ), | ||
| 682 | + widget.needBtn | ||
| 683 | + ? RoundButton( | ||
| 684 | + text: '保存并发短信', | ||
| 685 | + fontSize: 28, | ||
| 686 | + isBold: false, | ||
| 687 | + height: ScreenUtil().setWidth(70), | ||
| 688 | + width: ScreenUtil().setWidth(200), | ||
| 689 | + radius: ScreenUtil().setWidth(10), | ||
| 690 | + gradientStart: MyColours.color_199095, | ||
| 691 | + textColor: MyColours.color_ffffff, | ||
| 692 | + borderColor: MyColours.color_199095, | ||
| 693 | + gradientEnd: MyColours.color_199095, | ||
| 694 | + onPressed: () async { | ||
| 695 | + if (nameStr == null || | ||
| 696 | + nameStr.trim().length == 0) { | ||
| 697 | + Utils.showToast('请填写客人姓名'); | ||
| 698 | + return; | ||
| 699 | + } | ||
| 700 | + | ||
| 701 | + if (detailModel.phoneController.text | ||
| 702 | + .trim() | ||
| 703 | + .length == | ||
| 704 | + 0) { | ||
| 705 | + Utils.showToast('请填写电话'); | ||
| 706 | + return; | ||
| 707 | + } | ||
| 708 | + if (!Utils.isInteger(detailModel | ||
| 709 | + .phoneController.text | ||
| 710 | + .replaceAll(' ', ''))) { | ||
| 711 | + Utils.showToast('手机号错误,请修改正确'); | ||
| 712 | + return; | ||
| 713 | + } | ||
| 714 | + String sex = '1'; | ||
| 715 | + for (var item | ||
| 716 | + in detailModel.sexList) { | ||
| 717 | + if (item['select']) { | ||
| 718 | + sex = item['code']; | ||
| 719 | + } | ||
| 720 | + } | ||
| 721 | + bool sucess = | ||
| 722 | + await detailModel.upReserveInfo( | ||
| 723 | + context, widget.rid, | ||
| 724 | + name: nameStr, | ||
| 725 | + sex: sex, | ||
| 726 | + phone: detailModel | ||
| 727 | + .phoneController.text | ||
| 728 | + .replaceAll(' ', ''), | ||
| 729 | + showLoading: true); | ||
| 730 | + if (sucess) { | ||
| 731 | + bus.emit( | ||
| 732 | + "refresh_tablemanager"); //刷新桌位 | ||
| 733 | + bus.emit( | ||
| 734 | + "refresh_book_list"); //刷新已预订列表 | ||
| 735 | + bus.emit("refresh_detail"); | ||
| 736 | + UserModel userModel = | ||
| 737 | + Provider.of<UserModel>( | ||
| 738 | + context, | ||
| 739 | + listen: false); | ||
| 740 | + Map<String, String> params = { | ||
| 741 | + "rid": widget.rid, | ||
| 742 | + "sid": userModel.user.sellerid | ||
| 743 | + }; | ||
| 744 | + CouponProvider couponProvider = | ||
| 745 | + Provider.of<CouponProvider>( | ||
| 746 | + context, | ||
| 747 | + listen: false); | ||
| 748 | + bool success = | ||
| 749 | + await couponProvider | ||
| 750 | + .sendSMSWxSendSms( | ||
| 751 | + context, params); | ||
| 752 | + print(success); | ||
| 753 | + if (success) { | ||
| 754 | + Navigator.of(context).pop( | ||
| 755 | + detailModel | ||
| 756 | + .phoneController.text); | ||
| 757 | + } | ||
| 758 | + } | ||
| 759 | + }, | ||
| 760 | + ) | ||
| 761 | + : SizedBox(), | ||
| 762 | + RoundButton( | ||
| 763 | + text: widget.needBtn ? '仅保存' : '保存', | ||
| 764 | + fontSize: 28, | ||
| 765 | + isBold: false, | ||
| 766 | + height: ScreenUtil().setWidth(70), | ||
| 767 | + width: ScreenUtil().setWidth(180), | ||
| 768 | + radius: ScreenUtil().setWidth(10), | ||
| 769 | + gradientStart: widget.needBtn | ||
| 770 | + ? MyColours.color_ffffff | ||
| 771 | + : MyColours.color_199095, | ||
| 772 | + gradientEnd: widget.needBtn | ||
| 773 | + ? MyColours.color_ffffff | ||
| 774 | + : MyColours.color_199095, | ||
| 775 | + textColor: widget.needBtn | ||
| 776 | + ? MyColours.color_333333 | ||
| 777 | + : MyColours.color_ffffff, | ||
| 778 | + borderColor: MyColours.color_199095, | ||
| 779 | + onPressed: () async { | ||
| 780 | + if (nameStr == null || | ||
| 781 | + nameStr.trim().length == 0) { | ||
| 782 | + Utils.showToast('请填写客人姓名'); | ||
| 783 | + return; | ||
| 784 | + } | ||
| 785 | + | ||
| 786 | + if (detailModel.phoneController.text | ||
| 787 | + .trim() | ||
| 788 | + .length > | ||
| 789 | + 0) { | ||
| 790 | + if (!Utils.isInteger(detailModel | ||
| 791 | + .phoneController.text | ||
| 792 | + .replaceAll(' ', ''))) { | ||
| 793 | + Utils.showToast('手机号错误,请修改正确'); | ||
| 794 | + return; | ||
| 795 | + } | ||
| 796 | + } | ||
| 797 | + | ||
| 798 | + String sex = '1'; | ||
| 799 | + for (var item in detailModel.sexList) { | ||
| 800 | + if (item['select']) { | ||
| 801 | + sex = item['code']; | ||
| 802 | + } | ||
| 803 | + } | ||
| 804 | + bool sucess = await detailModel | ||
| 805 | + .upReserveInfo(context, widget.rid, | ||
| 806 | + name: nameStr, | ||
| 807 | + sex: sex, | ||
| 808 | + phone: detailModel | ||
| 809 | + .phoneController.text | ||
| 810 | + .replaceAll(' ', '')); | ||
| 811 | + if (sucess) { | ||
| 812 | + if (widget.mid != '' && | ||
| 813 | + widget.mid != null) { | ||
| 814 | + setMessageStatus(); | ||
| 815 | + } | ||
| 816 | + EventBus().emit( | ||
| 817 | + "refresh_tablemanager"); //刷新桌位 | ||
| 818 | + bus.emit("refresh_book_list"); //刷新已预订列表 | ||
| 819 | + bus.emit("refresh_detail"); | ||
| 820 | + | ||
| 821 | + Navigator.of(context).pop( | ||
| 822 | + detailModel.phoneController.text); | ||
| 823 | + } | ||
| 824 | + }, | ||
| 825 | + ) | ||
| 826 | + ], | ||
| 827 | + )), | ||
| 828 | + Offstage( | ||
| 829 | + offstage: !(showPhoneHistory && | ||
| 830 | + detailModel.userHistorys.length > 0), | ||
| 831 | + child: Container( | ||
| 832 | + decoration: BoxDecoration( | ||
| 833 | + borderRadius: BorderRadius.circular(8), | ||
| 834 | + border: Border.all(color: Colors.white), | ||
| 835 | + color: MyColours.color_ffffff, | ||
| 836 | + boxShadow: [ | ||
| 837 | + BoxShadow( | ||
| 838 | + color: MyColours.color_e5e5e5, | ||
| 839 | + blurRadius: ScreenUtil().setWidth(20)) | ||
| 840 | + ]), | ||
| 841 | + width: ScreenUtil().screenWidth - w(60), | ||
| 842 | + // width: ScreenUtil().setWidth(350), | ||
| 843 | + constraints: BoxConstraints(maxHeight: w(270)), | ||
| 844 | + // width: ScreenUtil().setWidth(440), | ||
| 845 | + // height: detailModel.userHistorys.length > 1 | ||
| 846 | + // ? ScreenUtil().setWidth(260) | ||
| 847 | + // : ScreenUtil().setWidth(104), | ||
| 848 | + padding: EdgeInsets.symmetric( | ||
| 849 | + horizontal: ScreenUtil().setWidth(30)), | ||
| 850 | + child: Align( | ||
| 851 | + alignment: Alignment.topCenter, | ||
| 852 | + child: MediaQuery.removePadding( | ||
| 853 | + context: context, | ||
| 854 | + removeTop: true, | ||
| 855 | + child: Scrollbar( | ||
| 856 | + isAlwaysShown: true, //设置滚动条常亮 | ||
| 857 | + controller: | ||
| 858 | + _scrollCrl, //必须设置一个controller | ||
| 859 | + | ||
| 860 | + ///添加进度条 | ||
| 861 | + child: ListView.builder( | ||
| 862 | + shrinkWrap: true, | ||
| 863 | + controller: _scrollCrl, | ||
| 864 | + itemBuilder: (context, index) { | ||
| 865 | + return GestureDetector( | ||
| 866 | + onTap: () { | ||
| 867 | + _byValueToReqeust(index); | ||
| 868 | + // setState(() { | ||
| 869 | + // showPhoneHistory = false; | ||
| 870 | + // UserHistoryEntity | ||
| 871 | + // userHistoryEntity = | ||
| 872 | + // detailModel | ||
| 873 | + // .userHistorys[ | ||
| 874 | + // index]; | ||
| 875 | + // if (userHistoryEntity.sex == | ||
| 876 | + // null || | ||
| 877 | + // userHistoryEntity.sex == | ||
| 878 | + // '') { | ||
| 879 | + // userHistoryEntity.sex = | ||
| 880 | + // '1'; | ||
| 881 | + // } | ||
| 882 | + // detailModel.phoneController | ||
| 883 | + // .text = | ||
| 884 | + // userHistoryEntity | ||
| 885 | + // .phone != | ||
| 886 | + // null | ||
| 887 | + // ? userHistoryEntity | ||
| 888 | + // .phone | ||
| 889 | + // : ''; | ||
| 890 | + // for (var item in detailModel | ||
| 891 | + // .sexList) { | ||
| 892 | + // item['select'] = false; | ||
| 893 | + // if (item['title'] == | ||
| 894 | + // userHistoryEntity | ||
| 895 | + // .sexStr) { | ||
| 896 | + // item['select'] = true; | ||
| 897 | + // } | ||
| 898 | + // } | ||
| 899 | + // // _homeEnterModel.nameController.text = | ||
| 900 | + // // _homeEnterModel | ||
| 901 | + // // .userHistorys[index].rname + | ||
| 902 | + // // _nameSuffix(); | ||
| 903 | + // _addNameSuffix( | ||
| 904 | + // userHistoryEntity.rname, | ||
| 905 | + // _nameSuffix()); | ||
| 906 | + // nameStr = | ||
| 907 | + // userHistoryEntity.rname; | ||
| 908 | + // _phoneNode.unfocus(); | ||
| 909 | + // detailModel.userHistorys | ||
| 910 | + // .clear(); | ||
| 911 | + // }); | ||
| 912 | + }, | ||
| 913 | + child: Container( | ||
| 914 | + width: double.infinity, | ||
| 915 | + height: ScreenUtil() | ||
| 916 | + .setWidth(102), | ||
| 917 | + alignment: Alignment.center, | ||
| 918 | + decoration: BoxDecoration( | ||
| 919 | + border: Border( | ||
| 920 | + bottom: (index != | ||
| 921 | + (detailModel | ||
| 922 | + .userHistorys | ||
| 923 | + .length - | ||
| 924 | + 1) && | ||
| 925 | + detailModel | ||
| 926 | + .userHistorys | ||
| 927 | + .length > | ||
| 928 | + 1) | ||
| 929 | + ? BorderSide( | ||
| 930 | + color: MyColours | ||
| 931 | + .color_e5e5e5, | ||
| 932 | + width: ScreenUtil() | ||
| 933 | + .setWidth( | ||
| 934 | + 2)) | ||
| 935 | + : BorderSide | ||
| 936 | + .none)), | ||
| 937 | + child: Align( | ||
| 938 | + alignment: | ||
| 939 | + Alignment.centerLeft, | ||
| 940 | + child: Text( | ||
| 941 | + (_nameNode.hasFocus | ||
| 942 | + ? (detailModel | ||
| 943 | + .userHistorys[ | ||
| 944 | + index] | ||
| 945 | + .rnameStr == | ||
| 946 | + null | ||
| 947 | + ? '' | ||
| 948 | + : detailModel | ||
| 949 | + .userHistorys[ | ||
| 950 | + index] | ||
| 951 | + .rnameStr) | ||
| 952 | + : (detailModel | ||
| 953 | + .userHistorys[ | ||
| 954 | + index] | ||
| 955 | + .phone == | ||
| 956 | + null | ||
| 957 | + ? '' | ||
| 958 | + : detailModel | ||
| 959 | + .userHistorys[ | ||
| 960 | + index] | ||
| 961 | + .phone)) + | ||
| 962 | + ' ' + | ||
| 963 | + (_nameNode.hasFocus | ||
| 964 | + ? (detailModel | ||
| 965 | + .userHistorys[ | ||
| 966 | + index] | ||
| 967 | + .phone == | ||
| 968 | + null | ||
| 969 | + ? '' | ||
| 970 | + : detailModel | ||
| 971 | + .userHistorys[ | ||
| 972 | + index] | ||
| 973 | + .phone) | ||
| 974 | + : (detailModel | ||
| 975 | + .userHistorys[ | ||
| 976 | + index] | ||
| 977 | + .rnameStr == | ||
| 978 | + null | ||
| 979 | + ? '' | ||
| 980 | + : detailModel | ||
| 981 | + .userHistorys[ | ||
| 982 | + index] | ||
| 983 | + .rnameStr)) + | ||
| 984 | + ' ' + | ||
| 985 | + detailModel | ||
| 986 | + .userHistorys[ | ||
| 987 | + index] | ||
| 988 | + .nickName, | ||
| 989 | + style: TextStyle( | ||
| 990 | + color: MyColours | ||
| 991 | + .color_333333, | ||
| 992 | + fontSize: | ||
| 993 | + ScreenUtil() | ||
| 994 | + .setSp(32)), | ||
| 995 | + )), | ||
| 996 | + ), | ||
| 997 | + ); | ||
| 998 | + }, | ||
| 999 | + itemExtent: | ||
| 1000 | + ScreenUtil().setWidth(104), | ||
| 1001 | + itemCount: | ||
| 1002 | + detailModel.userHistorys.length, | ||
| 1003 | + )))), | ||
| 1004 | + ), | ||
| 1005 | + ), | ||
| 1006 | + ], | ||
| 1007 | + ), | ||
| 1008 | + ]))))); | ||
| 1009 | + } | ||
| 1010 | +} |
-
Please register or login to post a comment