master
章文轩 2 years ago
parent a40162d6da
commit 859bcf3805

@ -15,7 +15,7 @@ import 'package:bytedesk_kefu/util/bytedesk_events.dart';
import 'package:bytedesk_kefu/util/bytedesk_utils.dart'; import 'package:bytedesk_kefu/util/bytedesk_utils.dart';
import 'package:bytedesk_kefu/util/bytedesk_uuid.dart'; import 'package:bytedesk_kefu/util/bytedesk_uuid.dart';
// import 'package:bytedesk_kefu/util/bytedesk_utils.dart'; // import 'package:bytedesk_kefu/util/bytedesk_utils.dart';
import 'package:file_picker/file_picker.dart'; // import 'package:file_picker/file_picker.dart';
import 'package:sp_util/sp_util.dart'; import 'package:sp_util/sp_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
@ -751,42 +751,44 @@ class _ChatIMPageState extends State<ChatIMPage>
// chrome // chrome
Future<void> _pickVideo() async { Future<void> _pickVideo() async {
try { try {
// final PickedFile videoFile = await _picker.getVideo( XFile? pickedFile = await _picker.pickVideo(
// source: ImageSource.gallery, maxDuration: const Duration(seconds: 10)); source: ImageSource.gallery, maxDuration: const Duration(seconds: 10));
// BytedeskUtils.printLog('pick video path: ${videoFile.path}');
// if (videoFile != null) { if (pickedFile != null) {
// BlocProvider.of<MessageBloc>(context) BytedeskUtils.printLog('pick video path: ${pickedFile.path}');
// ..add(UploadVideoEvent(filePath: videoFile.path)); //
// } else {
// Fluttertoast.showToast(msg: '未选取视频');
// }
// 使file_pickerimage_picker
List<PlatformFile>? _paths = (await FilePicker.platform.pickFiles(
type: FileType.video,
allowMultiple: false,
allowedExtensions: [],
))
?.files;
if (_paths!.length > 0) {
// TODO:
// TODO: loading
//
// final info = await _flutterVideoCompress.compressVideo(
// _paths[0].path,
// quality:
// VideoQuality.LowQuality, // default(VideoQuality.DefaultQuality)
// deleteOrigin: false, // default(false)
// );
// // debugBytedeskUtils.printLog(info.toJson().toString());
// String? afterPath = info.toJson()['path'];
// // BytedeskUtils.printLog('video path: ${_paths[0].path}, compress path: $afterPath');
// //
// BlocProvider.of<MessageBloc>(context)
// ..add(UploadVideoEvent(filePath: afterPath));
//
BlocProvider.of<MessageBloc>(context) BlocProvider.of<MessageBloc>(context)
..add(UploadVideoEvent(filePath: _paths[0].path)); ..add(UploadVideoEvent(filePath: pickedFile.path));
} else {
Fluttertoast.showToast(msg: '未选取视频');
} }
// 使file_pickerimage_picker
// List<PlatformFile>? _paths = (await FilePicker.platform.pickFiles(
// type: FileType.video,
// allowMultiple: false,
// allowedExtensions: [],
// ))
// ?.files;
// if (_paths!.length > 0) {
// // TODO:
// // TODO: loading
// //
// // final info = await _flutterVideoCompress.compressVideo(
// // _paths[0].path,
// // quality:
// // VideoQuality.LowQuality, // default(VideoQuality.DefaultQuality)
// // deleteOrigin: false, // default(false)
// // );
// // // debugBytedeskUtils.printLog(info.toJson().toString());
// // String? afterPath = info.toJson()['path'];
// // // BytedeskUtils.printLog('video path: ${_paths[0].path}, compress path: $afterPath');
// // //
// // BlocProvider.of<MessageBloc>(context)
// // ..add(UploadVideoEvent(filePath: afterPath));
// //
// BlocProvider.of<MessageBloc>(context)
// ..add(UploadVideoEvent(filePath: _paths[0].path));
// }
} catch (e) { } catch (e) {
BytedeskUtils.printLog('pick video error ${e.toString()}'); BytedeskUtils.printLog('pick video error ${e.toString()}');
Fluttertoast.showToast(msg: "未选取视频"); Fluttertoast.showToast(msg: "未选取视频");

@ -15,7 +15,7 @@ import 'package:bytedesk_kefu/util/bytedesk_constants.dart';
import 'package:bytedesk_kefu/util/bytedesk_events.dart'; import 'package:bytedesk_kefu/util/bytedesk_events.dart';
import 'package:bytedesk_kefu/util/bytedesk_utils.dart'; import 'package:bytedesk_kefu/util/bytedesk_utils.dart';
import 'package:bytedesk_kefu/util/bytedesk_uuid.dart'; import 'package:bytedesk_kefu/util/bytedesk_uuid.dart';
import 'package:file_picker/file_picker.dart'; // import 'package:file_picker/file_picker.dart';
import 'package:sp_util/sp_util.dart'; import 'package:sp_util/sp_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
@ -1343,42 +1343,44 @@ class _ChatKFPageState extends State<ChatKFPage>
// chrome // chrome
Future<void> _pickVideo() async { Future<void> _pickVideo() async {
try { try {
// final PickedFile videoFile = await _picker.getVideo( XFile? pickedFile = await _picker.pickVideo(
// source: ImageSource.gallery, maxDuration: const Duration(seconds: 10)); source: ImageSource.gallery, maxDuration: const Duration(seconds: 10));
// BytedeskUtils.printLog('pick video path: ${videoFile.path}');
// if (videoFile != null) { if (pickedFile != null) {
// BlocProvider.of<MessageBloc>(context) BytedeskUtils.printLog('pick video path: ${pickedFile.path}');
// ..add(UploadVideoEvent(filePath: videoFile.path)); //
// } else {
// Fluttertoast.showToast(msg: '未选取视频');
// }
// 使file_pickerimage_picker
List<PlatformFile>? _paths = (await FilePicker.platform.pickFiles(
type: FileType.video,
allowMultiple: false,
allowedExtensions: [],
))
?.files;
if (_paths!.length > 0) {
// TODO:
// TODO: loading
//
// final info = await _flutterVideoCompress.compressVideo(
// _paths[0].path,
// quality:
// VideoQuality.LowQuality, // default(VideoQuality.DefaultQuality)
// deleteOrigin: false, // default(false)
// );
// // debugBytedeskUtils.printLog(info.toJson().toString());
// String? afterPath = info.toJson()['path'];
// // BytedeskUtils.printLog('video path: ${_paths[0].path}, compress path: $afterPath');
// //
// BlocProvider.of<MessageBloc>(context)
// ..add(UploadVideoEvent(filePath: afterPath));
//
BlocProvider.of<MessageBloc>(context) BlocProvider.of<MessageBloc>(context)
..add(UploadVideoEvent(filePath: _paths[0].path)); ..add(UploadVideoEvent(filePath: pickedFile.path));
} else {
Fluttertoast.showToast(msg: '未选取视频');
} }
// 使file_pickerimage_picker
// List<PlatformFile>? _paths = (await FilePicker.platform.pickFiles(
// type: FileType.video,
// allowMultiple: false,
// allowedExtensions: [],
// ))
// ?.files;
// if (_paths!.length > 0) {
// // TODO:
// // TODO: loading
// //
// // final info = await _flutterVideoCompress.compressVideo(
// // _paths[0].path,
// // quality:
// // VideoQuality.LowQuality, // default(VideoQuality.DefaultQuality)
// // deleteOrigin: false, // default(false)
// // );
// // // debugBytedeskUtils.printLog(info.toJson().toString());
// // String? afterPath = info.toJson()['path'];
// // // BytedeskUtils.printLog('video path: ${_paths[0].path}, compress path: $afterPath');
// // //
// // BlocProvider.of<MessageBloc>(context)
// // ..add(UploadVideoEvent(filePath: afterPath));
// //
// BlocProvider.of<MessageBloc>(context)
// ..add(UploadVideoEvent(filePath: _paths[0].path));
// }
} catch (e) { } catch (e) {
BytedeskUtils.printLog('pick video error ${e.toString()}'); BytedeskUtils.printLog('pick video error ${e.toString()}');
Fluttertoast.showToast(msg: "未选取视频"); Fluttertoast.showToast(msg: "未选取视频");

@ -12,7 +12,7 @@ import 'package:bytedesk_kefu/ui/widget/image_choose_widget.dart';
import 'package:bytedesk_kefu/util/bytedesk_constants.dart'; import 'package:bytedesk_kefu/util/bytedesk_constants.dart';
import 'package:bytedesk_kefu/util/bytedesk_events.dart'; import 'package:bytedesk_kefu/util/bytedesk_events.dart';
// import 'package:bytedesk_kefu/util/bytedesk_utils.dart'; // import 'package:bytedesk_kefu/util/bytedesk_utils.dart';
import 'package:file_picker/file_picker.dart'; // import 'package:file_picker/file_picker.dart';
import 'package:sp_util/sp_util.dart'; import 'package:sp_util/sp_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
@ -663,42 +663,44 @@ class _ChatLSPageState extends State<ChatLSPage>
// chrome // chrome
Future<void> _pickVideo() async { Future<void> _pickVideo() async {
try { try {
// final PickedFile videoFile = await _picker.getVideo( XFile? pickedFile = await _picker.pickVideo(
// source: ImageSource.gallery, maxDuration: const Duration(seconds: 10)); source: ImageSource.gallery, maxDuration: const Duration(seconds: 10));
// BytedeskUtils.printLog('pick video path: ${videoFile.path}');
// if (videoFile != null) { if (pickedFile != null) {
// BlocProvider.of<MessageBloc>(context) BytedeskUtils.printLog('pick video path: ${pickedFile.path}');
// ..add(UploadVideoEvent(filePath: videoFile.path)); //
// } else {
// Fluttertoast.showToast(msg: '未选取视频');
// }
// 使file_pickerimage_picker
List<PlatformFile>? _paths = (await FilePicker.platform.pickFiles(
type: FileType.video,
allowMultiple: false,
allowedExtensions: [],
))
?.files;
if (_paths!.length > 0) {
// TODO:
// TODO: loading
//
// final info = await _flutterVideoCompress.compressVideo(
// _paths[0].path,
// quality:
// VideoQuality.LowQuality, // default(VideoQuality.DefaultQuality)
// deleteOrigin: false, // default(false)
// );
// // debugBytedeskUtils.printLog(info.toJson().toString());
// String? afterPath = info.toJson()['path'];
// // BytedeskUtils.printLog('video path: ${_paths[0].path}, compress path: $afterPath');
// //
// BlocProvider.of<MessageBloc>(context)
// ..add(UploadVideoEvent(filePath: afterPath));
//
BlocProvider.of<MessageBloc>(context) BlocProvider.of<MessageBloc>(context)
..add(UploadVideoEvent(filePath: _paths[0].path)); ..add(UploadVideoEvent(filePath: pickedFile.path));
} else {
Fluttertoast.showToast(msg: '未选取视频');
} }
// 使file_pickerimage_picker
// List<PlatformFile>? _paths = (await FilePicker.platform.pickFiles(
// type: FileType.video,
// allowMultiple: false,
// allowedExtensions: [],
// ))
// ?.files;
// if (_paths!.length > 0) {
// // TODO:
// // TODO: loading
// //
// // final info = await _flutterVideoCompress.compressVideo(
// // _paths[0].path,
// // quality:
// // VideoQuality.LowQuality, // default(VideoQuality.DefaultQuality)
// // deleteOrigin: false, // default(false)
// // );
// // // debugBytedeskUtils.printLog(info.toJson().toString());
// // String? afterPath = info.toJson()['path'];
// // // BytedeskUtils.printLog('video path: ${_paths[0].path}, compress path: $afterPath');
// // //
// // BlocProvider.of<MessageBloc>(context)
// // ..add(UploadVideoEvent(filePath: afterPath));
// //
// BlocProvider.of<MessageBloc>(context)
// ..add(UploadVideoEvent(filePath: _paths[0].path));
// }
} catch (e) { } catch (e) {
BytedeskUtils.printLog('pick video error ${e.toString()}'); BytedeskUtils.printLog('pick video error ${e.toString()}');
Fluttertoast.showToast(msg: "未选取视频"); Fluttertoast.showToast(msg: "未选取视频");

@ -1,6 +1,6 @@
name: bytedesk_kefu name: bytedesk_kefu
description: the best app chat sdk in china, you can chat with the agent freely at anytime. the agent can chat with the visitor by web/pc/mac/ios/android client. description: the best app chat sdk in china, you can chat with the agent freely at anytime. the agent can chat with the visitor by web/pc/mac/ios/android client.
version: 1.4.4 version: 1.4.5
homepage: https://www.weikefu.net homepage: https://www.weikefu.net
environment: environment:
@ -39,7 +39,7 @@ dependencies:
# https://pub.dev/packages/image_picker # https://pub.dev/packages/image_picker
image_picker: ^0.8.5 image_picker: ^0.8.5
# image_picker在选择视频的时候有bug选此替代 https://pub.dev/packages/file_picker # image_picker在选择视频的时候有bug选此替代 https://pub.dev/packages/file_picker
file_picker: ^4.5.1 # file_picker: ^4.5.1
# https://pub.dev/packages/protobuf # https://pub.dev/packages/protobuf
protobuf: ^2.0.1 protobuf: ^2.0.1
# 下拉刷新 https://pub.dev/packages/flutter_easyrefresh # 下拉刷新 https://pub.dev/packages/flutter_easyrefresh

Loading…
Cancel
Save