fix: block settings import #7

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-25 10:16:19 +08:00
parent 0ebe4e9a80
commit 36aa12025e
5 changed files with 14 additions and 66 deletions

View File

@@ -399,6 +399,7 @@ class _BangumiInfoState extends State<BangumiInfo>
: widget.bangumiDetail!.episodes!.first.cid),
changeFuc: bangumiIntroController.changeSeasonOrbangu,
showEpisodes: widget.showEpisodes,
newEp: bangumiItem?.newEp,
)
],
],

View File

@@ -15,6 +15,7 @@ class BangumiPanel extends StatefulWidget {
required this.changeFuc,
required this.showEpisodes,
required this.heroTag,
this.newEp,
});
final List<EpisodeItem> pages;
@@ -22,6 +23,7 @@ class BangumiPanel extends StatefulWidget {
final Function changeFuc;
final Function showEpisodes;
final String heroTag;
final dynamic newEp;
@override
State<BangumiPanel> createState() => _BangumiPanelState();
@@ -126,7 +128,9 @@ class _BangumiPanelState extends State<BangumiPanel> {
cid,
),
child: Text(
'${widget.pages.length}',
widget.newEp?['desc']?.contains('连载') == true
? '连载中,更新至第${widget.newEp?['title']}'
: '${widget.newEp?['title']}',
style: const TextStyle(fontSize: 13),
),
),

View File

@@ -25,7 +25,7 @@ class HistoryController extends GetxController {
Future queryHistoryList({type = 'init'}) async {
int max = 0;
int viewAt = 0;
if (type == 'onload') {
if (type == 'onload' && historyList.isNotEmpty) {
max = historyList.last.history!.oid!;
viewAt = historyList.last.viewAt!;
}

View File

@@ -32,19 +32,13 @@ Widget searchBangumiPanel(BuildContext context, ctr, loadingState) {
var i = loadingState.response[index];
return InkWell(
onTap: () {
/// TODO 番剧详情页面
// Get.toNamed('/video?bvid=${i.bvid}&cid=${i.cid}', arguments: {
// 'videoItem': i,
// 'heroTag': Utils.makeHeroTag(i.id),
// 'videoType': SearchType.media_bangumi
// });
Utils.viewBangumi(seasonId: i.seasonId);
},
child: Padding(
padding: const EdgeInsets.fromLTRB(
StyleString.safeSpace,
StyleString.safeSpace,
StyleString.safeSpace,
2),
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: StyleString.cardSpace,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -127,57 +121,6 @@ Widget searchBangumiPanel(BuildContext context, ctr, loadingState) {
Text(i.indexShow, style: style),
],
),
const SizedBox(height: 18),
SizedBox(
height: 32,
child: ElevatedButton(
onPressed: () async {
Utils.viewBangumi(seasonId: i.seasonId);
// SmartDialog.showLoading(msg: '获取中...');
// var res = await SearchHttp.bangumiInfo(
// seasonId: i.seasonId);
// SmartDialog.dismiss().then((value) {
// if (res['status']) {
// EpisodeItem episode =
// res['data'].episodes.first;
// int? epId = res['data']
// .userStatus
// ?.progress
// ?.lastEpId;
// if (epId == null) {
// epId = episode.epId;
// } else {
// for (var item
// in res['data'].episodes) {
// if (item.epId == epId) {
// episode = item;
// break;
// }
// }
// }
// String bvid = episode.bvid!;
// int cid = episode.cid!;
// String pic = episode.cover!;
// String heroTag =
// Utils.makeHeroTag(cid);
// Get.toNamed(
// '/video?bvid=$bvid&cid=$cid&seasonId=${i.seasonId}&epId=$epId',
// arguments: {
// 'pic': pic,
// 'heroTag': heroTag,
// 'videoType':
// SearchType.media_bangumi,
// 'bangumiItem': res['data'],
// },
// );
// } else {
// SmartDialog.showToast(res['msg']);
// }
// });
},
child: const Text('观看'),
),
),
],
),
),

View File

@@ -24,7 +24,7 @@ class GStorage {
static late final Box<dynamic> video;
static List<Pair<SegmentType, SkipType>> get blockSettings {
List<int> list = setting.get(
List list = setting.get(
SettingBoxKey.blockSettings,
defaultValue: List.generate(SegmentType.values.length, (_) => 1),
);
@@ -37,7 +37,7 @@ class GStorage {
}
static List<Color> get blockColor {
List<String> list = setting.get(
List list = setting.get(
SettingBoxKey.blockColor,
defaultValue: List.generate(SegmentType.values.length, (_) => ''),
);