Commit c89a60e733f12a3eeb8270e97876fa63f552e26e

Authored by wdn127929
1 parent 0f6b9210

新建分支

@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 additional functionality it is fine to subclass or reimplement 7 additional functionality it is fine to subclass or reimplement
8 FlutterApplication and put your custom class here. --> 8 FlutterApplication and put your custom class here. -->
9 9
  10 +
10 11
11 <uses-permission android:name="android.permission.READ_CONTACTS" /> 12 <uses-permission android:name="android.permission.READ_CONTACTS" />
12 <uses-permission android:name="android.permission.WRITE_CONTACTS" /> 13 <uses-permission android:name="android.permission.WRITE_CONTACTS" />
@@ -50,6 +50,7 @@ @@ -50,6 +50,7 @@
50 <key>NSAllowsArbitraryLoads</key> 50 <key>NSAllowsArbitraryLoads</key>
51 <true/> 51 <true/>
52 </dict> 52 </dict>
  53 +
53 <key>NSAppleMusicUsageDescription</key> 54 <key>NSAppleMusicUsageDescription</key>
54 <string>需要您的同意,APP才能访问媒体资料库</string> 55 <string>需要您的同意,APP才能访问媒体资料库</string>
55 <key>NSCalendarsUsageDescription</key> 56 <key>NSCalendarsUsageDescription</key>
  1 +import 'dart:typed_data';
  2 +import 'dart:ui';
  3 +
1 import 'package:cached_network_image/cached_network_image.dart'; 4 import 'package:cached_network_image/cached_network_image.dart';
2 import 'package:common_utils/common_utils.dart'; 5 import 'package:common_utils/common_utils.dart';
3 import 'package:flutter/material.dart'; 6 import 'package:flutter/material.dart';
  7 +import 'package:flutter/rendering.dart';
  8 +import 'package:flutter/services.dart';
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 9 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 import 'package:one_key/models/seller_phone_model.dart'; 10 import 'package:one_key/models/seller_phone_model.dart';
6 import 'package:one_key/models/user.dart'; 11 import 'package:one_key/models/user.dart';
@@ -9,12 +14,15 @@ import 'package:one_key/provider/base_info_provider.dart'; @@ -9,12 +14,15 @@ import 'package:one_key/provider/base_info_provider.dart';
9 import 'package:one_key/provider/coupon_provider.dart'; 14 import 'package:one_key/provider/coupon_provider.dart';
10 import 'package:one_key/provider/user_model.dart'; 15 import 'package:one_key/provider/user_model.dart';
11 import 'package:one_key/res/colors.dart'; 16 import 'package:one_key/res/colors.dart';
  17 +import 'package:one_key/utils/misc.dart';
12 import 'package:one_key/utils/navigator_util.dart'; 18 import 'package:one_key/utils/navigator_util.dart';
13 import 'package:one_key/utils/utils.dart'; 19 import 'package:one_key/utils/utils.dart';
14 import 'package:one_key/widgets/h_empty_view.dart'; 20 import 'package:one_key/widgets/h_empty_view.dart';
15 import 'package:one_key/widgets/round_button.dart'; 21 import 'package:one_key/widgets/round_button.dart';
16 import 'package:one_key/widgets/v_empty_view.dart'; 22 import 'package:one_key/widgets/v_empty_view.dart';
  23 +import 'package:permission_handler/permission_handler.dart';
17 import 'package:provider/provider.dart'; 24 import 'package:provider/provider.dart';
  25 +import 'dart:ui' as ui;
