Skip to content

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

add open in browser button in info page

Predidit8ccad51447ca
diff --git a/lib/pages/info/info_page.dart b/lib/pages/info/info_page.dart
index 4e959b88..e63b011f 100644
--- a/lib/pages/info/info_page.dart
+++ b/lib/pages/info/info_page.dart
@@ -17,6 +17,7 @@ import 'package:kazumi/bean/appbar/sys_app_bar.dart';
import 'package:kazumi/request/query_manager.dart';
import 'package:logger/logger.dart';
import 'package:kazumi/utils/logger.dart';
+import 'package:url_launcher/url_launcher.dart';
class InfoPage extends StatefulWidget {
const InfoPage({super.key});
@@ -112,91 +113,120 @@ class _InfoPageState extends State<InfoPage>
),
),
Scaffold(
- backgroundColor: Colors.transparent,
- appBar: const SysAppBar(backgroundColor: Colors.transparent),
- body: Column(
- children: [
- BangumiInfoCardV(bangumiItem: infoController.bangumiItem),
- TabBar(
- isScrollable: true,
- tabAlignment: TabAlignment.center,
- controller: tabController,
- tabs: pluginsController.pluginList
- .map((plugin) => Observer(
- builder: (context) => Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- plugin.name,
- overflow: TextOverflow.ellipsis,
- ),
- const SizedBox(width: 5.0),
- Container(
- width: 8.0,
- height: 8.0,
- decoration: BoxDecoration(
- color: infoController.pluginSearchStatus[
- plugin.name] ==
- 'success'
- ? Colors.green
- : (infoController.pluginSearchStatus[
- plugin.name] ==
- 'pending')
- ? Colors.grey
- : Colors.red,
- shape: BoxShape.circle,
+ backgroundColor: Colors.transparent,
+ appBar: const SysAppBar(backgroundColor: Colors.transparent),
+ body: Column(
+ children: [
+ BangumiInfoCardV(bangumiItem: infoController.bangumiItem),
+ TabBar(
+ isScrollable: true,
+ tabAlignment: TabAlignment.center,
+ controller: tabController,
+ tabs: pluginsController.pluginList
+ .map((plugin) => Observer(
+ builder: (context) => Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ plugin.name,
+ overflow: TextOverflow.ellipsis,
),
- ),
- ],
- ),
- ))
- .toList(),
- ),
- Expanded(
- child: Observer(
- builder: (context) => TabBarView(
- controller: tabController,
- children: List.generate(
- pluginsController.pluginList.length, (pluginIndex) {
- var plugin = pluginsController.pluginList[pluginIndex];
- var cardList = <Widget>[];
- for (var searchResponse
- in infoController.pluginSearchResponseList) {
- if (searchResponse.pluginName == plugin.name) {
- for (var searchItem in searchResponse.data) {
- cardList.add(Card(
- color: Colors.transparent,
- child: ListTile(
- tileColor: Colors.transparent,
- title: Text(searchItem.name),
- onTap: () async {
- SmartDialog.showLoading(msg: '获取中');
- videoPageController.currentPlugin = plugin;
- videoPageController.title = searchItem.name;
- videoPageController.src = searchItem.src;
- try {
- await infoController.queryRoads(
- searchItem.src, plugin.name);
- SmartDialog.dismiss();
- Modular.to.pushNamed('/tab/video/');
- } catch (e) {
- KazumiLogger().log(Level.error, e.toString());
- SmartDialog.dismiss();
- }
- },
- ),
- ));
+ const SizedBox(width: 5.0),
+ Container(
+ width: 8.0,
+ height: 8.0,
+ decoration: BoxDecoration(
+ color: infoController.pluginSearchStatus[
+ plugin.name] ==
+ 'success'
+ ? Colors.green
+ : (infoController.pluginSearchStatus[
+ plugin.name] ==
+ 'pending')
+ ? Colors.grey
+ : Colors.red,
+ shape: BoxShape.circle,
+ ),
+ ),
+ ],
+ ),
+ ))
+ .toList(),
+ ),
+ Expanded(
+ child: Observer(
+ builder: (context) => TabBarView(
+ controller: tabController,
+ children: List.generate(
+ pluginsController.pluginList.length, (pluginIndex) {
+ var plugin =
+ pluginsController.pluginList[pluginIndex];
+ var cardList = <Widget>[];
+ for (var searchResponse
+ in infoController.pluginSearchResponseList) {
+ if (searchResponse.pluginName == plugin.name) {
+ for (var searchItem in searchResponse.data) {
+ cardList.add(Card(
+ color: Colors.transparent,
+ child: ListTile(
+ tileColor: Colors.transparent,
+ title: Text(searchItem.name),
+ onTap: () async {
+ SmartDialog.showLoading(msg: '获取中');
+ videoPageController.currentPlugin =
+ plugin;
+ videoPageController.title =
+ searchItem.name;
+ videoPageController.src = searchItem.src;
+ try {
+ await infoController.queryRoads(
+ searchItem.src, plugin.name);
+ SmartDialog.dismiss();
+ Modular.to.pushNamed('/tab/video/');
+ } catch (e) {
+ KazumiLogger()
+ .log(Level.error, e.toString());
+ SmartDialog.dismiss();
+ }
+ },
+ ),
+ ));
+ }
}
}
- }
- return ListView(children: cardList);
- }),
+ return ListView(children: cardList);
+ }),
+ ),
),
- ),
- )
- ],
- ),
- ),
+ )
+ ],
+ ),
+ floatingActionButton: FloatingActionButton(
+ onPressed: () {
+ int currentIndex = tabController.index;
+ SmartDialog.show(
+ useAnimation: false,
+ builder: (context) {
+ return AlertDialog(
+ title: const Text('退出确认'),
+ content: const Text('您想要离开 Kazumi 并在浏览器中打开此视频源吗?'),
+ actions: [
+ TextButton(
+ onPressed: () {
+ SmartDialog.dismiss();
+ launchUrl(Uri.parse(pluginsController.pluginList[currentIndex].baseUrl));
+ },
+ child: const Text('确认')),
+ const TextButton(
+ onPressed: SmartDialog.dismiss,
+ child: Text('取消')),
+ ],
+ );
+ });
+ // print('Current Tab Index: $currentIndex');
+ },
+ child: const Icon(Icons.open_in_browser),
+ )),
],
),
);