mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
refa: whisper page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
||||
show ReplyInfo;
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/models/common/reply/reply_sort_type.dart';
|
||||
import 'package:PiliPlus/models/common/reply/reply_type.dart';
|
||||
@@ -454,7 +455,7 @@ class _ArticlePageState extends State<ArticlePage>
|
||||
() => PBadge(
|
||||
top: 12,
|
||||
right: paddingRight,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
text:
|
||||
'${_articleCtr.topIndex.value + 1}/$length'),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -61,7 +62,7 @@ class BangumiCardV extends StatelessWidget {
|
||||
text: bangumiItem.renewalTime,
|
||||
bottom: 6,
|
||||
left: 6,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
)
|
||||
else if (bangumiItem.order != null)
|
||||
PBadge(
|
||||
@@ -70,7 +71,7 @@ class BangumiCardV extends StatelessWidget {
|
||||
right: null,
|
||||
bottom: 6,
|
||||
left: 6,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -55,7 +56,7 @@ class BangumiCardVPgcIndex extends StatelessWidget {
|
||||
right: null,
|
||||
bottom: 6,
|
||||
left: 6,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/bangumi/pgc_timeline/episode.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -53,7 +54,7 @@ class BangumiCardVTimeline extends StatelessWidget {
|
||||
text: '${item.pubTime}',
|
||||
left: 6,
|
||||
bottom: 6,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/rich_node_panel.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
@@ -92,7 +93,7 @@ Widget liveRcmdPanel(
|
||||
text: watchedShow?['text_large'],
|
||||
top: 6,
|
||||
right: 56,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
PBadge(
|
||||
text: liveStatus == 1 ? '直播中' : '直播结束',
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/rich_node_panel.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -77,7 +78,9 @@ Widget videoSeasonWidget(
|
||||
right: 10.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
type: content.badge!['text'] == '充电专属' ? 'error' : 'primary',
|
||||
type: content.badge!['text'] == '充电专属'
|
||||
? PBadgeType.error
|
||||
: PBadgeType.primary,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/bangumi/info.dart' as bangumi;
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/episode_panel_type.dart';
|
||||
import 'package:PiliPlus/models/video_detail_res.dart' as video;
|
||||
import 'package:PiliPlus/pages/common/common_slide_page.dart';
|
||||
@@ -428,7 +429,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
|
||||
text: Utils.timeFormat(duration),
|
||||
right: 6.0,
|
||||
bottom: 6.0,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -70,7 +70,7 @@ class FavPgcItem extends StatelessWidget {
|
||||
right: 4,
|
||||
top: 4,
|
||||
text: item.badge,
|
||||
fs: 10,
|
||||
fontSize: 10,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 2,
|
||||
vertical: 1,
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/user/fav_detail.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
@@ -107,7 +108,7 @@ class FavVideoCardH extends StatelessWidget {
|
||||
text: Utils.timeFormat(videoItem.duration),
|
||||
right: 6.0,
|
||||
bottom: 6.0,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
PBadge(
|
||||
text: videoItem.ogv?['type_name'],
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:PiliPlus/common/widgets/progress_bar/video_progress_indicator.da
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/history_business_type.dart';
|
||||
import 'package:PiliPlus/models/user/history.dart';
|
||||
import 'package:PiliPlus/pages/common/multi_select_controller.dart';
|
||||
@@ -153,7 +154,7 @@ class HistoryItem extends StatelessWidget {
|
||||
: '${Utils.timeFormat(videoItem.progress)}/${Utils.timeFormat(videoItem.duration!)}',
|
||||
right: 6.0,
|
||||
bottom: 8.0,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
// 右上角
|
||||
if (HistoryBusinessType.showBadge
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/member/coin.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
@@ -67,7 +68,7 @@ class MemberCoinsItem extends StatelessWidget {
|
||||
PBadge(
|
||||
bottom: 6,
|
||||
right: 6,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
text: Utils.timeFormat(coinItem.duration),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/space_fav/list.dart';
|
||||
import 'package:PiliPlus/models/user/sub_folder.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -89,8 +90,8 @@ class MemberFavItem extends StatelessWidget {
|
||||
right: 3,
|
||||
bottom: 3,
|
||||
text: '合集',
|
||||
bold: false,
|
||||
size: 'small',
|
||||
isBold: false,
|
||||
size: PBadgeSize.small,
|
||||
)
|
||||
else if (item.type == 0 || item.type == 11)
|
||||
Positioned(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/search_type.dart';
|
||||
import 'package:PiliPlus/models/user/sub_detail.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
@@ -68,7 +69,7 @@ class SubVideoCardH extends StatelessWidget {
|
||||
text: Utils.timeFormat(videoItem.duration!),
|
||||
right: 6.0,
|
||||
bottom: 6.0,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/video/later.dart';
|
||||
import 'package:PiliPlus/pages/common/common_collapse_slide_page.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -206,7 +207,7 @@ class _MediaListPanelState
|
||||
text: Utils.timeFormat(item.duration!),
|
||||
right: 6.0,
|
||||
bottom: 6.0,
|
||||
type: 'gray',
|
||||
type: PBadgeType.gray,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
||||
show ReplyInfo, ReplyControl, Content;
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/vote.dart';
|
||||
import 'package:PiliPlus/pages/save_panel/view.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
@@ -219,9 +220,9 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
if (replyItem.mid == upMid)
|
||||
const PBadge(
|
||||
text: 'UP',
|
||||
size: 'small',
|
||||
stack: 'normal',
|
||||
fs: 9,
|
||||
size: PBadgeSize.small,
|
||||
isStack: false,
|
||||
fontSize: 9,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -290,11 +291,10 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
alignment: PlaceholderAlignment.top,
|
||||
child: PBadge(
|
||||
text: 'TOP',
|
||||
size: 'small',
|
||||
stack: 'normal',
|
||||
type: 'line',
|
||||
fs: 9,
|
||||
semanticsLabel: '置顶',
|
||||
size: PBadgeSize.small,
|
||||
isStack: false,
|
||||
type: PBadgeType.line_primary,
|
||||
fontSize: 9,
|
||||
textScaleFactor: 1,
|
||||
),
|
||||
),
|
||||
@@ -503,9 +503,9 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: PBadge(
|
||||
text: 'UP',
|
||||
size: 'small',
|
||||
stack: 'normal',
|
||||
fs: 9,
|
||||
size: PBadgeSize.small,
|
||||
isStack: false,
|
||||
fontSize: 9,
|
||||
textScaleFactor: 1,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
import 'package:PiliPlus/grpc/bilibili/app/im/v1.pb.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/msg.dart';
|
||||
import 'package:PiliPlus/models/msg/account.dart';
|
||||
import 'package:PiliPlus/models/msg/msgfeed_unread.dart';
|
||||
import 'package:PiliPlus/models/msg/session.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:protobuf/protobuf.dart' show PbMap;
|
||||
|
||||
class WhisperController
|
||||
extends CommonListController<List<SessionList>?, SessionList> {
|
||||
extends CommonListController<SessionMainReply, Session> {
|
||||
late final List msgFeedTopItems;
|
||||
late final RxList<int> unreadCounts;
|
||||
|
||||
int? endTs;
|
||||
PbMap<int, Offset>? offset;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -65,37 +64,20 @@ class WhisperController
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<List<SessionList>?>> customGetData() =>
|
||||
MsgHttp.sessionList(endTs: endTs);
|
||||
|
||||
@override
|
||||
bool customHandleResponse(
|
||||
bool isRefresh, Success<List<SessionList>?> response) {
|
||||
endTs = response.response?.lastOrNull?.sessionTs;
|
||||
List<SessionList>? dataList = response.response;
|
||||
if (dataList.isNullOrEmpty) {
|
||||
isEnd = true;
|
||||
if (isRefresh) {
|
||||
loadingState.value = LoadingState<List<SessionList>?>.success(dataList);
|
||||
}
|
||||
isLoading = false;
|
||||
return true;
|
||||
}
|
||||
queryAccountList(dataList!).then((_) {
|
||||
if (isRefresh) {
|
||||
loadingState.value = LoadingState<List<SessionList>?>.success(dataList);
|
||||
} else if (loadingState.value is Success) {
|
||||
loadingState.value.data!.addAll(dataList);
|
||||
loadingState.refresh();
|
||||
}
|
||||
});
|
||||
return true;
|
||||
List<Session>? getDataList(SessionMainReply response) {
|
||||
offset = response.paginationParams.offsets;
|
||||
isEnd = !response.paginationParams.hasMore;
|
||||
return response.sessions;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<SessionMainReply>> customGetData() =>
|
||||
MsgHttp.sessionMain(offset: offset);
|
||||
|
||||
@override
|
||||
Future<void> onRefresh() {
|
||||
offset = null;
|
||||
queryMsgFeedUnread();
|
||||
endTs = null;
|
||||
return super.onRefresh();
|
||||
}
|
||||
|
||||
@@ -116,11 +98,10 @@ class WhisperController
|
||||
opType: isTop ? 1 : 0,
|
||||
);
|
||||
if (res['status']) {
|
||||
List<SessionList> list = (loadingState.value as Success).response;
|
||||
list[index].topTs = isTop ? 0 : 1;
|
||||
List<Session> list = (loadingState.value as Success).response;
|
||||
list[index].isPinned = isTop ? false : true;
|
||||
if (!isTop) {
|
||||
SessionList item = list.removeAt(index);
|
||||
list.insert(0, item);
|
||||
list.insert(0, list.removeAt(index));
|
||||
}
|
||||
loadingState.refresh();
|
||||
SmartDialog.showToast('${isTop ? '移除' : ''}置顶成功');
|
||||
@@ -130,26 +111,10 @@ class WhisperController
|
||||
}
|
||||
|
||||
void onTap(int index) {
|
||||
List<SessionList> list = (loadingState.value as Success).response;
|
||||
list[index].unreadCount = 0;
|
||||
loadingState.refresh();
|
||||
}
|
||||
|
||||
Future queryAccountList(List<SessionList> sessionList) async {
|
||||
List<int?> midsList = sessionList.map((e) => e.talkerId).toList();
|
||||
var res = await MsgHttp.accountList(midsList.join(','));
|
||||
if (res['status']) {
|
||||
List<AccountListModel> accountList = res['data'];
|
||||
Map<int, AccountListModel> accountMap = {};
|
||||
for (AccountListModel item in accountList) {
|
||||
accountMap[item.mid!] = item;
|
||||
}
|
||||
for (SessionList item in sessionList) {
|
||||
AccountListModel? accountInfo = accountMap[item.talkerId];
|
||||
if (accountInfo != null) {
|
||||
item.accountInfo = accountInfo;
|
||||
}
|
||||
}
|
||||
Session item = loadingState.value.data![index];
|
||||
if (item.hasUnread()) {
|
||||
item.clearUnread();
|
||||
loadingState.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:PiliPlus/common/skeleton/whisper_item.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/grpc/bilibili/app/im/v1.pb.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/msg/session.dart';
|
||||
import 'package:PiliPlus/pages/whisper/controller.dart';
|
||||
import 'package:PiliPlus/pages/whisper/widgets/item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -38,7 +38,7 @@ class _WhisperPageState extends State<WhisperPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState<List<SessionList>?> loadingState) {
|
||||
Widget _buildBody(LoadingState<List<Session>?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => SliverList.builder(
|
||||
itemCount: 12,
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/msg/session.dart';
|
||||
import 'package:PiliPlus/grpc/bilibili/app/im/v1.pb.dart'
|
||||
show Session, UnreadStyle;
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -13,32 +19,19 @@ class WhisperSessionItem extends StatelessWidget {
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final SessionList item;
|
||||
final Session item;
|
||||
final Function(bool isTop, int? talkerId) onSetTop;
|
||||
final ValueChanged<int?> onRemove;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dynamic content = item.lastMsg?.content;
|
||||
Map? vipInfo = item.sessionInfo.hasVipInfo()
|
||||
? jsonDecode(item.sessionInfo.vipInfo)
|
||||
: null;
|
||||
final ThemeData theme = Theme.of(context);
|
||||
if (content == null || content == "") {
|
||||
content = '不支持的消息类型';
|
||||
} else {
|
||||
dynamic msg = content['text'] ??
|
||||
content['content'] ??
|
||||
content['title'] ??
|
||||
content['reply_content'];
|
||||
if (msg == null) {
|
||||
if (content['imageType'] != null) {
|
||||
msg = '[图片消息]';
|
||||
}
|
||||
}
|
||||
content = msg ?? content.toString();
|
||||
}
|
||||
|
||||
return ListTile(
|
||||
tileColor: item.topTs == 0 ? null : theme.colorScheme.onInverseSurface,
|
||||
tileColor: item.isPinned ? theme.colorScheme.onInverseSurface : null,
|
||||
onLongPress: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -53,10 +46,13 @@ class WhisperSessionItem extends StatelessWidget {
|
||||
dense: true,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
onSetTop(item.topTs != 0, item.talkerId);
|
||||
onSetTop(
|
||||
item.isPinned,
|
||||
item.id.privateId.talkerUid.toInt(),
|
||||
);
|
||||
},
|
||||
title: Text(
|
||||
item.topTs == 0 ? '置顶' : '移除置顶',
|
||||
item.isPinned ? '移除置顶' : '置顶',
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
),
|
||||
@@ -64,7 +60,7 @@ class WhisperSessionItem extends StatelessWidget {
|
||||
dense: true,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
onRemove(item.talkerId);
|
||||
onRemove(item.id.privateId.talkerUid.toInt());
|
||||
},
|
||||
title: const Text(
|
||||
'删除',
|
||||
@@ -82,11 +78,12 @@ class WhisperSessionItem extends StatelessWidget {
|
||||
Get.toNamed(
|
||||
'/whisperDetail',
|
||||
parameters: {
|
||||
'talkerId': '${item.talkerId}',
|
||||
'name': item.accountInfo?.name ?? '',
|
||||
'face': item.accountInfo?.face ?? '',
|
||||
if (item.accountInfo?.mid != null)
|
||||
'mid': '${item.accountInfo?.mid}',
|
||||
'talkerId': item.id.privateId.talkerUid.toString(),
|
||||
'name': item.sessionInfo.sessionName,
|
||||
'face': item.sessionInfo.avatar.fallbackLayers.layers.first.resource
|
||||
.resImage.imageSrc.remote.url,
|
||||
if (item.sessionInfo.avatar.hasMid())
|
||||
'mid': item.sessionInfo.avatar.mid.toString(),
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -96,19 +93,23 @@ class WhisperSessionItem extends StatelessWidget {
|
||||
width: 45,
|
||||
height: 45,
|
||||
type: 'avatar',
|
||||
src: item.accountInfo?.face ?? "",
|
||||
src: item.sessionInfo.avatar.fallbackLayers.layers.first
|
||||
.resource.resImage.imageSrc.remote.url,
|
||||
);
|
||||
return GestureDetector(
|
||||
onTap: item.accountInfo?.mid != null
|
||||
onTap: item.sessionInfo.avatar.hasMid()
|
||||
? () {
|
||||
Get.toNamed(
|
||||
'/member?mid=${item.accountInfo!.mid}',
|
||||
'/member?mid=${item.sessionInfo.avatar.mid}',
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: item.unreadCount != null && item.unreadCount! > 0
|
||||
child: item.hasUnread() &&
|
||||
item.unread.style != UnreadStyle.UNREAD_STYLE_NONE
|
||||
? Badge(
|
||||
label: Text(" ${item.unreadCount} "),
|
||||
label: item.unread.style == UnreadStyle.UNREAD_STYLE_NUMBER
|
||||
? Text(" ${item.unread.number} ")
|
||||
: null,
|
||||
alignment: Alignment.topRight,
|
||||
child: buildAvatar(),
|
||||
)
|
||||
@@ -116,17 +117,45 @@ class WhisperSessionItem extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
title: Text(item.accountInfo?.name ?? ""),
|
||||
title: Row(
|
||||
children: [
|
||||
Text(
|
||||
item.sessionInfo.sessionName,
|
||||
style: TextStyle(
|
||||
color: vipInfo?['status'] != null &&
|
||||
vipInfo!['status'] > 0 &&
|
||||
vipInfo['type'] == 2
|
||||
? context.vipColor
|
||||
: null,
|
||||
),
|
||||
),
|
||||
if (item.sessionInfo.userLabel.style.borderedLabel.hasText()) ...[
|
||||
const SizedBox(width: 5),
|
||||
PBadge(
|
||||
isStack: false,
|
||||
type: PBadgeType.line_secondary,
|
||||
fontSize: 10,
|
||||
isBold: false,
|
||||
text: item.sessionInfo.userLabel.style.borderedLabel.text,
|
||||
),
|
||||
],
|
||||
if (item.sessionInfo.isLive) ...[
|
||||
const SizedBox(width: 5),
|
||||
Image.asset('assets/images/live/live.gif', height: 15),
|
||||
],
|
||||
],
|
||||
),
|
||||
subtitle: Text(
|
||||
'$content',
|
||||
item.msgSummary.rawMsg,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.labelMedium!
|
||||
.copyWith(color: theme.colorScheme.outline),
|
||||
),
|
||||
trailing: item.lastMsg?.timestamp != null
|
||||
trailing: item.hasTimestamp()
|
||||
? Text(
|
||||
Utils.dateFormat(item.lastMsg!.timestamp, formatType: "day"),
|
||||
Utils.dateFormat((item.timestamp ~/ 1000000).toInt(),
|
||||
formatType: "day"),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.outline,
|
||||
|
||||
Reference in New Issue
Block a user