Skip to content

Commit

Permalink
修改集数表现形式,优化Mac端表现
Browse files Browse the repository at this point in the history
1. 几乎所有地方的表现都改成了原始网站表现形式
2. 历史记录页面的表现由于不熟悉也看不懂没敢做改动
3. Mac会被原来的代码认为是低分辨率,导致初始窗口很小,做了一个很不优雅的修改,让它启动时有正确的表现
4. 有些文件的自动修改我不清楚是否必要,总之都提交上去了
  • Loading branch information
ErBWs committed Oct 16, 2024
1 parent c77b504 commit 094bbc9
Show file tree
Hide file tree
Showing 14 changed files with 327 additions and 29 deletions.
39 changes: 27 additions & 12 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,33 @@ void main() async {
if (Utils.isDesktop()) {
await windowManager.ensureInitialized();
bool isLowResolution = await Utils.isLowResolution();
WindowOptions windowOptions = WindowOptions(
size: isLowResolution ? const Size(800, 600) : const Size(1280, 860),
center: true,
// backgroundColor: Colors.white,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.hidden,
windowButtonVisibility: false,
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
if (Platform.isMacOS) {
WindowOptions windowOptions = const WindowOptions(
size: Size(1400, 900),
center: true,
// backgroundColor: Colors.white,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.hidden,
windowButtonVisibility: false,
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
} else {
WindowOptions windowOptions = WindowOptions(
size: isLowResolution ? const Size(800, 600) : const Size(1280, 860),
center: true,
// backgroundColor: Colors.white,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.hidden,
windowButtonVisibility: false,
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
}
}
if (Platform.isAndroid || Platform.isIOS) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/roads/road_module.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
class Road {
String name;
List<String> data;
List<String> identifier;

Road({
required this.name,
required this.data,
required this.identifier,
});
}
2 changes: 1 addition & 1 deletion lib/pages/player/player_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class _PlayerItemState extends State<PlayerItem>
.roadList[videoPageController.currentRoad].data.length &&
!videoPageController.loading) {
SmartDialog.showToast(
'正在加载第 ${videoPageController.currentEspisode + 1} 话');
'正在加载${videoPageController.roadList[videoPageController.currentRoad].identifier[videoPageController.currentEspisode]}');
try {
playerTimer!.cancel();
} catch (_) {}
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/video/video_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ abstract class _VideoPageController with Store {
currentEspisode = episode;
this.currentRoad = currentRoad;
logLines.clear();
KazumiLogger().log(Level.info, '跳转到第$episode话');
String chapterName = roadList[currentRoad].identifier[episode - 1];
KazumiLogger().log(Level.info, '跳转到$chapterName');
String urlItem = roadList[currentRoad].data[episode - 1];
if (urlItem.contains(currentPlugin.baseUrl) ||
urlItem.contains(currentPlugin.baseUrl.replaceAll('https', 'http'))) {
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/video/video_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class _VideoPageState extends State<VideoPage>
const SizedBox(width: 6)
],
Text(
'第$count话',
road.identifier[count0 - 1],
style: TextStyle(
fontSize: 13,
color: (count0 ==
Expand Down
7 changes: 5 additions & 2 deletions lib/plugins/plugins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,15 @@ class Plugin {
htmlElement.queryXPath(chapterRoads).nodes.forEach((element) {
try {
List<String> chapterUrlList = [];
List<String> chapterNameList = [];
element.queryXPath(chapterResult).nodes.forEach((item) {
String itemUrl = item.node.attributes['href'] ?? '';
String itemName = item.node.text ?? '';
chapterUrlList.add(itemUrl);
chapterNameList.add(itemName);
});
if (chapterUrlList.isNotEmpty) {
Road road = Road(name: '播放列表$count', data: chapterUrlList);
if (chapterUrlList.isNotEmpty && chapterNameList.isNotEmpty) {
Road road = Road(name: '播放列表$count', data: chapterUrlList, identifier: chapterNameList);
roadList.add(road);
count++;
}
Expand Down
1 change: 1 addition & 0 deletions macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
1 change: 1 addition & 0 deletions macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
43 changes: 43 additions & 0 deletions macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
132 changes: 132 additions & 0 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
PODS:
- connectivity_plus (0.0.1):
- Flutter
- FlutterMacOS
- device_info_plus (0.0.1):
- FlutterMacOS
- flutter_volume_controller (0.0.1):
- FlutterMacOS
- FlutterMacOS (1.0.0)
- fvp (0.27.0):
- Flutter
- FlutterMacOS
- mdk (~> 0.29.1)
- mdk (0.29.1)
- package_info_plus (0.0.1):
- FlutterMacOS
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- screen_brightness_macos (0.1.0):
- FlutterMacOS
- screen_pixel (0.0.3):
- FlutterMacOS
- screen_retriever (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- tray_manager (0.0.1):
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS
- wakelock_plus (0.0.1):
- FlutterMacOS
- webview_flutter_wkwebview (0.0.1):
- Flutter
- FlutterMacOS
- window_manager (0.2.0):
- FlutterMacOS

DEPENDENCIES:
- connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/darwin`)
- device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`)
- flutter_volume_controller (from `Flutter/ephemeral/.symlinks/plugins/flutter_volume_controller/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- fvp (from `Flutter/ephemeral/.symlinks/plugins/fvp/darwin`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- screen_brightness_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos`)
- screen_pixel (from `Flutter/ephemeral/.symlinks/plugins/screen_pixel/macos`)
- screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)
- tray_manager (from `Flutter/ephemeral/.symlinks/plugins/tray_manager/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`)
- wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`)
- webview_flutter_wkwebview (from `Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin`)
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)

SPEC REPOS:
trunk:
- mdk

EXTERNAL SOURCES:
connectivity_plus:
:path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/darwin
device_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos
flutter_volume_controller:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_volume_controller/macos
FlutterMacOS:
:path: Flutter/ephemeral
fvp:
:path: Flutter/ephemeral/.symlinks/plugins/fvp/darwin
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
screen_brightness_macos:
:path: Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos
screen_pixel:
:path: Flutter/ephemeral/.symlinks/plugins/screen_pixel/macos
screen_retriever:
:path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
sqflite:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin
tray_manager:
:path: Flutter/ephemeral/.symlinks/plugins/tray_manager/macos
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
video_player_avfoundation:
:path: Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin
wakelock_plus:
:path: Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos
webview_flutter_wkwebview:
:path: Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin
window_manager:
:path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos

SPEC CHECKSUMS:
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720
flutter_volume_controller: 25d09126b0d695560f11c80b1311d5063fed882f
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
fvp: b843e46165476a3702ec3c80f781488ef5089964
mdk: 3c49affb38303cf86fd9f8ea1e05fe029c4dc194
package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
screen_pixel: 29576a1f6694cdb539c3bb0d27faab62de2e8e76
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
tray_manager: 9064e219c56d75c476e46b9a21182087930baf90
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269
webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4
window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.15.2
Loading

0 comments on commit 094bbc9

Please sign in to comment.