diff --git a/lib/pages/member/new/content/member_contribute/content/video/member_video.dart b/lib/pages/member/new/content/member_contribute/content/video/member_video.dart index 6b57e449..166b1353 100644 --- a/lib/pages/member/new/content/member_contribute/content/video/member_video.dart +++ b/lib/pages/member/new/content/member_contribute/content/video/member_video.dart @@ -87,30 +87,35 @@ class _MemberVideoState extends State style: const TextStyle(fontSize: 13), ), ), - if (_controller.episodicButton != null) ...[ - const SizedBox(width: 5), - SizedBox( - height: 35, - child: TextButton.icon( - onPressed: _controller.toViewPlayAll, - icon: Icon( - Icons.play_circle_outline_rounded, - size: 16, - color: - Theme.of(context).colorScheme.secondary, - ), - label: Text( - _controller.episodicButton?.text ?? '播放全部', - style: TextStyle( - fontSize: 13, - color: Theme.of(context) - .colorScheme - .secondary, - ), - ), - ), - ), - ], + Obx( + () => _controller.episodicButton.value.uri != null + ? Container( + height: 35, + padding: const EdgeInsets.only(left: 5), + child: TextButton.icon( + onPressed: _controller.toViewPlayAll, + icon: Icon( + Icons.play_circle_outline_rounded, + size: 16, + color: Theme.of(context) + .colorScheme + .secondary, + ), + label: Text( + _controller + .episodicButton.value.text ?? + '播放全部', + style: TextStyle( + fontSize: 13, + color: Theme.of(context) + .colorScheme + .secondary, + ), + ), + ), + ) + : const SizedBox.shrink(), + ), const Spacer(), SizedBox( height: 35, diff --git a/lib/pages/member/new/content/member_contribute/content/video/member_video_ctr.dart b/lib/pages/member/new/content/member_contribute/content/video/member_video_ctr.dart index 7a77861c..d0bfdbe0 100644 --- a/lib/pages/member/new/content/member_contribute/content/video/member_video_ctr.dart +++ b/lib/pages/member/new/content/member_contribute/content/video/member_video_ctr.dart @@ -32,7 +32,7 @@ class MemberVideoCtr extends CommonController { late RxString sort = 'desc'.obs; RxInt count = (-1).obs; int? next; - EpisodicButton? episodicButton; + Rx episodicButton = EpisodicButton().obs; final String? username; final String? title; @@ -55,7 +55,8 @@ class MemberVideoCtr extends CommonController { @override bool customHandleResponse(Success response) { Data data = response.response; - episodicButton = data.episodicButton; + episodicButton.value = data.episodicButton ?? EpisodicButton(); + episodicButton.refresh(); next = data.next; aid = data.item?.lastOrNull?.param; isEnd = @@ -98,9 +99,9 @@ class MemberVideoCtr extends CommonController { if (loadingState.value is Success) { List list = (loadingState.value as Success).response; - if (episodicButton?.text == '继续播放') { + if (episodicButton.value.text == '继续播放') { dynamic oid = RegExp(r'oid=([\d]+)') - .firstMatch('${episodicButton?.uri}') + .firstMatch('${episodicButton.value.uri}') ?.group(1); dynamic bvid = IdUtils.av2bv(int.tryParse(oid) ?? 0); dynamic cid = await SearchHttp.ab2c(aid: oid, bvid: bvid); @@ -111,18 +112,19 @@ class MemberVideoCtr extends CommonController { 'sourceType': 'archive', 'mediaId': seasonId ?? seriesId ?? mid, 'oid': oid, - 'favTitle': '$username: ${title ?? episodicButton?.text ?? '播放全部'}', + 'favTitle': + '$username: ${title ?? episodicButton.value.text ?? '播放全部'}', if (seriesId == null) 'count': count.value, if (seasonId != null || seriesId != null) 'mediaType': RegExp(r'page_type=([\d]+)') - .firstMatch('${episodicButton?.uri}') + .firstMatch('${episodicButton.value.uri}') ?.group(1), 'desc': RegExp(r'desc=([\d]+)') - .firstMatch('${episodicButton?.uri}') + .firstMatch('${episodicButton.value.uri}') ?.group(1) == '1', 'sortField': RegExp(r'sort_field=([\d]+)') - .firstMatch('${episodicButton?.uri}') + .firstMatch('${episodicButton.value.uri}') ?.group(1), 'isContinuePlaying': true, }, @@ -153,11 +155,11 @@ class MemberVideoCtr extends CommonController { 'mediaId': seasonId ?? seriesId ?? mid, 'oid': IdUtils.bv2av(element.bvid!), 'favTitle': - '$username: ${title ?? episodicButton?.text ?? '播放全部'}', + '$username: ${title ?? episodicButton.value.text ?? '播放全部'}', if (seriesId == null) 'count': count.value, if (seasonId != null || seriesId != null) 'mediaType': RegExp(r'page_type=([\d]+)') - .firstMatch('${episodicButton?.uri}') + .firstMatch('${episodicButton.value.uri}') ?.group(1), 'desc': desc, if (type == ContributeType.video)