Parcourir la source

图片发送下载/

master
jiahao il y a 5 ans
Parent
révision
cc936648dc
10 fichiers modifiés avec 63 ajouts et 39 suppressions
  1. +2
    -2
      ios/Flutter/flutter_export_environment.sh
  2. +6
    -0
      ios/Podfile.lock
  3. +1
    -1
      ios/Runner.xcodeproj/project.pbxproj
  4. +20
    -13
      lib/chat/ChatPageItem.dart
  5. +1
    -1
      lib/chat/company_server_view.dart
  6. +4
    -2
      lib/chat/download_item.dart
  7. +5
    -2
      lib/chat/full_img_view.dart
  8. +21
    -15
      lib/chat/group_chat_item.dart
  9. +2
    -2
      lib/chat/input_bar.dart
  10. +1
    -1
      lib/chat/util_keyboard.dart

+ 2
- 2
ios/Flutter/flutter_export_environment.sh Voir le fichier

@@ -1,8 +1,8 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/random/sdk/flutter_sdk"
export "FLUTTER_APPLICATION_PATH=/Users/random/code/flutter/project/qunliao"
export "FLUTTER_TARGET=/Users/random/code/flutter/project/qunliao/lib/main.dart"
export "FLUTTER_APPLICATION_PATH=/Users/random/code/flutter/project/Hibok"
export "FLUTTER_TARGET=/Users/random/code/flutter/project/Hibok/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/random/sdk/flutter_sdk/bin/cache/artifacts/engine/ios"


+ 6
- 0
ios/Podfile.lock Voir le fichier

