Skip to content

Commit

Permalink
集数表现形式修改,macOS表现优化
Browse files Browse the repository at this point in the history
1. 除历史记录界面表现外,其他界面均修改为原始网页表现形式
2. 优化macOS启动时界面大小
  • Loading branch information
ErBWs committed Oct 17, 2024
1 parent ce773ca commit ec079ac
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 17 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

0 comments on commit ec079ac

Please sign in to comment.