基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
fix: mobx error in timeline page
Prediditba14caf696b5
diff --git a/lib/pages/timeline/timeline_controller.dart b/lib/pages/timeline/timeline_controller.dartindex 06ebd185..19fe96c0 100644--- a/lib/pages/timeline/timeline_controller.dart+++ b/lib/pages/timeline/timeline_controller.dart@@ -30,6 +30,7 @@ abstract class _TimelineController with Store {Future<void> getSchedules() async {isLoading = true;+ isTimeOut = false;bangumiCalendar.clear();final resBangumiCalendar = await BangumiHTTP.getCalendar();bangumiCalendar.addAll(resBangumiCalendar);@@ -39,6 +40,9 @@ abstract class _TimelineController with Store {Future<void> getSchedulesBySeason() async {// 4次获取,每次最多20部+ isLoading = true;+ isTimeOut = false;+ bangumiCalendar.clear();var time = 0;const maxTime = 4;const limit = 20;@@ -53,6 +57,12 @@ abstract class _TimelineController with Store {bangumiCalendar.clear();bangumiCalendar.addAll(resBangumiCalendar);}+ isLoading = false;+ if (bangumiCalendar.isEmpty) {+ isTimeOut = true;+ } else {+ isTimeOut = bangumiCalendar.every((innerList) => innerList.isEmpty);+ }}void tryEnterSeason(DateTime date) {diff --git a/lib/pages/timeline/timeline_page.dart b/lib/pages/timeline/timeline_page.dartindex e496d244..8e3a242b 100644--- a/lib/pages/timeline/timeline_page.dart+++ b/lib/pages/timeline/timeline_page.dart@@ -201,7 +201,10 @@ class _TimelinePageState extends State<TimelinePage>context,seasonName,isSelected,- () => _onSeasonSelected(date),+ () {+ Navigator.pop(context);+ onSeasonSelected(date);+ },);}).toList(),),@@ -303,9 +306,7 @@ class _TimelinePageState extends State<TimelinePage>}}- void _onSeasonSelected(DateTime date) async {- Navigator.pop(context);-+ void onSeasonSelected(DateTime date) async {final currDate = DateTime.now();timelineController.tryEnterSeason(date);@@ -321,62 +322,60 @@ class _TimelinePageState extends State<TimelinePage>@overrideWidget build(BuildContext context) {- return Observer(builder: (context) {- return PopScope(- canPop: false,- onPopInvokedWithResult: (bool didPop, Object? result) {- if (didPop) {- return;- }- onBackPressed(context);- },- child: Scaffold(- appBar: SysAppBar(- needTopOffset: false,- toolbarHeight: 104,- bottom: TabBar(- controller: tabController,- tabs: tabs,- indicatorColor: Theme.of(context).colorScheme.primary,- ),- title: InkWell(- child: Text(timelineController.seasonString),- onTap: () {- showSeasonBottomSheet(context);- },- ),+ return PopScope(+ canPop: false,+ onPopInvokedWithResult: (bool didPop, Object? result) {+ if (didPop) {+ return;+ }+ onBackPressed(context);+ },+ child: Scaffold(+ appBar: SysAppBar(+ needTopOffset: false,+ toolbarHeight: 104,+ bottom: TabBar(+ controller: tabController,+ tabs: tabs,+ indicatorColor: Theme.of(context).colorScheme.primary,+ ),+ title: InkWell(+ child: Observer(builder: (context) {+ return Text(timelineController.seasonString);+ }),+ onTap: () {+ showSeasonBottomSheet(context);+ },),- body: renderBody,- ),- );- });- }-- Widget get renderBody {- if (timelineController.isLoading &&- timelineController.bangumiCalendar.isEmpty) {- return const Center(- child: CircularProgressIndicator(),- );- }- if (timelineController.isTimeOut) {- return Center(- child: SizedBox(- height: 400,- child: GeneralErrorWidget(errMsg: '什么都没有找到 (´;ω;`)', actions: [- GeneralErrorButton(- onPressed: () {- timelineController.getSchedules();- },- text: '点击重试',- ),- ]),),- );- }- return TabBarView(- controller: tabController,- children: contentGrid(timelineController.bangumiCalendar),+ body: Observer(builder: (context) {+ if (timelineController.isLoading &&+ timelineController.bangumiCalendar.isEmpty) {+ return const Center(+ child: CircularProgressIndicator(),+ );+ }+ if (timelineController.isTimeOut) {+ return Center(+ child: SizedBox(+ height: 400,+ child: GeneralErrorWidget(errMsg: '什么都没有找到 (´;ω;`)', actions: [+ GeneralErrorButton(+ onPressed: () {+ onSeasonSelected(timelineController.selectedDate);+ },+ text: '点击重试',+ ),+ ]),+ ),+ );+ }+ return TabBarView(+ controller: tabController,+ children: contentGrid(timelineController.bangumiCalendar),+ );+ }),+ ),);}