@@ -127,6 +127,8 @@ PODS:
- Flutter
- share (0.5.2):
- Flutter
- share_extend (0.0.1):
- Flutter
- shared_preferences (0.0.1):
- Flutter
- shared_preferences_macos (0.0.1):
@@ -189,6 +191,7 @@ DEPENDENCIES:
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
- share (from `.symlinks/plugins/share/ios`)
- share_extend (from `.symlinks/plugins/share_extend/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
@@ -298,6 +301,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/receive_sharing_intent/ios"
share:
:path: ".symlinks/plugins/share/ios"
share_extend:
:path: ".symlinks/plugins/share_extend/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
shared_preferences_macos:
@@ -370,6 +375,7 @@ SPEC CHECKSUMS:
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1
share: bae0a282aab4483288913fc4dc0b935d4b491f2e
share_extend: b6748dc53695587891126a89533b862b92548c7b
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9


+ 1
- 1
ios/Runner.xcodeproj/project.pbxproj Voir le fichier

@@ -778,7 +778,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = QJ9M3998Q6;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",


+ 20
- 13
lib/chat/ChatPageItem.dart Voir le fichier

@@ -1019,19 +1019,26 @@ class _ChatPageItemState extends State<ChatPageItem>
ImageProvider provider = MemoryImage(Uint8List.fromList(imgData));
var imgSize = _getImgSize();
return GestureDetector(
child: Container(
width: imgSize.width,
height: imgSize.height,
child: ClipRRect(
child: Image(
image: provider ?? AssetImage(R.assetsImagesIcAlbum),
),
borderRadius: BorderRadius.circular(5),
)),
onTap: () async {
showFullImg(context, widget.msg);
});
return DownloadItem(
isAutoDown: false,
msg: widget.msg,
onFinishTap: (){
widget.hideKeyboard();
showFullImg(context, widget.msg);
},
child: Container(
width: imgSize.width,
height: imgSize.height,
child: ClipRRect(
child: Image(
image: provider ?? AssetImage(R.assetsImagesIcAlbum),
),
borderRadius: BorderRadius.circular(5),
),
),
);
}
_receiveVideo(BuildContext context, List<int> imgData,


+ 1
- 1
lib/chat/company_server_view.dart Voir le fichier

@@ -178,7 +178,7 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
if (imgSize > ImgSizeLimit) {
print('图片大于 $ImgSizeLimit,压缩');
//发送压缩图
sendImg = await WidgetUtil.getCompressImg(imgFile.absolute.path);
sendImg = await WidgetUtil.getCompressImg(imgFile.absolute.path );
isNeedUpload = true;
} else {
sendImg = imgFile.readAsBytesSync();


+ 4
- 2
lib/chat/download_item.dart Voir le fichier

@@ -12,12 +12,14 @@ class DownloadItem extends StatefulWidget {
final bool isShowProgress;
final bool isAutoDown;
final Function onComplete;
final Function onFinishTap;
DownloadItem(
{this.msg,
this.child,
this.isShowProgress = true,
this.isAutoDown = true,
this.onComplete});
this.onComplete,
this.onFinishTap});
@override
_DownloadItemState createState() => _DownloadItemState();
}
@@ -129,7 +131,7 @@ class _DownloadItemState extends State<DownloadItem> {
(widget.msg.state != MsgState.Downloading &&
widget.msg.state != MsgState.DownloadSuccess);
return InkWell(
onTap: isNeedDown ? downloadRes : null,
onTap: isNeedDown ? downloadRes : widget.onFinishTap,
child: Stack(
alignment: Alignment.center,
children: <Widget>[widget.child, _downloadWidget()],


+ 5
- 2
lib/chat/full_img_view.dart Voir le fichier

@@ -56,6 +56,7 @@ class _PhotoPageState extends State<PhotoPage>
Widget build(BuildContext context) {
Uint8List fileData;
if (widget.msg.localFile != null) {
print('本地了');
fileData = File(widget.msg.localFile).readAsBytesSync();
} else {
fileData = Uint8List.fromList(widget.msg.msgContent);
@@ -99,15 +100,17 @@ class _PhotoPageState extends State<PhotoPage>
Positioned(
right: 10,
bottom: 10,
child: InkWell(
child: Material(child: InkWell(
onTap: saveToGallery,
child: Container(
width: 50,
height: 50,
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.grey.withAlpha(150),
borderRadius: BorderRadius.circular(8)),
child: Icon(Icons.save_alt, color: Colors.white70),
)))
)),))
],
)));
}


+ 21
- 15
lib/chat/group_chat_item.dart Voir le fichier

@@ -1036,21 +1036,27 @@ class _GroupChatPageItemState extends State<GroupChatPageItem>
ImageProvider provider = MemoryImage(Uint8List.fromList(imgData));
var imgSize = _getImgSize();
return GestureDetector(
child: Container(
alignment: Alignment.centerLeft,
width: imgSize.width,
height: imgSize.height,
child: ClipRRect(
child: Image(
image: provider ?? AssetImage(R.assetsImagesIcAlbum),
),
borderRadius: BorderRadius.circular(5),
)),
onTap: () async {
widget.hideKeyboard();
showFullImg(context, widget.msg);
});
return DownloadItem(
isAutoDown: false,
msg: widget.msg,
onFinishTap: (){
widget.hideKeyboard();
showFullImg(context, widget.msg);
},
child: Container(
alignment: Alignment.centerLeft,
width: imgSize.width,
height: imgSize.height,
child: ClipRRect(
child: Image(
image: provider ?? AssetImage(R.assetsImagesIcAlbum),
),
borderRadius: BorderRadius.circular(5),
),
),
);
}
_receiveVideo(BuildContext context, List<int> imgData,


+ 2
- 2
lib/chat/input_bar.dart Voir le fichier

@@ -732,8 +732,8 @@ class InputBarState extends State<InputBar>
bool isNeedUpload = false;
if (imgSize > ImgSizeLimit) {
print('图片大于 $ImgSizeLimit,压缩');
//发送压缩图
sendImg = await WidgetUtil.getCompressImg(imgFile.absolute.path);
//发送压缩图 WidgetUtil.getCompressImg(path,quality: 80,percentage: 80);
sendImg = await WidgetUtil.getCompressImg(imgFile.absolute.path );
isNeedUpload = true;
} else {
sendImg = imgFile.readAsBytesSync();


+ 1
- 1
lib/chat/util_keyboard.dart Voir le fichier

@@ -392,7 +392,7 @@ class _UtilKeyboardState extends State<UtilKeyboard> {
File file =await FileCacheMgr().writeFile(DateTime.now().millisecondsSinceEpoch.toString(),thumbnail);
File compressedFile = await FlutterNativeImage.compressImage(file.path,
quality: 20, percentage: 10);
quality: 30, percentage: 40);
thumbnail =compressedFile.readAsBytesSync().toList();


Chargement…
Annuler
Enregistrer