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/pair.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_list.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 (list.isNotEmpty)
SliverToBoxAdapter(
child: Row(
children: [
Expanded(
child: SizedBox(
// 20+10+14*textScaler
height: 30.0 + textScaler.scale(14),
child: ListView.separated(
scrollDirection: Axis.horizontal,
separatorBuilder: (context, index) =>
const SizedBox(width: 12),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
right: 12,
child: Padding(
padding: const .only(bottom: 8.0),
child: Row(
children: [
Expanded(
child: SizedBox(
// 10+14*textScaler
height: 10.0 + textScaler.scale(14),
child: ListView.separated(
scrollDirection: .horizontal,
padding: const .only(right: 8),
physics: const AlwaysScrollableScrollPhysics(),
separatorBuilder: (_, _) => const SizedBox(width: 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(
size: 26,
iconSize: 16,
context: context,
tooltip: '游戏赛事',
icon: const Icon(Icons.gamepad),
onPressed: () => Get.toNamed(
'/webview',
parameters: {
'uaType': 'mob',
'url':
'https://www.bilibili.com/h5/match/data/home?navhide=1&${Utils.themeUrl(theme.brightness.isDark)}',
},
iconButton(
size: 26,
iconSize: 16,
context: context,
tooltip: '游戏赛事',
icon: const Icon(Icons.gamepad),
onPressed: () => Get.toNamed(
'/webview',
parameters: {
'uaType': 'mob',
'url':
'https://www.bilibili.com/h5/match/data/home?navhide=1&${Utils.themeUrl(theme.brightness.isDark)}',
},
),
),
),
const SizedBox(width: 8),
iconButton(
size: 26,
iconSize: 16,
context: context,
tooltip: '全部标签',
icon: const Icon(Icons.widgets),
onPressed: () => Get.to(const LiveAreaPage()),
),
],
const SizedBox(width: 8),
iconButton(
size: 26,
iconSize: 16,
context: context,
tooltip: '全部标签',
icon: const Icon(Icons.widgets),
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
height: 18.0 + textScaler.scale(13),
child: ListView.separated(
scrollDirection: Axis.horizontal,
scrollDirection: .horizontal,
padding: const .only(bottom: 8),
separatorBuilder: (_, _) => const SizedBox(width: 12),
padding: const EdgeInsets.only(bottom: 8),
physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
late final item = newTags[index];
return Obx(
@@ -260,36 +257,39 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
List<Widget> _buildFollowList(ThemeData theme, LiveCardList item) {
return [
SliverToBoxAdapter(
child: Row(
children: [
Text.rich(
TextSpan(
children: [
const TextSpan(text: '我的关注 '),
TextSpan(
text:
'${item.cardData?.myIdolV1?.extraInfo?.totalCount ?? 0}',
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.primary,
child: Padding(
padding: const .only(bottom: 8.0),
child: Row(
children: [
Text.rich(
TextSpan(
children: [
const TextSpan(text: '我的关注 '),
TextSpan(
text:
'${item.cardData?.myIdolV1?.extraInfo?.totalCount ?? 0}',
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.primary,
),
),
),
TextSpan(
text: '人正在直播',
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
TextSpan(
text: '人正在直播',
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
),
),
),
],
],
),
),
),
const Spacer(),
moreTextButton(
onTap: () => Get.to(const LiveFollowPage()),
color: theme.colorScheme.outline,
),
],
const Spacer(),
moreTextButton(
onTap: () => Get.to(const LiveFollowPage()),
color: theme.colorScheme.outline,
),
],
),
),
),
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) {
return SliverToBoxAdapter(
child: SizedBox(
// 8+4+4+45+4+12*textScaler
height: 65.0 + textScaler.scale(12),
// 3+4+45+6+10+12*textScaler
height: 68.0 + textScaler.scale(12),
child: CustomScrollView(
scrollDirection: Axis.horizontal,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
SliverFixedExtentList.builder(
itemExtent: 70,
itemCount: followList.length,
itemBuilder: (context, index) {
final item = followList[index];
return SizedBox(
width: 65,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => PageUtils.toLiveRoom(item.roomid),
onLongPress: () {
Feedback.forLongPress(context);
Get.toNamed('/member?mid=${item.uid}');
},
onSecondaryTap: PlatformUtils.isMobile
? null
: () => Get.toNamed('/member?mid=${item.uid}'),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8),
Container(
margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
border: Border.all(
width: 1.5,
color: theme.colorScheme.primary,
strokeAlign: BorderSide.strokeAlignOutside,
return Padding(
padding: const .only(right: 5),
child: SizedBox(
width: 65,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => PageUtils.toLiveRoom(item.roomid),
onLongPress: () {
Feedback.forLongPress(context);
Get.toNamed('/member?mid=${item.uid}');
},
onSecondaryTap: PlatformUtils.isMobile
? null
: () => Get.toNamed('/member?mid=${item.uid}'),
child: Column(
mainAxisSize: .min,
children: [
Container(
padding: const .all(2),
decoration: BoxDecoration(
border: Border.all(
width: 1.5,
color: theme.colorScheme.primary,
strokeAlign: BorderSide.strokeAlignInside,
),
shape: .circle,
),
child: NetworkImgLayer(
type: .avatar,
width: 45,
height: 45,
src: item.face,
),
shape: BoxShape.circle,
),
child: NetworkImgLayer(
type: ImageType.avatar,
width: 45,
height: 45,
src: item.face,
const SizedBox(height: 6),
Text(
item.uname!,
maxLines: 1,
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,
),
],
],
),
),
),
);