Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-17 20:51:38 +08:00
parent 2e73688688
commit 53cf9d54c4

View File

@@ -7,7 +7,6 @@ import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart'; import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
import 'package:PiliPlus/common/widgets/pair.dart'; import 'package:PiliPlus/common/widgets/pair.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/common/image_type.dart';
import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dart'; import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dart';
import 'package:PiliPlus/models_new/live/live_feed_index/card_list.dart'; import 'package:PiliPlus/models_new/live/live_feed_index/card_list.dart';
import 'package:PiliPlus/pages/common/common_page.dart'; import 'package:PiliPlus/pages/common/common_page.dart';
@@ -88,84 +87,81 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
if (data.second?.cardData?.areaEntranceV3?.list case final list?) if (data.second?.cardData?.areaEntranceV3?.list case final list?)
if (list.isNotEmpty) if (list.isNotEmpty)
SliverToBoxAdapter( SliverToBoxAdapter(
child: Row( child: Padding(
children: [ padding: const .only(bottom: 8.0),
Expanded( child: Row(
child: SizedBox( children: [
// 20+10+14*textScaler Expanded(
height: 30.0 + textScaler.scale(14), child: SizedBox(
child: ListView.separated( // 10+14*textScaler
scrollDirection: Axis.horizontal, height: 10.0 + textScaler.scale(14),
separatorBuilder: (context, index) => child: ListView.separated(
const SizedBox(width: 12), scrollDirection: .horizontal,
padding: const EdgeInsets.only( padding: const .only(right: 8),
top: 10, physics: const AlwaysScrollableScrollPhysics(),
bottom: 10, separatorBuilder: (_, _) => const SizedBox(width: 12),
right: 12, itemBuilder: (context, index) {
late final item = list[index - 1];
return Obx(
() {
final isCurr =
index == controller.areaIndex.value;
return SearchText(
fontSize: 14,
height: 1,
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 5,
),
text: index == 0 ? '推荐' : '${item.title}',
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: null,
onTap: (value) {
controller.onSelectArea(
index,
index == 0 ? null : item,
);
},
);
},
);
},
itemCount: list.length + 1,
), ),
itemBuilder: (context, index) {
late final item = list[index - 1];
return Obx(
() {
final isCurr =
index == controller.areaIndex.value;
return SearchText(
fontSize: 14,
height: 1,
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 5,
),
text: index == 0 ? '推荐' : '${item.title}',
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: null,
onTap: (value) {
controller.onSelectArea(
index,
index == 0 ? null : item,
);
},
);
},
);
},
itemCount: list.length + 1,
), ),
), ),
), iconButton(
iconButton( size: 26,
size: 26, iconSize: 16,
iconSize: 16, context: context,
context: context, tooltip: '游戏赛事',
tooltip: '游戏赛事', icon: const Icon(Icons.gamepad),
icon: const Icon(Icons.gamepad), onPressed: () => Get.toNamed(
onPressed: () => Get.toNamed( '/webview',
'/webview', parameters: {
parameters: { 'uaType': 'mob',
'uaType': 'mob', 'url':
'url': 'https://www.bilibili.com/h5/match/data/home?navhide=1&${Utils.themeUrl(theme.brightness.isDark)}',
'https://www.bilibili.com/h5/match/data/home?navhide=1&${Utils.themeUrl(theme.brightness.isDark)}', },
}, ),
), ),
), const SizedBox(width: 8),
const SizedBox(width: 8), iconButton(
iconButton( size: 26,
size: 26, iconSize: 16,
iconSize: 16, context: context,
context: context, tooltip: '全部标签',
tooltip: '全部标签', icon: const Icon(Icons.widgets),
icon: const Icon(Icons.widgets), onPressed: () => Get.to(const LiveAreaPage()),
onPressed: () => Get.to(const LiveAreaPage()), ),
), ],
], ),
), ),
) ),
else
const SliverToBoxAdapter(child: SizedBox(height: 10)),
], ],
); );
} }
@@ -194,9 +190,10 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
// 8+10+13*textScaler // 8+10+13*textScaler
height: 18.0 + textScaler.scale(13), height: 18.0 + textScaler.scale(13),
child: ListView.separated( child: ListView.separated(
scrollDirection: Axis.horizontal, scrollDirection: .horizontal,
padding: const .only(bottom: 8),
separatorBuilder: (_, _) => const SizedBox(width: 12), separatorBuilder: (_, _) => const SizedBox(width: 12),
padding: const EdgeInsets.only(bottom: 8), physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
late final item = newTags[index]; late final item = newTags[index];
return Obx( return Obx(
@@ -260,36 +257,39 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
List<Widget> _buildFollowList(ThemeData theme, LiveCardList item) { List<Widget> _buildFollowList(ThemeData theme, LiveCardList item) {
return [ return [
SliverToBoxAdapter( SliverToBoxAdapter(
child: Row( child: Padding(
children: [ padding: const .only(bottom: 8.0),
Text.rich( child: Row(
TextSpan( children: [
children: [ Text.rich(
const TextSpan(text: '我的关注 '), TextSpan(
TextSpan( children: [
text: const TextSpan(text: '我的关注 '),
'${item.cardData?.myIdolV1?.extraInfo?.totalCount ?? 0}', TextSpan(
style: TextStyle( text:
fontSize: 13, '${item.cardData?.myIdolV1?.extraInfo?.totalCount ?? 0}',
color: theme.colorScheme.primary, style: TextStyle(
fontSize: 13,
color: theme.colorScheme.primary,
),
), ),
), TextSpan(
TextSpan( text: '人正在直播',
text: '人正在直播', style: TextStyle(
style: TextStyle( fontSize: 13,
fontSize: 13, color: theme.colorScheme.outline,
color: theme.colorScheme.outline, ),
), ),
), ],
], ),
), ),
), const Spacer(),
const Spacer(), moreTextButton(
moreTextButton( onTap: () => Get.to(const LiveFollowPage()),
onTap: () => Get.to(const LiveFollowPage()), color: theme.colorScheme.outline,
color: theme.colorScheme.outline, ),
), ],
], ),
), ),
), ),
if (item.cardData?.myIdolV1?.list case final list?) if (item.cardData?.myIdolV1?.list case final list?)
@@ -300,59 +300,61 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
Widget _buildFollowBody(ThemeData theme, List<CardLiveItem> followList) { Widget _buildFollowBody(ThemeData theme, List<CardLiveItem> followList) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: SizedBox( child: SizedBox(
// 8+4+4+45+4+12*textScaler // 3+4+45+6+10+12*textScaler
height: 65.0 + textScaler.scale(12), height: 68.0 + textScaler.scale(12),
child: CustomScrollView( child: CustomScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [ slivers: [
SliverFixedExtentList.builder( SliverFixedExtentList.builder(
itemExtent: 70, itemExtent: 70,
itemCount: followList.length, itemCount: followList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final item = followList[index]; final item = followList[index];
return SizedBox( return Padding(
width: 65, padding: const .only(right: 5),
child: GestureDetector( child: SizedBox(
behavior: HitTestBehavior.opaque, width: 65,
onTap: () => PageUtils.toLiveRoom(item.roomid), child: GestureDetector(
onLongPress: () { behavior: HitTestBehavior.opaque,
Feedback.forLongPress(context); onTap: () => PageUtils.toLiveRoom(item.roomid),
Get.toNamed('/member?mid=${item.uid}'); onLongPress: () {
}, Feedback.forLongPress(context);
onSecondaryTap: PlatformUtils.isMobile Get.toNamed('/member?mid=${item.uid}');
? null },
: () => Get.toNamed('/member?mid=${item.uid}'), onSecondaryTap: PlatformUtils.isMobile
child: Column( ? null
mainAxisSize: MainAxisSize.min, : () => Get.toNamed('/member?mid=${item.uid}'),
children: [ child: Column(
const SizedBox(height: 8), mainAxisSize: .min,
Container( children: [
margin: const EdgeInsets.all(2), Container(
padding: const EdgeInsets.all(2), padding: const .all(2),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
width: 1.5, width: 1.5,
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
strokeAlign: BorderSide.strokeAlignOutside, strokeAlign: BorderSide.strokeAlignInside,
),
shape: .circle,
),
child: NetworkImgLayer(
type: .avatar,
width: 45,
height: 45,
src: item.face,
), ),
shape: BoxShape.circle,
), ),
child: NetworkImgLayer( const SizedBox(height: 6),
type: ImageType.avatar, Text(
width: 45, item.uname!,
height: 45, maxLines: 1,
src: item.face, overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12, height: 1),
textAlign: TextAlign.center,
), ),
), ],
const SizedBox(height: 4), ),
Text(
item.uname!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12, height: 1),
textAlign: TextAlign.center,
),
],
), ),
), ),
); );