Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-06-26 16:34:02 +08:00
parent a623ceee47
commit 7049e5c63a
23 changed files with 71 additions and 116 deletions

View File

@@ -36,7 +36,7 @@ class DownloadDetailPage extends StatefulWidget {
}
class _DownloadDetailPageState extends State<DownloadDetailPage>
with BaseMultiSelectMixin<BiliDownloadEntryInfo> {
with BaseMultiSelectMixin<BiliDownloadEntryInfo>, GridMixin {
StreamSubscription? _sub;
final _downloadItems = RxList<BiliDownloadEntryInfo>();
final _controller = Get.find<DownloadPageController>();
@@ -149,11 +149,7 @@ class _DownloadDetailPageState extends State<DownloadDetailPage>
sliver: Obx(() {
if (_downloadItems.isNotEmpty) {
return SliverGrid.builder(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
mainAxisSpacing: 2,
mainAxisExtent: 100,
maxCrossAxisExtent: Grid.smallCardWidth * 2,
),
gridDelegate: gridDelegate,
itemBuilder: (context, index) {
final entry = _downloadItems[index];
return DetailItem(

View File

@@ -22,7 +22,7 @@ class DownloadingPage extends StatefulWidget {
}
class _DownloadingPageState extends State<DownloadingPage>
with BaseMultiSelectMixin<BiliDownloadEntryInfo> {
with BaseMultiSelectMixin<BiliDownloadEntryInfo>, GridMixin {
final _downloadService = Get.find<DownloadService>();
late final _waitDownloadQueue = _downloadService.waitDownloadQueue;
@override
@@ -69,11 +69,7 @@ class _DownloadingPageState extends State<DownloadingPage>
sliver: Obx(() {
if (_waitDownloadQueue.isNotEmpty) {
return SliverGrid.builder(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
mainAxisSpacing: 2,
mainAxisExtent: 100,
maxCrossAxisExtent: Grid.smallCardWidth * 2,
),
gridDelegate: gridDelegate,
itemCount: _waitDownloadQueue.length,
itemBuilder: (context, index) {
final entry = _waitDownloadQueue[index];

View File

@@ -29,7 +29,8 @@ class _DownloadSearchPageState
DownloadSearchPage,
List<BiliDownloadEntryInfo>,
BiliDownloadEntryInfo
> {
>
with GridMixin {
@override
DownloadSearchController controller = Get.put(DownloadSearchController());
final _downloadService = Get.find<DownloadService>();
@@ -84,11 +85,7 @@ class _DownloadSearchPageState
Widget buildList(List<BiliDownloadEntryInfo> list) {
if (list.isNotEmpty) {
return SliverGrid.builder(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
mainAxisSpacing: 2,
mainAxisExtent: 100,
maxCrossAxisExtent: Grid.smallCardWidth * 2,
),
gridDelegate: gridDelegate,
itemBuilder: (context, index) {
final entry = list[index];
return DetailItem(

View File

@@ -33,7 +33,7 @@ class DownloadPage extends StatefulWidget {
State<DownloadPage> createState() => _DownloadPageState();
}
class _DownloadPageState extends State<DownloadPage> {
class _DownloadPageState extends State<DownloadPage> with GridMixin {
final _downloadService = Get.find<DownloadService>();
final _controller = Get.put(DownloadPageController());
final _progress = ChangeNotifier();
@@ -139,7 +139,7 @@ class _DownloadPageState extends State<DownloadPage> {
),
SliverToBoxAdapter(
child: SizedBox(
height: 100,
height: 110,
child: DetailItem(
entry: entry,
progress: _progress,
@@ -172,12 +172,7 @@ class _DownloadPageState extends State<DownloadPage> {
),
),
SliverGrid.builder(
gridDelegate:
SliverGridDelegateWithMaxCrossAxisExtent(
mainAxisSpacing: 2,
mainAxisExtent: 100,
maxCrossAxisExtent: Grid.smallCardWidth * 2,
),
gridDelegate: gridDelegate,
itemBuilder: (context, index) {
final item = _controller.pages[index];
if (item.entries.length == 1) {

View File

@@ -262,15 +262,15 @@ class _EpisodePanelState extends State<EpisodePanel>
}
return offset + 7;
} else {
return index * 100 + 7;
return index * 112 + 7;
}
}
double _calcItemHeight(ugc.BaseEpisodeItem episode) {
if (episode is ugc.EpisodeItem && episode.pages!.length > 1) {
return 145; // 98 + 2 + 10 + 35
return 157; // 110 + 2 + 10 + 35
}
return 100;
return 112;
}
Widget _buildBody(
@@ -311,7 +311,7 @@ class _EpisodePanelState extends State<EpisodePanel>
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
episodeItem, // 98
episodeItem, // 110
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
@@ -352,7 +352,7 @@ class _EpisodePanelState extends State<EpisodePanel>
isCurrentIndex: isCurrItem,
);
},
itemExtent: 100,
itemExtent: 112,
),
),
],
@@ -428,9 +428,9 @@ class _EpisodePanelState extends State<EpisodePanel>
return Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SizedBox(
height: 98,
height: 110,
child: Material(
type: MaterialType.transparency,
type: .transparency,
child: InkWell(
onTap: () {
if (episode.badge == "会员" &&
@@ -462,7 +462,7 @@ class _EpisodePanelState extends State<EpisodePanel>
onLongPress: onLongPress,
onSecondaryTap: PlatformUtils.isMobile ? null : onLongPress,
child: Padding(
padding: const EdgeInsets.symmetric(
padding: const .symmetric(
horizontal: Style.safeSpace,
vertical: 5,
),
@@ -475,8 +475,8 @@ class _EpisodePanelState extends State<EpisodePanel>
children: [
NetworkImgLayer(
src: cover,
width: 140.8,
height: 88,
width: 160,
height: 100,
cacheWidth: cacheWidth,
),
if (duration != null && duration > 0)

View File

@@ -81,7 +81,7 @@ class _FavFolderSortPageState extends State<FavFolderSortPage>
final key = item.id.toString();
return SizedBox(
key: Key(key),
height: 98,
height: 110,
child: FavVideoItem(
heroTag: key,
item: item,

View File

@@ -20,11 +20,8 @@ class FavSearchPage extends StatefulWidget {
class _FavSearchPageState
extends
CommonSearchPageState<
FavSearchPage,
FavDetailData,
FavDetailItemModel
> {
CommonSearchPageState<FavSearchPage, FavDetailData, FavDetailItemModel>
with GridMixin {
@override
final FavSearchController controller = Get.put(
FavSearchController(),
@@ -88,8 +85,6 @@ class _FavSearchPageState
),
];
late final gridDelegate = Grid.videoCardHDelegate(context, minHeight: 110);
@override
Widget buildList(List<FavDetailItemModel> list) {
return SliverGrid.builder(

View File

@@ -108,7 +108,7 @@ class _FavSortPageState extends State<FavSortPage> with ReorderMixin {
final item = sortList[index];
return SizedBox(
key: ValueKey(item.id),
height: 98,
height: 110,
child: FavVideoCardH(item: item),
);
},

View File

@@ -17,19 +17,14 @@ class HistorySearchPage extends StatefulWidget {
class _HistorySearchPageState
extends
CommonSearchPageState<
HistorySearchPage,
HistoryData,
HistoryItemModel
> {
CommonSearchPageState<HistorySearchPage, HistoryData, HistoryItemModel>
with GridMixin {
@override
final HistorySearchController controller = Get.put(
HistorySearchController(),
tag: Utils.generateRandomString(8),
);
late final gridDelegate = Grid.videoCardHDelegate(context, minHeight: 110);
@override
Widget buildList(List<HistoryItemModel> list) {
return SliverGrid.builder(

View File

@@ -19,7 +19,8 @@ class LaterSearchPage extends StatefulWidget {
}
class _LaterSearchPageState
extends CommonSearchPageState<LaterSearchPage, LaterData, LaterItemModel> {
extends CommonSearchPageState<LaterSearchPage, LaterData, LaterItemModel>
with GridMixin {
@override
final LaterSearchController controller = Get.put(
LaterSearchController(),
@@ -58,8 +59,6 @@ class _LaterSearchPageState
];
}
late final gridDelegate = Grid.videoCardHDelegate(context, minHeight: 110);
@override
Widget buildList(List<LaterItemModel> list) {
return SliverGrid.builder(

View File

@@ -26,7 +26,7 @@ class MemberAudio extends StatefulWidget {
}
class _MemberAudioState extends State<MemberAudio>
with AutomaticKeepAliveClientMixin {
with AutomaticKeepAliveClientMixin, GridMixin {
late final MemberAudioController _controller;
@override
@@ -63,13 +63,6 @@ class _MemberAudioState extends State<MemberAudio>
@override
bool get wantKeepAlive => true;
late final gridDelegate = SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: 2,
maxCrossAxisExtent: Grid.smallCardWidth * 2,
childAspectRatio: Style.aspectRatio * 2.6,
minHeight: MediaQuery.textScalerOf(context).scale(90),
);
Widget _buildBody(
ColorScheme colorScheme,
LoadingState<List<SpaceAudioItem>?> loadingState,

View File

@@ -70,7 +70,7 @@ class _MemberFavoriteState extends State<MemberFavorite>
Loading() => SliverPadding(
padding: const EdgeInsets.only(top: 7),
sliver: SliverGrid.builder(
gridDelegate: Grid.videoCardHDelegate(context),
gridDelegate: gridDelegate,
itemBuilder: (context, index) => const VideoCardHSkeleton(),
itemCount: 10,
),
@@ -169,7 +169,7 @@ class _MemberFavoriteState extends State<MemberFavorite>
itemBuilder: (context, index) {
final item = list[index];
return SizedBox(
height: 98,
height: 110,
child: MemberFavItem(
item: item,
onDelete: (isDeleted) {

View File

@@ -52,12 +52,7 @@ class _MemberHomeState extends State<MemberHome>
mainAxisExtent: MediaQuery.textScalerOf(context).scale(55),
);
late final gridDelegateAudio = SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: 2,
maxCrossAxisExtent: Grid.smallCardWidth * 2,
childAspectRatio: Style.aspectRatio * 2.6,
minHeight: MediaQuery.textScalerOf(context).scale(90),
);
late final gridDelegateAudio = Grid.videoCardHDelegate();
late final gridDelegatePgc = SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: Style.cardSpace,
@@ -114,7 +109,7 @@ class _MemberHomeState extends State<MemberHome>
),
SliverToBoxAdapter(
child: SizedBox(
height: 98,
height: 110,
child: MemberFavItem(
item: res.favourite2!.item!.first,
),
@@ -183,7 +178,7 @@ class _MemberHomeState extends State<MemberHome>
),
SliverToBoxAdapter(
child: SizedBox(
height: 98,
height: 110,
child: MemberArticleItem(
item: res.article!.item!.first,
),

View File

@@ -42,8 +42,8 @@ class MemberFavItem extends StatelessWidget {
children: [
NetworkImgLayer(
src: item.cover,
width: 140.8,
height: 88,
width: 160,
height: 100,
),
const SizedBox(width: 10),
Expanded(

View File

@@ -104,7 +104,7 @@ class _SearchAllPanelState
@override
Widget get buildLoading => SliverGrid.builder(
gridDelegate: Grid.videoCardHDelegate(context),
gridDelegate: Grid.videoCardHDelegate(),
itemBuilder: (context, index) => const VideoCardHSkeleton(),
itemCount: 10,
);

View File

@@ -70,7 +70,6 @@ class _SearchPgcPanelState
mainAxisSpacing: 2,
maxCrossAxisExtent: Grid.smallCardWidth * 2,
childAspectRatio: Style.aspectRatio * 1.5,
minHeight: MediaQuery.textScalerOf(context).scale(155),
),
itemBuilder: (context, index) => const MediaPgcSkeleton(),
itemCount: 10,

View File

@@ -383,7 +383,7 @@ class _DownloadPanelState extends State<DownloadPanel> {
return Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SizedBox(
height: 98,
height: 110,
child: Builder(
builder: (context) {
return Material(
@@ -412,8 +412,8 @@ class _DownloadPanelState extends State<DownloadPanel> {
children: [
NetworkImgLayer(
src: cover,
width: 140.8,
height: 88,
width: 160,
height: 100,
cacheWidth: cacheWidth,
),
if (duration != null && duration > 0)

View File

@@ -88,7 +88,7 @@ class LocalIntroController extends CommonIntroController {
}
final index = (-1).obs;
double get _offset => index * 100 + 7 - 35;
double get _offset => index * 112 + 7 - 35;
final list = RxList<BiliDownloadEntryInfo>();
@override

View File

@@ -42,7 +42,7 @@ class _LocalIntroPanelState extends State<LocalIntroPanel>
final item = _controller.list[index];
return _buildItem(theme, currIndex == index, index, item);
},
itemExtent: 100,
itemExtent: 112,
);
});
}
@@ -59,7 +59,7 @@ class _LocalIntroPanelState extends State<LocalIntroPanel>
return Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SizedBox(
height: 98,
height: 110,
child: Material(
type: MaterialType.transparency,
child: InkWell(
@@ -85,15 +85,15 @@ class _LocalIntroPanelState extends State<LocalIntroPanel>
borderRadius: Style.mdRadius,
child: Image.file(
cover,
width: 140.8,
height: 88,
width: 160,
height: 100,
fit: BoxFit.cover,
cacheWidth: cacheWidth
? 140.8.cacheSize(context)
? 160.cacheSize(context)
: null,
cacheHeight: cacheWidth
? null
: 88.cacheSize(context),
: 100.cacheSize(context),
colorBlendMode: NetworkImgLayer.reduce
? BlendMode.modulate
: null,
@@ -104,8 +104,8 @@ class _LocalIntroPanelState extends State<LocalIntroPanel>
)
: NetworkImgLayer(
src: entry.cover,
width: 140.8,
height: 88,
width: 160,
height: 100,
),
PBadge(
text: DurationUtils.formatDuration(

View File

@@ -57,7 +57,7 @@ class _MediaListPanelState extends State<MediaListPanel>
final bvid = widget.bvid;
final bvIndex = widget.mediaList.indexWhere((item) => item.bvid == bvid);
_controller = ScrollController(
initialScrollOffset: bvIndex <= 0 ? 0 : bvIndex * 100.0 + 7,
initialScrollOffset: bvIndex <= 0 ? 0 : bvIndex * 112.0 + 7,
);
}
@@ -131,7 +131,7 @@ class _MediaListPanelState extends State<MediaListPanel>
),
sliver: Obx(
() => SliverFixedExtentList.builder(
itemExtent: 100,
itemExtent: 112,
itemCount: widget.mediaList.length,
itemBuilder: (context, index) {
if (index == widget.mediaList.length - 1 &&
@@ -166,7 +166,7 @@ class _MediaListPanelState extends State<MediaListPanel>
return Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SizedBox(
height: 98,
height: 110,
child: Material(
type: MaterialType.transparency,
child: InkWell(
@@ -196,8 +196,8 @@ class _MediaListPanelState extends State<MediaListPanel>
children: [
NetworkImgLayer(
src: item.cover,
width: 140.8,
height: 88,
width: 160,
height: 100,
),
if (item.badge?.isNotEmpty == true)
PBadge(

View File

@@ -66,7 +66,7 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
final index = res.response?.indexWhere((e) => e.bvid == _bvid) ?? -1;
if (index != -1) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_controller.scrollController.jumpTo(100.0 * index);
_controller.scrollController.jumpTo(112.0 * index);
});
}
}
@@ -177,7 +177,7 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
Loading() => SliverFixedExtentList.builder(
itemCount: 10,
itemBuilder: (_, _) => const VideoCardHSkeleton(),
itemExtent: 100,
itemExtent: 112,
),
Success(:final response) =>
response != null && response.isNotEmpty
@@ -209,7 +209,7 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
);
},
itemCount: response.length,
itemExtent: 100,
itemExtent: 112,
),
],
)

View File

@@ -144,7 +144,11 @@ class _ViewPointsPageState extends State<ViewPointsPage>
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
NetworkImgLayer(src: segment.url, width: 140.8, height: 88),
NetworkImgLayer(
src: segment.url,
width: 160,
height: 100,
),
const SizedBox(width: 10),
Expanded(
child: Column(