mirror of
https://github.com/TencentCloud/TIMSDK.git
synced 2026-10-22 01:06:31 +08:00
97 lines
2.8 KiB
Dart
97 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:im_api_example/im/conversationSelector.dart';
|
||
|
||
import 'package:im_api_example/im/messageSelector.dart';
|
||
import 'package:im_api_example/utils/sdkResponse.dart';
|
||
import 'package:tencent_im_sdk_plugin/models/v2_tim_callback.dart';
|
||
|
||
import 'package:tencent_im_sdk_plugin/tencent_im_sdk_plugin.dart';
|
||
import 'package:im_api_example/i18n/i18n_utils.dart';
|
||
|
||
class SetLocalCustomInt extends StatefulWidget {
|
||
@override
|
||
State<StatefulWidget> createState() => SetLocalCustomIntState();
|
||
}
|
||
|
||
class SetLocalCustomIntState extends State<SetLocalCustomInt> {
|
||
Map<String, dynamic>? resData;
|
||
List<String> receiver = List.empty(growable: true);
|
||
List<String> groupID = List.empty(growable: true);
|
||
int priority = 0;
|
||
bool onlineUserOnly = false;
|
||
bool isExcludedFromUnreadCount = false;
|
||
List<String> conversaions = List.empty(growable: true);
|
||
List<String> msgIDs = List.empty(growable: true);
|
||
setLocalCustomInt() async {
|
||
V2TimCallback res = await TencentImSDKPlugin.v2TIMManager
|
||
.getMessageManager()
|
||
.setLocalCustomInt(
|
||
msgID: msgIDs.first,
|
||
localCustomInt: 22,
|
||
);
|
||
setState(() {
|
||
resData = res.toJson();
|
||
});
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Container(
|
||
child: Column(
|
||
children: [
|
||
new Row(
|
||
children: [
|
||
ConversationSelector(
|
||
onSelect: (data) {
|
||
setState(() {
|
||
conversaions = data;
|
||
});
|
||
},
|
||
switchSelectType: true,
|
||
value: conversaions,
|
||
),
|
||
Expanded(
|
||
child: Container(
|
||
margin: EdgeInsets.only(left: 10),
|
||
child: Text(conversaions.length > 0
|
||
? conversaions.toString()
|
||
: imt("未选择")),
|
||
),
|
||
)
|
||
],
|
||
),
|
||
Row(
|
||
children: [
|
||
MessageSelector(
|
||
conversaions.isNotEmpty ? conversaions.first : "",
|
||
msgIDs,
|
||
(data) {
|
||
setState(() {
|
||
msgIDs = data;
|
||
});
|
||
},
|
||
),
|
||
Expanded(
|
||
child: Container(
|
||
margin: EdgeInsets.only(left: 12),
|
||
child: Text(msgIDs.toString()),
|
||
))
|
||
],
|
||
),
|
||
Row(
|
||
children: [
|
||
Expanded(
|
||
child: ElevatedButton(
|
||
onPressed: setLocalCustomInt,
|
||
child: Text(imt("本地修改消息(Int)")),
|
||
),
|
||
)
|
||
],
|
||
),
|
||
SDKResponse(resData),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
}
|