Showing
7 changed files
with
757 additions
and
3 deletions
assets/add_close.png
0 → 100644
1.11 KB
assets/add_close_b.png
0 → 100644
1.04 KB
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter_native_image/flutter_native_image.dart'; | ||
| 4 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 5 | +import 'package:image_picker/image_picker.dart'; | ||
| 6 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 7 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 8 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 9 | + | ||
| 10 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 11 | +import 'package:permission_handler/permission_handler.dart'; | ||
| 12 | +import 'package:provider/provider.dart'; | ||
| 13 | + | ||
| 14 | +import '../../models/upload_img_model.dart'; | ||
| 15 | +import '../../provider/upload_img_provider.dart'; | ||
| 16 | +import '../../res/colors.dart'; | ||
| 17 | +import '../../utils/screen_util.dart'; | ||
| 18 | +import '../../utils/upload_image_util.dart'; | ||
| 19 | +import '../../utils/utils.dart'; | ||
| 20 | +import 'dart:io'; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * 预订信息模块设置-自定义图文默认 | ||
| 24 | + */ | ||
| 25 | + | ||
| 26 | +class AdditionModel { | ||
| 27 | + String content; | ||
| 28 | + String type; // 1图片 2文本 | ||
| 29 | + int order; //顺序 | ||
| 30 | + UploadImgModel image; | ||
| 31 | + TextEditingController infoC = TextEditingController(); | ||
| 32 | + | ||
| 33 | + AdditionModel(); | ||
| 34 | + | ||
| 35 | + factory AdditionModel.fromJson(Map<String, dynamic> json) => AdditionModel() | ||
| 36 | + ..content = json["content"] | ||
| 37 | + ..type = json["type"] | ||
| 38 | + ..order = json['order']; | ||
| 39 | + | ||
| 40 | + Map<String, dynamic> toJson() => | ||
| 41 | + <String, dynamic>{"content": content, "type": type, 'order': order}; | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +class InvicationAdditionPage extends StatefulWidget { | ||
| 45 | + InvicationAdditionPage(); | ||
| 46 | + | ||
| 47 | + @override | ||
| 48 | + State<InvicationAdditionPage> createState() => _InvicationAdditionPageState(); | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +class _InvicationAdditionPageState extends State<InvicationAdditionPage> { | ||
| 52 | + TextEditingController titleC = TextEditingController(); | ||
| 53 | + List<AdditionModel> data = []; | ||
| 54 | + UploadImageProvider _uploadImageProvider; | ||
| 55 | + final picker = ImagePicker(); | ||
| 56 | + ScrollController controller = ScrollController(); | ||
| 57 | + | ||
| 58 | + @override | ||
| 59 | + void initState() { | ||
| 60 | + super.initState(); | ||
| 61 | + | ||
| 62 | + AdditionModel additionModel = AdditionModel(); | ||
| 63 | + additionModel.content = | ||
| 64 | + 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641'; | ||
| 65 | + additionModel.type = '1'; | ||
| 66 | + additionModel.order = 0; | ||
| 67 | + additionModel.image = UploadImgModel(); | ||
| 68 | + additionModel.image.process = 1; | ||
| 69 | + additionModel.image.qiniuUrl = | ||
| 70 | + 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641'; | ||
| 71 | + | ||
| 72 | + AdditionModel additionModel1 = AdditionModel(); | ||
| 73 | + additionModel1.content = 'webenkjfkdfjakdfjaldfkjaldfjaldf'; | ||
| 74 | + additionModel1.type = '2'; | ||
| 75 | + additionModel1.order = 1; | ||
| 76 | + | ||
| 77 | + data.add(additionModel); | ||
| 78 | + data.add(additionModel1); | ||
| 79 | + | ||
| 80 | + WidgetsBinding.instance.addPostFrameCallback((_) async { | ||
| 81 | + _getQiniuInfo(); | ||
| 82 | + }); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + ///获取七牛云token | ||
| 86 | + /// | ||
| 87 | + _getQiniuInfo() async { | ||
| 88 | + await _uploadImageProvider.getQiniuInfo(context, {}); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @override | ||
| 92 | + void dispose() { | ||
| 93 | + super.dispose(); | ||
| 94 | + _uploadImageProvider.tableImageList = []; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + ///#相机拍照,单图选择 | ||
| 98 | + Future _getFromPictureOrCamera(UploadImgModel imgModel, imageSource) async { | ||
| 99 | + final pickedFile = await picker.pickImage(source: imageSource); | ||
| 100 | + File compressedFile = await FlutterNativeImage.compressImage( | ||
| 101 | + pickedFile.path, | ||
| 102 | + quality: 50, | ||
| 103 | + percentage: 50); | ||
| 104 | + setState(() { | ||
| 105 | + if (pickedFile != null) { | ||
| 106 | + imgModel.file = File(pickedFile.path); | ||
| 107 | + imgModel.process = 0.01; | ||
| 108 | + } else { | ||
| 109 | + print('No image selected.'); | ||
| 110 | + } | ||
| 111 | + }); | ||
| 112 | + if (pickedFile != null) { | ||
| 113 | + // if (title == '头像') { | ||
| 114 | + // _uploadImageProvider.imgSizeTouxiang = 76; | ||
| 115 | + // _uploadImageProvider.touxiang.qiniuUrl = null; | ||
| 116 | + // } else { | ||
| 117 | + // _uploadImageProvider.imgSizeErweima = 76; | ||
| 118 | + _uploadImageProvider.firstImage.qiniuUrl = null; | ||
| 119 | + // } | ||
| 120 | + bool need = await Utils.sizeNeed(File(pickedFile.path)); | ||
| 121 | + File file = File(pickedFile.path); | ||
| 122 | + if (need) { | ||
| 123 | + file = File(compressedFile.absolute.path); | ||
| 124 | + } | ||
| 125 | + UploadImageUtil() | ||
| 126 | + .startUploadOnly(context, file, 4, true, _uploadImageProvider); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + ///添加图片UI弹出 | ||
| 131 | + Future _openModalBottomSheet(context) async { | ||
| 132 | + final option = await showModalBottomSheet( | ||
| 133 | + context: context, | ||
| 134 | + backgroundColor: Colors.transparent, | ||
| 135 | + isDismissible: false, | ||
| 136 | + builder: (BuildContext context) { | ||
| 137 | + return Container( | ||
| 138 | + // height: ScreenUtil().setWidth(180 * 2), | ||
| 139 | + decoration: BoxDecoration( | ||
| 140 | + color: MyColours.color_ffffff, | ||
| 141 | + borderRadius: BorderRadius.only( | ||
| 142 | + topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 143 | + topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 144 | + child: Column( | ||
| 145 | + mainAxisSize: MainAxisSize.min, | ||
| 146 | + children: <Widget>[ | ||
| 147 | + InkWell( | ||
| 148 | + onTap: () { | ||
| 149 | + // Utils.getPickPermission(context, () { | ||
| 150 | + // _getFromPictureOrCamera( | ||
| 151 | + // _uploadImageProvider.firstImage, ImageSource.camera); | ||
| 152 | + | ||
| 153 | + // Navigator.pop(context); | ||
| 154 | + // }, Permission.camera); | ||
| 155 | + Utils.getPickPermission(context, () { | ||
| 156 | + _getFromPictureOrCamera( | ||
| 157 | + _uploadImageProvider.firstImage, ImageSource.camera); | ||
| 158 | + Navigator.pop(context); | ||
| 159 | + }, | ||
| 160 | + Platform.isAndroid | ||
| 161 | + ? Permission.storage | ||
| 162 | + : Permission.photos); | ||
| 163 | + }, | ||
| 164 | + child: Container( | ||
| 165 | + width: double.infinity, | ||
| 166 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 167 | + child: Center( | ||
| 168 | + child: Text( | ||
| 169 | + '拍摄', | ||
| 170 | + style: TextStyle( | ||
| 171 | + fontSize: ScreenUtil().setSp(32), | ||
| 172 | + color: MyColours.color_353535, | ||
| 173 | + fontWeight: FontWeight.bold), | ||
| 174 | + ), | ||
| 175 | + )), | ||
| 176 | + ), | ||
| 177 | + MyDivider( | ||
| 178 | + double.infinity, | ||
| 179 | + ScreenUtil().setWidth(2), | ||
| 180 | + color: MyColours.color_EEEEEE, | ||
| 181 | + ), | ||
| 182 | + InkWell( | ||
| 183 | + onTap: () { | ||
| 184 | + // Utils.getPickPermission(context, () { | ||
| 185 | + // // pickAsset(RequestType.image); | ||
| 186 | + // _getFromPictureOrCamera( | ||
| 187 | + // _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 188 | + // Navigator.pop(context); | ||
| 189 | + // }, | ||
| 190 | + // Platform.isAndroid | ||
| 191 | + // ? Permission.storage | ||
| 192 | + // : Permission.photos); | ||
| 193 | + Utils.getPickPermission(context, () { | ||
| 194 | + _getFromPictureOrCamera( | ||
| 195 | + _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 196 | + Navigator.pop(context); | ||
| 197 | + }, | ||
| 198 | + Platform.isAndroid | ||
| 199 | + ? Permission.storage | ||
| 200 | + : Permission.photos); | ||
| 201 | + }, | ||
| 202 | + child: Container( | ||
| 203 | + width: double.infinity, | ||
| 204 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 205 | + child: Center( | ||
| 206 | + child: Text( | ||
| 207 | + '从相册选择', | ||
| 208 | + style: TextStyle( | ||
| 209 | + fontSize: ScreenUtil().setSp(32), | ||
| 210 | + color: MyColours.color_353535, | ||
| 211 | + fontWeight: FontWeight.bold), | ||
| 212 | + ), | ||
| 213 | + )), | ||
| 214 | + ), | ||
| 215 | + MyDivider( | ||
| 216 | + double.infinity, | ||
| 217 | + ScreenUtil().setWidth(10), | ||
| 218 | + color: MyColours.color_EEEEEE, | ||
| 219 | + ), | ||
| 220 | + InkWell( | ||
| 221 | + onTap: () { | ||
| 222 | + Navigator.pop(context, '取消'); | ||
| 223 | + }, | ||
| 224 | + child: Container( | ||
| 225 | + width: double.infinity, | ||
| 226 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 227 | + child: Center( | ||
| 228 | + child: Text( | ||
| 229 | + '取消', | ||
| 230 | + style: TextStyle( | ||
| 231 | + fontSize: ScreenUtil().setSp(32), | ||
| 232 | + color: MyColours.color_353535, | ||
| 233 | + fontWeight: FontWeight.bold), | ||
| 234 | + ), | ||
| 235 | + ))) | ||
| 236 | + ], | ||
| 237 | + ), | ||
| 238 | + ); | ||
| 239 | + }); | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + @override | ||
| 243 | + Widget build(BuildContext context) { | ||
| 244 | + _uploadImageProvider = | ||
| 245 | + Provider.of<UploadImageProvider>(context, listen: true); | ||
| 246 | + return Scaffold( | ||
| 247 | + backgroundColor: MyColours.color_ffffff, | ||
| 248 | + appBar: SystemAppBar('自定义图文'), | ||
| 249 | + body: SingleChildScrollView( | ||
| 250 | + controller: controller, | ||
| 251 | + child: Column( | ||
| 252 | + children: [ | ||
| 253 | + Container( | ||
| 254 | + padding: | ||
| 255 | + EdgeInsets.symmetric(horizontal: w(16), vertical: w(12)), | ||
| 256 | + child: Row( | ||
| 257 | + children: [ | ||
| 258 | + Text( | ||
| 259 | + '区域标题', | ||
| 260 | + style: TextStyle( | ||
| 261 | + color: MyColours.color_515151, fontSize: font(16)), | ||
| 262 | + ), | ||
| 263 | + // HEmptyView(44), | ||
| 264 | + | ||
| 265 | + Expanded( | ||
| 266 | + child: Container( | ||
| 267 | + height: w(24), | ||
| 268 | + // color: Colors.red, | ||
| 269 | + child: TextField( | ||
| 270 | + controller: titleC, | ||
| 271 | + textAlign: TextAlign.right, | ||
| 272 | + // focusNode: _cusdemNode, | ||
| 273 | + style: TextStyle( | ||
| 274 | + color: MyColours.color_515151, | ||
| 275 | + fontSize: ScreenUtil().setSp(32), | ||
| 276 | + // textBaseline: TextBaseline.alphabetic | ||
| 277 | + ), | ||
| 278 | + // textAlignVertical: TextAlignVertical.center, | ||
| 279 | + maxLines: 1, | ||
| 280 | + // inputFormatters: [ | ||
| 281 | + // LengthLimitingTextInputFormatter(10), // 设置输入长度限制 | ||
| 282 | + // ], | ||
| 283 | + decoration: InputDecoration( | ||
| 284 | + hintText: "点击输入区域标题(不超过10个字)", | ||
| 285 | + hintStyle: TextStyle( | ||
| 286 | + color: MyColours.color_999999, | ||
| 287 | + fontSize: ScreenUtil().setSp(32), | ||
| 288 | + ), | ||
| 289 | + contentPadding: EdgeInsets.zero, | ||
| 290 | + border: OutlineInputBorder( | ||
| 291 | + borderSide: BorderSide.none), | ||
| 292 | + ), | ||
| 293 | + keyboardType: TextInputType.text, | ||
| 294 | + onChanged: (value) {}), | ||
| 295 | + )) | ||
| 296 | + ], | ||
| 297 | + ), | ||
| 298 | + ), | ||
| 299 | + Padding( | ||
| 300 | + padding: EdgeInsets.only(left: w(16)), | ||
| 301 | + child: MyDivider( | ||
| 302 | + double.infinity, | ||
| 303 | + w(0.5), | ||
| 304 | + color: MyColours.color_E7E7E7, | ||
| 305 | + ), | ||
| 306 | + ), | ||
| 307 | + // Expanded( | ||
| 308 | + // child: | ||
| 309 | + Padding( | ||
| 310 | + padding: EdgeInsets.symmetric( | ||
| 311 | + // horizontal: ScreenUtil().setWidth(32), | ||
| 312 | + vertical: ScreenUtil().setWidth(26)), | ||
| 313 | + child: ReorderableListView( | ||
| 314 | + shrinkWrap: true, | ||
| 315 | + scrollController: controller, | ||
| 316 | + children: <Widget>[ | ||
| 317 | + for (AdditionModel item in data) | ||
| 318 | + item.type == '1' | ||
| 319 | + ? Container( | ||
| 320 | + key: ValueKey(item), | ||
| 321 | + child: InkWell( | ||
| 322 | + onTap: () { | ||
| 323 | + double process; | ||
| 324 | + String qiniuUrl; | ||
| 325 | + List<String> tempList = []; | ||
| 326 | + // if (title == '头像') { | ||
| 327 | + process = item.image.process; | ||
| 328 | + qiniuUrl = item.image.qiniuUrl; | ||
| 329 | + // } else { | ||
| 330 | + // process = _uploadImageProvider.erweima.process; | ||
| 331 | + // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl; | ||
| 332 | + // } | ||
| 333 | + | ||
| 334 | + if (qiniuUrl != null && | ||
| 335 | + qiniuUrl != '') { | ||
| 336 | + // tempList.add(qiniuUrl); | ||
| 337 | + | ||
| 338 | + // ///没有上传完成的不可以点击 | ||
| 339 | + // _showPhotoView(context, 0, tempList); | ||
| 340 | + | ||
| 341 | + // _uploadImageProvider.firstImage.qiniuUrl = null; | ||
| 342 | + // _uploadImageProvider.firstImage.process = 0; | ||
| 343 | + // setState(() {}); | ||
| 344 | + _openModalBottomSheet(context); | ||
| 345 | + // Utils.getPickPermission(context, () { | ||
| 346 | + // _getFromPictureOrCamera( | ||
| 347 | + // _uploadImageProvider.firstImage, | ||
| 348 | + // ImageSource.gallery); | ||
| 349 | + // }, | ||
| 350 | + // Platform.isAndroid | ||
| 351 | + // ? Permission.storage | ||
| 352 | + // : Permission.photos); | ||
| 353 | + } | ||
| 354 | + }, | ||
| 355 | + child: Stack( | ||
| 356 | + alignment: Alignment.bottomCenter, | ||
| 357 | + children: [ | ||
| 358 | + Stack( | ||
| 359 | + clipBehavior: Clip.none, | ||
| 360 | + children: [ | ||
| 361 | + item.image.qiniuUrl != null && | ||
| 362 | + item.image.qiniuUrl != | ||
| 363 | + '' | ||
| 364 | + ? Image.network( | ||
| 365 | + item.image.qiniuUrl, | ||
| 366 | + fit: BoxFit.contain, | ||
| 367 | + width: | ||
| 368 | + double.infinity, | ||
| 369 | + // width: ScreenUtil() | ||
| 370 | + // .setWidth(imgSize * 2), | ||
| 371 | + // height: ScreenUtil().setWidth( | ||
| 372 | + // _uploadImageProvider | ||
| 373 | + // .imgSizefirstImage * | ||
| 374 | + // 2), | ||
| 375 | + ) | ||
| 376 | + : Image.file( | ||
| 377 | + item.image.file, | ||
| 378 | + fit: BoxFit.contain, | ||
| 379 | + width: | ||
| 380 | + double.infinity, | ||
| 381 | + // width: ScreenUtil() | ||
| 382 | + // .setWidth(imgSize * 2), | ||
| 383 | + // height: ScreenUtil().setWidth( | ||
| 384 | + // _uploadImageProvider | ||
| 385 | + // .imgSizefirstImage * | ||
| 386 | + // 2), | ||
| 387 | + ), | ||
| 388 | + Positioned( | ||
| 389 | + left: 0, | ||
| 390 | + top: 0, | ||
| 391 | + child: (item.image.file != | ||
| 392 | + null) && | ||
| 393 | + item.image | ||
| 394 | + .process != | ||
| 395 | + 1 && | ||
| 396 | + item.image | ||
| 397 | + .process != | ||
| 398 | + 0.01 | ||
| 399 | + ? Container( | ||
| 400 | + width: ScreenUtil() | ||
| 401 | + .screenWidth, | ||
| 402 | + height: w( | ||
| 403 | + _uploadImageProvider | ||
| 404 | + .imgSizefirstImage), | ||
| 405 | + color: MyColours | ||
| 406 | + .color_4D000000, | ||
| 407 | + child: Center( | ||
| 408 | + child: Text( | ||
| 409 | + '上传中', | ||
| 410 | + style: TextStyle( | ||
| 411 | + color: MyColours | ||
| 412 | + .color_F8F9FD)), | ||
| 413 | + ), | ||
| 414 | + ) | ||
| 415 | + : Container()), | ||
| 416 | + ]), | ||
| 417 | + // item.image.process == 1 | ||
| 418 | + // ? Container( | ||
| 419 | + // width: w(150), | ||
| 420 | + // height: w(30), | ||
| 421 | + // color: MyColours.color_4D000000, | ||
| 422 | + // alignment: Alignment.center, | ||
| 423 | + // child: Text( | ||
| 424 | + // '点击图片可以更换', | ||
| 425 | + // style: TextStyle( | ||
| 426 | + // color: MyColours | ||
| 427 | + // .color_F8F9FD, | ||
| 428 | + // fontSize: font(14), | ||
| 429 | + // fontWeight: | ||
| 430 | + // FontWeight.bold), | ||
| 431 | + // )) | ||
| 432 | + // : SizedBox(), | ||
| 433 | + item.image.process == 1 | ||
| 434 | + ? Positioned( | ||
| 435 | + top: w(15), | ||
| 436 | + right: w(15), | ||
| 437 | + child: InkWell( | ||
| 438 | + onTap: () { | ||
| 439 | + data.remove(item); | ||
| 440 | + setState(() {}); | ||
| 441 | + }, | ||
| 442 | + child: Container( | ||
| 443 | + width: w(30), | ||
| 444 | + height: w(30), | ||
| 445 | + color: Colors | ||
| 446 | + .transparent, | ||
| 447 | + alignment: Alignment | ||
| 448 | + .center, | ||
| 449 | + child: Image.asset( | ||
| 450 | + Utils.getImgPath( | ||
| 451 | + 'add_close'))))) | ||
| 452 | + : SizedBox(), | ||
| 453 | + ]))) | ||
| 454 | + : Container( | ||
| 455 | + key: ValueKey(item), | ||
| 456 | + decoration: BoxDecoration( | ||
| 457 | + border: Border.all( | ||
| 458 | + width: w(1), | ||
| 459 | + color: MyColours.color_DBDBDB)), | ||
| 460 | + // child: Text(item.content), | ||
| 461 | + | ||
| 462 | + // color: Colors.red, | ||
| 463 | + child: Stack( | ||
| 464 | + children: [ | ||
| 465 | + Container( | ||
| 466 | + // height: w(152), | ||
| 467 | + decoration: BoxDecoration( | ||
| 468 | + borderRadius: | ||
| 469 | + BorderRadius.circular(r(5)), | ||
| 470 | + border: Border.all( | ||
| 471 | + width: w(1), | ||
| 472 | + color: | ||
| 473 | + MyColours.color_DBDBDB)), | ||
| 474 | + margin: EdgeInsets.only( | ||
| 475 | + left: w(10), | ||
| 476 | + top: w(10), | ||
| 477 | + bottom: w(10), | ||
| 478 | + right: w(60)), | ||
| 479 | + padding: EdgeInsets.only( | ||
| 480 | + top: w(16), | ||
| 481 | + bottom: w(16), | ||
| 482 | + left: w(14), | ||
| 483 | + right: w(10)), | ||
| 484 | + child: TextField( | ||
| 485 | + controller: item.infoC, | ||
| 486 | + // textAlign: TextAlign.right, | ||
| 487 | + // focusNode: _cusdemNode, | ||
| 488 | + style: TextStyle( | ||
| 489 | + color: MyColours.color_515151, | ||
| 490 | + fontSize: | ||
| 491 | + ScreenUtil().setSp(28), | ||
| 492 | + // textBaseline: TextBaseline.alphabetic | ||
| 493 | + ), | ||
| 494 | + // textAlignVertical: TextAlignVertical.center, | ||
| 495 | + maxLines: 5, | ||
| 496 | + maxLength: 50, | ||
| 497 | + // inputFormatters: [ | ||
| 498 | + // LengthLimitingTextInputFormatter(10), // 设置输入长度限制 | ||
| 499 | + // ], | ||
| 500 | + decoration: InputDecoration( | ||
| 501 | + hintText: "点击录入文字", | ||
| 502 | + hintStyle: TextStyle( | ||
| 503 | + color: MyColours.color_999999, | ||
| 504 | + fontSize: | ||
| 505 | + ScreenUtil().setSp(28), | ||
| 506 | + ), | ||
| 507 | + contentPadding: EdgeInsets.zero, | ||
| 508 | + border: OutlineInputBorder( | ||
| 509 | + borderSide: | ||
| 510 | + BorderSide.none), | ||
| 511 | + ), | ||
| 512 | + keyboardType: TextInputType.text, | ||
| 513 | + onChanged: (value) {})), | ||
| 514 | + Positioned( | ||
| 515 | + top: w(10), | ||
| 516 | + right: w(10), | ||
| 517 | + child: InkWell( | ||
| 518 | + onTap: () { | ||
| 519 | + data.remove(item); | ||
| 520 | + setState(() {}); | ||
| 521 | + }, | ||
| 522 | + child: Container( | ||
| 523 | + width: w(30), | ||
| 524 | + height: w(30), | ||
| 525 | + color: Colors.transparent, | ||
| 526 | + alignment: Alignment.center, | ||
| 527 | + child: Image.asset( | ||
| 528 | + Utils.getImgPath( | ||
| 529 | + 'add_close_b'))))) | ||
| 530 | + ], | ||
| 531 | + ), | ||
| 532 | + ), | ||
| 533 | + ], | ||
| 534 | + onReorder: (int oldIndex, int newIndex) async { | ||
| 535 | + // if (oldIndex < newIndex) { | ||
| 536 | + // newIndex -= 1; | ||
| 537 | + // } | ||
| 538 | + | ||
| 539 | + // var childold = tableManagerModel.areas[oldIndex]; | ||
| 540 | + // Map<String, String> params = { | ||
| 541 | + // 'sid': Provider.of<UserModel>(context, listen: false) | ||
| 542 | + // .user | ||
| 543 | + // .sellerid, | ||
| 544 | + // 'regionid': childold.rid, | ||
| 545 | + // 'order_o': tableManagerModel.areas[newIndex].orderId, | ||
| 546 | + // 'sort': oldIndex < newIndex ? '2' : '1' | ||
| 547 | + // }; | ||
| 548 | + // var child = tableManagerModel.areas.removeAt(oldIndex); | ||
| 549 | + // tableManagerModel.areas.insert(newIndex, child); | ||
| 550 | + // setState(() {}); | ||
| 551 | + // await tableManagerModel.sortByRegion(context, params); | ||
| 552 | + // //刷新前一页数据 | ||
| 553 | + // bus.emit('refresh_table_area'); | ||
| 554 | + }, | ||
| 555 | + )), | ||
| 556 | + Container( | ||
| 557 | + padding: EdgeInsets.only(top: w(15)), | ||
| 558 | + child: Row( | ||
| 559 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 560 | + children: [ | ||
| 561 | + InkWell( | ||
| 562 | + onTap: () { | ||
| 563 | + AdditionModel additionModel = AdditionModel(); | ||
| 564 | + additionModel.content = | ||
| 565 | + 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641'; | ||
| 566 | + additionModel.type = '1'; | ||
| 567 | + additionModel.order = 0; | ||
| 568 | + additionModel.image = UploadImgModel(); | ||
| 569 | + additionModel.image.process = 1; | ||
| 570 | + additionModel.image.qiniuUrl = | ||
| 571 | + 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641'; | ||
| 572 | + | ||
| 573 | + data.add(additionModel); | ||
| 574 | + setState(() {}); | ||
| 575 | + }, | ||
| 576 | + child: Container( | ||
| 577 | + width: w(77), | ||
| 578 | + height: w(34), | ||
| 579 | + alignment: Alignment.center, | ||
| 580 | + decoration: BoxDecoration( | ||
| 581 | + borderRadius: BorderRadius.circular(r(5)), | ||
| 582 | + border: Border.all( | ||
| 583 | + width: w(1), | ||
| 584 | + color: MyColours.color_438E93)), | ||
| 585 | + child: Text( | ||
| 586 | + '+图片', | ||
| 587 | + style: TextStyle( | ||
| 588 | + color: MyColours.color_000000, | ||
| 589 | + fontSize: font(14)), | ||
| 590 | + ), | ||
| 591 | + )), | ||
| 592 | + HEmptyView(20), | ||
| 593 | + InkWell( | ||
| 594 | + onTap: () { | ||
| 595 | + AdditionModel additionModel1 = AdditionModel(); | ||
| 596 | + additionModel1.content = | ||
| 597 | + 'webenkjfkdfjakdfjaldfkjaldfjaldf'; | ||
| 598 | + additionModel1.type = '2'; | ||
| 599 | + additionModel1.order = 1; | ||
| 600 | + | ||
| 601 | + data.add(additionModel1); | ||
| 602 | + setState(() {}); | ||
| 603 | + }, | ||
| 604 | + child: Container( | ||
| 605 | + width: w(77), | ||
| 606 | + height: w(34), | ||
| 607 | + alignment: Alignment.center, | ||
| 608 | + decoration: BoxDecoration( | ||
| 609 | + borderRadius: BorderRadius.circular(r(5)), | ||
| 610 | + border: Border.all( | ||
| 611 | + width: w(1), | ||
| 612 | + color: MyColours.color_438E93)), | ||
| 613 | + child: Text( | ||
| 614 | + '+文字', | ||
| 615 | + style: TextStyle( | ||
| 616 | + color: MyColours.color_000000, | ||
| 617 | + fontSize: font(14)), | ||
| 618 | + ), | ||
| 619 | + )), | ||
| 620 | + ], | ||
| 621 | + ), | ||
| 622 | + ) | ||
| 623 | + // ) | ||
| 624 | + ], | ||
| 625 | + ))); | ||
| 626 | + } | ||
| 627 | +} |
| @@ -2498,14 +2498,14 @@ class InvicationPageState extends State<InvicationPage> | @@ -2498,14 +2498,14 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2498 | //输入文本的样式 | 2498 | //输入文本的样式 |
| 2499 | style: TextStyle( | 2499 | style: TextStyle( |
| 2500 | fontSize: ScreenUtil().setSp(28), | 2500 | fontSize: ScreenUtil().setSp(28), |
| 2501 | - color: MyColours.color_353535), | 2501 | + color: MyColours.color_515151), |
| 2502 | // controller: _baseIndoProvider.nameController, | 2502 | // controller: _baseIndoProvider.nameController, |
| 2503 | // focusNode: _nameNode, | 2503 | // focusNode: _nameNode, |
| 2504 | // textAlignVertical: TextAlignVertical.top, | 2504 | // textAlignVertical: TextAlignVertical.top, |
| 2505 | decoration: InputDecoration( | 2505 | decoration: InputDecoration( |
| 2506 | - hintText: "用餐类型", | 2506 | + hintText: "用餐类型:", |
| 2507 | hintStyle: TextStyle( | 2507 | hintStyle: TextStyle( |
| 2508 | - color: MyColours.color_999999, | 2508 | + color: MyColours.color_515151, |
| 2509 | fontSize: ScreenUtil().setSp(28), | 2509 | fontSize: ScreenUtil().setSp(28), |
| 2510 | ), | 2510 | ), |
| 2511 | // contentPadding: | 2511 | // contentPadding: |
| @@ -2567,6 +2567,97 @@ class InvicationPageState extends State<InvicationPage> | @@ -2567,6 +2567,97 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2567 | ) | 2567 | ) |
| 2568 | ], | 2568 | ], |
| 2569 | )), | 2569 | )), |
| 2570 | + InkWell( | ||
| 2571 | + onTap: () { | ||
| 2572 | + FocusScope.of(context) | ||
| 2573 | + .requestFocus(FocusNode()); //隐藏键盘 | ||
| 2574 | + | ||
| 2575 | + //跳转到新页面 | ||
| 2576 | + | ||
| 2577 | + NavigatorUtil.goInvicationAdditionPage(context); | ||
| 2578 | + | ||
| 2579 | + }, | ||
| 2580 | + child: Container( | ||
| 2581 | + margin: EdgeInsets.only( | ||
| 2582 | + // top: ScreenUtil().setWidth(40), | ||
| 2583 | + bottom: ScreenUtil().setWidth(40)), | ||
| 2584 | + height: ScreenUtil().setWidth(68), | ||
| 2585 | + padding: EdgeInsets.symmetric( | ||
| 2586 | + horizontal: ScreenUtil().setWidth(16)), | ||
| 2587 | + decoration: BoxDecoration( | ||
| 2588 | + borderRadius: BorderRadius.circular( | ||
| 2589 | + ScreenUtil().setWidth(12)), | ||
| 2590 | + // color: Colors.red, | ||
| 2591 | + border: Border.all( | ||
| 2592 | + width: ScreenUtil().setWidth(2), | ||
| 2593 | + color: MyColours.color_DBDBDB)), | ||
| 2594 | + child: Row( | ||
| 2595 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 2596 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 2597 | + children: [ | ||
| 2598 | + Text( | ||
| 2599 | + '自定义图文:', | ||
| 2600 | + style: TextStyle( | ||
| 2601 | + fontSize: ScreenUtil().setSp(28), | ||
| 2602 | + color: MyColours.color_515151), | ||
| 2603 | + ), | ||
| 2604 | + | ||
| 2605 | + Expanded( | ||
| 2606 | + child: Text( | ||
| 2607 | + '点击设置本单追加的自定义图文', | ||
| 2608 | + textAlign: TextAlign.right, | ||
| 2609 | + style: TextStyle( | ||
| 2610 | + fontSize: ScreenUtil().setSp(28), | ||
| 2611 | + color: MyColours.color_999999), | ||
| 2612 | + ), | ||
| 2613 | + ), | ||
| 2614 | + | ||
| 2615 | + // InkWell( | ||
| 2616 | + // onTap: () { | ||
| 2617 | + // FocusScope.of(context) | ||
| 2618 | + // .requestFocus(FocusNode()); //隐藏键盘 | ||
| 2619 | + // // 存储 | ||
| 2620 | + | ||
| 2621 | + // DialogUtil.openDishTypeSelectModalBottomSheet( | ||
| 2622 | + // context, | ||
| 2623 | + // detailModel.reserveTypes, | ||
| 2624 | + // reserveType, rCallback: (value) async { | ||
| 2625 | + // if (value != null) { | ||
| 2626 | + // reserveType = value; | ||
| 2627 | + // setState(() {}); | ||
| 2628 | + // bool sucess = await detailModel | ||
| 2629 | + // .upReserveInfo(context, widget.rid, | ||
| 2630 | + // reserveType: reserveType, | ||
| 2631 | + // needToast: false); | ||
| 2632 | + // if (sucess) { | ||
| 2633 | + // EventBus() | ||
| 2634 | + // .emit("refresh_tablemanager"); //刷新桌位 | ||
| 2635 | + // bus.emit("refresh_book_list"); //刷新已预订列表 | ||
| 2636 | + // bus.emit("refresh_detail"); | ||
| 2637 | + // // await _getReserveDetail( | ||
| 2638 | + // // showCicle: false); | ||
| 2639 | + // } | ||
| 2640 | + // } | ||
| 2641 | + // }); | ||
| 2642 | + // }, | ||
| 2643 | + // child: Row(children: [ | ||
| 2644 | + // Text( | ||
| 2645 | + // reserveType, | ||
| 2646 | + // style: TextStyle( | ||
| 2647 | + // color: reserveType == '请选择' | ||
| 2648 | + // ? MyColours.color_999999 | ||
| 2649 | + // : MyColours.color_515151, | ||
| 2650 | + // fontSize: ScreenUtil().setSp(28), | ||
| 2651 | + // ), | ||
| 2652 | + // ), | ||
| 2653 | + // HEmptyView(4), | ||
| 2654 | + // Image.asset(Utils.getImgPath('quan_down_f'), | ||
| 2655 | + // width: ScreenUtil().setWidth(28), | ||
| 2656 | + // height: ScreenUtil().setWidth(28)), | ||
| 2657 | + // ]), | ||
| 2658 | + // ) | ||
| 2659 | + ], | ||
| 2660 | + ))), | ||
| 2570 | //输入框 | 2661 | //输入框 |
| 2571 | Container( | 2662 | Container( |
| 2572 | width: double.infinity, | 2663 | width: double.infinity, |
| @@ -2163,4 +2163,16 @@ class NavigatorUtil { | @@ -2163,4 +2163,16 @@ class NavigatorUtil { | ||
| 2163 | return _navigateTo(context, "${Routes.month_order_home_page}", | 2163 | return _navigateTo(context, "${Routes.month_order_home_page}", |
| 2164 | replace: replace); | 2164 | replace: replace); |
| 2165 | } | 2165 | } |
| 2166 | + | ||
| 2167 | + | ||
| 2168 | + | ||
| 2169 | + | ||
| 2170 | + //预订信息模块设置-自定义图文默认 | ||
| 2171 | + static Future<dynamic> goInvicationAdditionPage( | ||
| 2172 | + BuildContext context, { | ||
| 2173 | + replace = false, | ||
| 2174 | + }) { | ||
| 2175 | + return _navigateTo(context, "${Routes.invication_addition_page}", | ||
| 2176 | + replace: replace); | ||
| 2177 | + } | ||
| 2166 | } | 2178 | } |
| @@ -191,6 +191,7 @@ import '../pages/feast/feast_qy_menu_show_page.dart'; | @@ -191,6 +191,7 @@ import '../pages/feast/feast_qy_menu_show_page.dart'; | ||
| 191 | import '../pages/feast/feast_set_page.dart'; | 191 | import '../pages/feast/feast_set_page.dart'; |
| 192 | import '../pages/feast/feast_setmeal_page.dart'; | 192 | import '../pages/feast/feast_setmeal_page.dart'; |
| 193 | import '../pages/feast/feast_wine_page.dart'; | 193 | import '../pages/feast/feast_wine_page.dart'; |
| 194 | +import '../pages/invicate/invitation_addition_page.dart'; | ||
| 194 | import '../pages/login/collect_store_info_page.dart'; | 195 | import '../pages/login/collect_store_info_page.dart'; |
| 195 | import '../pages/login/complete_create_store.dart'; | 196 | import '../pages/login/complete_create_store.dart'; |
| 196 | import '../pages/login/web_page.dart'; | 197 | import '../pages/login/web_page.dart'; |
| @@ -3683,3 +3684,17 @@ var monthOrderHomePageHandle = new Handler( | @@ -3683,3 +3684,17 @@ var monthOrderHomePageHandle = new Handler( | ||
| 3683 | child: ChangeNotifierProvider<PersonnelProvider>( | 3684 | child: ChangeNotifierProvider<PersonnelProvider>( |
| 3684 | create: (_) => PersonnelProvider(), child: MonthOrderHomePage())); | 3685 | create: (_) => PersonnelProvider(), child: MonthOrderHomePage())); |
| 3685 | }); | 3686 | }); |
| 3687 | + | ||
| 3688 | + | ||
| 3689 | + | ||
| 3690 | +///预订信息模块设置-自定义图文默认 | ||
| 3691 | +var invicationAdditionPageHandle = new Handler( | ||
| 3692 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 3693 | + // String id = params["id"].first; | ||
| 3694 | + // // String smsTemplate = params["smsTemplate"].first; | ||
| 3695 | + // CouponUse use = CouponUse.fromJson( | ||
| 3696 | + // json.decode(FluroConvertUtils.fluroCnParamsDecode(params["use"].first))); | ||
| 3697 | + // CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode( | ||
| 3698 | + // FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first))); | ||
| 3699 | + return InvicationAdditionPage(); | ||
| 3700 | +}); |
| @@ -374,6 +374,12 @@ static String customer_detail_page_sim = "/customer_detail_page_sim"; //å®¢æˆ·è¯ | @@ -374,6 +374,12 @@ static String customer_detail_page_sim = "/customer_detail_page_sim"; //å®¢æˆ·è¯ | ||
| 374 | static String month_order_home_page = | 374 | static String month_order_home_page = |
| 375 | "/month_order_home_page"; //月度订单 全店和分经理显示 | 375 | "/month_order_home_page"; //月度订单 全店和分经理显示 |
| 376 | 376 | ||
| 377 | + | ||
| 378 | + static String invication_addition_page = | ||
| 379 | + "/invication_addition_page"; //预订信息模块设置-自定义图文默认 | ||
| 380 | + | ||
| 381 | + | ||
| 382 | + | ||
| 377 | 383 | ||
| 378 | 384 | ||
| 379 | static void configureRoutes(FluroRouter router) { | 385 | static void configureRoutes(FluroRouter router) { |
| @@ -702,6 +708,9 @@ router.define(invication_sim, handler: handleInvicationSimHandler); | @@ -702,6 +708,9 @@ router.define(invication_sim, handler: handleInvicationSimHandler); | ||
| 702 | 708 | ||
| 703 | router.define(month_order_home_page, handler: monthOrderHomePageHandle); | 709 | router.define(month_order_home_page, handler: monthOrderHomePageHandle); |
| 704 | 710 | ||
| 711 | + router.define(invication_addition_page, handler: invicationAdditionPageHandle); | ||
| 712 | + | ||
| 713 | + | ||
| 705 | 714 | ||
| 706 | 715 | ||
| 707 | 716 |
-
Please register or login to post a comment