update flutter uikit to 1.6.1

This commit is contained in:
anonymous 2023-02-13 12:37:04 +08:00
parent c859e4e65c
commit c77c24e562
4 changed files with 60 additions and 34 deletions

View File

@ -1,3 +1,7 @@
## 1.6.1
* Fix: A bug of muting someone in a group.
* Fix: A bug on Flutter 3.7.0.
## 1.6.0 ## 1.6.0

View File

@ -325,8 +325,9 @@ class TUIGroupProfileModel extends ChangeNotifier {
return null; return null;
} }
Future<V2TimCallback?> muteGroupMember(String userID, bool isMute) async { Future<V2TimCallback?> muteGroupMember(
const muteTime = 31556926 * 10; String userID, bool isMute, int? serverTime) async {
final muteTime = serverTime != null ? serverTime + 9999 : 51556926 * 10;
final res = await _groupServices.muteGroupMember( final res = await _groupServices.muteGroupMember(
groupID: _groupID, userID: userID, seconds: isMute ? muteTime : 0); groupID: _groupID, userID: userID, seconds: isMute ? muteTime : 0);
if (res.code == 0) { if (res.code == 0) {

View File

@ -70,9 +70,19 @@ class GroupProfileGroupManagePage extends StatefulWidget {
class _GroupProfileGroupManagePageState class _GroupProfileGroupManagePageState
extends TIMUIKitState<GroupProfileGroupManagePage> { extends TIMUIKitState<GroupProfileGroupManagePage> {
int? serverTime;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
getServerTime();
}
void getServerTime() async {
final res = await TencentImSDKPlugin.v2TIMManager.getServerTime();
setState(() {
serverTime = res.data;
});
} }
@override @override
@ -228,7 +238,10 @@ class _GroupProfileGroupManagePageState
builder: (context) => GroupProfileAddAdmin( builder: (context) => GroupProfileAddAdmin(
appbarTitle: TIM_t("设置禁言"), appbarTitle: TIM_t("设置禁言"),
memberList: memberList.where((element) { memberList: memberList.where((element) {
final isMute = element?.muteUntil != 0; final isMute = (serverTime != null
? (element?.muteUntil ?? 0) >
serverTime!
: false);
final isMember = element!.role == final isMember = element!.role ==
GroupMemberRoleType GroupMemberRoleType
.V2TIM_GROUP_MEMBER_ROLE_MEMBER; .V2TIM_GROUP_MEMBER_ROLE_MEMBER;
@ -240,7 +253,7 @@ class _GroupProfileGroupManagePageState
for (var member in selectedMember) { for (var member in selectedMember) {
final userID = member!.userID; final userID = member!.userID;
widget.model widget.model
.muteGroupMember(userID, true); .muteGroupMember(userID, true, serverTime);
} }
} }
}, },
@ -249,14 +262,16 @@ class _GroupProfileGroupManagePageState
), ),
if (!isAllMuted) if (!isAllMuted)
...memberList ...memberList
.where((element) => element?.muteUntil != 0) .where((element) => (serverTime != null
? (element?.muteUntil ?? 0) > serverTime!
: false))
.map((e) => _buildListItem( .map((e) => _buildListItem(
context, context,
e!, e!,
ActionPane(motion: const DrawerMotion(), children: [ ActionPane(motion: const DrawerMotion(), children: [
SlidableAction( SlidableAction(
onPressed: (_) { onPressed: (_) {
widget.model.muteGroupMember(e.userID, false); widget.model.muteGroupMember(e.userID, false, serverTime);
}, },
flex: 1, flex: 1,
backgroundColor: theme.cautionColor ?? backgroundColor: theme.cautionColor ??
@ -292,35 +307,41 @@ Widget _buildListItem(BuildContext context, V2TimGroupMemberFullInfo memberInfo,
final theme = Provider.of<TUIThemeViewModel>(context).theme; final theme = Provider.of<TUIThemeViewModel>(context).theme;
return Container( return Container(
color: Colors.white, color: Colors.white,
child: Slidable( child: ListView.builder(
endActionPane: endActionPane, itemCount: 1,
child: Column(children: [ shrinkWrap: true,
ListTile( itemBuilder: (context, index){
tileColor: Colors.black, return Slidable(
leading: SizedBox( endActionPane: endActionPane,
width: 36, child: Column(children: [
height: 36, ListTile(
child: Avatar( tileColor: Colors.black,
faceUrl: memberInfo.faceUrl ?? "", leading: SizedBox(
showName: _getShowName(memberInfo), width: 36,
type: 2, height: 36,
child: Avatar(
faceUrl: memberInfo.faceUrl ?? "",
showName: _getShowName(memberInfo),
type: 2,
),
), ),
title: Row(
children: [
Text(_getShowName(memberInfo),
style: const TextStyle(fontSize: 16)),
],
),
onTap: () {},
), ),
title: Row( Divider(
children: [ thickness: 1,
Text(_getShowName(memberInfo), indent: 74,
style: const TextStyle(fontSize: 16)), endIndent: 0,
], color: theme.weakDividerColor,
), height: 0)
onTap: () {}, ]));
), })
Divider( );
thickness: 1,
indent: 74,
endIndent: 0,
color: theme.weakDividerColor,
height: 0)
])));
} }
/// ///

View File

@ -1,6 +1,6 @@
name: tencent_cloud_chat_uikit name: tencent_cloud_chat_uikit
description: Chat UI components library and basic chat business logic for Tencent Cloud Chat, helping you build In-APP Chat module easily. description: Chat UI components library and basic chat business logic for Tencent Cloud Chat, helping you build In-APP Chat module easily.
version: 1.6.0 version: 1.6.1
homepage: https://www.tencentcloud.com/products/im?from=pub homepage: https://www.tencentcloud.com/products/im?from=pub
repository: https://github.com/TencentCloud/chat-uikit-flutter repository: https://github.com/TencentCloud/chat-uikit-flutter
documentation: https://comm.qq.com/im/doc/flutter/en/TUIKit/readme.html documentation: https://comm.qq.com/im/doc/flutter/en/TUIKit/readme.html