opt live follow list

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-19 21:29:00 +08:00
parent d80324655e
commit 5bcd822251
2 changed files with 31 additions and 9 deletions

View File

@@ -2,12 +2,10 @@ import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dar
class CardDataItem { class CardDataItem {
List<CardLiveItem>? list; List<CardLiveItem>? list;
dynamic topView;
ExtraInfo? extraInfo; ExtraInfo? extraInfo;
CardDataItem({ CardDataItem({
this.list, this.list,
this.topView,
this.extraInfo, this.extraInfo,
}); });
@@ -15,7 +13,6 @@ class CardDataItem {
list: (json['list'] as List<dynamic>?) list: (json['list'] as List<dynamic>?)
?.map((e) => CardLiveItem.fromJson(e as Map<String, dynamic>)) ?.map((e) => CardLiveItem.fromJson(e as Map<String, dynamic>))
.toList(), .toList(),
topView: json['top_view'] as dynamic,
extraInfo: json['extra_info'] == null extraInfo: json['extra_info'] == null
? null ? null
: ExtraInfo.fromJson(json['extra_info'] as Map<String, dynamic>), : ExtraInfo.fromJson(json['extra_info'] as Map<String, dynamic>),

View File

@@ -255,19 +255,20 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
} }
List<Widget> _buildFollowList(ThemeData theme, LiveCardList item) { List<Widget> _buildFollowList(ThemeData theme, LiveCardList item) {
final totalCount = item.cardData?.myIdolV1?.extraInfo?.totalCount ?? 0;
return [ return [
SliverToBoxAdapter( SliverToBoxAdapter(
child: Padding( child: Padding(
padding: const .only(bottom: 8.0), padding: const .only(bottom: 8.0),
child: Row( child: Row(
mainAxisAlignment: .spaceBetween,
children: [ children: [
Text.rich( Text.rich(
TextSpan( TextSpan(
children: [ children: [
const TextSpan(text: '我的关注 '), const TextSpan(text: '我的关注 '),
TextSpan( TextSpan(
text: text: totalCount.toString(),
'${item.cardData?.myIdolV1?.extraInfo?.totalCount ?? 0}',
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
@@ -283,7 +284,6 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
], ],
), ),
), ),
const Spacer(),
moreTextButton( moreTextButton(
onTap: () => Get.to(const LiveFollowPage()), onTap: () => Get.to(const LiveFollowPage()),
color: theme.colorScheme.outline, color: theme.colorScheme.outline,
@@ -293,11 +293,16 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
), ),
), ),
if (item.cardData?.myIdolV1?.list case final list?) if (item.cardData?.myIdolV1?.list case final list?)
if (list.isNotEmpty) _buildFollowBody(theme, list), if (list.isNotEmpty) _buildFollowBody(theme, list, totalCount),
]; ];
} }
Widget _buildFollowBody(ThemeData theme, List<CardLiveItem> followList) { Widget _buildFollowBody(
ThemeData theme,
List<CardLiveItem> followList,
int totalCount,
) {
final listLength = followList.length;
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: SizedBox( child: SizedBox(
// 3+4+45+6+10+12*textScaler // 3+4+45+6+10+12*textScaler
@@ -308,8 +313,28 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
slivers: [ slivers: [
SliverFixedExtentList.builder( SliverFixedExtentList.builder(
itemExtent: 70, itemExtent: 70,
itemCount: followList.length, itemCount: totalCount > listLength ? listLength + 1 : listLength,
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index == listLength) {
return Align(
alignment: const Alignment(0, -0.3),
child: GestureDetector(
onTap: () => Get.to(const LiveFollowPage()),
child: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
shape: .circle,
color: theme.colorScheme.onInverseSurface,
),
child: Icon(
Icons.keyboard_arrow_right,
color: theme.colorScheme.onSurfaceVariant,
),
),
),
);
}
final item = followList[index]; final item = followList[index];
return Padding( return Padding(
padding: const .only(right: 5), padding: const .only(right: 5),