Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

migrate to onPopInvokedWithResult & update wake lock lib

Prediditc0e6b8e2d59c
diff --git a/lib/pages/about/about_page.dart b/lib/pages/about/about_page.dart
index 296c18c6..c1eec94b 100644
--- a/lib/pages/about/about_page.dart
+++ b/lib/pages/about/about_page.dart
@@ -129,7 +129,10 @@ class _AboutPageState extends State<AboutPage> {
});
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) async {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: Scaffold(
diff --git a/lib/pages/history/history_page.dart b/lib/pages/history/history_page.dart
index a5bc36dd..e0ff897a 100644
--- a/lib/pages/history/history_page.dart
+++ b/lib/pages/history/history_page.dart
@@ -49,7 +49,10 @@ class _HistoryPageState extends State<HistoryPage>
return Observer(builder: (context) {
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) async {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: Scaffold(
diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart
index 4ee580d1..5e187e90 100644
--- a/lib/pages/player/player_item.dart
+++ b/lib/pages/player/player_item.dart
@@ -51,7 +51,6 @@ class _PlayerItemState extends State<PlayerItem>
late DanmakuController danmakuController;
late bool isFavorite;
late bool webDavEnable;
- bool isPopping = false;
// 界面管理
bool showPositioned = false;
@@ -106,7 +105,7 @@ class _PlayerItemState extends State<PlayerItem>
_animationController.reverse();
}
hideTimer = null;
- });
+ });
} else {
_animationController.reverse();
if (hideTimer != null) {
@@ -245,17 +244,16 @@ class _PlayerItemState extends State<PlayerItem>
KazumiLogger().log(Level.error, '卸载播放器错误 ${e.toString()}');
}
}
- // workaround on flutter 3.22.1
- if (!isPopping) {
- isPopping = true;
- if (webDavEnable) {
- try {
- var webDav = WebDav();
- webDav.updateHistory();
- } catch (e) {
- SmartDialog.showToast('同步记录失败 ${e.toString()}');
- }
+
+ if (webDavEnable) {
+ try {
+ var webDav = WebDav();
+ webDav.updateHistory();
+ } catch (e) {
+ SmartDialog.showToast('同步记录失败 ${e.toString()}');
}
+ }
+ if (mounted) {
Navigator.of(context).pop();
}
// Navigator.of(context).pop();
@@ -492,7 +490,10 @@ class _PlayerItemState extends State<PlayerItem>
return PopScope(
// key: _key,
canPop: false,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: SafeArea(
@@ -541,7 +542,8 @@ class _PlayerItemState extends State<PlayerItem>
try {
playerController.playOrPause();
} catch (e) {
- KazumiLogger().log(Level.error, '播放器内部错误 ${e.toString()}');
+ KazumiLogger().log(
+ Level.error, '播放器内部错误 ${e.toString()}');
}
}
// 右方向键被按下
@@ -559,7 +561,8 @@ class _PlayerItemState extends State<PlayerItem>
.seek(playerController.currentPosition);
playerTimer = getPlayerTimer();
} catch (e) {
- KazumiLogger().log(Level.error, '播放器内部错误 ${e.toString()}');
+ KazumiLogger().log(
+ Level.error, '播放器内部错误 ${e.toString()}');
}
}
// 左方向键被按下
@@ -1075,7 +1078,8 @@ class _PlayerItemState extends State<PlayerItem>
playerController.currentPosition =
duration;
playerController.seek(duration);
- playerTimer = getPlayerTimer(); //Bug_time
+ playerTimer =
+ getPlayerTimer(); //Bug_time
},
),
),
@@ -1087,9 +1091,13 @@ class _PlayerItemState extends State<PlayerItem>
padding: const EdgeInsets.only(
left: 10.0),
child: Text(
- Utils.durationToString(playerController.currentPosition)+
- " / "+
- Utils.durationToString(playerController.duration),
+ Utils.durationToString(
+ playerController
+ .currentPosition) +
+ " / " +
+ Utils.durationToString(
+ playerController
+ .duration),
style: TextStyle(
color: Colors.white,
fontSize: !Utils.isCompact()
diff --git a/lib/pages/plugin_editor/plugin_shop_page.dart b/lib/pages/plugin_editor/plugin_shop_page.dart
index 92a2c3aa..7f9890e1 100644
--- a/lib/pages/plugin_editor/plugin_shop_page.dart
+++ b/lib/pages/plugin_editor/plugin_shop_page.dart
@@ -49,7 +49,10 @@ class _PluginShopPageState extends State<PluginShopPage> {
});
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: Scaffold(
diff --git a/lib/pages/plugin_editor/plugin_view_page.dart b/lib/pages/plugin_editor/plugin_view_page.dart
index b4733e0d..3d692dc1 100644
--- a/lib/pages/plugin_editor/plugin_view_page.dart
+++ b/lib/pages/plugin_editor/plugin_view_page.dart
@@ -136,7 +136,10 @@ class _PluginViewPageState extends State<PluginViewPage> {
});
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: Scaffold(
diff --git a/lib/pages/popular/popular_page.dart b/lib/pages/popular/popular_page.dart
index 0003d111..8d3b5035 100644
--- a/lib/pages/popular/popular_page.dart
+++ b/lib/pages/popular/popular_page.dart
@@ -90,7 +90,10 @@ class _PopularPageState extends State<PopularPage>
});
return PopScope(
canPop: false,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: RefreshIndicator(
@@ -315,7 +318,10 @@ class _PopularPageState extends State<PopularPage>
'悬疑',
'热血',
'后宫',
- '机战'
+ '机战',
+ '轻改',
+ '偶像',
+ '治愈',
];
return Row(
children: <Widget>[
diff --git a/lib/pages/settings/danmaku_settings.dart b/lib/pages/settings/danmaku_settings.dart
index bc11e3de..2b873dd1 100644
--- a/lib/pages/settings/danmaku_settings.dart
+++ b/lib/pages/settings/danmaku_settings.dart
@@ -77,7 +77,10 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
});
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: Scaffold(
diff --git a/lib/pages/settings/other_settings.dart b/lib/pages/settings/other_settings.dart
index c00dab28..bb593205 100644
--- a/lib/pages/settings/other_settings.dart
+++ b/lib/pages/settings/other_settings.dart
@@ -46,7 +46,10 @@ class _OtherSettingsPageState extends State<OtherSettingsPage> {
});
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: const Scaffold(
diff --git a/lib/pages/settings/player_settings.dart b/lib/pages/settings/player_settings.dart
index 65c7d2bd..f245f065 100644
--- a/lib/pages/settings/player_settings.dart
+++ b/lib/pages/settings/player_settings.dart
@@ -41,7 +41,10 @@ class _PlayerSettingsPageState extends State<PlayerSettingsPage> {
});
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: const Scaffold(
diff --git a/lib/pages/settings/theme_settings_page.dart b/lib/pages/settings/theme_settings_page.dart
index ef56e2b9..f9babe87 100644
--- a/lib/pages/settings/theme_settings_page.dart
+++ b/lib/pages/settings/theme_settings_page.dart
@@ -123,7 +123,10 @@ class _ThemeSettingsPageState extends State<ThemeSettingsPage> {
});
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: Scaffold(
diff --git a/lib/pages/timeline/timeline_page.dart b/lib/pages/timeline/timeline_page.dart
index 1af46ef0..8d6f87f1 100644
--- a/lib/pages/timeline/timeline_page.dart
+++ b/lib/pages/timeline/timeline_page.dart
@@ -79,7 +79,10 @@ class _TimelinePageState extends State<TimelinePage>
return Observer(builder: (context) {
return PopScope(
canPop: false,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: Scaffold(
diff --git a/lib/pages/webdav_editor/webdav_setting.dart b/lib/pages/webdav_editor/webdav_setting.dart
index ab466b65..28d0a30a 100644
--- a/lib/pages/webdav_editor/webdav_setting.dart
+++ b/lib/pages/webdav_editor/webdav_setting.dart
@@ -67,7 +67,10 @@ class _PlayerSettingsPageState extends State<WebDavSettingsPage> {
});
return PopScope(
canPop: true,
- onPopInvoked: (bool didPop) async {
+ onPopInvokedWithResult: (bool didPop, Object? result) {
+ if (didPop) {
+ return;
+ }
onBackPressed(context);
},
child: Scaffold(
diff --git a/pubspec.lock b/pubspec.lock
index a8b6e3eb..bdb05b17 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -783,18 +783,18 @@ packages:
dependency: transitive
description:
name: package_info_plus
- sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
+ sha256: "4de6c36df77ffbcef0a5aefe04669d33f2d18397fea228277b852a2d4e58e860"
url: "https://pub.dev"
source: hosted
- version: "4.2.0"
+ version: "8.0.1"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
- sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
+ sha256: ac1f4a4847f1ade8e6a87d1f39f5d7c67490738642e2542f559ec38c37489a66
url: "https://pub.dev"
source: hosted
- version: "2.0.1"
+ version: "3.0.1"
path:
dependency: transitive
description:
@@ -1356,10 +1356,10 @@ packages:
dependency: "direct main"
description:
name: wakelock_plus
- sha256: f268ca2116db22e57577fb99d52515a24bdc1d570f12ac18bb762361d43b043d
+ sha256: "4fa83a128b4127619e385f686b4f080a5d2de46cff8e8c94eccac5fcf76550e5"
url: "https://pub.dev"
source: hosted
- version: "1.1.4"
+ version: "1.2.7"
wakelock_plus_platform_interface:
dependency: transitive
description:
@@ -1380,10 +1380,10 @@ packages:
dependency: transitive
description:
name: web
- sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062
+ sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
- version: "1.0.0"
+ version: "0.5.1"
web_socket:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 03001fb4..d1444c74 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -58,7 +58,7 @@ dependencies:
flutter_volume_controller: ^1.3.1
screen_brightness: ^0.2.2+1
- wakelock_plus: ^1.1.1
+ wakelock_plus: ^1.2.7
audio_video_progress_bar: ^2.0.2
adaptive_theme: ^3.6.0
flutter_displaymode: ^0.6.0