diff --git a/lib/pages/player/player_controller.dart b/lib/pages/player/player_controller.dart index 50534ee..e6be156 100644 --- a/lib/pages/player/player_controller.dart +++ b/lib/pages/player/player_controller.dart @@ -133,7 +133,8 @@ abstract class _PlayerController with Store { mode, overlays: SystemUiOverlay.values, ); - await SystemChrome.setPreferredOrientations([]); + // await SystemChrome.setPreferredOrientations([]); + verticalScreen(); } else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) { await const MethodChannel('com.alexmercerind/media_kit_video') .invokeMethod( diff --git a/lib/pages/video/video_page.dart b/lib/pages/video/video_page.dart index 30fc5a1..ac25498 100644 --- a/lib/pages/video/video_page.dart +++ b/lib/pages/video/video_page.dart @@ -170,121 +170,115 @@ class _VideoPageState extends State with WindowListener { 1.75, 2.0 ]; - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: const Text('播放速度'), - content: StatefulBuilder( - builder: (BuildContext context, StateSetter setState) { - return Wrap( - spacing: 8, - runSpacing: 2, - children: [ - for (final double i in speedsList) ...[ - if (i == currentSpeed) ...[ - FilledButton( - onPressed: () async { - await videoController.setPlaybackSpeed(i); - Modular.to.pop(); - }, - child: Text(i.toString()), - ), - ] else ...[ - FilledButton.tonal( - onPressed: () async { - await videoController.setPlaybackSpeed(i); - Modular.to.pop(); - }, - child: Text(i.toString()), - ), - ] + SmartDialog.show(useAnimation: false, builder: (context) { + return AlertDialog( + title: const Text('播放速度'), + content: StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return Wrap( + spacing: 8, + runSpacing: 2, + children: [ + for (final double i in speedsList) ...[ + if (i == currentSpeed) ...[ + FilledButton( + onPressed: () async { + await videoController.setPlaybackSpeed(i); + SmartDialog.dismiss(); + }, + child: Text(i.toString()), + ), + ] else ...[ + FilledButton.tonal( + onPressed: () async { + await videoController.setPlaybackSpeed(i); + SmartDialog.dismiss(); + }, + child: Text(i.toString()), + ), ] - ], - ); - }), - actions: [ - TextButton( - onPressed: () => Modular.to.pop(), - child: Text( - '取消', - style: TextStyle(color: Theme.of(context).colorScheme.outline), - ), - ), - TextButton( - onPressed: () async { - await videoController.setPlaybackSpeed(1.0); - Modular.to.pop(); - }, - child: const Text('默认速度'), + ] + ], + ); + }), + actions: [ + TextButton( + onPressed: () => SmartDialog.dismiss(), + child: Text( + '取消', + style: TextStyle(color: Theme.of(context).colorScheme.outline), ), - ], - ); - }, - ); + ), + TextButton( + onPressed: () async { + await videoController.setPlaybackSpeed(1.0); + SmartDialog.dismiss(); + }, + child: const Text('默认速度'), + ), + ], + ); + }); } /// 发送弹幕 由于接口限制, 暂时未提交云端 void showShootDanmakuSheet() { final TextEditingController textController = TextEditingController(); bool isSending = false; // 追踪是否正在发送 - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: const Text('发送弹幕'), - content: StatefulBuilder( - builder: (BuildContext context, StateSetter setState) { - return TextField( - controller: textController, - ); - }), - actions: [ - TextButton( - onPressed: () => Modular.to.pop(), - child: Text( - '取消', - style: TextStyle(color: Theme.of(context).colorScheme.outline), - ), + SmartDialog.show(useAnimation: false, builder: (context) { + return AlertDialog( + title: const Text('发送弹幕'), + content: StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return TextField( + controller: textController, + ); + }), + actions: [ + TextButton( + onPressed: () => SmartDialog.dismiss(), + child: Text( + '取消', + style: TextStyle(color: Theme.of(context).colorScheme.outline), ), - StatefulBuilder( - builder: (BuildContext context, StateSetter setState) { - return TextButton( - onPressed: isSending - ? null - : () async { - final String msg = textController.text; - if (msg.isEmpty) { - SmartDialog.showToast('弹幕内容不能为空'); - return; - } else if (msg.length > 100) { - SmartDialog.showToast('弹幕内容不能超过100个字符'); - return; - } - setState(() { - isSending = true; // 开始发送,更新状态 - }); - // Todo 接口方限制 + ), + StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return TextButton( + onPressed: isSending + ? null + : () async { + final String msg = textController.text; + if (msg.isEmpty) { + SmartDialog.showToast('弹幕内容不能为空'); + return; + } else if (msg.length > 100) { + SmartDialog.showToast('弹幕内容不能超过100个字符'); + return; + } + setState(() { + isSending = true; // 开始发送,更新状态 + }); + // Todo 接口方限制 - setState(() { - isSending = false; // 发送结束,更新状态 - }); - SmartDialog.showToast('发送成功'); - danmakuController.addItems([ - DanmakuItem( - msg, - // color: Colors.purple, - ) - ]); - Modular.to.pop(); - }, - child: Text(isSending ? '发送中...' : '发送'), - ); - }) - ], - ); - }, - ); + setState(() { + isSending = false; // 发送结束,更新状态 + }); + SmartDialog.showToast('发送成功'); + danmakuController.addItems([ + DanmakuItem( + msg, + // color: Colors.purple, + ) + ]); + SmartDialog.dismiss(); + }, + child: Text(isSending ? '发送中...' : '发送'), + ); + }) + ], + ); + }); } @override @@ -637,19 +631,24 @@ class _VideoPageState extends State with WindowListener { }, ), ), - IconButton( - color: Colors.white, - icon: const Icon(Icons.notes), - onPressed: () { - if (videoController - .danDanmakus.length == - 0) { - SmartDialog.showToast('当前剧集不支持弹幕发送的说'); - return; - } - showShootDanmakuSheet(); - }, - ), + (videoController.androidFullscreen == + true && + videoController.danmakuOn == true) + ? IconButton( + color: Colors.white, + icon: const Icon(Icons.notes), + onPressed: () { + if (videoController + .danDanmakus.length == + 0) { + SmartDialog.showToast( + '当前剧集不支持弹幕发送的说'); + return; + } + showShootDanmakuSheet(); + }, + ) + : Container(), IconButton( color: Colors.white, icon: Icon(videoController.danmakuOn diff --git a/lib/request/api.dart b/lib/request/api.dart index e723d9d..e2f3fda 100644 --- a/lib/request/api.dart +++ b/lib/request/api.dart @@ -4,7 +4,7 @@ class Api { static const String domain = HttpString.baseUrl + '/'; static const String animeList = 'https://d1zquzjgwo9yb.cloudfront.net/'; static const String videoAPI = 'https://v.anime1.me/api'; - static const String version = '1.0.6'; + static const String version = '1.0.7'; static const String sourceUrl = "https://github.com/Predidit/oneAnime"; static const String aniDanmakuAPI = "https://ani.gamer.com.tw/ajax/danmuGet.php"; static const String aniSearch = "https://ani.gamer.com.tw/search.php"; diff --git a/pubspec.yaml b/pubspec.yaml index 7ae8b25..7772839 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.6+1 +version: 1.0.7+1 environment: sdk: '>=3.2.6 <4.0.0'