基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
fix comments bug when changing episode
ErBW_sf2561865e91d
diff --git a/lib/pages/player/episode_comments_sheet.dart b/lib/pages/player/episode_comments_sheet.dartindex d8c7b6f6..f82a3f7e 100644--- a/lib/pages/player/episode_comments_sheet.dart+++ b/lib/pages/player/episode_comments_sheet.dart@@ -15,8 +15,7 @@ class EpisodeCommentsSheet extends StatefulWidget {State<EpisodeCommentsSheet> createState() => _EpisodeCommentsSheetState();}-class _EpisodeCommentsSheetState extends State<EpisodeCommentsSheet>- with AutomaticKeepAliveClientMixin {+class _EpisodeCommentsSheetState extends State<EpisodeCommentsSheet> {final infoController = Modular.get<InfoController>();bool isLoading = false;bool commentsQueryTimeout = false;@@ -58,30 +57,39 @@ class _EpisodeCommentsSheetState extends State<EpisodeCommentsSheet>Widget get episodeCommentsBody {return SelectionArea(- child: Padding(- padding: const EdgeInsets.fromLTRB(4, 0, 4, 4),- child: Observer(builder: (context) {- if (isLoading) {- return const Center(- child: CircularProgressIndicator(),- );- }- if (commentsQueryTimeout) {- return const Center(- child: Text('空空如也'),- );- }- return SingleChildScrollView(- child: ListView.builder(- shrinkWrap: true,- physics: const NeverScrollableScrollPhysics(),- itemCount: infoController.episodeCommentsList.length,- itemBuilder: (context, index) {- return EpisodeCommentsCard(- commentItem: infoController.episodeCommentsList[index]);- }));- }),- ));+ child: CustomScrollView(+ slivers: [+ SliverPadding(+ padding: const EdgeInsets.fromLTRB(4, 0, 4, 4),+ sliver: Observer(builder: (context) {+ if (isLoading) {+ return const SliverFillRemaining(+ child: Center(+ child: CircularProgressIndicator(),+ ),+ );+ }+ if (commentsQueryTimeout) {+ return const SliverFillRemaining(+ child: Center(+ child: Text('空空如也'),+ ),+ );+ }+ return SliverList(+ delegate: SliverChildBuilderDelegate(+ (context, index) {+ return EpisodeCommentsCard(+ commentItem: infoController.episodeCommentsList[index]);+ },+ childCount: infoController.episodeCommentsList.length,+ ),+ );+ }),+ ),+ ],+ ),+ );}Widget get commentsInfo {@@ -184,7 +192,6 @@ class _EpisodeCommentsSheetState extends State<EpisodeCommentsSheet>@overrideWidget build(BuildContext context) {- super.build(context);return Scaffold(body: Column(crossAxisAlignment: CrossAxisAlignment.start,@@ -192,7 +199,4 @@ class _EpisodeCommentsSheetState extends State<EpisodeCommentsSheet>),);}-- @override- bool get wantKeepAlive => true;}diff --git a/lib/pages/video/video_page.dart b/lib/pages/video/video_page.dartindex bdf98f98..12515d83 100644--- a/lib/pages/video/video_page.dart+++ b/lib/pages/video/video_page.dart@@ -270,7 +270,7 @@ class _VideoPageState extends State<VideoPage>width: MediaQuery.of(context).size.width,child: playerBody,),- if (videoPageController.showTabBody)+ if (videoPageController.showTabBody) ...[GestureDetector(onTap: () {closeTabBodyAnimated();@@ -281,17 +281,18 @@ class _VideoPageState extends State<VideoPage>height: double.infinity,),),- SlideTransition(- position: _rightOffsetAnimation,- child: SizedBox(- height: MediaQuery.of(context).size.height,- width:- MediaQuery.of(context).size.width * 1 / 3 > 420- ? 420- : MediaQuery.of(context).size.width * 1 / 3,- child: tabBody,+ SlideTransition(+ position: _rightOffsetAnimation,+ child: SizedBox(+ height: MediaQuery.of(context).size.height,+ width: MediaQuery.of(context).size.width * 1 / 3 >+ 420+ ? 420+ : MediaQuery.of(context).size.width * 1 / 3,+ child: tabBody,+ ),),- ),+ ],],): (!videoPageController.isFullscreen)@@ -718,50 +719,46 @@ class _VideoPageState extends State<VideoPage>episodeNum = videoPageController.currentEpisode;}- return Visibility(- maintainState: true,- visible: videoPageController.showTabBody,- child: Container(- color: Theme.of(context).canvasColor,- child: DefaultTabController(- length: 2,- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- TabBar(- dividerHeight: Utils.isDesktop() ? 0.5 : 0.2,- isScrollable: true,- tabAlignment: TabAlignment.start,- labelPadding:- const EdgeInsetsDirectional.only(start: 30, end: 30),- onTap: (index) {- if (index == 0) {- menuJumpToCurrentEpisode();- }- },- tabs: const [- Tab(text: '选集'),- Tab(text: '评论'),- ],- ),- Expanded(- child: TabBarView(- children: [- GridViewObserver(- controller: observerController,- child: Column(- children: [- menuBar,- menuBody,- ],- ),+ return Container(+ color: Theme.of(context).canvasColor,+ child: DefaultTabController(+ length: 2,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ TabBar(+ dividerHeight: Utils.isDesktop() ? 0.5 : 0.2,+ isScrollable: true,+ tabAlignment: TabAlignment.start,+ labelPadding:+ const EdgeInsetsDirectional.only(start: 30, end: 30),+ onTap: (index) {+ if (index == 0) {+ menuJumpToCurrentEpisode();+ }+ },+ tabs: const [+ Tab(text: '选集'),+ Tab(text: '评论'),+ ],+ ),+ Expanded(+ child: TabBarView(+ children: [+ GridViewObserver(+ controller: observerController,+ child: Column(+ children: [+ menuBar,+ menuBody,+ ],),- EpisodeCommentsSheet(episode: episodeNum),- ],- ),+ ),+ EpisodeCommentsSheet(episode: episodeNum),+ ],),- ],- ),+ ),+ ],),),);