diff --git a/bytedesk_demo/lib/page/chat_type_page.dart b/bytedesk_demo/lib/page/chat_type_page.dart index 29d7319..f123393 100755 --- a/bytedesk_demo/lib/page/chat_type_page.dart +++ b/bytedesk_demo/lib/page/chat_type_page.dart @@ -130,6 +130,15 @@ class _ChatTypePageState extends State { context, _workGroupWid, "技能组客服-电商-回调", custom, (value) { print('value为custom参数原样返回 $value'); // 主要用途:用户在聊天页面点击商品消息,回调此接口,开发者可在此打开进入商品详情页 + showModalBottomSheet( + context: context, + builder: (context) { + return Container( + width: 200, + height: 200, + color: Colors.red, + ); + }); }); }, ), diff --git a/bytedesk_kefu/assets/images/chat/extra_order.png b/bytedesk_kefu/assets/images/chat/extra_order.png new file mode 100644 index 0000000..2828772 Binary files /dev/null and b/bytedesk_kefu/assets/images/chat/extra_order.png differ diff --git a/bytedesk_kefu/example/assets/images/chat/extra_order.png b/bytedesk_kefu/example/assets/images/chat/extra_order.png new file mode 100644 index 0000000..2828772 Binary files /dev/null and b/bytedesk_kefu/example/assets/images/chat/extra_order.png differ diff --git a/bytedesk_kefu/lib/bytedesk_kefu.dart b/bytedesk_kefu/lib/bytedesk_kefu.dart index 32ffd7b..f32a245 100644 --- a/bytedesk_kefu/lib/bytedesk_kefu.dart +++ b/bytedesk_kefu/lib/bytedesk_kefu.dart @@ -207,9 +207,9 @@ class BytedeskKefu { } static void startWorkGroupChatShopCallback(BuildContext context, String wid, - String title, String commodity, ValueSetter customCallback) { + String title, String commodity, ValueSetter customCallback,{Widget? widget}) { startChatShop(context, wid, BytedeskConstants.CHAT_TYPE_WORKGROUP, title, - commodity, customCallback); + commodity, customCallback,widget: widget); } // 指定客服会话 @@ -247,8 +247,9 @@ class BytedeskKefu { // 电商对话-自定义类型(技能组、指定客服) static void startChatShop(BuildContext context, String uuid, String type, - String title, String commodity, ValueSetter? customCallback) { - startChat(context, uuid, type, title, commodity, '', false, customCallback); + String title, String commodity, ValueSetter? customCallback, + {Widget? widget}) { + startChat(context, uuid, type, title, commodity, '', false, customCallback,widget:widget); } // 发送附言消息-自定义类型(技能组、指定客服) @@ -266,7 +267,9 @@ class BytedeskKefu { String commodity, String postScript, bool isV2Robot, - ValueSetter? customCallback) { + ValueSetter? customCallback, + {Widget? widget} + ) { Navigator.of(context).push(new MaterialPageRoute(builder: (context) { return new ChatKFProvider( wid: uuid, diff --git a/bytedesk_kefu/lib/ui/chat/page/chat_kf_page.dart b/bytedesk_kefu/lib/ui/chat/page/chat_kf_page.dart index 0bf927e..1a19215 100755 --- a/bytedesk_kefu/lib/ui/chat/page/chat_kf_page.dart +++ b/bytedesk_kefu/lib/ui/chat/page/chat_kf_page.dart @@ -51,6 +51,7 @@ class ChatKFPage extends StatefulWidget { final bool? isThread; final Thread? thread; final ValueSetter? customCallback; + final Widget? widget; // ChatKFPage( {Key? key, @@ -63,7 +64,7 @@ class ChatKFPage extends StatefulWidget { this.isV2Robot, this.isThread, this.thread, - this.customCallback}) + this.customCallback, this.widget}) : super(key: key); // @override @@ -254,7 +255,7 @@ class _ChatKFPageState extends State // style: TextStyle(color: Colors.black), ), ))), - ) + ), ], ), body: MultiBlocListener( @@ -658,7 +659,10 @@ class _ChatKFPageState extends State // 上传视频 handleUploadVideo: _handleUploadVideo, // 录制视频 - handleCaptureVideo: _handleCaptureVideo), + handleCaptureVideo: _handleCaptureVideo, + + handleShowOrders: _handleShowOrders, + ), ); } @@ -682,6 +686,13 @@ class _ChatKFPageState extends State _pickImage(); } + void _handleShowOrders() async { + print('_handleShowOrders'); + if(widget.customCallback!=null){ + widget.customCallback!('点击订单'); + } + } + void _handleFileSelection() async { print('_handleFileSelection'); } diff --git a/bytedesk_kefu/lib/ui/chat/provider/chat_kf_provider.dart b/bytedesk_kefu/lib/ui/chat/provider/chat_kf_provider.dart index bde8329..a60d5eb 100755 --- a/bytedesk_kefu/lib/ui/chat/provider/chat_kf_provider.dart +++ b/bytedesk_kefu/lib/ui/chat/provider/chat_kf_provider.dart @@ -14,6 +14,7 @@ class ChatKFProvider extends StatelessWidget { final String? postscript; final bool? isV2Robot; final ValueSetter? customCallback; + final Widget? widget; // const ChatKFProvider( {Key? key, @@ -24,7 +25,7 @@ class ChatKFProvider extends StatelessWidget { this.custom, this.postscript, this.isV2Robot, - this.customCallback}) + this.customCallback, this.widget}) : super(key: key); // @override @@ -49,7 +50,8 @@ class ChatKFProvider extends StatelessWidget { postscript: postscript, isV2Robot: isV2Robot, isThread: false, - customCallback: customCallback), + customCallback: customCallback, + widget: widget,), ); } } diff --git a/bytedesk_kefu/lib/ui/widget/extra_item.dart b/bytedesk_kefu/lib/ui/widget/extra_item.dart index a2e5998..25d98fc 100644 --- a/bytedesk_kefu/lib/ui/widget/extra_item.dart +++ b/bytedesk_kefu/lib/ui/widget/extra_item.dart @@ -73,7 +73,7 @@ class ExtraItems extends StatefulWidget { this.handleFileSelection, this.handlePickerSelection, this.handleUploadVideo, - this.handleCaptureVideo, + this.handleCaptureVideo, this.handleShowOrders, }) : super(key: key); final void Function()? handleImageSelection; @@ -81,6 +81,8 @@ class ExtraItems extends StatefulWidget { final void Function()? handlePickerSelection; final void Function()? handleUploadVideo; final void Function()? handleCaptureVideo; + final void Function()? handleShowOrders;///新增外部显示订单弹窗 + @override _ExtraItemsState createState() => _ExtraItemsState(); @@ -127,11 +129,11 @@ class _ExtraItemsState extends State { Row( children: [ // TODO: 选择文件 - // ExtraItem( - // title: "文件", - // image: AssetImage('assets/images/chat/extra_file.webp'), - // onPressed: widget.handleFileSelection, - // ), + ExtraItem( + title: "发送订单", + image: AssetImage('assets/images/chat/extra_wallet.png'), + onPressed: widget.handleShowOrders, + ), // ExtraItem( // title: "语音输入", // image: AssetImage('assets/images/chat/extra_voice.webp'),