mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-21 08:38:37 +00:00
opt live follow list
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -2,12 +2,10 @@ import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dar
|
||||
|
||||
class CardDataItem {
|
||||
List<CardLiveItem>? list;
|
||||
dynamic topView;
|
||||
ExtraInfo? extraInfo;
|
||||
|
||||
CardDataItem({
|
||||
this.list,
|
||||
this.topView,
|
||||
this.extraInfo,
|
||||
});
|
||||
|
||||
@@ -15,7 +13,6 @@ class CardDataItem {
|
||||
list: (json['list'] as List<dynamic>?)
|
||||
?.map((e) => CardLiveItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
topView: json['top_view'] as dynamic,
|
||||
extraInfo: json['extra_info'] == null
|
||||
? null
|
||||
: ExtraInfo.fromJson(json['extra_info'] as Map<String, dynamic>),
|
||||
|
||||
@@ -255,19 +255,20 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
|
||||
}
|
||||
|
||||
List<Widget> _buildFollowList(ThemeData theme, LiveCardList item) {
|
||||
final totalCount = item.cardData?.myIdolV1?.extraInfo?.totalCount ?? 0;
|
||||
return [
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const .only(bottom: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: .spaceBetween,
|
||||
children: [
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
const TextSpan(text: '我的关注 '),
|
||||
TextSpan(
|
||||
text:
|
||||
'${item.cardData?.myIdolV1?.extraInfo?.totalCount ?? 0}',
|
||||
text: totalCount.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: theme.colorScheme.primary,
|
||||
@@ -283,7 +284,6 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
|
||||
],
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
moreTextButton(
|
||||
onTap: () => Get.to(const LiveFollowPage()),
|
||||
color: theme.colorScheme.outline,
|
||||
@@ -293,11 +293,16 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
|
||||
),
|
||||
),
|
||||
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(
|
||||
child: SizedBox(
|
||||
// 3+4+45+6+10+12*textScaler
|
||||
@@ -308,8 +313,28 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
|
||||
slivers: [
|
||||
SliverFixedExtentList.builder(
|
||||
itemExtent: 70,
|
||||
itemCount: followList.length,
|
||||
itemCount: totalCount > listLength ? listLength + 1 : listLength,
|
||||
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];
|
||||
return Padding(
|
||||
padding: const .only(right: 5),
|
||||
|
||||
Reference in New Issue
Block a user