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