Skip to content

Commit

Permalink
feat: revert some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
st1020 committed Nov 6, 2024
1 parent b2614d9 commit 8e83ea4
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 76 deletions.
31 changes: 13 additions & 18 deletions lib/bean/card/bangumi_info_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,25 +145,20 @@ class _BangumiInfoCardVState extends State<BangumiInfoCardV> {
child:
Text('#${widget.bangumiItem.rank}', style: style),
),
Utils.isCompact()
? Container()
: const SizedBox(width: 7),
Utils.isCompact()
? Container()
: FilledButton.tonal(
onPressed: () {},
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
side: const BorderSide(
// width: 2,
),
backgroundColor: Colors.transparent,
Utils.isCompact() ? Container() : const SizedBox(width: 7),
Utils.isCompact() ? Container() : FilledButton.tonal(
onPressed: () {},
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
side: const BorderSide(
// width: 2,
),
child: Text(widget.bangumiItem.airDate,
style: style),
),
backgroundColor: Colors.transparent,
),
child: Text(widget.bangumiItem.airDate, style: style),
),
],
),
Utils.isCompact() ? Container() : const SizedBox(height: 10),
Expand Down
27 changes: 11 additions & 16 deletions lib/pages/favorite/favorite_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,20 @@ class _FavoritePageState extends State<FavoritePage> {
if (bangumiList.isNotEmpty) {
return Stack(
children: [
BangumiCardV(
bangumiItem: bangumiList[index],
canTap: !showDelete,
),
BangumiCardV(bangumiItem: bangumiList[index], canTap: !showDelete,),
Positioned(
right: 5,
bottom: 5,
child: showDelete
? IconButton.filledTonal(
icon: const Icon(Icons.favorite),
onPressed: () async {
await favoriteController
.deleteFavorite(bangumiList[index]);
if (mounted) {
setState(() {});
}
},
)
: Container(),
child: showDelete ? IconButton.filledTonal(
icon: const Icon(Icons.favorite),
onPressed: () async {
await favoriteController
.deleteFavorite(bangumiList[index]);
if (mounted) {
setState(() {});
}
},
) : Container(),
),
],
);
Expand Down
27 changes: 8 additions & 19 deletions lib/pages/my/my_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,16 @@ class MyModule extends Module {
@override
void routes(r) {
r.child("/", child: (_) => const MyPage());
r.child("/theme",
child: (_) => const ThemeSettingsPage(),
transition: TransitionType.noTransition);
r.child("/theme", child: (_) => const ThemeSettingsPage(), transition: TransitionType.noTransition);
r.child("/theme/display",
child: (_) => const SetDisplayMode(),
transition: TransitionType.noTransition);
r.child("/player",
child: (_) => const PlayerSettingsPage(),
transition: TransitionType.noTransition);
r.child("/other",
child: (_) => const OtherSettingsPage(),
transition: TransitionType.noTransition);
r.module("/webdav",
module: WebDavModule(), transition: TransitionType.noTransition);
r.module("/about",
module: AboutModule(), transition: TransitionType.noTransition);
r.module("/plugin",
module: PluginModule(), transition: TransitionType.noTransition);
r.module("/history",
module: HistoryModule(), transition: TransitionType.noTransition);
r.module("/danmaku",
module: DanmakuModule(), transition: TransitionType.noTransition);
r.child("/player", child: (_) => const PlayerSettingsPage(), transition: TransitionType.noTransition);
r.child("/other", child: (_) => const OtherSettingsPage(), transition: TransitionType.noTransition);
r.module("/webdav", module: WebDavModule(), transition: TransitionType.noTransition);
r.module("/about", module: AboutModule(), transition: TransitionType.noTransition);
r.module("/plugin", module: PluginModule(), transition: TransitionType.noTransition);
r.module("/history", module: HistoryModule(), transition: TransitionType.noTransition);
r.module("/danmaku", module: DanmakuModule(), transition: TransitionType.noTransition);
}
}
10 changes: 3 additions & 7 deletions lib/pages/player/player_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ abstract class _PlayerController with Store {
KazumiLogger().log(Level.info, 'VideoItem开始初始化');
int episodeFromTitle = 0;
try {
episodeFromTitle = Utils.extractEpisodeNumber(videoPageController
.roadList[videoPageController.currentRoad]
.identifier[videoPageController.currentEpisode - 1]);
episodeFromTitle = Utils.extractEpisodeNumber(videoPageController.roadList[videoPageController.currentRoad].identifier[videoPageController.currentEpisode - 1]);
} catch (e) {
KazumiLogger().log(Level.error, '从标题解析集数错误 ${e.toString()}');
}
Expand All @@ -87,8 +85,7 @@ abstract class _PlayerController with Store {
getDanDanmaku(videoPageController.title, episodeFromTitle);
mediaPlayer = await createVideoController();
bool autoPlay = setting.get(SettingBoxKey.autoPlay, defaultValue: true);
playerSpeed =
setting.get(SettingBoxKey.defaultPlaySpeed, defaultValue: 1.0);
playerSpeed = setting.get(SettingBoxKey.defaultPlaySpeed, defaultValue: 1.0);
if (offset != 0) {
await mediaPlayer.seekTo(Duration(seconds: offset));
}
Expand Down Expand Up @@ -120,8 +117,7 @@ abstract class _PlayerController with Store {
mediaPlayer.addListener(() {
if (mediaPlayer.value.hasError && !mediaPlayer.value.isCompleted) {
SmartDialog.showToast('播放器内部错误 ${mediaPlayer.value.errorDescription}');
KazumiLogger().log(Level.error,
'Player inent error. ${mediaPlayer.value.errorDescription} $videoUrl');
KazumiLogger().log(Level.error, 'Player inent error. ${mediaPlayer.value.errorDescription} $videoUrl');
}
});
await mediaPlayer.initialize();
Expand Down
4 changes: 3 additions & 1 deletion lib/pages/settings/danmaku/danmaku_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
TextButton(
onPressed: () async {
updateDanmakuFontSize(
(Utils.isCompact()) ? 16.0 : 25.0);
(Utils.isCompact())
? 16.0
: 25.0);
SmartDialog.dismiss();
},
child: const Text('默认设置'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import 'package:kazumi/utils/utils.dart';
import 'package:kazumi/pages/webview/webview_controller.dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebviewItemControllerImpel
extends WebviewItemController<WebViewController> {
class WebviewItemControllerImpel extends WebviewItemController<WebViewController> {
// workaround for webview_flutter lib.
// webview_flutter lib won't change currentUrl after redirect using window.location.href.
// which causes multiple redirects to the same url.
Expand Down Expand Up @@ -148,14 +147,14 @@ class WebviewItemControllerImpel

@override
unloadPage() async {
await webviewController!
.removeJavaScriptChannel('JSBridgeDebug')
await webviewController
!.removeJavaScriptChannel('JSBridgeDebug')
.catchError((_) {});
await webviewController!
.removeJavaScriptChannel('VideoBridgeDebug')
await webviewController
!.removeJavaScriptChannel('VideoBridgeDebug')
.catchError((_) {});
await webviewController!
.removeJavaScriptChannel('FullscreenBridgeDebug')
await webviewController
!.removeJavaScriptChannel('FullscreenBridgeDebug')
.catchError((_) {});
await webviewController!.loadRequest(Uri.parse('about:blank'));
await webviewController!.clearCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {
videoPageController.logLines.add('Parsing video source $messageItem');
if (Utils.decodeVideoSource(messageItem) !=
Uri.encodeFull(messageItem) &&
videoPageController.currentPlugin.useNativePlayer &&
videoPageController.currentPlugin.useLegacyParser) {
videoPageController.currentPlugin.useNativePlayer && videoPageController.currentPlugin.useLegacyParser) {
isIframeLoaded = true;
isVideoSourceLoaded = true;
videoPageController.loading = false;
Expand Down Expand Up @@ -120,7 +119,8 @@ class WebviewLinuxItemControllerImpel extends WebviewItemController<Webview> {
if (messageItem.contains('http') && !isVideoSourceLoaded) {
String videoUrl = Uri.decodeFull(messageItem);
debugPrint('Loading video source $videoUrl');
videoPageController.logLines.add('Loading video source $videoUrl');
videoPageController.logLines
.add('Loading video source $videoUrl');
isIframeLoaded = true;
isVideoSourceLoaded = true;
videoPageController.loading = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import 'package:webview_windows/webview_windows.dart';
import 'package:kazumi/utils/utils.dart';
import 'package:kazumi/pages/webview/webview_controller.dart';

class WebviewWindowsItemControllerImpel
extends WebviewItemController<WebviewController> {
class WebviewWindowsItemControllerImpel extends WebviewItemController<WebviewController> {
Timer? ifrmaeParserTimer;
Timer? videoParserTimer;

@override
init() async {
webviewController ??= WebviewController();
await webviewController!.initialize();
await webviewController!
.setPopupWindowPolicy(WebviewPopupWindowPolicy.deny);
await webviewController!.setPopupWindowPolicy(WebviewPopupWindowPolicy.deny);
await initJSBridge();
if (videoPageController.currentPlugin.useNativePlayer &&
!videoPageController.currentPlugin.useLegacyParser) {
Expand Down

0 comments on commit 8e83ea4

Please sign in to comment.