flutter_sobot_client 4.1.9 flutter_sobot_client: ^4.1.9 copied to clipboard
sobot_flutter_client
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:flutter_sobot_client/sobotsdk.dart';
import 'dart:async';
import 'package:flutter/services.dart';
// import 'package';
// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
// import 'dart:async';
class ZCSobotWidge extends StatefulWidget {
@override
ZCSobotWidgeState createState() => ZCSobotWidgeState();
}
class ZCSobotWidgeState extends State<ZCSobotWidge> {
int newmesaage = 0;
final zhiChiSobot = SobotApi();
var sobotMethodChannel = MethodChannel('flutter_sobot_client');
static const EventChannel eventChannel = EventChannel('sobot');
// void _onEvent(Object event) {
// print('zhichi> on Event....1 $event');
// // print(event.toString());
// }
//
// void _onError(Object error) {
// print('zhichi> on Error.... $error');
// print(error);
// }
@override
void initState() {
// TODO: implement initState
super.initState();
// eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError);
eventChannel.receiveBroadcastStream().listen((event) {
print('***********************************');
print(event);
// closeSobotChatPage();
print('+++++++++++++++++++++++++++++++++++');
});
// 接收 ios _channel_1 的调用, 并返回给 ios 一个数据回调
// sobotMethodChannel.setMethodCallHandler((call) {
// setState(() {
// // 此处一个 channel 可以调用很多 method,
// if (call.method == 'flutterSobotHandle') {
// print('flutterSobotHandle 收到原生的回调'+call.arguments);
// if (call.arguments['type'] == '5') {
// } else if (call.arguments['type'] == '1') {
// // 点击返回按钮回掉
// print("flutter 收到点击返回按钮的事件");
// } else if (call.arguments['type'] == '4') {
// // 未读消息回掉
// final unreadNumber = call.arguments['value'];
// print(unreadNumber);
// } else if (call.arguments['type'] == '2') {
// var linkStr = call.arguments['value'];
// print('url======================================='+linkStr);
//
// // sendProductInfo();
// // sendOrderGoodsInfo();
// // closeSobotChatPage();
// }
// }
// });
// return Future.value('测试给原生 传参');
// });
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('text'),
),
body: Container(
padding: EdgeInsets.all(32.0),
child: Center(
child: Column(
children: <Widget>[
MaterialButton(
color: Colors.blue,
child: Text('启动智齿'),
onPressed: () {
startZhichi();
},
),
MaterialButton(
color: Colors.blue,
child: Text('启动客户服务中心'),
onPressed: () {
openSobotHelpCenter();
},
),
MaterialButton(
color: Colors.blue,
child: Text('关闭智齿'),
onPressed: () {
closeSobotChat();
},
),
MaterialButton(
color: Colors.blue,
child: Text('电商版消息中心'),
onPressed: () {
openSobotHelpMallCenter();
},
),
MaterialButton(
color: Colors.blue,
child: Text('获取未读消息'),
onPressed: () {
getUnReadMessage();
},
),
MaterialButton(
color: Colors.blue,
child: Text('关闭智齿页面'),
onPressed: () {
closeSobotChatPage();
},
),
MaterialButton(
color: Colors.blue,
child: Text('发送商品卡片'),
onPressed: () {
sendProductInfo();
},
),
MaterialButton(
color: Colors.blue,
child: Text('发送订单卡片'),
onPressed: () {
sendOrderGoodsInfo();
},
),
MaterialButton(
color: Colors.blue,
child: Text('关闭智齿页面'),
onPressed: () {
closeSobotChatPage();
},
),
MaterialButton(
color: Colors.blue,
child: Text('关闭通道移除IM监听'),
onPressed: () {
closeIMCommectionAndRemoveObserver();
},
),
MaterialButton(
color: Colors.blue,
child: Text('添加IM监听并检查IM通道'),
onPressed: () {
checkIMConnectedAndAddObserver();
},
),
MaterialButton(
color: Colors.blue,
child: Text('发送自定义卡片'),
onPressed: () {
sendCustomCard();
},
),
],
),
),
),
);
}
Future<void> sendCustomCard() async{
var params = {'custom_card':
{'cardId': 86,
'cardStyle': 1,
'cardType': 1,
'customCards': [
{'customCardDesc': '型 号:J2SN码:sn5',
'customCardName': '测服yyyyyyy',
'customCardThumbnail': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669954871449/J2.png',
'customMenus': [
{'menuName': '发送', 'menuType': 2}
]
}],
'customField': {
'actionType': 'to_group',
'optionId': '4',
'deciId': 'a457f4dfe92842f8a11d1616c1c58dc1'
},
'cardGuide': '请问您要咨询的设备是?',
'cardDesc': '选择设备'
}
};
final result = zhiChiSobot.sendCustomCard(params);
handleJson(result);
}
Future<void> closeSobotChatPage() async {
var params = {};
final result = zhiChiSobot.closeSobotChatPage(params);
handleJson(result);
}
Future<void> sendProductInfo() async {
var params = {'goodsTitle':'商品名字', 'goodsLabel':'30.5','goodsDesc':'商品描述', 'goodsImage':'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png',
'goodsLink':'https://home.firefoxchina.cn/'};
final result = zhiChiSobot.sendProductInfo(params);
handleJson(result);
}
Future<void> sendOrderGoodsInfo() async {
var params = {"orderStatus":"0","statusCustom":"自定义状态","createTime":"","goodsCount":"1","orderUrl":"https://www.sobot.com","orderCode":"1000234242342345","totalFee":"4980","goods":[{"name":"商品名称","pictureUrl":"http://pic25.nipic.com/20121112/9252150_150552938000_2.jpg"}]};
final result = zhiChiSobot.sendOrderGoodsInfo(params);
handleJson(result);
}
Future<void> startZhichi() async {
var params = {
// "app_key": "dd0e991266a94723af14cc23cda5e1f1",
"app_key":"1c1da2c0aad047d7ba1d14ecd18ae4f6",
// "api_host": "https://test.sobot.com",
"navcBarHidden": true,
// "isCustomLinkClick": true,
"partnerid": "1554309398961004545",
"user_nick": "ZY_34079077",
"user_name": "ZY_34079077",
"service_mode": 4,
"orderStatus": 1,
"orderCode": "240110033056N60133",
"autoSendOrderMessage": true,
"goodsCount": 4,
"totalFee": 37624,
"createTime": '1704828656000',
"absolute_language": "en",
"orderUrl": "/orderDetail?orderSn=240110033056N60133",
"isEveryTimeAutoSend": true,
"isDebugMode": true,
"goods": [
{
"name": "White / S",
"pictureUrl": "https://dev-zhiyi-foreign-ec-1319975145.cos.ap-hongkong.myqcloud.com/ec/sku/img/shopify/1507336675259453440.jpg"
},
{
"name": "Black / M",
"pictureUrl": "https://dev-zhiyi-foreign-ec-1319975145.cos.ap-hongkong.myqcloud.com/ec/sku/img/2022-08-15/zyScale133zyScale20228215105125_1660547451025.jpg"
}
]
};
// var params = {'app_key': 'dd0e991266a94723af14cc23cda5e1f1',
// 'api_host': 'https://test.sobot.com',
// 'partnerid': '9a0a5c240d0d4561915ec1359175700e',
// 'user_nick': '一个云鲸用户不存在加(13585073-app)',
// 'user_tels': '17726151408',
// 'face': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/1687847195047-1687847194214.png',
// 'params': {'messageTag': 'app'},
// 'service_mode': 3,
// 'isSendInfoCard': false,
// 'show_permission_tips_pop': true,
// 'landscape_screen':false,
// 'isEveryTimeSendCard': false,
// 'isShowReturnTips': true,
// 'isOpenRecord': false,
// 'sobot_color_title_bar_right_bg': '#6179F5',
// 'sobotColor_title_bar_left_bg': '#6179F5',
// 'absolute_language':'en',
// 'themeStyle': 2,
// // 'isShowTansfer': false,
// // 'unWordsCount': 1,
// 'custom_card': {'cardId': 86, 'cardStyle': 1, 'cardType': 1, 'customCards': [{'customCardDesc': '型 号:J2SN码:sn5', 'customCardName': '测服yyyyyyy', 'customCardThumbnail': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669954871449/J2.png', 'customMenus': [{'menuName': '发送', 'menuType': 2}]}, {'customCardDesc': '型 号:J3, customCardName: 好好让哥哥, customCardThumbnail: https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669257715915/J3.png, customMenus: [{menuName: 发送, menuType: 2}]}, {customCardDesc: 型 号:J3SN码:YB2AAC2218CA01D0020', 'customCardName': '丁沛然-测试服', 'customCardThumbnail': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669257763153/J3.png', 'customMenus': [{'menuName': '发送', 'menuType': 2}]}, {'customCardDesc': '型 号:J3SSN码:bolin.li@narwal.com', 'customCardName': '柏林J44', 'customCardThumbnail': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1664346719929/J3%20(2).png', 'customMenus': [{'menuName': '发送', 'menuType': 2}]}], 'customField': {}, 'cardGuide': '请问您要咨询的设备是?', 'cardDesc': '选择设备'}};
// var params = {
// // 'app_key': 'fdd8f0f6844c4a2487caa8deb8bb8163',
// // 'app_key': 'e550c6e4250c4ab490f290c6d7cb5ac2',//测试
// 'app_key': 'dd0e991266a94723af14cc23cda5e1f1',//测试
// // 'api_host': 'https://www.sobot.com',
// 'api_host':'https://test.sobot.com',
// 'partnerid': '123456789',
// 'isOpenActiveUser':true,
// 'themeStyle':'2',
// 'sobot_color_title_bar_right_bg':'#123456',
// 'sobotColor_title_bar_left_bg':'#000000',
// // 'isCustomLinkClick': true,
// // 'user_nick': 'sobot123123123',
// // 'user_name': '智齿jkhkjhk',
// // 'user_tels': '18510002000',
// // 'user_emails': '123@qq.com',
// // 'qq': '123456789',
// // 'remark': '好好学习,天天向上',
// // 'params': {
// // // 'actionType': 'to_group',
// // // 'optionId': '4',
// // // 'deciId': 'a457f4dfe92842f8a11d1616c1c58dc1'
// // },
// // 'service_mode': 0,
// // 'title_type': 1,
// // 'custom_title': '自定义标题',
// // 'is_show_custom_title': true,
// // 'is_show_custom_title_url': false,
// // 'showNotification': true,
// // 'isShowReturnTips': true,
// // 'isShowClose': true,
// // 'isShowCloseSatisfaction': true,
// // 'isCloseAfterEvaluation': true,
// // 'isOpenEvaluation': true,
// // 'hideRototEvaluationLabels':false,//隐藏机器人是评价标签
// // 'hideManualEvaluationLabels':false,//隐藏人工时评价标签
// // 'hideChatTime':true,
// // 'absolute_language':'en',
// 'goodsTitle': '商品名字',
// 'goodsLabel': '30.5\$',
// 'goodsDesc': '商品描述',
// 'goodsImage':
// 'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png',
// 'goodsLink': 'https://home.firefoxchina.cn/',
// 'isSendInfoCard': true,
// 'orderStatus': 1,
// 'orderCode': 'v2131232132',
// 'autoSendOrderMessage': true,
// 'goodsCount': 2,
// 'totalFee': 3034,
// 'createTime': '1569491413000',
// 'autoSendOrderMessage': true,
// 'isSendInfoCard': true,
// 'orderUrl': 'https://www.sobot.com/',
// 'canSendLocation': true,
// 'custom_card':{},
// // 'custom_card':{'cardDesc':'测试的是的方式测试的是的方式测试的是的方式测试的是的方式测试的是的方式测试的是的方式测试的是的方式','cardGuide':'测试标题 引导语测试标题 引导语测试标题 引导语测试标题 引导语测试标题 引导语测试标题 引导语测试标题 引导语','cardId':'cardId121212vv12','cardImg':'https://hk.sobot.com/auth/_next/static/media/sideZh.74024132.png','cardMenus':[{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫胜多负少士大夫胜多负少士大夫胜多负少士大夫','menuLinkType':0,'menuName':'发送','menuTip':'发送提示','menuType':2},{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫','menuLinkType':2,'menuName':'确认','menuTip':'发送提示','menuType':1},{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫','menuLinkType':2,'menuName':'查看详情手动阀手动阀是的发士大夫士大夫士大夫是的发士大夫','menuTip':'发送提示','menuType':0}],'cardStyle':1,'cardType':1,'customCards':[{'customCardAmount':'222.9','customCardAmountSymbol':'¥','customCardCode':'sobot121u321u3','customCardCount':'5','customCardDesc':'测试邮箱我是的就就的的的是是我我我的的的嗡嗡嗡嗡嗡嗡嗡嗡嗡问问二位问问额嗡嗡嗡嗡嗡嗡为微软微软微软微软微软微软','customCardId':'cardId_0','customCardName':'0测试邮箱我是的就就的的的是是我我我的的的嗡嗡嗡嗡嗡嗡嗡嗡嗡问问二位问问额嗡嗡嗡嗡嗡嗡为微软微软微软微软微软微软','customCardStatus':'待收货','customCardThumbnail':'https://hk.sobot.com/auth/_next/static/media/sideZh.74024132.png','customCardTime':'2023-06-25 14:32:21','customMenus':[{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫胜多负少士大夫胜多负少士大夫胜多负少士大夫','menuLinkType':0,'menuName':'发送','menuTip':'发送提示','menuType':2}]},{'customCardAmount':'222.9','customCardAmountSymbol':'¥','customCardCode':'sobot121u321u3','customCardCount':'5','customCardDesc':'测试邮箱我是的就就的的的是是我我我的的的嗡嗡嗡嗡嗡嗡嗡嗡嗡问问二位问问额嗡嗡嗡嗡嗡嗡为微软微软微软微软微软微软','customCardId':'cardId_1','customCardName':'1测试邮箱我是的就就的的的是是我我我的的的嗡嗡嗡嗡嗡嗡嗡嗡嗡问问二位问问额嗡嗡嗡嗡嗡嗡为微软微软微软微软微软微软','customCardStatus':'待收货','customCardThumbnail':'https://hk.sobot.com/auth/_next/static/media/sideZh.74024132.png','customCardTime':'2023-06-25 14:32:21','customMenus':[{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫胜多负少士大夫胜多负少士大夫胜多负少士大夫','menuLinkType':0,'menuName':'发送','menuTip':'发送提示','menuType':2},{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫','menuLinkType':2,'menuName':'确认','menuTip':'发送提示','menuType':1}]},{'customCardAmount':'222.9','customCardAmountSymbol':'¥','customCardCode':'sobot121u321u3','customCardCount':'5','customCardDesc':'测试邮箱我是的就就的的的是是我我我的的的嗡嗡嗡嗡嗡嗡嗡嗡嗡问问二位问问额嗡嗡嗡嗡嗡嗡为微软微软微软微软微软微软','customCardId':'cardId_2','customCardName':'2测试邮箱我是的就就的的的是是我我我的的的嗡嗡嗡嗡嗡嗡嗡嗡嗡问问二位问问额嗡嗡嗡嗡嗡嗡为微软微软微软微软微软微软','customCardStatus':'待收货','customCardThumbnail':'https://hk.sobot.com/auth/_next/static/media/sideZh.74024132.png','customCardTime':'2023-06-25 14:32:21','customMenus':[{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫胜多负少士大夫胜多负少士大夫胜多负少士大夫','menuLinkType':0,'menuName':'发送','menuTip':'发送提示','menuType':2},{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫','menuLinkType':2,'menuName':'确认','menuTip':'发送提示','menuType':1},{'isDisable':false,'menuId':0,'menuLink':'胜多负少士大夫','menuLinkType':2,'menuName':'查看详情手动阀手动阀是的发士大夫士大夫士大夫是的发士大夫','menuTip':'发送提示','menuType':0}]}],'customField':{'顶顶顶2':'399','顶顶顶3':'399','测试':'0999999999999990','顶顶ew顶':'399','顶顶wer顶':'399','顶顶s顶':'399','顶顶顶':'399','顶顶3顶':'399','顶顶we顶':'399','顶顶2顶':'399','顶顶1顶':'399'},'isOpen':false,'showCustomCardAllMode':true},
// // 'custom_card':{'cardId': 75, 'cardStyle': 1, 'cardType': 1, 'customCards': [{'customCardDesc':'型 号:J2I/flutter ( 5432): SN码:sn5', 'customCardName': '测服yyyyyyyy', 'customCardThumbnail': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669954871449/J2.png', 'customMenus': [{'menuName': '发送', 'menuType': 2}]}, {'customCardDesc': '型 号:J3I/flutter ( 5432): SN码:YB2AAC2218CA01D0020', 'customCardName': '好好让哥哥', 'customCardThumbnail': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669257715915/J3.png', 'customMenus': [{'menuName': '发送', 'menuType': 2}]}, {'customCardDesc': '型 号:J3I/flutter ( 5432): SN码:YB1AAC224TCB01C0009', 'customCardName': '丁沛然-测试服', 'customCardThumbnail': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669257763153/J3.png', 'customMenus': [{'menuName': '发送', 'menuType': 2}]}, {'customCardDesc': '型 号:J3SI/flutter ( 5432): SN码:bolin.li@narwal.com', 'customCardName': '柏林J44', 'customCardThumbnail': 'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1664346719929/J3%20(2).png', 'customMenus': [{'menuName': '发送', 'menuType': 2}]}]},
// 'custom_card':{'cardDesc':'测试的是的方式方式测试的是的方式','cardGuide':'测试标题', 'cardId':'87','cardStyle':1,'cardType':1,'customCards':[{'customCardDesc':'型 号:J2I/flutter ( 5432): SN码:sn5','customCardName':'测服yyyyyyyy','customCardThumbnail':'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669954871449/J2.png','customMenus':[{'menuName': '发送', 'menuType': 2}]},{'customCardDesc':'型 号:J3I/flutter ( 5432): SN码:YB2AAC2218CA01D0020','customCardName':'好好让哥哥','customCardThumbnail':'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669257715915/J3.png','customMenus':[{'menuName': '发送', 'menuType': 2}]},{'customCardDesc':'型 号:J3I/flutter ( 5432): SN码:YB1AAC224TCB01C0009','customCardName':'丁沛然-测试服','customCardThumbnail':'https://narwal-test-public.oss-cn-shenzhen.aliyuncs.com/default/1669257763153/J3.png','customMenus':[{'menuName': '发送', 'menuType': 2}]}],'isOpen':false,'showCustomCardAllMode':true},
// 'isShowTansfer': false,
// 'unWordsCount': 1,
// 'goods': [
// {
// 'name': '商品名称',
// 'pictureUrl':
// 'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png'
// },
// {
// 'name': '商品名称',
// 'pictureUrl':
// 'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png'
// }
// ]
// };
final result = await zhiChiSobot.startZhichi(params);
handleJson(result);
}
Future<void> openSobotHelpCenter() async {
var params = {
'app_key': 'dd0e991266a94723af14cc23cda5e1f1',
'api_host': 'https://test.sobot.com',
// 'isCustomLinkClick': true,
'show_permission_tips_pop': false,
'landscape_screen':false,
'partnerid': '123456789',
'user_nick': 'sobot123123123',
'user_name': '智齿jkhkjhk',
'user_tels': '18510002000',
'user_emails': '123@qq.com',
'qq': '123456789',
'remark': '好好学习,天天向上',
'params': {
'actionType': 'to_group',
'optionId': '4',
'deciId': 'a457f4dfe92842f8a11d1616c1c58dc1'
},
'service_mode': 0,
'title_type': 1,
'custom_title': '自定义标题',
'is_show_custom_title': true,
'is_show_custom_title_url': true,
'showNotification': true,
'isShowReturnTips': true,
'isShowClose': true,
'isShowCloseSatisfaction': true,
'isCloseAfterEvaluation': true,
'isOpenEvaluation': true,
'goodsTitle': '商品名字',
'goodsLabel': '30.5\$',
'goodsDesc': '商品描述',
'goodsImage':
'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png',
'goodsLink': 'https://home.firefoxchina.cn/',
'isSendInfoCard': true,
'orderStatus': 1,
'orderCode': 'v2131232132',
'autoSendOrderMessage': true,
'goodsCount': 2,
'totalFee': 3034,
'createTime': '1569491413000',
'goods': [
{
'name': '商品名称',
'pictureUrl':
'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png'
},
{
'name': '商品名称',
'pictureUrl':
'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png'
}
]
};
final result = zhiChiSobot.openSobotHelpCenter(params);
// result.then((value) => Map<String,Object>);
handleJson(result);
}
Future<void> openSobotHelpMallCenter() async {
var params = {
'app_key': 'dd0e991266a94723af14cc23cda5e1f1',
'api_host': '',
'isCustomLinkClick': true,
'partnerid': '123456789',
'user_nick': 'sobot123123123',
'user_name': '智齿jkhkjhk',
'user_tels': '18510002000',
'user_emails': '123@qq.com',
'qq': '123456789',
'remark': '好好学习,天天向上',
'params': {
'actionType': 'to_group',
'optionId': '4',
'deciId': 'a457f4dfe92842f8a11d1616c1c58dc1'
},
'isDebugMode': 1,
'service_mode': 0,
'title_type': 1,
'custom_title': '自定义标题',
'is_show_custom_title': true,
'is_show_custom_title_url': true,
'showNotification': true,
'isShowReturnTips': true,
'isShowClose': true,
'isShowCloseSatisfaction': true,
'isCloseAfterEvaluation': true,
'isOpenEvaluation': true,
'goodsTitle': '商品名字',
'goodsLabel': '30.5\$',
'goodsDesc': '商品描述',
'goodsImage':
'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png',
'goodsLink': 'https://home.firefoxchina.cn/',
'isSendInfoCard': true,
'orderStatus': 1,
'orderCode': 'v2131232132',
'autoSendOrderMessage': true,
'goodsCount': 2,
'totalFee': 3034,
'createTime': '1569491413000',
'goods': [
{
'name': '商品名称',
'pictureUrl':
'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png'
},
{
'name': '商品名称',
'pictureUrl':
'https://img.sobot.com/chatres/75574e5fa29a48458d1f57ab5489a4c5/msg/20200612/75574e5fa29a48458d1f57ab5489a4c5123456789/aae707c620744e92bb112de8b67cd3ed.png'
}
]
};
final result = zhiChiSobot.openSobotHelpMallCenter(params);
handleJson(result);
}
Future<void> closeSobotChat() async {
var params = {'isClosePush':true};
await zhiChiSobot.closeSobotChat(params);
}
Future<void> getUnReadMessage() async{
var params = {'partnerid':'123456789'};
final result = zhiChiSobot.getUnReadMessage(params);
handleJson(result);
}
// Future<void> messageLinkClic() async {
// var params = {'isClosePush':true};
// final result = await zhiChiSobot.messageLinkClic();
// handleJson(result);
// }
Future<void> closeIMCommectionAndRemoveObserver() async {
var params = {};
await zhiChiSobot.closeIMCommectionAndRemoveObserver(params);
}
Future<void> checkIMConnectedAndAddObserver() async {
var params = {};
await zhiChiSobot.checkIMConnectedAndAddObserver(params);
}
Future<void> handleJson(json) async {
print('ttttttttttttttttt----------');
print(json);
setState(() {
// newmesaage = json['type'];
});
}
}
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: ZCSobotWidge(),
);
}
}
abstract class NRBaseBuried with WidgetsBindingObserver{
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
switch(state){
case AppLifecycleState.inactive:
print("111111111111");
break;
case AppLifecycleState.resumed:
print("2222222222");
break;
case AppLifecycleState.paused:
print("333333333");
break;
case AppLifecycleState.detached:
print("44444444444444");
break;
}
super.didChangeAppLifecycleState(state);
}
}