Compare commits
15 Commits
feature-pl
...
feature-ed
Author | SHA1 | Date | |
---|---|---|---|
ed8443ba02 | |||
3d09d80007 | |||
fffa15faa3 | |||
d6b972a8ab | |||
d6fd299395 | |||
1953653044 | |||
9faa625d52 | |||
7e7bb1f43a | |||
a925ef63eb | |||
f8326e7cb5 | |||
02d2598d01 | |||
77b509fd17 | |||
11e907d74b | |||
6298711528 | |||
0f0546ae59 |
@ -9,6 +9,7 @@ PODS:
|
||||
- Flutter
|
||||
- connectivity_plus (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- ReachabilitySwift
|
||||
- device_info_plus (0.0.1):
|
||||
- Flutter
|
||||
@ -38,7 +39,7 @@ PODS:
|
||||
- path_provider_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- permission_handler_apple (9.1.1):
|
||||
- permission_handler_apple (9.3.0):
|
||||
- Flutter
|
||||
- ReachabilitySwift (5.0.0)
|
||||
- saver_gallery (0.0.1):
|
||||
@ -71,7 +72,7 @@ DEPENDENCIES:
|
||||
- audio_service (from `.symlinks/plugins/audio_service/ios`)
|
||||
- audio_session (from `.symlinks/plugins/audio_session/ios`)
|
||||
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
|
||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_mailer (from `.symlinks/plugins/flutter_mailer/ios`)
|
||||
@ -113,7 +114,7 @@ EXTERNAL SOURCES:
|
||||
auto_orientation:
|
||||
:path: ".symlinks/plugins/auto_orientation/ios"
|
||||
connectivity_plus:
|
||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||
:path: ".symlinks/plugins/connectivity_plus/darwin"
|
||||
device_info_plus:
|
||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||
Flutter:
|
||||
@ -166,7 +167,7 @@ SPEC CHECKSUMS:
|
||||
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
||||
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
||||
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
||||
connectivity_plus: e2dad488011aeb593e219360e804c43cc1af5770
|
||||
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83
|
||||
@ -180,7 +181,7 @@ SPEC CHECKSUMS:
|
||||
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
||||
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
||||
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||
@ -193,7 +194,7 @@ SPEC CHECKSUMS:
|
||||
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
|
||||
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
|
||||
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
|
||||
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
|
||||
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4
|
||||
|
||||
PODFILE CHECKSUM: 637cd290bed23275b5f5ffcc7eb1e73d0a5fb2be
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../pages/dynamics/index.dart';
|
||||
import '../../pages/home/index.dart';
|
||||
import '../../pages/media/index.dart';
|
||||
import '../../pages/rank/index.dart';
|
||||
|
||||
List defaultNavigationBars = [
|
||||
{
|
||||
'id': 0,
|
||||
@ -13,6 +18,7 @@ List defaultNavigationBars = [
|
||||
),
|
||||
'label': "首页",
|
||||
'count': 0,
|
||||
'page': const HomePage(),
|
||||
},
|
||||
{
|
||||
'id': 1,
|
||||
@ -26,6 +32,7 @@ List defaultNavigationBars = [
|
||||
),
|
||||
'label': "排行榜",
|
||||
'count': 0,
|
||||
'page': const RankPage(),
|
||||
},
|
||||
{
|
||||
'id': 2,
|
||||
@ -39,6 +46,7 @@ List defaultNavigationBars = [
|
||||
),
|
||||
'label': "动态",
|
||||
'count': 0,
|
||||
'page': const DynamicsPage(),
|
||||
},
|
||||
{
|
||||
'id': 3,
|
||||
@ -52,5 +60,6 @@ List defaultNavigationBars = [
|
||||
),
|
||||
'label': "媒体库",
|
||||
'count': 0,
|
||||
'page': const MediaPage(),
|
||||
}
|
||||
];
|
||||
|
@ -6,23 +6,16 @@ import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/common.dart';
|
||||
import 'package:pilipala/pages/dynamics/index.dart';
|
||||
import 'package:pilipala/pages/home/view.dart';
|
||||
import 'package:pilipala/pages/media/index.dart';
|
||||
import 'package:pilipala/pages/rank/index.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import '../../models/common/dynamic_badge_mode.dart';
|
||||
import '../../models/common/nav_bar_config.dart';
|
||||
|
||||
class MainController extends GetxController {
|
||||
List<Widget> pages = <Widget>[
|
||||
const HomePage(),
|
||||
const RankPage(),
|
||||
const DynamicsPage(),
|
||||
const MediaPage(),
|
||||
];
|
||||
RxList navigationBars = defaultNavigationBars.obs;
|
||||
List<Widget> pages = <Widget>[];
|
||||
RxList navigationBars = [].obs;
|
||||
late List defaultNavTabs;
|
||||
late List<int> navBarSort;
|
||||
final StreamController<bool> bottomBarStream =
|
||||
StreamController<bool>.broadcast();
|
||||
Box setting = GStrorage.setting;
|
||||
@ -41,10 +34,7 @@ class MainController extends GetxController {
|
||||
Utils.checkUpdata();
|
||||
}
|
||||
hideTabBar = setting.get(SettingBoxKey.hideTabBar, defaultValue: true);
|
||||
int defaultHomePage =
|
||||
setting.get(SettingBoxKey.defaultHomePage, defaultValue: 0) as int;
|
||||
selectedIndex = defaultNavigationBars
|
||||
.indexWhere((item) => item['id'] == defaultHomePage);
|
||||
|
||||
var userInfo = userInfoCache.get('userInfoCache');
|
||||
userLogin.value = userInfo != null;
|
||||
dynamicBadgeType.value = DynamicBadgeMode.values[setting.get(
|
||||
@ -53,6 +43,7 @@ class MainController extends GetxController {
|
||||
if (dynamicBadgeType.value != DynamicBadgeMode.hidden) {
|
||||
getUnreadDynamic();
|
||||
}
|
||||
setNavBarConfig();
|
||||
}
|
||||
|
||||
void onBackPressed(BuildContext context) {
|
||||
@ -93,4 +84,21 @@ class MainController extends GetxController {
|
||||
}
|
||||
navigationBars.refresh();
|
||||
}
|
||||
|
||||
void setNavBarConfig() async {
|
||||
defaultNavTabs = [...defaultNavigationBars];
|
||||
navBarSort =
|
||||
setting.get(SettingBoxKey.navBarSort, defaultValue: [0, 1, 2, 3]);
|
||||
defaultNavTabs.retainWhere((item) => navBarSort.contains(item['id']));
|
||||
defaultNavTabs.sort((a, b) =>
|
||||
navBarSort.indexOf(a['id']).compareTo(navBarSort.indexOf(b['id'])));
|
||||
navigationBars.value = defaultNavTabs;
|
||||
int defaultHomePage =
|
||||
setting.get(SettingBoxKey.defaultHomePage, defaultValue: 0) as int;
|
||||
int defaultIndex =
|
||||
navigationBars.indexWhere((item) => item['id'] == defaultHomePage);
|
||||
// 如果找不到匹配项,默认索引设置为0或其他合适的值
|
||||
selectedIndex = defaultIndex != -1 ? defaultIndex : 0;
|
||||
pages = navigationBars.map<Widget>((e) => e['page']).toList();
|
||||
}
|
||||
}
|
||||
|
@ -50,21 +50,5 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
length: tabs.length,
|
||||
vsync: this,
|
||||
);
|
||||
// 监听 tabController 切换
|
||||
if (enableGradientBg) {
|
||||
tabController.animation!.addListener(() {
|
||||
if (tabController.indexIsChanging) {
|
||||
if (initialIndex.value != tabController.index) {
|
||||
initialIndex.value = tabController.index;
|
||||
}
|
||||
} else {
|
||||
final int temp = tabController.animation!.value.round();
|
||||
if (initialIndex.value != temp) {
|
||||
initialIndex.value = temp;
|
||||
tabController.index = initialIndex.value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
100
lib/pages/setting/pages/navigation_bar_set.dart
Normal file
100
lib/pages/setting/pages/navigation_bar_set.dart
Normal file
@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/models/common/tab_type.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
import '../../../models/common/nav_bar_config.dart';
|
||||
|
||||
class NavigationBarSetPage extends StatefulWidget {
|
||||
const NavigationBarSetPage({super.key});
|
||||
|
||||
@override
|
||||
State<NavigationBarSetPage> createState() => _NavigationbarSetPageState();
|
||||
}
|
||||
|
||||
class _NavigationbarSetPageState extends State<NavigationBarSetPage> {
|
||||
Box settingStorage = GStrorage.setting;
|
||||
late List defaultNavTabs;
|
||||
late List<int> navBarSort;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
defaultNavTabs = defaultNavigationBars;
|
||||
navBarSort = settingStorage
|
||||
.get(SettingBoxKey.navBarSort, defaultValue: [0, 1, 2, 3]);
|
||||
// 对 tabData 进行排序
|
||||
defaultNavTabs.sort((a, b) {
|
||||
int indexA = navBarSort.indexOf(a['id']);
|
||||
int indexB = navBarSort.indexOf(b['id']);
|
||||
|
||||
// 如果类型在 sortOrder 中不存在,则放在末尾
|
||||
if (indexA == -1) indexA = navBarSort.length;
|
||||
if (indexB == -1) indexB = navBarSort.length;
|
||||
|
||||
return indexA.compareTo(indexB);
|
||||
});
|
||||
}
|
||||
|
||||
void saveEdit() {
|
||||
List<int> sortedTabbar = defaultNavTabs
|
||||
.where((i) => navBarSort.contains(i['id']))
|
||||
.map<int>((i) => i['id'])
|
||||
.toList();
|
||||
settingStorage.put(SettingBoxKey.navBarSort, sortedTabbar);
|
||||
SmartDialog.showToast('保存成功,下次启动时生效');
|
||||
}
|
||||
|
||||
void onReorder(int oldIndex, int newIndex) {
|
||||
setState(() {
|
||||
if (newIndex > oldIndex) {
|
||||
newIndex -= 1;
|
||||
}
|
||||
final tabsItem = defaultNavTabs.removeAt(oldIndex);
|
||||
defaultNavTabs.insert(newIndex, tabsItem);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final listTiles = [
|
||||
for (int i = 0; i < defaultNavTabs.length; i++) ...[
|
||||
CheckboxListTile(
|
||||
key: Key(defaultNavTabs[i]['label']),
|
||||
value: navBarSort.contains(defaultNavTabs[i]['id']),
|
||||
onChanged: (bool? newValue) {
|
||||
int tabTypeId = defaultNavTabs[i]['id'];
|
||||
if (!newValue!) {
|
||||
navBarSort.remove(tabTypeId);
|
||||
} else {
|
||||
navBarSort.add(tabTypeId);
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
title: Text(defaultNavTabs[i]['label']),
|
||||
secondary: const Icon(Icons.drag_indicator_rounded),
|
||||
enabled: defaultNavTabs[i]['id'] != 3,
|
||||
)
|
||||
]
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Navbar编辑'),
|
||||
actions: [
|
||||
TextButton(onPressed: () => saveEdit(), child: const Text('保存')),
|
||||
const SizedBox(width: 12)
|
||||
],
|
||||
),
|
||||
body: ReorderableListView(
|
||||
onReorder: onReorder,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
footer: SizedBox(
|
||||
height: MediaQuery.of(context).padding.bottom + 30,
|
||||
),
|
||||
children: listTiles,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -284,12 +284,17 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
onTap: () => Get.toNamed('/tabbarSetting'),
|
||||
title: Text('首页tabbar', style: titleStyle),
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
onTap: () => Get.toNamed('/navbarSetting'),
|
||||
title: Text('navbar设置', style: titleStyle),
|
||||
),
|
||||
if (Platform.isAndroid)
|
||||
ListTile(
|
||||
dense: false,
|
||||
onTap: () => Get.toNamed('/displayModeSetting'),
|
||||
title: Text('屏幕帧率', style: titleStyle),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -15,6 +15,7 @@ import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import '../../../../http/user.dart';
|
||||
import '../widgets/expandable_section.dart';
|
||||
import 'widgets/action_item.dart';
|
||||
import 'widgets/fav_panel.dart';
|
||||
@ -479,7 +480,11 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
),
|
||||
ActionItem(
|
||||
icon: const Icon(FontAwesomeIcons.clock),
|
||||
onTap: () => videoIntroController.actionShareVideo(),
|
||||
onTap: () async {
|
||||
final res =
|
||||
await UserHttp.toViewLater(bvid: widget.videoDetail!.bvid);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
selectStatus: false,
|
||||
text: '稍后看',
|
||||
),
|
||||
|
@ -376,6 +376,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
false)
|
||||
? SvgPicture.asset(
|
||||
'assets/images/video/danmu_close.svg',
|
||||
// ignore: deprecated_member_use
|
||||
color:
|
||||
Theme.of(context).colorScheme.outline,
|
||||
)
|
||||
: SvgPicture.asset(
|
||||
'assets/images/video/danmu_open.svg',
|
||||
|
@ -39,6 +39,7 @@ import '../pages/setting/pages/color_select.dart';
|
||||
import '../pages/setting/pages/display_mode.dart';
|
||||
import '../pages/setting/pages/font_size_select.dart';
|
||||
import '../pages/setting/pages/home_tabbar_set.dart';
|
||||
import '../pages/setting/pages/navigation_bar_set.dart';
|
||||
import '../pages/setting/pages/play_gesture_set.dart';
|
||||
import '../pages/setting/pages/play_speed_set.dart';
|
||||
import '../pages/setting/recommend_setting.dart';
|
||||
@ -170,6 +171,9 @@ class Routes {
|
||||
// 播放器手势
|
||||
CustomGetPage(
|
||||
name: '/playerGestureSet', page: () => const PlayGesturePage()),
|
||||
// navigation bar
|
||||
CustomGetPage(
|
||||
name: '/navbarSetting', page: () => const NavigationBarSetPage()),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,8 @@ class SettingBoxKey {
|
||||
hideTabBar = 'hideTabBar', // 收起底栏
|
||||
tabbarSort = 'tabbarSort', // 首页tabbar
|
||||
dynamicBadgeMode = 'dynamicBadgeMode',
|
||||
enableGradientBg = 'enableGradientBg';
|
||||
enableGradientBg = 'enableGradientBg',
|
||||
navBarSort = 'navBarSort';
|
||||
}
|
||||
|
||||
class LocalCacheKey {
|
||||
|
Reference in New Issue
Block a user