mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-01 07:39:47 +08:00
@@ -1,17 +1,11 @@
|
||||
import 'package:PiliPlus/common/constants.dart' show StyleString;
|
||||
import 'package:PiliPlus/pages/common/common_controller.dart';
|
||||
import 'package:PiliPlus/pages/home/controller.dart';
|
||||
import 'package:PiliPlus/pages/main/controller.dart';
|
||||
import 'package:flutter/foundation.dart' show clampDouble;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
abstract class CommonPageState<
|
||||
T extends StatefulWidget,
|
||||
R extends CommonController
|
||||
>
|
||||
extends State<T> {
|
||||
R get controller;
|
||||
abstract class CommonPageState<T extends StatefulWidget> extends State<T> {
|
||||
RxDouble? _barOffset;
|
||||
RxBool? _showTopBar;
|
||||
RxBool? _showBottomBar;
|
||||
@@ -88,6 +82,8 @@ abstract class CommonPageState<
|
||||
@override
|
||||
void dispose() {
|
||||
_barOffset = null;
|
||||
_showTopBar = null;
|
||||
_showBottomBar = null;
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/dynamics_type.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
||||
import 'package:PiliPlus/models/dynamics/up.dart';
|
||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/up_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_create/view.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_tab/view.dart';
|
||||
import 'package:PiliPlus/pages/main/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension/get_ext.dart';
|
||||
import 'package:flutter/material.dart' hide DraggableScrollableSheet;
|
||||
import 'package:get/get.dart';
|
||||
@@ -18,15 +20,16 @@ class DynamicsPage extends StatefulWidget {
|
||||
State<DynamicsPage> createState() => _DynamicsPageState();
|
||||
}
|
||||
|
||||
class _DynamicsPageState extends State<DynamicsPage>
|
||||
class _DynamicsPageState extends CommonPageState<DynamicsPage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
final _dynamicsController = Get.putOrFind(DynamicsController.new);
|
||||
UpPanelPosition get upPanelPosition => _dynamicsController.upPanelPosition;
|
||||
late final MainController _mainController = Get.find<MainController>();
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
Widget _createDynamicBtn(ThemeData theme, [bool isRight = true]) => Center(
|
||||
Widget _createDynamicBtn(ThemeData theme, {bool isRight = true}) => Center(
|
||||
child: Container(
|
||||
width: 34,
|
||||
height: 34,
|
||||
@@ -54,11 +57,11 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
);
|
||||
|
||||
Widget upPanelPart(ThemeData theme) {
|
||||
bool isTop = upPanelPosition == UpPanelPosition.top;
|
||||
bool needBg = upPanelPosition.index > 1;
|
||||
final isTop = upPanelPosition == .top;
|
||||
final needBg = upPanelPosition.index > 2;
|
||||
return Material(
|
||||
type: needBg ? .canvas : .transparency,
|
||||
color: needBg ? theme.colorScheme.surface : null,
|
||||
type: needBg ? MaterialType.canvas : MaterialType.transparency,
|
||||
child: SizedBox(
|
||||
width: isTop ? null : 64,
|
||||
height: isTop ? 76 : null,
|
||||
@@ -85,41 +88,104 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
Error() => Center(
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: () {
|
||||
_dynamicsController
|
||||
..upState.value = LoadingState<FollowUpModel>.loading()
|
||||
..queryFollowUp();
|
||||
},
|
||||
onPressed: () => _dynamicsController
|
||||
..upState.value = LoadingState<FollowUpModel>.loading()
|
||||
..queryFollowUp(),
|
||||
),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
bool get checkPage =>
|
||||
_mainController.navigationBars[0] != .dynamics &&
|
||||
_mainController.selectedIndex.value == 0;
|
||||
|
||||
@override
|
||||
bool onNotificationType1(UserScrollNotification notification) {
|
||||
if (checkPage) {
|
||||
return false;
|
||||
}
|
||||
return super.onNotificationType1(notification);
|
||||
}
|
||||
|
||||
@override
|
||||
bool onNotificationType2(ScrollNotification notification) {
|
||||
if (checkPage) {
|
||||
return false;
|
||||
}
|
||||
return super.onNotificationType2(notification);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
ThemeData theme = Theme.of(context);
|
||||
final theme = Theme.of(context);
|
||||
|
||||
Widget? drawer;
|
||||
Widget? endDrawer;
|
||||
|
||||
Widget? leading;
|
||||
List<Widget>? actions;
|
||||
|
||||
Widget child = videoTabBarView(
|
||||
controller: _dynamicsController.tabController,
|
||||
children: DynamicsTabType.values
|
||||
.map((e) => DynamicsTabPage(dynamicsType: e))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
switch (upPanelPosition) {
|
||||
case UpPanelPosition.top:
|
||||
child = Column(
|
||||
children: [
|
||||
upPanelPart(theme),
|
||||
Expanded(child: child),
|
||||
],
|
||||
);
|
||||
actions = [_createDynamicBtn(theme)];
|
||||
case UpPanelPosition.leftFixed:
|
||||
child = Row(
|
||||
children: [
|
||||
upPanelPart(theme),
|
||||
Expanded(child: child),
|
||||
],
|
||||
);
|
||||
actions = [_createDynamicBtn(theme)];
|
||||
case UpPanelPosition.rightFixed:
|
||||
child = Row(
|
||||
children: [
|
||||
Expanded(child: child),
|
||||
upPanelPart(theme),
|
||||
],
|
||||
);
|
||||
actions = [_createDynamicBtn(theme)];
|
||||
case UpPanelPosition.leftDrawer:
|
||||
drawer = upPanelPart(theme);
|
||||
actions = [_createDynamicBtn(theme)];
|
||||
case UpPanelPosition.rightDrawer:
|
||||
endDrawer = upPanelPart(theme);
|
||||
leading = _createDynamicBtn(theme, isRight: false);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
primary: false,
|
||||
leading: upPanelPosition == UpPanelPosition.rightDrawer
|
||||
? _createDynamicBtn(theme, false)
|
||||
: null,
|
||||
leading: leading,
|
||||
leadingWidth: 50,
|
||||
toolbarHeight: 50,
|
||||
backgroundColor: Colors.transparent,
|
||||
title: SizedBox(
|
||||
height: 50,
|
||||
child: TabBar(
|
||||
controller: _dynamicsController.tabController,
|
||||
isScrollable: true,
|
||||
dividerColor: Colors.transparent,
|
||||
dividerHeight: 0,
|
||||
tabAlignment: TabAlignment.center,
|
||||
indicatorColor: theme.colorScheme.primary,
|
||||
isScrollable: true,
|
||||
tabAlignment: .center,
|
||||
dividerColor: Colors.transparent,
|
||||
labelColor: theme.colorScheme.primary,
|
||||
indicatorColor: theme.colorScheme.primary,
|
||||
controller: _dynamicsController.tabController,
|
||||
unselectedLabelColor: theme.colorScheme.onSurface,
|
||||
labelStyle:
|
||||
TabBarTheme.of(context).labelStyle?.copyWith(fontSize: 13) ??
|
||||
@@ -134,39 +200,11 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
},
|
||||
),
|
||||
),
|
||||
actions: upPanelPosition == UpPanelPosition.rightDrawer
|
||||
? null
|
||||
: [_createDynamicBtn(theme)],
|
||||
),
|
||||
drawer: upPanelPosition == UpPanelPosition.leftDrawer
|
||||
? upPanelPart(theme)
|
||||
: null,
|
||||
drawerEnableOpenDragGesture: true,
|
||||
endDrawer: upPanelPosition == UpPanelPosition.rightDrawer
|
||||
? upPanelPart(theme)
|
||||
: null,
|
||||
endDrawerEnableOpenDragGesture: true,
|
||||
body: Row(
|
||||
children: [
|
||||
if (upPanelPosition == UpPanelPosition.leftFixed) upPanelPart(theme),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
if (upPanelPosition == UpPanelPosition.top) upPanelPart(theme),
|
||||
Expanded(
|
||||
child: videoTabBarView(
|
||||
controller: _dynamicsController.tabController,
|
||||
children: DynamicsTabType.values
|
||||
.map((e) => DynamicsTabPage(dynamicsType: e))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (upPanelPosition == UpPanelPosition.rightFixed) upPanelPart(theme),
|
||||
],
|
||||
actions: actions,
|
||||
),
|
||||
drawer: drawer,
|
||||
endDrawer: endDrawer,
|
||||
body: onBuild(child),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,10 @@ import 'package:PiliPlus/common/widgets/flutter/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/dynamics_type.dart';
|
||||
import 'package:PiliPlus/models/common/nav_bar_config.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/dynamic_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_tab/controller.dart';
|
||||
import 'package:PiliPlus/pages/main/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension/get_ext.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/waterfall.dart';
|
||||
@@ -28,39 +25,16 @@ class DynamicsTabPage extends StatefulWidget {
|
||||
State<DynamicsTabPage> createState() => _DynamicsTabPageState();
|
||||
}
|
||||
|
||||
class _DynamicsTabPageState
|
||||
extends CommonPageState<DynamicsTabPage, DynamicsTabController>
|
||||
class _DynamicsTabPageState extends State<DynamicsTabPage>
|
||||
with AutomaticKeepAliveClientMixin, DynMixin {
|
||||
StreamSubscription? _listener;
|
||||
late final MainController _mainController = Get.find<MainController>();
|
||||
|
||||
DynamicsController dynamicsController = Get.putOrFind(DynamicsController.new);
|
||||
@override
|
||||
late final DynamicsTabController controller;
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
bool get checkPage =>
|
||||
_mainController.navigationBars[0] != NavigationBarType.dynamics &&
|
||||
_mainController.selectedIndex.value == 0;
|
||||
|
||||
@override
|
||||
bool onNotificationType1(UserScrollNotification notification) {
|
||||
if (checkPage) {
|
||||
return false;
|
||||
}
|
||||
return super.onNotificationType1(notification);
|
||||
}
|
||||
|
||||
@override
|
||||
bool onNotificationType2(ScrollNotification notification) {
|
||||
if (checkPage) {
|
||||
return false;
|
||||
}
|
||||
return super.onNotificationType2(notification);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
controller = Get.putOrFind(
|
||||
@@ -91,24 +65,22 @@ class _DynamicsTabPageState
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return onBuild(
|
||||
refreshIndicator(
|
||||
onRefresh: () {
|
||||
dynamicsController.queryFollowUp();
|
||||
return controller.onRefresh();
|
||||
},
|
||||
child: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: controller.scrollController,
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(bottom: 100),
|
||||
sliver: buildPage(
|
||||
Obx(() => _buildBody(controller.loadingState.value)),
|
||||
),
|
||||
return refreshIndicator(
|
||||
onRefresh: () {
|
||||
dynamicsController.queryFollowUp();
|
||||
return controller.onRefresh();
|
||||
},
|
||||
child: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: controller.scrollController,
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(bottom: 100),
|
||||
sliver: buildPage(
|
||||
Obx(() => _buildBody(controller.loadingState.value)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/custom_height_widget.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||
import 'package:PiliPlus/pages/home/controller.dart';
|
||||
import 'package:PiliPlus/pages/main/controller.dart';
|
||||
import 'package:PiliPlus/pages/mine/controller.dart';
|
||||
@@ -19,7 +20,7 @@ class HomePage extends StatefulWidget {
|
||||
State<HomePage> createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage>
|
||||
class _HomePageState extends CommonPageState<HomePage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
final _homeController = Get.putOrFind(HomeController.new);
|
||||
final _mainController = Get.find<MainController>();
|
||||
@@ -72,9 +73,11 @@ class _HomePageState extends State<HomePage>
|
||||
customAppBar(theme),
|
||||
tabBar,
|
||||
Expanded(
|
||||
child: tabBarView(
|
||||
controller: _homeController.tabController,
|
||||
children: _homeController.tabs.map((e) => e.page).toList(),
|
||||
child: onBuild(
|
||||
tabBarView(
|
||||
controller: _homeController.tabController,
|
||||
children: _homeController.tabs.map((e) => e.page).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/home_tab_type.dart';
|
||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||
import 'package:PiliPlus/pages/home/controller.dart';
|
||||
import 'package:PiliPlus/pages/hot/controller.dart';
|
||||
import 'package:PiliPlus/pages/rank/view.dart';
|
||||
@@ -22,10 +21,9 @@ class HotPage extends StatefulWidget {
|
||||
State<HotPage> createState() => _HotPageState();
|
||||
}
|
||||
|
||||
class _HotPageState extends CommonPageState<HotPage, HotController>
|
||||
class _HotPageState extends State<HotPage>
|
||||
with AutomaticKeepAliveClientMixin, GridMixin {
|
||||
@override
|
||||
HotController controller = Get.put(HotController());
|
||||
final HotController controller = Get.put(HotController());
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
@@ -60,68 +58,66 @@ class _HotPageState extends CommonPageState<HotPage, HotController>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return onBuild(
|
||||
refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: controller.scrollController,
|
||||
slivers: [
|
||||
if (Pref.showHotRcmd)
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const .only(left: 12, top: 12, right: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: .spaceEvenly,
|
||||
children: [
|
||||
_buildEntranceItem(
|
||||
iconUrl:
|
||||
'https://i0.hdslb.com/bfs/archive/a3f11218aaf4521b4967db2ae164ecd3052586b9.png',
|
||||
title: '排行榜',
|
||||
onTap: () {
|
||||
try {
|
||||
final homeController = Get.find<HomeController>();
|
||||
final index = homeController.tabs.indexOf(
|
||||
HomeTabType.rank,
|
||||
return refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: controller.scrollController,
|
||||
slivers: [
|
||||
if (Pref.showHotRcmd)
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const .only(left: 12, top: 12, right: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: .spaceEvenly,
|
||||
children: [
|
||||
_buildEntranceItem(
|
||||
iconUrl:
|
||||
'https://i0.hdslb.com/bfs/archive/a3f11218aaf4521b4967db2ae164ecd3052586b9.png',
|
||||
title: '排行榜',
|
||||
onTap: () {
|
||||
try {
|
||||
final homeController = Get.find<HomeController>();
|
||||
final index = homeController.tabs.indexOf(
|
||||
HomeTabType.rank,
|
||||
);
|
||||
if (index != -1) {
|
||||
homeController.tabController.animateTo(index);
|
||||
} else {
|
||||
Get.to(
|
||||
Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(title: const Text('排行榜')),
|
||||
body: const ViewSafeArea(child: RankPage()),
|
||||
),
|
||||
);
|
||||
if (index != -1) {
|
||||
homeController.tabController.animateTo(index);
|
||||
} else {
|
||||
Get.to(
|
||||
Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(title: const Text('排行榜')),
|
||||
body: const ViewSafeArea(child: RankPage()),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
_buildEntranceItem(
|
||||
iconUrl:
|
||||
'https://i0.hdslb.com/bfs/archive/552ebe8c4794aeef30ebd1568b59ad35f15e21ad.png',
|
||||
title: '每周必看',
|
||||
onTap: () => Get.toNamed('/popularSeries'),
|
||||
),
|
||||
_buildEntranceItem(
|
||||
iconUrl:
|
||||
'https://i0.hdslb.com/bfs/archive/3693ec9335b78ca57353ac0734f36a46f3d179a9.png',
|
||||
title: '入站必刷',
|
||||
onTap: () => Get.toNamed('/popularPrecious'),
|
||||
),
|
||||
],
|
||||
),
|
||||
}
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
_buildEntranceItem(
|
||||
iconUrl:
|
||||
'https://i0.hdslb.com/bfs/archive/552ebe8c4794aeef30ebd1568b59ad35f15e21ad.png',
|
||||
title: '每周必看',
|
||||
onTap: () => Get.toNamed('/popularSeries'),
|
||||
),
|
||||
_buildEntranceItem(
|
||||
iconUrl:
|
||||
'https://i0.hdslb.com/bfs/archive/3693ec9335b78ca57353ac0734f36a46f3d179a9.png',
|
||||
title: '入站必刷',
|
||||
onTap: () => Get.toNamed('/popularPrecious'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(top: 7, bottom: 100),
|
||||
sliver: Obx(
|
||||
() => _buildBody(controller.loadingState.value),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(top: 7, bottom: 100),
|
||||
sliver: Obx(
|
||||
() => _buildBody(controller.loadingState.value),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'package:PiliPlus/common/widgets/pair.dart';
|
||||
import 'package:PiliPlus/http/loading_state.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';
|
||||
import 'package:PiliPlus/pages/live/controller.dart';
|
||||
import 'package:PiliPlus/pages/live/widgets/live_item_app.dart';
|
||||
import 'package:PiliPlus/pages/live_area/view.dart';
|
||||
@@ -30,10 +29,9 @@ class LivePage extends StatefulWidget {
|
||||
State<LivePage> createState() => _LivePageState();
|
||||
}
|
||||
|
||||
class _LivePageState extends CommonPageState<LivePage, LiveController>
|
||||
class _LivePageState extends State<LivePage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
LiveController controller = Get.put(LiveController());
|
||||
final LiveController controller = Get.put(LiveController());
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
@@ -50,31 +48,29 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return onBuild(
|
||||
Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
decoration: const BoxDecoration(borderRadius: StyleString.mdRadius),
|
||||
child: refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: StyleString.cardSpace,
|
||||
bottom: 100,
|
||||
),
|
||||
sliver: SliverMainAxisGroup(
|
||||
slivers: [
|
||||
Obx(() => _buildTop(theme, controller.topState.value)),
|
||||
Obx(() => _buildBody(theme, controller.loadingState.value)),
|
||||
],
|
||||
),
|
||||
return Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
decoration: const BoxDecoration(borderRadius: StyleString.mdRadius),
|
||||
child: refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: StyleString.cardSpace,
|
||||
bottom: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
sliver: SliverMainAxisGroup(
|
||||
slivers: [
|
||||
Obx(() => _buildTop(theme, controller.topState.value)),
|
||||
Obx(() => _buildBody(theme, controller.loadingState.value)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -31,10 +31,9 @@ class MinePage extends StatefulWidget {
|
||||
State<MinePage> createState() => _MediaPageState();
|
||||
}
|
||||
|
||||
class _MediaPageState extends CommonPageState<MinePage, MineController>
|
||||
class _MediaPageState extends CommonPageState<MinePage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
MineController controller = Get.putOrFind(MineController.new);
|
||||
final MineController controller = Get.putOrFind(MineController.new);
|
||||
late final MainController _mainController = Get.find<MainController>();
|
||||
|
||||
@override
|
||||
@@ -65,19 +64,19 @@ class _MediaPageState extends CommonPageState<MinePage, MineController>
|
||||
super.build(context);
|
||||
final theme = Theme.of(context);
|
||||
final secondary = theme.colorScheme.secondary;
|
||||
return onBuild(
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const .symmetric(vertical: 10),
|
||||
child: _buildHeaderActions,
|
||||
),
|
||||
Expanded(
|
||||
child: Material(
|
||||
type: .transparency,
|
||||
child: refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: ListView(
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const .symmetric(vertical: 10),
|
||||
child: _buildHeaderActions,
|
||||
),
|
||||
Expanded(
|
||||
child: Material(
|
||||
type: .transparency,
|
||||
child: refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: onBuild(
|
||||
ListView(
|
||||
padding: const .only(bottom: 100),
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
@@ -94,8 +93,8 @@ class _MediaPageState extends CommonPageState<MinePage, MineController>
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import 'package:PiliPlus/models/common/home_tab_type.dart';
|
||||
import 'package:PiliPlus/models_new/fav/fav_pgc/list.dart';
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_index_result/list.dart';
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_timeline/result.dart';
|
||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||
import 'package:PiliPlus/pages/pgc/controller.dart';
|
||||
import 'package:PiliPlus/pages/pgc/widgets/pgc_card_v.dart';
|
||||
import 'package:PiliPlus/pages/pgc/widgets/pgc_card_v_timeline.dart';
|
||||
@@ -37,9 +36,7 @@ class PgcPage extends StatefulWidget {
|
||||
State<PgcPage> createState() => _PgcPageState();
|
||||
}
|
||||
|
||||
class _PgcPageState extends CommonPageState<PgcPage, PgcController>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
class _PgcPageState extends State<PgcPage> with AutomaticKeepAliveClientMixin {
|
||||
late final PgcController controller;
|
||||
|
||||
@override
|
||||
@@ -58,28 +55,26 @@ class _PgcPageState extends CommonPageState<PgcPage, PgcController>
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return onBuild(
|
||||
refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
_buildFollow(theme),
|
||||
if (controller.showPgcTimeline)
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height:
|
||||
Grid.smallCardWidth / 2 / 0.75 +
|
||||
MediaQuery.textScalerOf(context).scale(96),
|
||||
child: Obx(
|
||||
() => _buildTimeline(theme, controller.timelineState.value),
|
||||
),
|
||||
return refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
_buildFollow(theme),
|
||||
if (controller.showPgcTimeline)
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height:
|
||||
Grid.smallCardWidth / 2 / 0.75 +
|
||||
MediaQuery.textScalerOf(context).scale(96),
|
||||
child: Obx(
|
||||
() => _buildTimeline(theme, controller.timelineState.value),
|
||||
),
|
||||
),
|
||||
..._buildRcmd(theme),
|
||||
],
|
||||
),
|
||||
),
|
||||
..._buildRcmd(theme),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/video_card/video_card_h.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||
import 'package:PiliPlus/pages/rank/zone/controller.dart';
|
||||
import 'package:PiliPlus/pages/rank/zone/widget/pgc_rank_item.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
@@ -20,9 +19,8 @@ class ZonePage extends StatefulWidget {
|
||||
State<ZonePage> createState() => _ZonePageState();
|
||||
}
|
||||
|
||||
class _ZonePageState extends CommonPageState<ZonePage, ZoneController>
|
||||
class _ZonePageState extends State<ZonePage>
|
||||
with AutomaticKeepAliveClientMixin, GridMixin {
|
||||
@override
|
||||
late final ZoneController controller;
|
||||
|
||||
@override
|
||||
@@ -40,19 +38,17 @@ class _ZonePageState extends CommonPageState<ZonePage, ZoneController>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return onBuild(
|
||||
refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(top: 7, bottom: 100),
|
||||
sliver: Obx(() => _buildBody(controller.loadingState.value)),
|
||||
),
|
||||
],
|
||||
),
|
||||
return refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(top: 7, bottom: 100),
|
||||
sliver: Obx(() => _buildBody(controller.loadingState.value)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:PiliPlus/common/widgets/flutter/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/video_card/video_card_v.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||
import 'package:PiliPlus/pages/rcmd/controller.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
@@ -18,9 +17,8 @@ class RcmdPage extends StatefulWidget {
|
||||
State<RcmdPage> createState() => _RcmdPageState();
|
||||
}
|
||||
|
||||
class _RcmdPageState extends CommonPageState<RcmdPage, RcmdController>
|
||||
class _RcmdPageState extends State<RcmdPage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
final RcmdController controller = Get.put(RcmdController());
|
||||
|
||||
@override
|
||||
@@ -29,23 +27,21 @@ class _RcmdPageState extends CommonPageState<RcmdPage, RcmdController>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return onBuild(
|
||||
Container(
|
||||
clipBehavior: .hardEdge,
|
||||
margin: const .symmetric(horizontal: StyleString.safeSpace),
|
||||
decoration: const BoxDecoration(borderRadius: StyleString.mdRadius),
|
||||
child: refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const .only(top: StyleString.cardSpace, bottom: 100),
|
||||
sliver: Obx(() => _buildBody(controller.loadingState.value)),
|
||||
),
|
||||
],
|
||||
),
|
||||
return Container(
|
||||
clipBehavior: .hardEdge,
|
||||
margin: const .symmetric(horizontal: StyleString.safeSpace),
|
||||
decoration: const BoxDecoration(borderRadius: StyleString.mdRadius),
|
||||
child: refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const .only(top: StyleString.cardSpace, bottom: 100),
|
||||
sliver: Obx(() => _buildBody(controller.loadingState.value)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user