diff --git a/lib/pages/bangumi/introduction/view.dart b/lib/pages/bangumi/introduction/view.dart index 1a8a6316..f30f0bcf 100644 --- a/lib/pages/bangumi/introduction/view.dart +++ b/lib/pages/bangumi/introduction/view.dart @@ -265,7 +265,7 @@ class _BangumiInfoState extends State Expanded( child: GestureDetector( onTap: showIntroDetail, - behavior: HitTestBehavior.translucent, + behavior: HitTestBehavior.opaque, child: SizedBox( height: isLandscape ? 115 : 115 / 0.75, child: Column( diff --git a/lib/pages/bangumi/view.dart b/lib/pages/bangumi/view.dart index 30d127c0..8748037f 100644 --- a/lib/pages/bangumi/view.dart +++ b/lib/pages/bangumi/view.dart @@ -82,48 +82,48 @@ class _BangumiPageState extends State slivers: [ SliverToBoxAdapter( child: Obx( - () => Visibility( - visible: _bangumiController.isLogin.value, - child: Column( - children: [ - Padding( - padding: const EdgeInsets.only(left: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Obx( - () => Text( - '最近${widget.tabType == TabType.bangumi ? '追番' : '追剧'}${_bangumiController.followCount.value == -1 ? '' : ' ${_bangumiController.followCount.value}'}', - style: Theme.of(context).textTheme.titleMedium, - ), + () => _bangumiController.isLogin.value + ? Column( + children: [ + Padding( + padding: const EdgeInsets.only(left: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Obx( + () => Text( + '最近${widget.tabType == TabType.bangumi ? '追番' : '追剧'}${_bangumiController.followCount.value == -1 ? '' : ' ${_bangumiController.followCount.value}'}', + style: + Theme.of(context).textTheme.titleMedium, + ), + ), + IconButton( + tooltip: '刷新', + onPressed: () { + _bangumiController + ..followPage = 1 + ..followEnd = false + ..queryBangumiFollow(); + }, + icon: const Icon( + Icons.refresh, + size: 20, + ), + ), + ], ), - IconButton( - tooltip: '刷新', - onPressed: () { - _bangumiController - ..followPage = 1 - ..followEnd = false - ..queryBangumiFollow(); - }, - icon: const Icon( - Icons.refresh, - size: 20, - ), + ), + SizedBox( + height: Grid.smallCardWidth / 2 / 0.75 + + MediaQuery.textScalerOf(context).scale(50), + child: Obx( + () => _buildFollowBody( + _bangumiController.followState.value), ), - ], - ), - ), - SizedBox( - height: Grid.smallCardWidth / 2 / 0.75 + - MediaQuery.textScalerOf(context).scale(50), - child: Obx( - () => _buildFollowBody( - _bangumiController.followState.value), - ), - ), - ], - ), - ), + ), + ], + ) + : const SizedBox.shrink(), ), ), SliverToBoxAdapter( diff --git a/lib/pages/mine/view.dart b/lib/pages/mine/view.dart index fd17e885..01f4af17 100644 --- a/lib/pages/mine/view.dart +++ b/lib/pages/mine/view.dart @@ -127,7 +127,7 @@ class _MinePageState extends State { mainAxisSize: MainAxisSize.min, children: [ GestureDetector( - behavior: HitTestBehavior.translucent, + behavior: HitTestBehavior.opaque, onTap: _mineController.onLogin, child: Row( mainAxisSize: MainAxisSize.min, diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index bb9c4ca1..d580a80f 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -308,223 +308,192 @@ class _VideoInfoState extends State with TickerProviderStateMixin { constraints.viewportMainAxisExtent * 1.25; return SliverPadding( padding: const EdgeInsets.only( - left: StyleString.safeSpace, - right: StyleString.safeSpace, - top: 10), + left: StyleString.safeSpace, + right: StyleString.safeSpace, + top: 10, + ), sliver: SliverToBoxAdapter( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: showIntroDetail, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: videoItem['staff'] == null - ? GestureDetector( - onTap: onPushMember, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - NetworkImgLayer( - type: 'avatar', - src: widget.loadingStatus - ? videoItem['owner']?.face ?? "" - : videoDetail.owner!.face, - width: 35, - height: 35, - fadeInDuration: Duration.zero, - fadeOutDuration: Duration.zero, - ), - const SizedBox(width: 10), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - widget.loadingStatus - ? videoItem['owner']?.name ?? "" - : videoDetail.owner!.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - // color: t.colorScheme.primary, - ), - // semanticsLabel: "UP主:${owner.name}", - ), - const SizedBox(height: 0), - Obx( - () => Text( - '${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝', - style: TextStyle( - fontSize: 12, - color: t.colorScheme.outline, - ), - ), - ), - ], - ), - ), - followButton(context, t), - ], - ), - ) - : SelfSizedHorizontalList( - gapSize: 25, - itemCount: videoItem['staff'].length, - childBuilder: (index) => GestureDetector( - onTap: () { - int? ownerMid = !widget.loadingStatus - ? videoDetail.owner?.mid - : videoItem['owner']?.mid; - if (videoItem['staff'][index].mid == ownerMid && - context.orientation == - Orientation.landscape && - _horizontalMemberPage) { - widget.onShowMemberPage(ownerMid); - } else { - Get.toNamed( - '/member?mid=${videoItem['staff'][index].mid}', - // arguments: { - // 'face': - // videoItem['staff'][index].face, - // 'heroTag': Utils.makeHeroTag( - // videoItem['staff'][index].mid), - // }, - ); - } - }, - child: Row( - children: [ - NetworkImgLayer( - type: 'avatar', - src: videoItem['staff'][index].face, - width: 35, - height: 35, - fadeInDuration: Duration.zero, - fadeOutDuration: Duration.zero, - ), - const SizedBox(width: 5), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - videoItem['staff'][index].name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 13, - color: videoItem['staff'][index] - .vip - .status > - 0 && - videoItem['staff'][index] - .vip - .type == - 2 - ? context.vipColor - : null, - ), - ), - Text( - videoItem['staff'][index].title, - style: TextStyle( - fontSize: 12, - color: Theme.of(context) - .colorScheme - .outline, - ), - ), - ], - ), - ], - ), - ), - ), - ), - if (isHorizontal) ...[ - const SizedBox(width: 10), - Expanded(child: actionGrid(context, videoIntroController)), - ] - ], - ), - if (videoIntroController.videoDetail.value.argueMsg?.isNotEmpty == - true && - videoIntroController.showArgueMsg) ...[ - const SizedBox(height: 8), - Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6), - color: Theme.of(context).colorScheme.secondaryContainer, - ), - padding: - const EdgeInsets.symmetric(horizontal: 10, vertical: 4), - child: Text.rich( - TextSpan(children: [ - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - size: 17, - Icons.warning_rounded, - color: Theme.of(context) - .colorScheme - .onSecondaryContainer, - ), - ), - TextSpan( - text: - ' ${videoIntroController.videoDetail.value.argueMsg}') - ]), - style: TextStyle( - fontSize: 13, - color: Theme.of(context).colorScheme.onSecondaryContainer, - ), - ), - ) - ], - const SizedBox(height: 8), - GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: showIntroDetail, - child: ExpandablePanel( - controller: videoIntroController.expandableCtr, - collapsed: GestureDetector( - onLongPress: () { - feedBack(); - Utils.copyText( - '${videoDetail.title ?? videoItem['title'] ?? ''}'); - }, - child: _buildVideoTitle(), - ), - expanded: GestureDetector( - onLongPress: () { - feedBack(); - Utils.copyText( - '${videoDetail.title ?? videoItem['title'] ?? ''}'); - }, - child: _buildVideoTitle(true), - ), - theme: const ExpandableThemeData( - animationDuration: Duration(milliseconds: 300), - scrollAnimationDuration: Duration(milliseconds: 300), - crossFadePoint: 0, - fadeCurve: Curves.ease, - sizeCurve: Curves.linear, - ), - ), - ), - Stack( + crossAxisAlignment: CrossAxisAlignment.start, children: [ GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: showIntroDetail, - child: Padding( - padding: const EdgeInsets.only(top: 8), - child: Row( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Row( + children: [ + Expanded( + child: videoItem['staff'] == null + ? GestureDetector( + onTap: onPushMember, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + NetworkImgLayer( + type: 'avatar', + src: widget.loadingStatus + ? videoItem['owner']?.face ?? "" + : videoDetail.owner!.face, + width: 35, + height: 35, + fadeInDuration: Duration.zero, + fadeOutDuration: Duration.zero, + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + widget.loadingStatus + ? videoItem['owner']?.name ?? + "" + : videoDetail.owner!.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 13, + // color: t.colorScheme.primary, + ), + // semanticsLabel: "UP主:${owner.name}", + ), + const SizedBox(height: 0), + Obx( + () => Text( + '${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝', + style: TextStyle( + fontSize: 12, + color: t.colorScheme.outline, + ), + ), + ), + ], + ), + ), + followButton(context, t), + ], + ), + ) + : SelfSizedHorizontalList( + gapSize: 25, + itemCount: videoItem['staff'].length, + childBuilder: (index) => GestureDetector( + onTap: () { + int? ownerMid = !widget.loadingStatus + ? videoDetail.owner?.mid + : videoItem['owner']?.mid; + if (videoItem['staff'][index].mid == + ownerMid && + context.orientation == + Orientation.landscape && + _horizontalMemberPage) { + widget.onShowMemberPage(ownerMid); + } else { + Get.toNamed( + '/member?mid=${videoItem['staff'][index].mid}', + // arguments: { + // 'face': + // videoItem['staff'][index].face, + // 'heroTag': Utils.makeHeroTag( + // videoItem['staff'][index].mid), + // }, + ); + } + }, + child: Row( + children: [ + NetworkImgLayer( + type: 'avatar', + src: videoItem['staff'][index].face, + width: 35, + height: 35, + fadeInDuration: Duration.zero, + fadeOutDuration: Duration.zero, + ), + const SizedBox(width: 5), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + videoItem['staff'][index].name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 13, + color: videoItem['staff'][index] + .vip + .status > + 0 && + videoItem['staff'] + [index] + .vip + .type == + 2 + ? context.vipColor + : null, + ), + ), + Text( + videoItem['staff'][index].title, + style: TextStyle( + fontSize: 12, + color: Theme.of(context) + .colorScheme + .outline, + ), + ), + ], + ), + ], + ), + ), + ), + ), + if (isHorizontal) ...[ + const SizedBox(width: 10), + Expanded( + child: actionGrid(context, videoIntroController)), + ] + ], + ), + ), + const SizedBox(height: 8), + ExpandablePanel( + controller: videoIntroController.expandableCtr, + collapsed: GestureDetector( + onLongPress: () { + feedBack(); + Utils.copyText( + '${videoDetail.title ?? videoItem['title'] ?? ''}'); + }, + child: _buildVideoTitle(), + ), + expanded: GestureDetector( + onLongPress: () { + feedBack(); + Utils.copyText( + '${videoDetail.title ?? videoItem['title'] ?? ''}'); + }, + child: _buildVideoTitle(true), + ), + theme: const ExpandableThemeData( + animationDuration: Duration(milliseconds: 300), + scrollAnimationDuration: Duration(milliseconds: 300), + crossFadePoint: 0, + fadeCurve: Curves.ease, + sizeCurve: Curves.linear, + ), + ), + const SizedBox(height: 8), + Stack( + children: [ + Row( children: [ statView( context: context, @@ -577,169 +546,195 @@ class _VideoInfoState extends State with TickerProviderStateMixin { ), ], ), - ), - ), - if (videoIntroController.enableAi) - Positioned( - right: 10, - top: 0, - bottom: 0, - child: Center( - child: Semantics( - label: 'AI总结', - child: GestureDetector( - onTap: () async { - final res = - await videoIntroController.aiConclusion(); - if (res['status']) { - widget.showAiBottomSheet(); - } - }, - child: - Image.asset('assets/images/ai.png', height: 22), + if (videoIntroController.enableAi) + Positioned( + right: 10, + top: 0, + bottom: 0, + child: Center( + child: Semantics( + label: 'AI总结', + child: GestureDetector( + onTap: () async { + final res = + await videoIntroController.aiConclusion(); + if (res['status']) { + widget.showAiBottomSheet(); + } + }, + child: Image.asset('assets/images/ai.png', + height: 22), + ), + ), ), - ), - ), - ) - ], - ), - GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: showIntroDetail, - child: ExpandablePanel( - controller: videoIntroController.expandableCtr, - collapsed: const SizedBox.shrink(), - expanded: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 8), - GestureDetector( - onTap: () { - Utils.copyText( - '${videoIntroController.videoDetail.value.bvid}'); - }, - child: Text( - videoIntroController.videoDetail.value.bvid ?? '', - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.primary, - ), - ), - ), - if (videoIntroController - .videoDetail.value.descV2.isNullOrEmpty.not) ...[ - const SizedBox(height: 8), - SelectableText.rich( - style: const TextStyle( - height: 1.4, - // fontSize: 13, - ), - TextSpan( - children: [ - buildContent(context, - videoIntroController.videoDetail.value), - ], - ), - ), - ], - if (videoIntroController.videoTags is List && - videoIntroController.videoTags.isNotEmpty) ...[ - const SizedBox(height: 8), - Wrap( - spacing: 8, - runSpacing: 8, - children: (videoIntroController.videoTags as List) - .map( - (item) => SearchText( - fontSize: 13, - text: item['tag_name'], - onTap: (_) => Get.toNamed('/searchResult', - parameters: { - 'keyword': item['tag_name'] - }), - onLongPress: (_) => - Utils.copyText(item['tag_name']), - ), - ) - .toList(), - ), - ], + ) ], ), - theme: const ExpandableThemeData( - animationDuration: Duration(milliseconds: 300), - scrollAnimationDuration: Duration(milliseconds: 300), - crossFadePoint: 0, - fadeCurve: Curves.ease, - sizeCurve: Curves.linear, - ), - ), - ), - Obx( - () => videoIntroController.queryVideoIntroData.value["status"] - ? const SizedBox.shrink() - : Center( - child: TextButton.icon( - icon: const Icon(Icons.refresh), - onPressed: () { - videoIntroController - .queryVideoIntroData.value["status"] = true; - videoIntroController.queryVideoIntro(); - if (videoDetailCtr.videoUrl.isNullOrEmpty && - videoDetailCtr.isQuerying.not) { - videoDetailCtr.queryVideoUrl(); - } - }, - label: const Text("点此重新加载"), - ), + if (videoIntroController + .videoDetail.value.argueMsg?.isNotEmpty == + true && + videoIntroController.showArgueMsg) ...[ + const SizedBox(height: 2), + Text.rich( + TextSpan( + children: [ + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + size: 13, + Icons.error_outline, + color: Theme.of(context).colorScheme.outline, + ), + ), + WidgetSpan(child: SizedBox(width: 2)), + TextSpan( + text: + '${videoIntroController.videoDetail.value.argueMsg}', + ) + ], ), + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.outline, + ), + ), + ], + ExpandablePanel( + controller: videoIntroController.expandableCtr, + collapsed: const SizedBox.shrink(), + expanded: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 8), + GestureDetector( + onTap: () { + Utils.copyText( + '${videoIntroController.videoDetail.value.bvid}'); + }, + child: Text( + videoIntroController.videoDetail.value.bvid ?? '', + style: TextStyle( + fontSize: 14, + color: Theme.of(context).colorScheme.primary, + ), + ), + ), + if (videoIntroController + .videoDetail.value.descV2.isNullOrEmpty.not) ...[ + const SizedBox(height: 8), + SelectableText.rich( + style: const TextStyle( + height: 1.4, + // fontSize: 13, + ), + TextSpan( + children: [ + buildContent(context, + videoIntroController.videoDetail.value), + ], + ), + ), + ], + if (videoIntroController.videoTags is List && + videoIntroController.videoTags.isNotEmpty) ...[ + const SizedBox(height: 8), + Wrap( + spacing: 8, + runSpacing: 8, + children: (videoIntroController.videoTags as List) + .map( + (item) => SearchText( + fontSize: 13, + text: item['tag_name'], + onTap: (_) => Get.toNamed('/searchResult', + parameters: { + 'keyword': item['tag_name'] + }), + onLongPress: (_) => + Utils.copyText(item['tag_name']), + ), + ) + .toList(), + ), + ], + ], + ), + theme: const ExpandableThemeData( + animationDuration: Duration(milliseconds: 300), + scrollAnimationDuration: Duration(milliseconds: 300), + crossFadePoint: 0, + fadeCurve: Curves.ease, + sizeCurve: Curves.linear, + ), + ), + Obx( + () => + videoIntroController.queryVideoIntroData.value["status"] + ? const SizedBox.shrink() + : Center( + child: TextButton.icon( + icon: const Icon(Icons.refresh), + onPressed: () { + videoIntroController.queryVideoIntroData + .value["status"] = true; + videoIntroController.queryVideoIntro(); + if (videoDetailCtr.videoUrl.isNullOrEmpty && + videoDetailCtr.isQuerying.not) { + videoDetailCtr.queryVideoUrl(); + } + }, + label: const Text("点此重新加载"), + ), + ), + ), + // 点赞收藏转发 布局样式1 + // SingleChildScrollView( + // padding: const EdgeInsets.only(top: 7, bottom: 7), + // scrollDirection: Axis.horizontal, + // child: actionRow( + // context, + // videoIntroController, + // videoDetailCtr, + // ), + // ), + // 点赞收藏转发 布局样式2 + if (!isHorizontal) ...[ + const SizedBox(height: 8), + actionGrid(context, videoIntroController), + ], + // 合集 + if (!widget.loadingStatus && + videoDetail.ugcSeason != null && + (context.orientation != Orientation.landscape || + (context.orientation == Orientation.landscape && + videoDetailCtr.horizontalSeasonPanel.not))) + SeasonPanel( + heroTag: widget.heroTag, + ugcSeason: videoDetail.ugcSeason!, + changeFuc: videoIntroController.changeSeasonOrbangu, + showEpisodes: widget.showEpisodes, + pages: videoDetail.pages, + videoIntroController: videoIntroController, + ), + if (!widget.loadingStatus && + videoDetail.pages != null && + videoDetail.pages!.length > 1 && + (context.orientation != Orientation.landscape || + (context.orientation == Orientation.landscape && + videoDetailCtr.horizontalSeasonPanel.not))) ...[ + PagesPanel( + heroTag: widget.heroTag, + videoIntroController: videoIntroController, + bvid: videoIntroController.bvid, + changeFuc: videoIntroController.changeSeasonOrbangu, + showEpisodes: widget.showEpisodes, + ), + ], + ], ), - // 点赞收藏转发 布局样式1 - // SingleChildScrollView( - // padding: const EdgeInsets.only(top: 7, bottom: 7), - // scrollDirection: Axis.horizontal, - // child: actionRow( - // context, - // videoIntroController, - // videoDetailCtr, - // ), - // ), - // 点赞收藏转发 布局样式2 - if (!isHorizontal) ...[ - const SizedBox(height: 8), - actionGrid(context, videoIntroController), - ], - // 合集 - if (!widget.loadingStatus && - videoDetail.ugcSeason != null && - (context.orientation != Orientation.landscape || - (context.orientation == Orientation.landscape && - videoDetailCtr.horizontalSeasonPanel.not))) - SeasonPanel( - heroTag: widget.heroTag, - ugcSeason: videoDetail.ugcSeason!, - changeFuc: videoIntroController.changeSeasonOrbangu, - showEpisodes: widget.showEpisodes, - pages: videoDetail.pages, - videoIntroController: videoIntroController, - ), - if (!widget.loadingStatus && - videoDetail.pages != null && - videoDetail.pages!.length > 1 && - (context.orientation != Orientation.landscape || - (context.orientation == Orientation.landscape && - videoDetailCtr.horizontalSeasonPanel.not))) ...[ - PagesPanel( - heroTag: widget.heroTag, - videoIntroController: videoIntroController, - bvid: videoIntroController.bvid, - changeFuc: videoIntroController.changeSeasonOrbangu, - showEpisodes: widget.showEpisodes, - ), - ], - ], - )), + ), + ), ); }, ); diff --git a/lib/utils/login.dart b/lib/utils/login.dart index 07826397..99e5c1ad 100644 --- a/lib/utils/login.dart +++ b/lib/utils/login.dart @@ -6,8 +6,10 @@ import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/common/dynamics_type.dart'; +import 'package:PiliPlus/models/common/tab_type.dart' hide tabsConfig; import 'package:PiliPlus/models/user/info.dart'; import 'package:PiliPlus/models/user/stat.dart'; +import 'package:PiliPlus/pages/bangumi/controller.dart'; import 'package:PiliPlus/pages/dynamics/tab/controller.dart'; import 'package:PiliPlus/pages/live/controller.dart'; import 'package:PiliPlus/pages/main/controller.dart'; @@ -113,6 +115,18 @@ class LoginUtils { ..isLogin.value = true ..fetchLiveFollowing(); } catch (_) {} + + try { + Get.find(tag: TabType.bangumi.name) + ..isLogin.value = true + ..queryBangumiFollow(); + } catch (_) {} + + try { + Get.find(tag: TabType.cinema.name) + ..isLogin.value = true + ..queryBangumiFollow(); + } catch (_) {} } else { // 获取用户信息失败 SmartDialog.showNotify( @@ -170,6 +184,18 @@ class LoginUtils { Get.find(tag: tabsConfig[i]['tag']).onRefresh(); } catch (_) {} } + + try { + Get.find(tag: TabType.bangumi.name) + ..isLogin.value = false + ..followState.value = LoadingState.loading(); + } catch (_) {} + + try { + Get.find(tag: TabType.cinema.name) + ..isLogin.value = false + ..followState.value = LoadingState.loading(); + } catch (_) {} } static String buvid() {