18 26
19 class InvicationPage extends StatefulWidget { 27 class InvicationPage extends StatefulWidget {
20 final String rid; //预订订单id 28 final String rid; //预订订单id
@@ -46,6 +54,7 @@ class InvicationPageState extends State<InvicationPage> { @@ -46,6 +54,7 @@ class InvicationPageState extends State<InvicationPage> {
46 String phone = '填写电话'; 54 String phone = '填写电话';
47 String qiniuUrl = ''; 55 String qiniuUrl = '';
48 final GlobalKey key = new GlobalKey(); 56 final GlobalKey key = new GlobalKey();
  57 + final GlobalKey globalKey = GlobalKey();
49 58
50 @override 59 @override
51 void initState() { 60 void initState() {
@@ -250,6 +259,18 @@ class InvicationPageState extends State<InvicationPage> { @@ -250,6 +259,18 @@ class InvicationPageState extends State<InvicationPage> {
250 } 259 }
251 } 260 }
252 261
  262 + ///获取截图
  263 + Future<Uint8List> _getImage() async {
  264 + BuildContext buildContext = globalKey.currentContext;
  265 + if (null != buildContext) {
  266 + RenderRepaintBoundary boundary = buildContext.findRenderObject();
  267 + ui.Image image = await boundary.toImage(pixelRatio: 6);
  268 + ByteData byteData = await image.toByteData(format: ImageByteFormat.png);
  269 + Uint8List pngBytes = byteData.buffer.asUint8List();
  270 + return pngBytes;
  271 + }
  272 + }
  273 +
253 @override 274 @override
254 Widget build(BuildContext context) { 275 Widget build(BuildContext context) {
255 // Utils.changeStatusColor(color: Colors.transparent); 276 // Utils.changeStatusColor(color: Colors.transparent);
@@ -507,123 +528,174 @@ class InvicationPageState extends State<InvicationPage> { @@ -507,123 +528,174 @@ class InvicationPageState extends State<InvicationPage> {
507 // ScreenUtil().setHeight(33 * 2), 528 // ScreenUtil().setHeight(33 * 2),
508 // ), 529 // ),
509 // VEmptyView(50), 530 // VEmptyView(50),
510 - Container(  
511 - height: ScreenUtil().setWidth(58),  
512 - child: Text(  
513 - user.sellername,  
514 - style: TextStyle(  
515 - // letterSpacing: ScreenUtil()  
516 - // .setWidth(2.13 * 2),  
517 - color: MyColours.color_BA9953,  
518 - // fontWeight: FontWeight.bold,  
519 - fontSize:  
520 - ScreenUtil().setSp(42)),  
521 - ),  
522 - ),  
523 - VEmptyView(14),  
524 - Container(  
525 - height: ScreenUtil().setWidth(58),  
526 - child: Text(  
527 - '${dateTimeStr}',  
528 - style: TextStyle(  
529 - letterSpacing: ScreenUtil()  
530 - .setWidth(1.8 * 2),  
531 - color: MyColours.color_BA9953,  
532 - fontSize:  
533 - ScreenUtil().setSp(42)),  
534 - ),  
535 - ),  
536 - VEmptyView(26),  
537 - Container(  
538 - height: ScreenUtil().setWidth(44),  
539 - child: Text(  
540 - '已为您安排在包间',  
541 - style: TextStyle(  
542 - color: MyColours.color_ffffff,  
543 - fontSize:  
544 - ScreenUtil().setSp(32)),  
545 - ),  
546 - ),  
547 - VEmptyView(28),  
548 - GestureDetector(  
549 - onTapDown:  
550 - (TapDownDetails details) =>  
551 - onTapDown(context, details),  
552 - child: Container(  
553 - child: Stack(  
554 - alignment: Alignment.bottomCenter,  
555 - overflow: Overflow.visible, 531 +
  532 + RepaintBoundary(
  533 + key: globalKey,
  534 + child: Container(
  535 + padding: EdgeInsets.fromLTRB(
  536 + ScreenUtil().setWidth(10),
  537 + ScreenUtil().setWidth(10),
  538 + ScreenUtil().setWidth(10),
  539 + ScreenUtil().setWidth(40)),
  540 + // color: Colors.red,
  541 + child: Column(
556 children: [ 542 children: [
557 Container( 543 Container(
558 - constraints: BoxConstraints(  
559 - maxWidth: ScreenUtil()  
560 - .setWidth(195 * 2)),  
561 - padding: EdgeInsets.fromLTRB(  
562 - ScreenUtil().setWidth(60),  
563 - ScreenUtil().setWidth(30),  
564 - ScreenUtil().setWidth(60),  
565 - ScreenUtil()  
566 - .setWidth(24 * 2)),  
567 - // height:  
568 - // ScreenUtil().setWidth(84 * 2),  
569 - decoration: BoxDecoration(  
570 - borderRadius: BorderRadius  
571 - .all(Radius.circular(  
572 - ScreenUtil()  
573 - .setWidth(  
574 - 13 * 2))),  
575 - border: Border.all(  
576 - color: MyColours  
577 - .color_BA9953,  
578 - width: ScreenUtil()  
579 - .setWidth(4))), 544 + height:
  545 + ScreenUtil().setWidth(58),
580 child: Text( 546 child: Text(
581 - widget.tableInfo  
582 - .replaceAll("\n", ""), 547 + user.sellername,
583 style: TextStyle( 548 style: TextStyle(
584 // letterSpacing: ScreenUtil() 549 // letterSpacing: ScreenUtil()
585 // .setWidth(2.13 * 2), 550 // .setWidth(2.13 * 2),
586 color: MyColours 551 color: MyColours
587 .color_BA9953, 552 .color_BA9953,
588 - fontWeight:  
589 - FontWeight.bold, 553 + // fontWeight: FontWeight.bold,
590 fontSize: ScreenUtil() 554 fontSize: ScreenUtil()
591 - .setSp(52)), 555 + .setSp(42)),
592 ), 556 ),
593 ), 557 ),
594 - Positioned(  
595 - key: key,  
596 - bottom: ScreenUtil()  
597 - .setWidth(-24),  
598 - child: _baseIndoProvider  
599 - .photoList  
600 - .length >  
601 - 0  
602 - ? RoundButton(  
603 - onPressed: () {  
604 - _seePhoto();  
605 - },  
606 - text: '浏览照片',  
607 - width: ScreenUtil()  
608 - .setWidth(68 * 2),  
609 - height: ScreenUtil()  
610 - .setWidth(24 * 2),  
611 - fontSize: 26,  
612 - textColor: MyColours  
613 - .color_333333,  
614 - isBold: false,  
615 - gradientStart:  
616 - MyColours  
617 - .color_BA9953,  
618 - gradientEnd: MyColours  
619 - .color_BA9953, 558 + VEmptyView(14),
  559 + Container(
  560 + height:
  561 + ScreenUtil().setWidth(58),
  562 + child: Text(
  563 + '${dateTimeStr}',
  564 + style: TextStyle(
  565 + letterSpacing:
  566 + ScreenUtil()
  567 + .setWidth(
  568 + 1.8 * 2),
  569 + color: MyColours
  570 + .color_BA9953,
  571 + fontSize: ScreenUtil()
  572 + .setSp(42)),
  573 + ),
  574 + ),
  575 + VEmptyView(26),
  576 + Container(
  577 + height:
  578 + ScreenUtil().setWidth(44),
  579 + child: Text(
  580 + '已为您安排在包间',
  581 + style: TextStyle(
  582 + color: MyColours
  583 + .color_ffffff,
  584 + fontSize: ScreenUtil()
  585 + .setSp(32)),
  586 + ),
  587 + ),
  588 + VEmptyView(28),
  589 + GestureDetector(
  590 + onTapDown: (TapDownDetails
  591 + details) =>
  592 + onTapDown(
  593 + context, details),
  594 + child: Container(
  595 + child: Stack(
  596 + alignment: Alignment
  597 + .bottomCenter,
  598 + overflow:
  599 + Overflow.visible,
  600 + children: [
  601 + Container(
  602 + constraints: BoxConstraints(
  603 + maxWidth:
  604 + ScreenUtil()
  605 + .setWidth(
  606 + 195 *
  607 + 2)),
  608 + padding: EdgeInsets
  609 + .fromLTRB(
  610 + ScreenUtil()
  611 + .setWidth(
  612 + 60),
  613 + ScreenUtil()
  614 + .setWidth(
  615 + 30),
  616 + ScreenUtil()
  617 + .setWidth(
  618 + 60),
  619 + ScreenUtil()
  620 + .setWidth(
  621 + 24 *
  622 + 2)),
  623 + // height:
  624 + // ScreenUtil().setWidth(84 * 2),
  625 + decoration: BoxDecoration(
  626 + borderRadius: BorderRadius.all(
  627 + Radius.circular(
  628 + ScreenUtil()
  629 + .setWidth(13 *
  630 + 2))),
  631 + border: Border.all(
  632 + color: MyColours
  633 + .color_BA9953,
  634 + width: ScreenUtil()
  635 + .setWidth(
  636 + 4))),
  637 + child: Text(
  638 + widget.tableInfo
  639 + .replaceAll(
  640 + "\n", ""),
  641 + style: TextStyle(
  642 + // letterSpacing: ScreenUtil()
  643 + // .setWidth(2.13 * 2),
  644 + color: MyColours
  645 + .color_BA9953,
  646 + fontWeight:
  647 + FontWeight
  648 + .bold,
  649 + fontSize:
  650 + ScreenUtil()
  651 + .setSp(
  652 + 52)),
  653 + ),
  654 + ),
  655 + Positioned(
  656 + key: key,
  657 + bottom: ScreenUtil()
  658 + .setWidth(-24),
  659 + child: _baseIndoProvider
  660 + .photoList
  661 + .length >
  662 + 0
  663 + ? RoundButton(
  664 + onPressed:
  665 + () {
  666 + _seePhoto();
  667 + },
  668 + text: '浏览照片',
  669 + width: ScreenUtil()
  670 + .setWidth(
  671 + 68 *
  672 + 2),
  673 + height: ScreenUtil()
  674 + .setWidth(
  675 + 24 *
  676 + 2),
  677 + fontSize: 26,
  678 + textColor:
  679 + MyColours
  680 + .color_333333,
  681 + isBold: false,
  682 + gradientStart:
  683 + MyColours
  684 + .color_BA9953,
  685 + gradientEnd:
  686 + MyColours
  687 + .color_BA9953,
  688 + )
  689 + : Container(),
620 ) 690 )
621 - : Container(),  
622 - ) 691 + ],
  692 + ))),
623 ], 693 ],
624 - ))), 694 + ),
  695 + ),
  696 + ),
625 697
626 - VEmptyView(70), 698 + VEmptyView(30),
627 Container( 699 Container(
628 // height: ScreenUtil().setWidth(40), 700 // height: ScreenUtil().setWidth(40),
629 child: Text( 701 child: Text(
@@ -700,6 +772,8 @@ class InvicationPageState extends State<InvicationPage> { @@ -700,6 +772,8 @@ class InvicationPageState extends State<InvicationPage> {
700 Expanded( 772 Expanded(
701 child: GestureDetector( 773 child: GestureDetector(
702 onTap: () async { 774 onTap: () async {
  775 + // Uint8List image = await _getImage();
  776 +
703 if (ObjectUtil.isEmpty( 777 if (ObjectUtil.isEmpty(
704 _baseIndoProvider.baseInfoSunModel)) { 778 _baseIndoProvider.baseInfoSunModel)) {
705 Utils.showToast('请输入个人资料'); 779 Utils.showToast('请输入个人资料');
@@ -59,7 +59,7 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -59,7 +59,7 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
59 int partSize = 4; 59 int partSize = 4;
60 // 用户输入的 token 60 // 用户输入的 token
61 String token; 61 String token;
62 - 62 +
63 /// storage 实例 63 /// storage 实例
64 final Storage storage = Storage(); 64 final Storage storage = Storage();
65 // 控制器,可以用于取消任务、获取上述的状态,进度等信息 65 // 控制器,可以用于取消任务、获取上述的状态,进度等信息
1 import 'dart:io'; 1 import 'dart:io';
  2 +import 'dart:typed_data';
2 3
3 import 'package:common_utils/common_utils.dart'; 4 import 'package:common_utils/common_utils.dart';
4 import 'package:connectivity/connectivity.dart'; 5 import 'package:connectivity/connectivity.dart';
@@ -257,7 +258,8 @@ class Utils { @@ -257,7 +258,8 @@ class Utils {
257 } 258 }
258 259
259 //分享邀请函 260 //分享邀请函
260 - static goShareInvicationToWeChat(String rid, String uid) async { 261 + static goShareInvicationToWeChat(
  262 + String rid, String uid) async {
261 String _webPageUrl = "http://colorcun.com/"; 263 String _webPageUrl = "http://colorcun.com/";
262 // String _thumbnail = 264 // String _thumbnail =
263 // "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1"; 265 // "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1";
@@ -265,7 +267,8 @@ class Utils { @@ -265,7 +267,8 @@ class Utils {
265 "https://qn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148572.jpg"; 267 "https://qn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148572.jpg";
266 String _title = "用餐已为您安排"; 268 String _title = "用餐已为您安排";
267 String _userName = "gh_487873d353b3"; 269 String _userName = "gh_487873d353b3";
268 - String _path = "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid"; 270 + String _path =
  271 + "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
269 String _description = "进入查看包间详情,转发同行好友,还可一键导航到饭店"; 272 String _description = "进入查看包间详情,转发同行好友,还可一键导航到饭店";
270 //跳转小程序 273 //跳转小程序
271 var model = new WeChatShareMiniProgramModel( 274 var model = new WeChatShareMiniProgramModel(
@@ -274,7 +277,9 @@ class Utils { @@ -274,7 +277,9 @@ class Utils {
274 title: _title, 277 title: _title,
275 path: _path, 278 path: _path,
276 description: _description, 279 description: _description,
277 - thumbnail: WeChatImage.network(_thumbnail)); 280 + thumbnail: WeChatImage.network(_thumbnail)
  281 + // thumbnail: WeChatImage.binary(image)
  282 + );
278 //分享链接 283 //分享链接
279 // var model = WeChatShareWebPageModel( 284 // var model = WeChatShareWebPageModel(
280 // // 'https://xt04.colorcun.com/h5/index.html#/?id=$rid&hasInvitation=1', 285 // // 'https://xt04.colorcun.com/h5/index.html#/?id=$rid&hasInvitation=1',