mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: bangumi
This commit is contained in:
@@ -457,10 +457,10 @@ class BangumiIntroController extends CommonController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int epid = episodes[prevIndex].epid!;
|
int epid = episodes[prevIndex].epId;
|
||||||
int cid = episodes[prevIndex].cid!;
|
int cid = episodes[prevIndex].cid;
|
||||||
String bvid = episodes[prevIndex].bvid!;
|
String bvid = episodes[prevIndex].bvid;
|
||||||
int aid = episodes[prevIndex].aid!;
|
int aid = episodes[prevIndex].aid;
|
||||||
dynamic cover = episodes[prevIndex].cover;
|
dynamic cover = episodes[prevIndex].cover;
|
||||||
changeSeasonOrbangu(epid, bvid, cid, aid, cover);
|
changeSeasonOrbangu(epid, bvid, cid, aid, cover);
|
||||||
return true;
|
return true;
|
||||||
@@ -493,10 +493,10 @@ class BangumiIntroController extends CommonController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int epid = episodes[nextIndex].epid!;
|
int epid = episodes[nextIndex].epId;
|
||||||
int cid = episodes[nextIndex].cid!;
|
int cid = episodes[nextIndex].cid;
|
||||||
String bvid = episodes[nextIndex].bvid!;
|
String bvid = episodes[nextIndex].bvid;
|
||||||
int aid = episodes[nextIndex].aid!;
|
int aid = episodes[nextIndex].aid;
|
||||||
dynamic cover = episodes[nextIndex].cover;
|
dynamic cover = episodes[nextIndex].cover;
|
||||||
changeSeasonOrbangu(epid, bvid, cid, aid, cover);
|
changeSeasonOrbangu(epid, bvid, cid, aid, cover);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:PiliPalaX/common/widgets/pair.dart';
|
|||||||
import 'package:PiliPalaX/pages/video/detail/controller.dart'
|
import 'package:PiliPalaX/pages/video/detail/controller.dart'
|
||||||
show SegmentType, SegmentTypeExt, SkipType, SkipTypeExt;
|
show SegmentType, SegmentTypeExt, SkipType, SkipTypeExt;
|
||||||
import 'package:PiliPalaX/utils/storage.dart';
|
import 'package:PiliPalaX/utils/storage.dart';
|
||||||
|
import 'package:PiliPalaX/utils/utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ class SponsorBlockPage extends StatefulWidget {
|
|||||||
class _SponsorBlockPageState extends State<SponsorBlockPage> {
|
class _SponsorBlockPageState extends State<SponsorBlockPage> {
|
||||||
late double _blockLimit;
|
late double _blockLimit;
|
||||||
late List<Pair<SegmentType, SkipType>> _blockSettings;
|
late List<Pair<SegmentType, SkipType>> _blockSettings;
|
||||||
|
final _url = 'https://github.com/hanydd/BilibiliSponsorBlock';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -37,122 +39,133 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: ListView.separated(
|
body: ListView.separated(
|
||||||
itemCount: _blockSettings.length + 1,
|
itemCount: _blockSettings.length + 2,
|
||||||
itemBuilder: (_, index) => index == 0
|
itemBuilder: (_, index) => index == _blockSettings.length + 1
|
||||||
? ListTile(
|
? ListTile(
|
||||||
onTap: () {
|
leading: Icon(Icons.code),
|
||||||
final textController =
|
title: const Text('About'),
|
||||||
TextEditingController(text: _blockLimit.toString());
|
subtitle: Text(_url),
|
||||||
showDialog(
|
onTap: () => Utils.launchURL(_url),
|
||||||
context: context,
|
)
|
||||||
builder: (BuildContext context) {
|
: index == 0
|
||||||
return AlertDialog(
|
? ListTile(
|
||||||
title: const Text('Block Limit'),
|
onTap: () {
|
||||||
content: TextFormField(
|
final textController =
|
||||||
keyboardType:
|
TextEditingController(text: _blockLimit.toString());
|
||||||
TextInputType.numberWithOptions(decimal: true),
|
showDialog(
|
||||||
controller: textController,
|
context: context,
|
||||||
autofocus: true,
|
builder: (BuildContext context) {
|
||||||
decoration: InputDecoration(suffixText: 's'),
|
return AlertDialog(
|
||||||
),
|
title: const Text('Block Limit'),
|
||||||
actions: [
|
content: TextFormField(
|
||||||
TextButton(
|
keyboardType: TextInputType.numberWithOptions(
|
||||||
onPressed: Get.back,
|
decimal: true),
|
||||||
child: Text(
|
controller: textController,
|
||||||
'取消',
|
autofocus: true,
|
||||||
style: TextStyle(
|
decoration: InputDecoration(suffixText: 's'),
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: Get.back,
|
||||||
Get.back();
|
child: Text(
|
||||||
_blockLimit = max(0.0,
|
'取消',
|
||||||
double.tryParse(textController.text) ?? 0.0);
|
style: TextStyle(
|
||||||
await GStorage.setting
|
color:
|
||||||
.put(SettingBoxKey.blockLimit, _blockLimit);
|
Theme.of(context).colorScheme.outline,
|
||||||
setState(() {});
|
),
|
||||||
},
|
),
|
||||||
child: Text('确定'),
|
),
|
||||||
)
|
TextButton(
|
||||||
],
|
onPressed: () async {
|
||||||
|
Get.back();
|
||||||
|
_blockLimit = max(
|
||||||
|
0.0,
|
||||||
|
double.tryParse(textController.text) ??
|
||||||
|
0.0);
|
||||||
|
await GStorage.setting.put(
|
||||||
|
SettingBoxKey.blockLimit, _blockLimit);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: Text('确定'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
leading: Icon(Icons.av_timer),
|
||||||
},
|
title: const Text('Block Limit'),
|
||||||
leading: Icon(Icons.av_timer),
|
trailing: Text(
|
||||||
title: const Text('Block Limit'),
|
'${_blockLimit}s',
|
||||||
trailing: Text(
|
style: TextStyle(fontSize: 13),
|
||||||
'${_blockLimit}s',
|
|
||||||
style: TextStyle(fontSize: 13),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: ListTile(
|
|
||||||
leading: Container(
|
|
||||||
height: 24,
|
|
||||||
width: 24,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Container(
|
|
||||||
height: 10,
|
|
||||||
width: 10,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: _blockSettings[index - 1].first.color,
|
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
),
|
: ListTile(
|
||||||
title: Text(
|
leading: Container(
|
||||||
_blockSettings[index - 1].first.name,
|
height: 24,
|
||||||
style: _blockSettings[index - 1].second == SkipType.disable
|
width: 24,
|
||||||
? TextStyle(
|
alignment: Alignment.center,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
child: Container(
|
||||||
)
|
height: 10,
|
||||||
: null,
|
width: 10,
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
trailing: PopupMenuButton(
|
shape: BoxShape.circle,
|
||||||
initialValue: _blockSettings[index - 1].second,
|
color: _blockSettings[index - 1].first.color,
|
||||||
onSelected: (item) async {
|
|
||||||
_blockSettings[index - 1].second = item;
|
|
||||||
await GStorage.setting.put(
|
|
||||||
SettingBoxKey.blockSettings,
|
|
||||||
_blockSettings
|
|
||||||
.map((item) => item.second.index)
|
|
||||||
.toList());
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
itemBuilder: (context) => SkipType.values
|
|
||||||
.map((item) => PopupMenuItem<SkipType>(
|
|
||||||
value: item,
|
|
||||||
child: Text(item.title),
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
_blockSettings[index - 1].second.title,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 13,
|
|
||||||
color: _blockSettings[index - 1].second ==
|
|
||||||
SkipType.disable
|
|
||||||
? Theme.of(context).colorScheme.error
|
|
||||||
: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Icon(
|
),
|
||||||
size: 20,
|
title: Text(
|
||||||
Icons.keyboard_arrow_right,
|
_blockSettings[index - 1].first.name,
|
||||||
color:
|
style:
|
||||||
_blockSettings[index - 1].second == SkipType.disable
|
_blockSettings[index - 1].second == SkipType.disable
|
||||||
|
? TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
trailing: PopupMenuButton(
|
||||||
|
initialValue: _blockSettings[index - 1].second,
|
||||||
|
onSelected: (item) async {
|
||||||
|
_blockSettings[index - 1].second = item;
|
||||||
|
await GStorage.setting.put(
|
||||||
|
SettingBoxKey.blockSettings,
|
||||||
|
_blockSettings
|
||||||
|
.map((item) => item.second.index)
|
||||||
|
.toList());
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
itemBuilder: (context) => SkipType.values
|
||||||
|
.map((item) => PopupMenuItem<SkipType>(
|
||||||
|
value: item,
|
||||||
|
child: Text(item.title),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
_blockSettings[index - 1].second.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: _blockSettings[index - 1].second ==
|
||||||
|
SkipType.disable
|
||||||
|
? Theme.of(context).colorScheme.error
|
||||||
|
: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
size: 20,
|
||||||
|
Icons.keyboard_arrow_right,
|
||||||
|
color: _blockSettings[index - 1].second ==
|
||||||
|
SkipType.disable
|
||||||
? Theme.of(context).colorScheme.error
|
? Theme.of(context).colorScheme.error
|
||||||
: Theme.of(context).colorScheme.primary,
|
: Theme.of(context).colorScheme.primary,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
separatorBuilder: (_, index) => Divider(height: 1),
|
separatorBuilder: (_, index) => Divider(height: 1),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user