|
...
|
...
|
@@ -56,12 +56,12 @@ import 'dart:typed_data'; |
|
|
|
typedef BookTimeSetCallback = void Function(bool needChange);
|
|
|
|
|
|
|
|
class Utils {
|
|
|
|
static Future<bool> isImageLargerThan64KB(Uint8List? imageBytes) async {
|
|
|
|
static Future<bool> isImageLargerThan120KB(Uint8List? imageBytes) async {
|
|
|
|
if (imageBytes == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
var fileSize = imageBytes.lengthInBytes;
|
|
|
|
return fileSize > 64 * 1024; // 64KB = 64 * 1024 bytes
|
|
|
|
return fileSize > 120 * 1024; // 64KB = 120 * 1024 bytes
|
|
|
|
}
|
|
|
|
|
|
|
|
static List<CallLogEntry> removeDuplicates(List<CallLogEntry> items) {
|
|
...
|
...
|
@@ -1453,13 +1453,13 @@ class Utils { |
|
|
|
|
|
|
|
Fluwx fluwx = Fluwx();
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
Uint8List? result;
|
|
|
|
Uint8List? result=pngByte;
|
|
|
|
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
: await compressImage(resultnew, mb: 120/ 1024);
|
|
|
|
}
|
|
|
|
var model = new WeChatShareMiniProgramModel(
|
|
|
|
miniProgramType: Constant.wxMiniProgramType,
|
|
...
|
...
|
@@ -1501,12 +1501,12 @@ class Utils { |
|
|
|
// Uint8List source = await testComporessList(context, _thumbnail);
|
|
|
|
Fluwx fluwx = Fluwx();
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
Uint8List? result;
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
Uint8List? result=pngByte;
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
: await compressImage(resultnew, mb: 120 / 1024);
|
|
|
|
}
|
|
|
|
var model = new WeChatShareMiniProgramModel(
|
|
|
|
// miniProgramType: , //体验版
|
|
...
|
...
|
@@ -1596,12 +1596,12 @@ class Utils { |
|
|
|
// Uint8List source = await testComporessList(context, _thumbnail);
|
|
|
|
Fluwx fluwx = Fluwx();
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
Uint8List? result;
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
Uint8List? result=pngByte;
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
: await compressImage(resultnew, mb: 120 / 1024);
|
|
|
|
}
|
|
|
|
var model = new WeChatShareMiniProgramModel(
|
|
|
|
miniProgramType: Constant.wxMiniProgramType,
|
|
...
|
...
|
@@ -2029,12 +2029,12 @@ class Utils { |
|
|
|
String _description = "诚邀您参加储值优惠活动,点击查看详情。";
|
|
|
|
// Uint8List source = await testComporessList(context, _thumbnail);
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
Uint8List? result;
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
Uint8List? result=pngByte;
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
: await compressImage(resultnew, mb: 120 / 1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
//跳转小程序
|
|
...
|
...
|
@@ -2091,12 +2091,12 @@ class Utils { |
|
|
|
String _description = "进入查看包间详情,转发同行好友,还可一键导航到饭店";
|
|
|
|
// Uint8List source = await testComporessList(context, _thumbnail);
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
Uint8List? result;
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
Uint8List? result = pngByte;
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
: await compressImage(resultnew, mb: 120 / 1024);
|
|
|
|
}
|
|
|
|
//跳转小程序
|
|
|
|
Fluwx fluwx = Fluwx();
|
|
...
|
...
|
@@ -2197,12 +2197,12 @@ class Utils { |
|
|
|
String _description = "进入查看包间详情,转发同行好友,还可一键导航到饭店";
|
|
|
|
// Uint8List source = await testComporessList(context, _thumbnail);
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
Uint8List? result;
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
Uint8List? result = pngByte;
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
: await compressImage(resultnew, mb: 120 / 1024);
|
|
|
|
}
|
|
|
|
// print(result!.length/1024);
|
|
|
|
//跳转小程序
|
|
...
|
...
|
@@ -2264,12 +2264,12 @@ class Utils { |
|
|
|
//跳转小程序
|
|
|
|
Fluwx fluwx = Fluwx();
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
Uint8List? result;
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
Uint8List? result = pngByte;
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
: await compressImage(resultnew, mb: 120 / 1024);
|
|
|
|
}
|
|
|
|
var model = new WeChatShareMiniProgramModel(
|
|
|
|
webPageUrl: _webPageUrl,
|
|
...
|
...
|
@@ -3094,17 +3094,17 @@ class Utils { |
|
|
|
"pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId";
|
|
|
|
}
|
|
|
|
Fluwx fluwx = Fluwx();
|
|
|
|
Uint8List? result;
|
|
|
|
if (liteStyle == '0') {
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
}
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
Uint8List? result = pngByte;
|
|
|
|
// if (liteStyle == '0') {
|
|
|
|
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 120 / 1024);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
var model = new WeChatShareMiniProgramModel(
|
|
|
|
webPageUrl: _webPageUrl,
|
|
...
|
...
|
@@ -3200,7 +3200,7 @@ class Utils { |
|
|
|
String _thumbnail = sellerImage == null || sellerImage == ''
|
|
|
|
? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
|
|
|
|
: sellerImage;
|
|
|
|
late Uint8List _thumbnailUint8List;
|
|
|
|
late Uint8List? _thumbnailUint8List;
|
|
|
|
print(size(_thumbnail.length));
|
|
|
|
|
|
|
|
String dsoltStr = '${ddateHm == null || ddateHm == '' ? '' : ddateHm}';
|
|
...
|
...
|
@@ -3280,15 +3280,15 @@ class Utils { |
|
|
|
"pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId";
|
|
|
|
}
|
|
|
|
Fluwx fluwx = Fluwx();
|
|
|
|
Uint8List? result;
|
|
|
|
// Uint8List? result;
|
|
|
|
if (liteStyle == '0') {
|
|
|
|
Uint8List? pngByte = await WxSdk.fetchImageAsUint8List(_thumbnail);
|
|
|
|
|
|
|
|
if (pngByte != null && await isImageLargerThan64KB(pngByte)) {
|
|
|
|
_thumbnailUint8List = pngByte;
|
|
|
|
if (pngByte != null && await isImageLargerThan120KB(pngByte)) {
|
|
|
|
Uint8List? resultnew = await realComporessList(pngByte); //压缩图片
|
|
|
|
result = resultnew == null
|
|
|
|
_thumbnailUint8List= resultnew == null
|
|
|
|
? null
|
|
|
|
: await compressImage(resultnew, mb: 64 / 1024);
|
|
|
|
: await compressImage(resultnew, mb: 120 / 1024);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// print(_thumbnailUint8List.length/1024);
|
|
...
|
...
|
@@ -3303,7 +3303,7 @@ class Utils { |
|
|
|
// miniProgramType: //开发版
|
|
|
|
// thumbnail: WeChatImage.binary(source)
|
|
|
|
// thumbnail: WeChatImage.network(_thumbnail)
|
|
|
|
thumbData: liteStyle == '0' ? result : _thumbnailUint8List);
|
|
|
|
thumbData: _thumbnailUint8List);
|
|
|
|
|
|
|
|
// thumbData: );
|
|
|
|
|
...
|
...
|
|