mirror of
https://github.com/TencentCloud/TIMSDK.git
synced 2026-10-22 01:06:31 +08:00
65 lines
1.8 KiB
Dart
65 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:im_api_example/utils/sdkResponse.dart';
|
|
import 'package:tencent_im_sdk_plugin/tencent_im_sdk_plugin.dart';
|
|
import 'package:im_api_example/i18n/i18n_utils.dart';
|
|
|
|
class CallExperimentalAPI extends StatefulWidget {
|
|
@override
|
|
State<StatefulWidget> createState() => CallExperimentalAPIState();
|
|
}
|
|
|
|
class CallExperimentalAPIState extends State<CallExperimentalAPI> {
|
|
var resData;
|
|
String username = '';
|
|
List<String> users = List.empty(growable: true);
|
|
sendC2CTextMessage() async {
|
|
var res = await TencentImSDKPlugin.v2TIMManager.callExperimentalAPI(
|
|
api: "initLocalStorage",
|
|
param: username,
|
|
);
|
|
|
|
setState(() {
|
|
resData = res.toJson();
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
child: Column(
|
|
children: [
|
|
Form(
|
|
child: Column(
|
|
children: <Widget>[
|
|
TextField(
|
|
decoration: InputDecoration(
|
|
labelText: imt("请输入用户名"),
|
|
hintText: imt("调用实验性接口:初始化本地数据库(您可以在SDK中自行尝试其他接口)"),
|
|
prefixIcon: Icon(Icons.person),
|
|
),
|
|
onChanged: (res) {
|
|
setState(() {
|
|
username = res;
|
|
});
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ElevatedButton(
|
|
onPressed: sendC2CTextMessage,
|
|
child: Text(imt("调用实验性接口")),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SDKResponse(resData),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|