mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 侧边栏、动态重构,排行改为首页分区,平板、折叠屏、竖屏视频新适配,播放页可隐藏黑边、截图、点踩,弹幕粗细调整,默认关闭后台播放,弹窗接受返回
This commit is contained in:
@@ -34,7 +34,7 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
void animateToTop() {
|
||||
int index = tabController.index;
|
||||
var ctr = tabsCtrList[index];
|
||||
ctr().animateToTop();
|
||||
ctr.animateToTop();
|
||||
}
|
||||
|
||||
void setTabConfig() async {
|
||||
|
||||
@@ -35,72 +35,94 @@ class _RankPageState extends State<RankPage>
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_rankController.tabController.removeListener(() {});
|
||||
_rankController.tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 0,
|
||||
elevation: 0,
|
||||
systemOverlayStyle: SystemUiOverlayStyle(
|
||||
// Customize the status bar here
|
||||
statusBarIconBrightness:
|
||||
MediaQuery.of(context).platformBrightness == Brightness.dark
|
||||
? Brightness.light
|
||||
: Brightness.dark,
|
||||
return Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: StyleString.cardSpace,
|
||||
),
|
||||
),
|
||||
body: Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: StyleString.cardSpace,
|
||||
// SizedBox(
|
||||
// width: 55,
|
||||
// child: NavigationRail(
|
||||
//
|
||||
// backgroundColor: Colors.transparent,
|
||||
// minWidth: 50.0,
|
||||
// // elevation: 0,
|
||||
// selectedIndex: _selectedTabIndex,
|
||||
// onDestinationSelected: (int index) {
|
||||
// feedBack();
|
||||
// if (_selectedTabIndex == index) {
|
||||
// _rankController.tabsCtrList[index]().animateToTop();
|
||||
// } else {
|
||||
// setState(() {
|
||||
// _rankController.tabController.index = index;
|
||||
// _selectedTabIndex = index;
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// labelType: NavigationRailLabelType.none,
|
||||
// destinations: [
|
||||
// for (var tab in _rankController.tabs)
|
||||
// NavigationRailDestination(
|
||||
// padding: EdgeInsets.zero,
|
||||
// icon: Text(tab['label']),
|
||||
// // selectedIcon: Text(tab['label']),
|
||||
// label: const SizedBox.shrink(),
|
||||
// ),
|
||||
// ],
|
||||
// trailing: const SizedBox(height: 100),
|
||||
// )),
|
||||
LayoutBuilder(builder: (context, constraint) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(minHeight: constraint.maxHeight),
|
||||
child: IntrinsicHeight(
|
||||
child: NavigationRail(
|
||||
backgroundColor: Colors.transparent,
|
||||
minWidth: 50.0,
|
||||
// elevation: 0,
|
||||
selectedIndex: _selectedTabIndex,
|
||||
onDestinationSelected: (int index) {
|
||||
feedBack();
|
||||
if (_selectedTabIndex == index) {
|
||||
_rankController.tabsCtrList[index]().animateToTop();
|
||||
} else {
|
||||
setState(() {
|
||||
_rankController.tabController.index = index;
|
||||
_selectedTabIndex = index;
|
||||
});
|
||||
}
|
||||
},
|
||||
labelType: NavigationRailLabelType.none,
|
||||
destinations: [
|
||||
for (var tab in _rankController.tabs)
|
||||
NavigationRailDestination(
|
||||
icon: Text(tab['label']),
|
||||
// selectedIcon: Text(tab['label']),
|
||||
label: const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
trailing: const SizedBox(height: 100),
|
||||
))));
|
||||
}),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _rankController.tabController,
|
||||
children: _rankController.tabsPageList,
|
||||
),
|
||||
LayoutBuilder(builder: (context, constraint) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
BoxConstraints(minHeight: constraint.maxHeight + 100),
|
||||
child: IntrinsicHeight(
|
||||
child: NavigationRail(
|
||||
minWidth: 55.0,
|
||||
selectedIndex: _selectedTabIndex,
|
||||
onDestinationSelected: (int index) {
|
||||
feedBack();
|
||||
if (_selectedTabIndex == index) {
|
||||
_rankController.tabsCtrList[index]().animateToTop();
|
||||
} else {
|
||||
setState(() {
|
||||
_rankController.tabController.index = index;
|
||||
_selectedTabIndex = index;
|
||||
});
|
||||
}
|
||||
},
|
||||
labelType: NavigationRailLabelType.none,
|
||||
destinations: [
|
||||
for (var tab in _rankController.tabs)
|
||||
NavigationRailDestination(
|
||||
icon: Text(tab['label']),
|
||||
// selectedIcon: Text(tab['label']),
|
||||
label: const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
))));
|
||||
}),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _rankController.tabController,
|
||||
children: _rankController.tabsPageList,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ class ZonePage extends StatefulWidget {
|
||||
class _ZonePageState extends State<ZonePage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
late ZoneController _zoneController;
|
||||
List videoList = [];
|
||||
Future? _futureBuilderFuture;
|
||||
late ScrollController scrollController;
|
||||
|
||||
@@ -81,12 +80,12 @@ class _ZonePageState extends State<ZonePage>
|
||||
return await _zoneController.onRefresh();
|
||||
},
|
||||
child: CustomScrollView(
|
||||
controller: _zoneController.scrollController,
|
||||
controller: scrollController,
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
// 单列布局 EdgeInsets.zero
|
||||
padding:
|
||||
const EdgeInsets.fromLTRB(0, StyleString.safeSpace - 5, 0, 0),
|
||||
const EdgeInsets.fromLTRB(StyleString.safeSpace, StyleString.safeSpace, 0, 0),
|
||||
sliver: FutureBuilder(
|
||||
future: _futureBuilderFuture,
|
||||
builder: (context, snapshot) {
|
||||
@@ -95,19 +94,12 @@ class _ZonePageState extends State<ZonePage>
|
||||
if (data['status']) {
|
||||
return Obx(
|
||||
() => SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
// 行间距
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
// 列间距
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
// 最大宽度
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
maxCrossAxisExtent: Grid.maxRowWidth * 2,
|
||||
mainAxisExtent: Grid.calculateActualWidth(context,
|
||||
Grid.maxRowWidth * 2, StyleString.cardSpace,
|
||||
screenWidthOffset:
|
||||
StyleString.cardSpace + 55) /
|
||||
2.1 /
|
||||
StyleString.aspectRatio),
|
||||
childAspectRatio: StyleString.aspectRatio * 2.3,
|
||||
mainAxisExtent: 0),
|
||||
delegate: SliverChildBuilderDelegate((context, index) {
|
||||
return VideoCardH(
|
||||
videoItem: _zoneController.videoList[index],
|
||||
@@ -138,7 +130,13 @@ class _ZonePageState extends State<ZonePage>
|
||||
}
|
||||
} else {
|
||||
// 骨架屏
|
||||
return SliverList(
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
maxCrossAxisExtent: Grid.maxRowWidth * 2,
|
||||
childAspectRatio: StyleString.aspectRatio * 2.3,
|
||||
mainAxisExtent: 0),
|
||||
delegate: SliverChildBuilderDelegate((context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
}, childCount: 10),
|
||||
|
||||
Reference in New Issue
Block a user