mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -35,6 +35,17 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
|
|
||||||
late int _pressCount = 0;
|
late int _pressCount = 0;
|
||||||
|
|
||||||
|
late Color outline;
|
||||||
|
late TextStyle subTitleStyle;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
outline = Theme.of(context).colorScheme.outline;
|
||||||
|
subTitleStyle =
|
||||||
|
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -49,9 +60,6 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final Color outline = Theme.of(context).colorScheme.outline;
|
|
||||||
TextStyle subTitleStyle =
|
|
||||||
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar:
|
appBar:
|
||||||
widget.showAppBar == false ? null : AppBar(title: const Text('关于')),
|
widget.showAppBar == false ? null : AppBar(title: const Text('关于')),
|
||||||
@@ -90,27 +98,27 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text('PiliPlus',
|
title: Text(
|
||||||
textAlign: TextAlign.center,
|
'PiliPlus',
|
||||||
style: Theme.of(context)
|
textAlign: TextAlign.center,
|
||||||
.textTheme
|
style:
|
||||||
.titleMedium!
|
Theme.of(context).textTheme.titleMedium!.copyWith(height: 2),
|
||||||
.copyWith(height: 2)),
|
),
|
||||||
subtitle: Row(children: [
|
subtitle: Row(
|
||||||
const Spacer(),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
Text(
|
children: [
|
||||||
'使用Flutter开发的B站第三方客户端',
|
Text(
|
||||||
textAlign: TextAlign.center,
|
'使用Flutter开发的B站第三方客户端',
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
style: TextStyle(color: outline),
|
||||||
semanticsLabel: '与你一起,发现不一样的世界',
|
semanticsLabel: '与你一起,发现不一样的世界',
|
||||||
),
|
),
|
||||||
const Icon(
|
const Icon(
|
||||||
Icons.accessibility_new,
|
Icons.accessibility_new,
|
||||||
semanticLabel: "无障碍适配",
|
semanticLabel: "无障碍适配",
|
||||||
size: 18,
|
size: 18,
|
||||||
),
|
),
|
||||||
const Spacer(),
|
],
|
||||||
]),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => ListTile(
|
() => ListTile(
|
||||||
@@ -137,29 +145,6 @@ Commit Hash: ${BuildConfig.commitHash}''',
|
|||||||
'https://github.com/bggRGjQaUbCoE/PiliPlus/commit/${BuildConfig.commitHash}'),
|
'https://github.com/bggRGjQaUbCoE/PiliPlus/commit/${BuildConfig.commitHash}'),
|
||||||
onLongPress: () => Utils.copyText(BuildConfig.commitHash),
|
onLongPress: () => Utils.copyText(BuildConfig.commitHash),
|
||||||
),
|
),
|
||||||
// Obx(
|
|
||||||
// () => ListTile(
|
|
||||||
// onTap: () => _aboutController.onUpdate(),
|
|
||||||
// title: const Text('最新版本'),
|
|
||||||
// leading: const Icon(Icons.flag_outlined),
|
|
||||||
// trailing: Text(
|
|
||||||
// _aboutController.isLoading.value
|
|
||||||
// ? '正在获取'
|
|
||||||
// : _aboutController.isUpdate.value
|
|
||||||
// ? '有新版本 ❤️${_aboutController.remoteVersion.value}'
|
|
||||||
// : '当前已是最新版',
|
|
||||||
// style: subTitleStyle,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ListTile(
|
|
||||||
// onTap: () {},
|
|
||||||
// title: const Text('更新日志'),
|
|
||||||
// trailing: const Icon(
|
|
||||||
// Icons.arrow_forward,
|
|
||||||
// size: 16,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
Divider(
|
Divider(
|
||||||
thickness: 1,
|
thickness: 1,
|
||||||
height: 30,
|
height: 30,
|
||||||
@@ -303,10 +288,7 @@ Commit Hash: ${BuildConfig.commitHash}''',
|
|||||||
onPressed: Get.back,
|
onPressed: Get.back,
|
||||||
child: Text(
|
child: Text(
|
||||||
'取消',
|
'取消',
|
||||||
style: TextStyle(
|
style: TextStyle(color: outline),
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -391,11 +373,7 @@ Commit Hash: ${BuildConfig.commitHash}''',
|
|||||||
onPressed: Get.back,
|
onPressed: Get.back,
|
||||||
child: Text(
|
child: Text(
|
||||||
'取消',
|
'取消',
|
||||||
style: TextStyle(
|
style: TextStyle(color: outline),
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.outline,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -425,8 +403,8 @@ Commit Hash: ${BuildConfig.commitHash}''',
|
|||||||
ListTile(
|
ListTile(
|
||||||
title: const Text('重置所有设置'),
|
title: const Text('重置所有设置'),
|
||||||
leading: const Icon(Icons.settings_backup_restore_outlined),
|
leading: const Icon(Icons.settings_backup_restore_outlined),
|
||||||
onTap: () async {
|
onTap: () {
|
||||||
await showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
@@ -490,47 +468,13 @@ class AboutController extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
// init();
|
|
||||||
// 获取当前版本
|
|
||||||
getCurrentApp();
|
getCurrentApp();
|
||||||
// 获取最新的版本
|
|
||||||
// getRemoteApp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取设备信息
|
|
||||||
// Future init() async {
|
|
||||||
// DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
|
||||||
// if (Platform.isAndroid) {
|
|
||||||
// AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
|
||||||
// debugPrint(androidInfo.supportedAbis);
|
|
||||||
// } else if (Platform.isIOS) {
|
|
||||||
// IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
|
|
||||||
// debugPrint(iosInfo);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取当前版本
|
// 获取当前版本
|
||||||
Future getCurrentApp() async {
|
Future getCurrentApp() async {
|
||||||
var currentInfo = await PackageInfo.fromPlatform();
|
var currentInfo = await PackageInfo.fromPlatform();
|
||||||
String buildNumber = currentInfo.buildNumber;
|
String buildNumber = currentInfo.buildNumber;
|
||||||
currentVersion.value = "${currentInfo.version}+$buildNumber";
|
currentVersion.value = "${currentInfo.version}+$buildNumber";
|
||||||
}
|
}
|
||||||
|
|
||||||
// // 获取远程版本
|
|
||||||
// Future getRemoteApp() async {
|
|
||||||
// var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
|
||||||
// if (result.data.isEmpty) {
|
|
||||||
// SmartDialog.showToast('检查更新失败,github接口未返回数据,请检查网络');
|
|
||||||
// return false;
|
|
||||||
// } else if (result.data[0] == null) {
|
|
||||||
// SmartDialog.showToast('检查更新失败,github接口返回如下内容:\n${result.data}');
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// data = LatestDataModel.fromJson(result.data[0]);
|
|
||||||
// remoteAppInfo = data;
|
|
||||||
// remoteVersion.value = data!.tagName!;
|
|
||||||
// isUpdate.value =
|
|
||||||
// Utils.needUpdate(currentVersion.value, remoteVersion.value);
|
|
||||||
// isLoading.value = false;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ class BangumiController extends CommonListController<
|
|||||||
BangumiController({required this.tabType});
|
BangumiController({required this.tabType});
|
||||||
final TabType tabType;
|
final TabType tabType;
|
||||||
|
|
||||||
RxBool isLogin = false.obs;
|
|
||||||
int? mid;
|
int? mid;
|
||||||
|
late final RxBool isLogin;
|
||||||
late final showPgcTimeline =
|
late final showPgcTimeline =
|
||||||
tabType == TabType.bangumi && GStorage.showPgcTimeline;
|
tabType == TabType.bangumi && GStorage.showPgcTimeline;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ class BangumiController extends CommonListController<
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
mid = Accounts.main.mid;
|
mid = Accounts.main.mid;
|
||||||
isLogin.value = mid != 0;
|
isLogin = (mid != 0).obs;
|
||||||
|
|
||||||
queryData();
|
queryData();
|
||||||
queryBangumiFollow();
|
queryBangumiFollow();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import 'package:get/get.dart';
|
|||||||
class BlackListController
|
class BlackListController
|
||||||
extends CommonListController<BlackListDataModel, BlackListItem> {
|
extends CommonListController<BlackListDataModel, BlackListItem> {
|
||||||
int pageSize = 50;
|
int pageSize = 50;
|
||||||
RxInt total = 0.obs;
|
RxInt total = (-1).obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Obx(
|
title: Obx(
|
||||||
() => Text('黑名单管理: ${_blackListController.total.value}'),
|
() => Text(
|
||||||
|
'黑名单管理${_blackListController.total.value == -1 ? '' : ': ${_blackListController.total.value}'}'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: refreshIndicator(
|
body: refreshIndicator(
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class DanmakuBlockController extends GetxController
|
class DanmakuBlockController extends GetxController
|
||||||
with GetTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
final ruleTypes = RxMap<int, Map<int, String>>({0: {}, 1: {}, 2: {}});
|
final ruleTypes = RxMap<int, Map<int, String>>({0: {}, 1: {}, 2: {}});
|
||||||
late TabController tabController;
|
late TabController tabController;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import '../../models/follow/result.dart';
|
|||||||
import '../common/common_controller.dart';
|
import '../common/common_controller.dart';
|
||||||
|
|
||||||
class DynamicsController extends GetxController
|
class DynamicsController extends GetxController
|
||||||
with GetTickerProviderStateMixin, ScrollOrRefreshMixin {
|
with GetSingleTickerProviderStateMixin, ScrollOrRefreshMixin {
|
||||||
@override
|
@override
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
String? offset = '';
|
String? offset = '';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import '../../http/reply.dart';
|
|||||||
|
|
||||||
class EmotePanelController
|
class EmotePanelController
|
||||||
extends CommonListController<List<Packages>?, Packages>
|
extends CommonListController<List<Packages>?, Packages>
|
||||||
with GetTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
TabController? tabController;
|
TabController? tabController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import 'package:PiliPlus/utils/storage.dart';
|
|||||||
|
|
||||||
/// 查看自己的关注时,可以查看分类
|
/// 查看自己的关注时,可以查看分类
|
||||||
/// 查看其他人的关注时,只可以看全部
|
/// 查看其他人的关注时,只可以看全部
|
||||||
class FollowController extends GetxController with GetTickerProviderStateMixin {
|
class FollowController extends GetxController
|
||||||
|
with GetSingleTickerProviderStateMixin {
|
||||||
int pn = 1;
|
int pn = 1;
|
||||||
int ps = 20;
|
int ps = 20;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import 'package:PiliPlus/models/user/history.dart';
|
|||||||
import 'package:PiliPlus/utils/storage.dart';
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
|
|
||||||
class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||||
with GetTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
HistoryController(this.type);
|
HistoryController(this.type);
|
||||||
|
|
||||||
late final baseCtr = Get.put(HistoryBaseController());
|
late final baseCtr = Get.put(HistoryBaseController());
|
||||||
|
|||||||
@@ -11,18 +11,16 @@ import '../common/common_controller.dart';
|
|||||||
import '../mine/view.dart';
|
import '../mine/view.dart';
|
||||||
|
|
||||||
class HomeController extends GetxController
|
class HomeController extends GetxController
|
||||||
with GetTickerProviderStateMixin, ScrollOrRefreshMixin {
|
with GetSingleTickerProviderStateMixin, ScrollOrRefreshMixin {
|
||||||
late RxList tabs = [].obs;
|
late List tabs;
|
||||||
late TabController tabController;
|
|
||||||
late List tabsCtrList;
|
late List tabsCtrList;
|
||||||
late List<Widget> tabsPageList;
|
late TabController tabController;
|
||||||
|
|
||||||
RxBool isLogin = false.obs;
|
RxBool isLogin = false.obs;
|
||||||
RxString userFace = ''.obs;
|
RxString userFace = ''.obs;
|
||||||
dynamic userInfo;
|
|
||||||
StreamController<bool>? searchBarStream;
|
StreamController<bool>? searchBarStream;
|
||||||
late bool hideSearchBar;
|
late bool hideSearchBar;
|
||||||
late List defaultTabs;
|
|
||||||
late List<String> tabbarSort;
|
|
||||||
late bool useSideBar;
|
late bool useSideBar;
|
||||||
|
|
||||||
late bool enableSearchWord;
|
late bool enableSearchWord;
|
||||||
@@ -45,23 +43,26 @@ class HomeController extends GetxController
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
userInfo = GStorage.userInfo.get('userInfoCache');
|
final userInfo = GStorage.userInfo.get('userInfoCache');
|
||||||
isLogin.value = userInfo != null;
|
isLogin.value = userInfo != null;
|
||||||
userFace.value = userInfo != null ? userInfo.face : '';
|
userFace.value = userInfo != null ? userInfo.face : '';
|
||||||
|
|
||||||
hideSearchBar =
|
hideSearchBar =
|
||||||
GStorage.setting.get(SettingBoxKey.hideSearchBar, defaultValue: true);
|
GStorage.setting.get(SettingBoxKey.hideSearchBar, defaultValue: true);
|
||||||
if (hideSearchBar) {
|
if (hideSearchBar) {
|
||||||
searchBarStream = StreamController<bool>.broadcast();
|
searchBarStream = StreamController<bool>.broadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
enableSearchWord = GStorage.setting
|
enableSearchWord = GStorage.setting
|
||||||
.get(SettingBoxKey.enableSearchWord, defaultValue: true);
|
.get(SettingBoxKey.enableSearchWord, defaultValue: true);
|
||||||
if (enableSearchWord) {
|
if (enableSearchWord) {
|
||||||
lateCheckSearchAt = DateTime.now().millisecondsSinceEpoch;
|
lateCheckSearchAt = DateTime.now().millisecondsSinceEpoch;
|
||||||
querySearchDefault();
|
querySearchDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
useSideBar =
|
useSideBar =
|
||||||
GStorage.setting.get(SettingBoxKey.useSideBar, defaultValue: false);
|
GStorage.setting.get(SettingBoxKey.useSideBar, defaultValue: false);
|
||||||
// 进行tabs配置
|
|
||||||
setTabConfig();
|
setTabConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,18 +72,17 @@ class HomeController extends GetxController
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setTabConfig() async {
|
void setTabConfig() async {
|
||||||
defaultTabs = [...tabsConfig];
|
final defaultTabs = [...tabsConfig];
|
||||||
tabbarSort = GStorage.tabbarSort;
|
final tabbarSort = GStorage.tabbarSort;
|
||||||
defaultTabs.retainWhere(
|
defaultTabs.retainWhere(
|
||||||
(item) => tabbarSort.contains((item['type'] as TabType).name));
|
(item) => tabbarSort.contains((item['type'] as TabType).name));
|
||||||
defaultTabs.sort((a, b) => tabbarSort
|
defaultTabs.sort((a, b) => tabbarSort
|
||||||
.indexOf((a['type'] as TabType).name)
|
.indexOf((a['type'] as TabType).name)
|
||||||
.compareTo(tabbarSort.indexOf((b['type'] as TabType).name)));
|
.compareTo(tabbarSort.indexOf((b['type'] as TabType).name)));
|
||||||
|
|
||||||
tabs.value = defaultTabs;
|
tabs = defaultTabs;
|
||||||
|
|
||||||
tabsCtrList = tabs.map((e) => e['ctr']).toList();
|
tabsCtrList = tabs.map((e) => e['ctr']).toList();
|
||||||
tabsPageList = tabs.map<Widget>((e) => e['page']).toList();
|
|
||||||
|
|
||||||
tabController = TabController(
|
tabController = TabController(
|
||||||
initialIndex: max(0, tabbarSort.indexOf(TabType.rcmd.name)),
|
initialIndex: max(0, tabbarSort.indexOf(TabType.rcmd.name)),
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ class _HomePageState extends State<HomePage>
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: tabBarView(
|
child: tabBarView(
|
||||||
controller: _homeController.tabController,
|
controller: _homeController.tabController,
|
||||||
children: _homeController.tabsPageList,
|
children:
|
||||||
|
_homeController.tabs.map<Widget>((e) => e['page']).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:PiliPlus/models/common/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/common/common_page.dart';
|
||||||
import 'package:PiliPlus/pages/rank/view.dart';
|
import 'package:PiliPlus/pages/rank/view.dart';
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:PiliPlus/common/constants.dart';
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
@@ -41,7 +42,7 @@ class _HotPageState extends CommonPageState<HotPage, HotController>
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Image.network(width: 35, height: 35, iconUrl),
|
CachedNetworkImage(width: 35, height: 35, imageUrl: iconUrl),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
class LiveEmotePanelController
|
class LiveEmotePanelController
|
||||||
extends CommonListController<List<LiveEmoteDatum>?, LiveEmoteDatum>
|
extends CommonListController<List<LiveEmoteDatum>?, LiveEmoteDatum>
|
||||||
with GetTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
LiveEmotePanelController(this.roomId);
|
LiveEmotePanelController(this.roomId);
|
||||||
final int roomId;
|
final int roomId;
|
||||||
TabController? tabController;
|
TabController? tabController;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import 'package:get/get.dart';
|
|||||||
import '../../../../models/space/item.dart';
|
import '../../../../models/space/item.dart';
|
||||||
|
|
||||||
class MemberContributeCtr extends CommonDataController
|
class MemberContributeCtr extends CommonDataController
|
||||||
with GetTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
MemberContributeCtr({
|
MemberContributeCtr({
|
||||||
required this.heroTag,
|
required this.heroTag,
|
||||||
required this.initialIndex,
|
required this.initialIndex,
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ class MemberControllerNew extends CommonDataController<Data, dynamic>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
tabs = tab2!.map((item) => Tab(text: item.title ?? '')).toList();
|
tabs = tab2!.map((item) => Tab(text: item.title ?? '')).toList();
|
||||||
|
tabController?.dispose();
|
||||||
tabController = TabController(
|
tabController = TabController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
length: tabs.length,
|
length: tabs.length,
|
||||||
@@ -132,6 +133,7 @@ class MemberControllerNew extends CommonDataController<Data, dynamic>
|
|||||||
Tab2(title: '追番', param: 'bangumi'),
|
Tab2(title: '追番', param: 'bangumi'),
|
||||||
];
|
];
|
||||||
tabs = tab2!.map((item) => Tab(text: item.title)).toList();
|
tabs = tab2!.map((item) => Tab(text: item.title)).toList();
|
||||||
|
tabController?.dispose();
|
||||||
tabController = TabController(
|
tabController = TabController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
length: tabs.length,
|
length: tabs.length,
|
||||||
|
|||||||
@@ -7,41 +7,19 @@ import 'package:get/get.dart';
|
|||||||
import 'package:PiliPlus/models/common/rank_type.dart';
|
import 'package:PiliPlus/models/common/rank_type.dart';
|
||||||
|
|
||||||
class RankController extends GetxController
|
class RankController extends GetxController
|
||||||
with GetTickerProviderStateMixin, ScrollOrRefreshMixin {
|
with GetSingleTickerProviderStateMixin, ScrollOrRefreshMixin {
|
||||||
bool flag = false;
|
RxInt tabIndex = 0.obs;
|
||||||
late RxList tabs = [].obs;
|
|
||||||
RxInt initialIndex = 0.obs;
|
|
||||||
late TabController tabController;
|
late TabController tabController;
|
||||||
late List<Widget> tabsPageList;
|
|
||||||
// late final StreamController<bool> searchBarStream =
|
|
||||||
// StreamController<bool>.broadcast();
|
|
||||||
late bool enableGradientBg;
|
|
||||||
|
|
||||||
ZoneController get controller => Get.find<ZoneController>(
|
ZoneController get controller => Get.find<ZoneController>(
|
||||||
tag: tabsConfig[tabController.index]['rid'].toString());
|
tag: tabsConfig[tabController.index]['rid'].toString());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ScrollController get scrollController => controller.scrollController;
|
ScrollController get scrollController => controller.scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
// enableGradientBg =
|
tabController = TabController(length: tabsConfig.length, vsync: this);
|
||||||
// setting.get(SettingBoxKey.enableGradientBg, defaultValue: true);
|
|
||||||
// 进行tabs配置
|
|
||||||
setTabConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTabConfig() async {
|
|
||||||
tabs.value = tabsConfig;
|
|
||||||
initialIndex.value = 0;
|
|
||||||
tabsPageList = tabs.map((item) => ZonePage(rid: item['rid'])).toList();
|
|
||||||
|
|
||||||
tabController = TabController(
|
|
||||||
initialIndex: initialIndex.value,
|
|
||||||
length: tabs.length,
|
|
||||||
vsync: this,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:PiliPlus/models/common/rank_type.dart';
|
||||||
|
import 'package:PiliPlus/pages/rank/zone/view.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import './controller.dart';
|
import './controller.dart';
|
||||||
@@ -10,19 +12,12 @@ class RankPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _RankPageState extends State<RankPage>
|
class _RankPageState extends State<RankPage>
|
||||||
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
final RankController _rankController = Get.put(RankController());
|
final RankController _rankController = Get.put(RankController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_rankController.tabController =
|
|
||||||
TabController(vsync: this, length: _rankController.tabs.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
@@ -36,16 +31,16 @@ class _RankPageState extends State<RankPage>
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: List.generate(
|
children: List.generate(
|
||||||
_rankController.tabs.length,
|
tabsConfig.length,
|
||||||
(index) => Obx(
|
(index) => Obx(
|
||||||
() => IntrinsicHeight(
|
() => IntrinsicHeight(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_rankController.initialIndex.value = index;
|
_rankController.tabIndex.value = index;
|
||||||
_rankController.tabController.animateTo(index);
|
_rankController.tabController.animateTo(index);
|
||||||
},
|
},
|
||||||
child: ColoredBox(
|
child: ColoredBox(
|
||||||
color: index == _rankController.initialIndex.value
|
color: index == _rankController.tabIndex.value
|
||||||
? Theme.of(context).colorScheme.onInverseSurface
|
? Theme.of(context).colorScheme.onInverseSurface
|
||||||
: Theme.of(context).colorScheme.surface,
|
: Theme.of(context).colorScheme.surface,
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -54,7 +49,7 @@ class _RankPageState extends State<RankPage>
|
|||||||
Container(
|
Container(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
width: 3,
|
width: 3,
|
||||||
color: index == _rankController.initialIndex.value
|
color: index == _rankController.tabIndex.value
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
),
|
),
|
||||||
@@ -65,10 +60,10 @@ class _RankPageState extends State<RankPage>
|
|||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(vertical: 7),
|
const EdgeInsets.symmetric(vertical: 7),
|
||||||
child: Text(
|
child: Text(
|
||||||
_rankController.tabs[index]['label'],
|
tabsConfig[index]['label'],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: index ==
|
color: index ==
|
||||||
_rankController.initialIndex.value
|
_rankController.tabIndex.value
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
@@ -94,7 +89,8 @@ class _RankPageState extends State<RankPage>
|
|||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
controller: _rankController.tabController,
|
controller: _rankController.tabController,
|
||||||
children: _rankController.tabsPageList,
|
children:
|
||||||
|
tabsConfig.map((item) => ZonePage(rid: item['rid'])).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class _ZonePageState extends CommonPageState<ZonePage, ZoneController>
|
|||||||
controller: controller.scrollController,
|
controller: controller.scrollController,
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
// 单列布局 EdgeInsets.zero
|
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: StyleString.safeSpace - 5,
|
top: StyleString.safeSpace - 5,
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 80,
|
bottom: MediaQuery.of(context).padding.bottom + 80,
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ import '../../../../http/search.dart';
|
|||||||
import '../../../../models/model_hot_video_item.dart';
|
import '../../../../models/model_hot_video_item.dart';
|
||||||
import '../related/index.dart';
|
import '../related/index.dart';
|
||||||
|
|
||||||
class VideoIntroController extends GetxController
|
class VideoIntroController extends GetxController {
|
||||||
with GetTickerProviderStateMixin {
|
|
||||||
// 视频bvid
|
// 视频bvid
|
||||||
late String bvid;
|
late String bvid;
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ class ActionItem extends StatefulWidget {
|
|||||||
State<ActionItem> createState() => ActionItemState();
|
State<ActionItem> createState() => ActionItemState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActionItemState extends State<ActionItem> with TickerProviderStateMixin {
|
class ActionItemState extends State<ActionItem>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
AnimationController? controller;
|
AnimationController? controller;
|
||||||
Animation<double>? _animation;
|
Animation<double>? _animation;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get_state_manager/src/rx_flutter/rx_ticket_provider_mixin.dart';
|
import 'package:get/get_state_manager/src/rx_flutter/rx_ticket_provider_mixin.dart';
|
||||||
|
|
||||||
class VideoReplyController extends ReplyController<MainListReply>
|
class VideoReplyController extends ReplyController<MainListReply>
|
||||||
with GetTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
VideoReplyController({required this.aid});
|
VideoReplyController({required this.aid});
|
||||||
// 视频aid 请求时使用的oid
|
// 视频aid 请求时使用的oid
|
||||||
int aid;
|
int aid;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import 'package:PiliPlus/models/common/reply_type.dart';
|
|||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||||
|
|
||||||
class VideoReplyReplyController extends ReplyController
|
class VideoReplyReplyController extends ReplyController
|
||||||
with GetTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
VideoReplyReplyController({
|
VideoReplyReplyController({
|
||||||
required this.hasRoot,
|
required this.hasRoot,
|
||||||
required this.id,
|
required this.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user