Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-23 16:47:11 +08:00
parent 148e0872b4
commit 418a1e8d39
821 changed files with 29467 additions and 25520 deletions

View File

@@ -15,7 +15,7 @@ class WhisperController extends CommonWhisperController<SessionMainReply> {
SessionPageType sessionPageType = SessionPageType.SESSION_PAGE_TYPE_HOME;
late final List<({bool enabled, IconData icon, String name, String route})>
msgFeedTopItems;
msgFeedTopItems;
late final RxList<int> unreadCounts;
PbMap<int, Offset>? offset;
@@ -79,7 +79,9 @@ class WhisperController extends CommonWhisperController<SessionMainReply> {
@override
bool customHandleResponse(
bool isRefresh, Success<SessionMainReply> response) {
bool isRefresh,
Success<SessionMainReply> response,
) {
if (isRefresh) {
threeDotItems.value = response.response.threeDotItems;
outsideItem.value = response.response.outsideItem;

View File

@@ -30,16 +30,17 @@ class _WhisperPageState extends State<WhisperPage> {
final outsideItem = _controller.outsideItem.value;
if (outsideItem?.isNotEmpty == true) {
return Row(
children: outsideItem!.map((e) {
return IconButton(
tooltip: e.hasTitle() ? e.title : null,
onPressed: () => e.type.action(
context: context,
controller: _controller,
),
icon: e.type.icon,
);
}).toList());
children: outsideItem!.map((e) {
return IconButton(
tooltip: e.hasTitle() ? e.title : null,
onPressed: () => e.type.action(
context: context,
controller: _controller,
),
icon: e.type.icon,
);
}).toList(),
);
}
return const SizedBox.shrink();
}),
@@ -49,18 +50,20 @@ class _WhisperPageState extends State<WhisperPage> {
return PopupMenuButton(
itemBuilder: (context) {
return threeDotItems!
.map((e) => PopupMenuItem(
onTap: () => e.type.action(
context: context,
controller: _controller,
),
child: Row(
children: [
e.type.icon,
Text(' ${e.title}'),
],
),
))
.map(
(e) => PopupMenuItem(
onTap: () => e.type.action(
context: context,
controller: _controller,
),
child: Row(
children: [
e.type.icon,
Text(' ${e.title}'),
],
),
),
)
.toList();
},
);
@@ -96,37 +99,39 @@ class _WhisperPageState extends State<WhisperPage> {
);
return switch (loadingState) {
Loading() => SliverList.builder(
itemCount: 12,
itemBuilder: (context, index) {
return const WhisperItemSkeleton();
},
),
Success(:var response) => response?.isNotEmpty == true
? SliverList.separated(
itemCount: response!.length,
itemBuilder: (context, index) {
if (index == response.length - 1) {
_controller.onLoadMore();
}
final item = response[index];
return WhisperSessionItem(
item: item,
onSetTop: (isTop, id) =>
_controller.onSetTop(item, index, isTop, id),
onSetMute: (isMuted, talkerUid) =>
_controller.onSetMute(item, isMuted, talkerUid),
onRemove: (talkerId) => _controller.onRemove(index, talkerId),
);
},
separatorBuilder: (context, index) => divider,
)
: HttpError(
onReload: _controller.onReload,
),
itemCount: 12,
itemBuilder: (context, index) {
return const WhisperItemSkeleton();
},
),
Success(:var response) =>
response?.isNotEmpty == true
? SliverList.separated(
itemCount: response!.length,
itemBuilder: (context, index) {
if (index == response.length - 1) {
_controller.onLoadMore();
}
final item = response[index];
return WhisperSessionItem(
item: item,
onSetTop: (isTop, id) =>
_controller.onSetTop(item, index, isTop, id),
onSetMute: (isMuted, talkerUid) =>
_controller.onSetMute(item, isMuted, talkerUid),
onRemove: (talkerId) =>
_controller.onRemove(index, talkerId),
);
},
separatorBuilder: (context, index) => divider,
)
: HttpError(
onReload: _controller.onReload,
),
Error(:var errMsg) => HttpError(
errMsg: errMsg,
onReload: _controller.onReload,
),
errMsg: errMsg,
onReload: _controller.onReload,
),
};
}

View File

@@ -35,16 +35,17 @@ class WhisperSessionItem extends StatelessWidget {
final avatar = resource.hasResImage()
? resource.resImage.imageSrc.remote.url
: resource.hasResAnimation()
? resource.resAnimation.webpSrc.remote.url
: resource.resNativeDraw.drawSrc.remote.url;
? resource.resAnimation.webpSrc.remote.url
: resource.resNativeDraw.drawSrc.remote.url;
Map? vipInfo = item.sessionInfo.hasVipInfo()
? jsonDecode(item.sessionInfo.vipInfo)
: null;
final ThemeData theme = Theme.of(context);
return ListTile(
tileColor: item.isPinned
? theme.colorScheme.onInverseSurface
.withValues(alpha: Get.isDarkMode ? 0.4 : 0.8)
? theme.colorScheme.onInverseSurface.withValues(
alpha: Get.isDarkMode ? 0.4 : 0.8,
)
: null,
onLongPress: () => showDialog(
context: context,
@@ -155,13 +156,20 @@ class WhisperSessionItem extends StatelessWidget {
final pendant = item.sessionInfo.avatar.fallbackLayers.layers
.getOrNull(1)
?.resource;
final offcial = item.sessionInfo.avatar.fallbackLayers.layers
.lastOrNull?.resource.resImage.imageSrc;
final offcial = item
.sessionInfo
.avatar
.fallbackLayers
.layers
.lastOrNull
?.resource
.resImage
.imageSrc;
return GestureDetector(
onTap: item.sessionInfo.avatar.hasMid()
? () =>
Get.toNamed('/member?mid=${item.sessionInfo.avatar.mid}')
Get.toNamed('/member?mid=${item.sessionInfo.avatar.mid}')
: null,
child: PendantAvatar(
size: 42,
@@ -169,8 +177,8 @@ class WhisperSessionItem extends StatelessWidget {
avatar: avatar,
garbPendantImage:
pendant?.resImage.imageSrc.remote.hasUrl() == true
? pendant!.resImage.imageSrc.remote.url
: pendant?.resAnimation.webpSrc.remote.url,
? pendant!.resImage.imageSrc.remote.url
: pendant?.resAnimation.webpSrc.remote.url,
isVip: vipInfo?['status'] != null && vipInfo!['status'] > 0,
officialType: offcial?.hasLocalValue() == true
? switch (offcial!.localValue) {
@@ -197,7 +205,8 @@ class WhisperSessionItem extends StatelessWidget {
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 15,
color: vipInfo?['status'] != null &&
color:
vipInfo?['status'] != null &&
vipInfo!['status'] > 0 &&
vipInfo['type'] == 2
? context.vipColor
@@ -240,8 +249,9 @@ class WhisperSessionItem extends StatelessWidget {
item.msgSummary.rawMsg,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.labelMedium!
.copyWith(color: theme.colorScheme.outline),
style: theme.textTheme.labelMedium!.copyWith(
color: theme.colorScheme.outline,
),
),
),
if (item.isMuted)
@@ -256,7 +266,7 @@ class WhisperSessionItem extends StatelessWidget {
label: item.unread.style == UnreadStyle.UNREAD_STYLE_NUMBER
? Text(item.unread.number.toString())
: null,
)
),
],
),
);