From ad5dbd53793cd0659863182745e409f075444e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A0=E6=96=87=E8=BD=A9?= <12812285557@qq.com> Date: Wed, 17 Aug 2022 10:55:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=A2=E5=8D=95=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bytedesk_demo/lib/page/chat_type_page.dart | 9 +++++++++ .../assets/images/chat/extra_order.png | Bin 0 -> 1238 bytes .../example/assets/images/chat/extra_order.png | Bin 0 -> 1238 bytes bytedesk_kefu/lib/bytedesk_kefu.dart | 13 ++++++++----- .../lib/ui/chat/page/chat_kf_page.dart | 17 ++++++++++++++--- .../lib/ui/chat/provider/chat_kf_provider.dart | 6 ++++-- bytedesk_kefu/lib/ui/widget/extra_item.dart | 14 ++++++++------ 7 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 bytedesk_kefu/assets/images/chat/extra_order.png create mode 100644 bytedesk_kefu/example/assets/images/chat/extra_order.png 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 0000000000000000000000000000000000000000..28287728ac1b250df9a37b9a9ec4e6f826f83bb5 GIT binary patch literal 1238 zcmeAS@N?(olHy`uVBq!ia0vp^DImV42|Q;uum9 z_ja!Dim9O@ZS%SLrl@K0hIj!W8S5MOHvFlZyr-z~4Rf4tSby)N1J(z!R|Y;|sN}veO-ttYzsU#W z5~{t_Ryw3H+ArfcHm{Gwr<1v!Xg|1_m-O-TZ#4x;y_eGhxh7QZ{BKyAZPin+ z7kO&;hCXf9jy;R3swLW2Snf*Ee7~owp@w76f|pqm*`Cw%r!iTw>PQ?@%<9vN)Zx4~zuB>M6s9KWR#JEJq{_87-MRJ)l6Bsm4`|q`CSm7R}CgE`EQ}B8|g;x`& zak7!G{Fy@@b9kfusb>Kz^7fn%5VteBGV7JZstL61PCvvk*r*ls5KJaB$u-O~c?VLHe5x2LTVd=QD#%S5f z$6clFji#c%J+*}uF8xq_(0uCfvu&GqEV|EgV*LTm9+n0SenC;1LqH< zJk&D*B+idc~6dubX+{M?lzl1dIggQL*cXrW9vdErjE@lb8dDD3pvbD zeQ>7lC+9@(&;r89##nX@Xz7J?qELsM1xp+g&d{z0NuZN4Gv`_;G9HO!I``%XC#S+Wp@KAZKOFw@ zn=^sokq%>e*`pSi5h)r>k_=BCJ&t(F>Csoz8F+l^C*9oBI{U)+)Rax7sv7juuW{AWEkSvp>vHs)T=^!I>BLWtjG#XaHk z4r!V1h}&7rKGSBhcD5<&q^l}s%hd%OE^S`5$+#h;({isTgXj5Gr_R+gtdo78`s9Vq RBVa+r;OXk;vd$@?2>=f{JMRDh literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..28287728ac1b250df9a37b9a9ec4e6f826f83bb5 GIT binary patch literal 1238 zcmeAS@N?(olHy`uVBq!ia0vp^DImV42|Q;uum9 z_ja!Dim9O@ZS%SLrl@K0hIj!W8S5MOHvFlZyr-z~4Rf4tSby)N1J(z!R|Y;|sN}veO-ttYzsU#W z5~{t_Ryw3H+ArfcHm{Gwr<1v!Xg|1_m-O-TZ#4x;y_eGhxh7QZ{BKyAZPin+ z7kO&;hCXf9jy;R3swLW2Snf*Ee7~owp@w76f|pqm*`Cw%r!iTw>PQ?@%<9vN)Zx4~zuB>M6s9KWR#JEJq{_87-MRJ)l6Bsm4`|q`CSm7R}CgE`EQ}B8|g;x`& zak7!G{Fy@@b9kfusb>Kz^7fn%5VteBGV7JZstL61PCvvk*r*ls5KJaB$u-O~c?VLHe5x2LTVd=QD#%S5f z$6clFji#c%J+*}uF8xq_(0uCfvu&GqEV|EgV*LTm9+n0SenC;1LqH< zJk&D*B+idc~6dubX+{M?lzl1dIggQL*cXrW9vdErjE@lb8dDD3pvbD zeQ>7lC+9@(&;r89##nX@Xz7J?qELsM1xp+g&d{z0NuZN4Gv`_;G9HO!I``%XC#S+Wp@KAZKOFw@ zn=^sokq%>e*`pSi5h)r>k_=BCJ&t(F>Csoz8F+l^C*9oBI{U)+)Rax7sv7juuW{AWEkSvp>vHs)T=^!I>BLWtjG#XaHk z4r!V1h}&7rKGSBhcD5<&q^l}s%hd%OE^S`5$+#h;({isTgXj5Gr_R+gtdo78`s9Vq RBVa+r;OXk;vd$@?2>=f{JMRDh literal 0 HcmV?d00001 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'),