diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index a011c3d..c2e3548 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -6,6 +6,6 @@ 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" -export "FLUTTER_BUILD_NAME=1.0.5" -export "FLUTTER_BUILD_NUMBER=6" +export "FLUTTER_BUILD_NAME=1.0.9" +export "FLUTTER_BUILD_NUMBER=13" export "TRACK_WIDGET_CREATION=true" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index f018f05..5ded8b7 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -542,7 +542,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -556,7 +556,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.0.8; + MARKETING_VERSION = 1.0.9; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -578,14 +578,14 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.0.8; + MARKETING_VERSION = 1.0.9; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; @@ -610,14 +610,14 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.0.8; + MARKETING_VERSION = 1.0.9; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok.share; @@ -640,14 +640,14 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share ExtensionProfile.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.0.8; + MARKETING_VERSION = 1.0.9; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok.share; @@ -777,7 +777,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -791,7 +791,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.0.8; + MARKETING_VERSION = 1.0.9; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -811,7 +811,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -825,7 +825,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.0.8; + MARKETING_VERSION = 1.0.9; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/lib/chat/ChatPage.dart b/lib/chat/ChatPage.dart index 0da9f09..47cfa58 100644 --- a/lib/chat/ChatPage.dart +++ b/lib/chat/ChatPage.dart @@ -1,5 +1,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:chat/home/audio_chat_view.dart'; +import 'package:chat/utils/screen.dart'; import 'package:chat/utils/upload_util.dart'; import 'package:fixnum/fixnum.dart'; import 'package:cached_network_image/cached_network_image.dart'; @@ -216,10 +218,12 @@ class _ChatPageState extends State { MsgModel msg = MsgHandler.createSendMsg( ChatType.valueOf(originMsg.msgType), originMsg.msgContent); msg.extraInfo = originMsg.extraInfo; - if(originMsg.extraFile==null ||originMsg.extraFile.contains('http')){ + if (originMsg.extraFile == null || + originMsg.extraFile.contains('http')) { msg.extraFile = originMsg.extraFile; - }else{ - msg.extraFile = UploadUtil().getFullUrl(originMsg.extraFile, originMsg.sessionId, originMsg.channelType); + } else { + msg.extraFile = UploadUtil().getFullUrl( + originMsg.extraFile, originMsg.sessionId, originMsg.channelType); } msg.localFile = originMsg.localFile; @@ -281,7 +285,8 @@ class _ChatPageState extends State { userId: friendInfo.userId, pageType: SendMessagePageType.Remark, originalName: Provider.of(context) - .getRefName(friendInfo.userId, friendInfo.nickName)); + .getRefName( + friendInfo.userId, friendInfo.nickName)); }, ), ); @@ -322,73 +327,187 @@ class _ChatPageState extends State { ]; }))); - return MultiProvider( - providers: [ - ChangeNotifierProvider(create: (_) => _keyboardIndexProvider), - Provider.value(value: false), - Provider.value(value: widget.friendId), - ], - child: GestureDetector( - onTap: hideKeyBoard, - child: ExtendedTextSelectionPointerHandler( - ///选择文字,消除弹窗 - - builder: (states) { - return Listener( - child: Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: const Color(0xFFE2E9F1), - appBar: AppBar( - title: Text( - '${Provider.of(context).getRefName(friendInfo.userId, friendInfo.nickName)}', - textScaleFactor: 1.0, - style: TextStyle( - color: Constants.BlackTextColor, - fontSize: 16.47), - ), - leading: CustomUI.buildCustomLeading(context), - titleSpacing: -10, - centerTitle: false, - elevation: 1, - actions: actions), - body: SafeArea( - child: Column( - children: [ - NetStateWidget(), - widget.isTranslateButler - ? _buildTranslationButler() - : Container(), - widget.isTranslateButler - ? _buildServiceCard(true, () {}) - : Container(), - widget.isTranslateButler - ? _buildServiceCard(false, () {}) - : Container(), - Expanded(child: _buildMessageList()), - InputBar(sendMsg: sendMsg), - ], - ))), - behavior: HitTestBehavior.translucent, - onPointerDown: (value) { - for (var state in states) { - if (!state.containsPosition(value.position)) { - //clear other selection - state.clearSelection(); - } - } - }, - onPointerMove: (value) { - //clear other selection - for (var state in states) { - if (!state.containsPosition(value.position)) { + return Stack( + children: [ + MultiProvider( + providers: [ + ChangeNotifierProvider(create: (_) => _keyboardIndexProvider), + Provider.value(value: false), + Provider.value(value: widget.friendId), + ], + child: GestureDetector( + onTap: hideKeyBoard, + child: ExtendedTextSelectionPointerHandler( + ///选择文字,消除弹窗 + + builder: (states) { + return Listener( + child: Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFFE2E9F1), + appBar: AppBar( + title: Text( + '${Provider.of(context).getRefName(friendInfo.userId, friendInfo.nickName)}', + textScaleFactor: 1.0, + style: TextStyle( + color: Constants.BlackTextColor, + fontSize: 16.47), + ), + leading: CustomUI.buildCustomLeading(context), + titleSpacing: -10, + centerTitle: false, + elevation: 1, + actions: actions), + body: SafeArea( + child: Column( + children: [ + NetStateWidget(), + widget.isTranslateButler + ? _buildTranslationButler() + : Container(), + widget.isTranslateButler + ? _buildServiceCard(true, () {}) + : Container(), + widget.isTranslateButler + ? _buildServiceCard(false, () {}) + : Container(), + Expanded(child: _buildMessageList()), + InputBar(sendMsg: sendMsg), + ], + ))), + behavior: HitTestBehavior.translucent, + onPointerDown: (value) { + for (var state in states) { + if (!state.containsPosition(value.position)) { + //clear other selection + state.clearSelection(); + } + } + }, + onPointerMove: (value) { //clear other selection - state.clearSelection(); - } - } + for (var state in states) { + if (!state.containsPosition(value.position)) { + //clear other selection + state.clearSelection(); + } + } + }, + ); }, - ); - }, - ))); + ))), + widget.isTranslateButler ? getAudioChatView() : Container(), + widget.isTranslateButler ? zoomAudioButton() : Container() + ], + ); + } + + Widget getAudioChatView() { + if (friendInfo == null) { + return Container(); + } + + return isActive == null + ? Container() + : Offstage( + offstage: !isShowAudio, + child: AudioChatPage( + userInfo: friendInfo, + isTranslateButler: true, + translateButlerCloseCallBack: audioChatPageCallBack, + ), + ); + } + + audioChatPageCallBack(int args) { + switch (args) { + case 1: + setState(() { + isShowAudio = !isShowAudio; + isShowZoomButton = true; + }); + break; + case 2: + setState(() { + isActive = false; + }); + break; + } + } + + bool isShowAudio = false; + + ///控住连麦窗口是否显示 + bool isActive = true; + + ///控制连麦是否关闭 + bool isShowZoomButton = true; + GlobalKey mykey = GlobalKey(); + + double dx = 0, dy = 0; + double zoomButtonSize = 60; + + void dragEvent(DragUpdateDetails details) { + final RenderObject box = context.findRenderObject(); + // 获得自定义Widget的大小,用来计算Widget的中心锚点 + dx = details.globalPosition.dx - mykey.currentContext.size.width / 2; + dy = details.globalPosition.dy - mykey.currentContext.size.height / 2; + + print('dx $dx dy $dy screen width:${Screen.width}'); + + if (dx > Screen.width - zoomButtonSize) { + dx = Screen.width - zoomButtonSize; + } else if (dx < 0) { + dx = 0; + } + + if (dy > Screen.height - zoomButtonSize) { + dy = Screen.height - zoomButtonSize; + } else if (dy < 0) { + dy = 0; + } + + setState(() {}); + } + + Widget zoomAudioButton() { + friendInfo == null + ? Container() + : AudioChatPage( + userInfo: friendInfo, + ); + + if (friendInfo == null || !isShowZoomButton) { + return Container(); + } + + Widget button = Container( + key: mykey, + color: Colors.blue, + width: 60, + height: 60, + ); + + return GestureDetector( + onHorizontalDragUpdate: dragEvent, + onVerticalDragUpdate: dragEvent, + onTap: (){ + setState(() { + isShowAudio = !isShowAudio; + isShowZoomButton = !isShowZoomButton; + }); + }, + child: Container( + + child: Transform.translate( + offset: Offset(dx, dy), + child: Align( + alignment: Alignment.topLeft, + child: button, + ), + ), + ), + ); } Widget _buildTranslationButler() { @@ -426,31 +545,35 @@ class _ChatPageState extends State { child: Image.asset(R.assetsImagesDefaultNorAvatar))), Padding( padding: EdgeInsets.only(left: 10), - child: Container(child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - I18n.of(context).translation_butler , - textScaleFactor: 1.0, - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - color: AppColors.NewAppbarTextColor, fontSize: 15), - ), - SizedBox(height: 5,), - Text( - coinTIme, - textScaleFactor: 1.0, - maxLines: 1, - style: TextStyle( - color: Color(0xFF797979), fontSize: 13), - ) - ], - ),constraints:BoxConstraints(maxWidth: 135),), + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + I18n.of(context).translation_butler, + textScaleFactor: 1.0, + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: AppColors.NewAppbarTextColor, fontSize: 15), + ), + SizedBox( + height: 5, + ), + Text( + coinTIme, + textScaleFactor: 1.0, + maxLines: 1, + style: TextStyle(color: Color(0xFF797979), fontSize: 13), + ) + ], + ), + constraints: BoxConstraints(maxWidth: 135), + ), ), Expanded( child: Container( - constraints:BoxConstraints(maxWidth: 130), + constraints: BoxConstraints(maxWidth: 130), width: double.maxFinite, child: CountDownButton( I18n.of(context).translation_butler_end_service, @@ -596,27 +719,23 @@ class _ChatPageState extends State { } MsgModel msg; - int count=0; - testBig(MsgModel msg)async{ - + int count = 0; - - for(int k=0;k<100;k++){ + testBig(MsgModel msg) async { + for (int k = 0; k < 100; k++) { msg.msgContent = utf8.encode('测试$count'); Int64 time = Int64((DateTime.now()).millisecondsSinceEpoch); msg.time = time.toInt(); MsgHandler.insertMsgToDB(msg); MsgHandler.sendChatMsg(msg); - await Future.delayed(Duration(milliseconds: 500),(){}); + await Future.delayed(Duration(milliseconds: 500), () {}); count++; } - count=0; + count = 0; print('发送完毕'); showToast('发送完毕'); } - - void receiveMsg(args) { if (mounted) { setState(() {}); diff --git a/lib/chat/full_img_view.dart b/lib/chat/full_img_view.dart index cdcface..58599d7 100644 --- a/lib/chat/full_img_view.dart +++ b/lib/chat/full_img_view.dart @@ -62,7 +62,7 @@ class _PhotoPageState extends State } else { fileData = Uint8List.fromList(widget.msg.msgContent); } - return GestureDetector( + return Material(color: Colors.black,child: GestureDetector( onTap: () { Navigator.pop(context); }, @@ -74,30 +74,30 @@ class _PhotoPageState extends State children: [ SingleChildScrollView( child: Column( - children: [ - Container( - width: Screen.width, - constraints: BoxConstraints(minHeight: Screen.height), - child: ExtendedImage.memory( - fileData, - fit: BoxFit.fitWidth, - mode: ExtendedImageMode.gesture, - initGestureConfigHandler: (state) { - return GestureConfig( - minScale: 0.9, - animationMinScale: 0.7, - maxScale: 3.0, - animationMaxScale: 3.5, - speed: 1.0, - inertialSpeed: 100.0, - initialScale: 1.0, - inPageView: true, - initialAlignment: InitialAlignment.center, - ); - }, - )) - ], - )), + children: [ + Container( + width: Screen.width, + constraints: BoxConstraints(minHeight: Screen.height), + child: ExtendedImage.memory( + fileData, + fit: BoxFit.fitWidth, + mode: ExtendedImageMode.gesture, + initGestureConfigHandler: (state) { + return GestureConfig( + minScale: 0.9, + animationMinScale: 0.7, + maxScale: 3.0, + animationMaxScale: 3.5, + speed: 1.0, + inertialSpeed: 100.0, + initialScale: 1.0, + inPageView: true, + initialAlignment: InitialAlignment.center, + ); + }, + )) + ], + )), Positioned( right: 10, bottom: 10, @@ -113,7 +113,7 @@ class _PhotoPageState extends State child: Icon(Icons.save_alt, color: Colors.white70), )),)) ], - ))); + ))),); } saveToGallery() async { diff --git a/lib/home/audio_chat_view.dart b/lib/home/audio_chat_view.dart index 6d2d20b..03756dd 100644 --- a/lib/home/audio_chat_view.dart +++ b/lib/home/audio_chat_view.dart @@ -33,8 +33,9 @@ import 'package:provider/provider.dart'; class AudioChatPage extends StatefulWidget { final UserInfo userInfo; final bool isReplay; - - AudioChatPage({this.userInfo, this.isReplay = false}); + final bool isTranslateButler; + final Function translateButlerCloseCallBack; + AudioChatPage({@required this.userInfo, this.isReplay = false, this.isTranslateButler,this.translateButlerCloseCallBack}); @override _AudioChatPageState createState() => _AudioChatPageState(); } @@ -215,7 +216,11 @@ class _AudioChatPageState extends State { _viewAudio(), isReply ? _replayToolBar() : _bottomToolBar(), ], - ))) + ))), + widget.isTranslateButler?Material(child: InkWell(child: Container(color: Colors.yellow,width: 60,height: 60,),onTap: (){ + widget.translateButlerCloseCallBack(1); + print('内页内页'); + },),):Container() ], ))); } @@ -774,7 +779,13 @@ class _AudioChatPageState extends State { if (!isQuit) { if (Navigator.canPop(context)) { isQuit = true; - Navigator.of(context).pop(); + + if(widget.translateButlerCloseCallBack!=null){ + widget.translateButlerCloseCallBack(2); + }else{ + Navigator.of(context).pop(); + } + SoundUtils().stop(); callingTimer?.cancel(); } diff --git a/lib/home/realtimehelper/translation_butler_page.dart b/lib/home/realtimehelper/translation_butler_page.dart index c96a099..0e65a19 100644 --- a/lib/home/realtimehelper/translation_butler_page.dart +++ b/lib/home/realtimehelper/translation_butler_page.dart @@ -75,18 +75,18 @@ class TranslationButlerPageState extends State { Future.delayed(Duration(seconds: 1), () { - CustomUI.buildTranslationHelperOrderDialog(context,true); -// Navigator.of(context).push( -// new MaterialPageRoute( -// builder: (context) { -// return ChatPage( -// key: Key('Chat'), -// friendId: 100006, -// isTranslateButler: true, -// ); -// }, -// ), -// ); +// CustomUI.buildTranslationHelperOrderDialog(context,true); + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return ChatPage( + key: Key('Chat'), + friendId: 100029, + isTranslateButler: true, + ); + }, + ), + ); }); diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index 7661a77..86d44dd 100644 --- a/lib/utils/HttpUtil.dart +++ b/lib/utils/HttpUtil.dart @@ -44,9 +44,9 @@ class HttpUtil { //static const String BaseUrl = 'http://192.168.0.223:7001/'; //static const String BaseUrl = 'http://192.168.0.207:9080/'; -// static const String BaseUrl = 'http://120.79.107.63:9080/'; + static const String BaseUrl = 'http://120.79.107.63:9080/'; //static const String BaseUrl = 'http://192.168.0.177:9016/'; - static const String BaseUrl = 'https://datasm.chengyouhd.com/'; +// static const String BaseUrl = 'https://datasm.chengyouhd.com/'; static HttpUtil _getInstance() { if (_instance == null) {