diff --git a/lib/common/widgets/stat/stat.dart b/lib/common/widgets/stat/stat.dart index 817a2de77..efa79c6ed 100644 --- a/lib/common/widgets/stat/stat.dart +++ b/lib/common/widgets/stat/stat.dart @@ -5,14 +5,14 @@ import 'package:flutter/material.dart'; class StatWidget extends StatelessWidget { final StatType type; final dynamic value; - final Color? textColor; + final Color? color; final double iconSize; const StatWidget({ super.key, required this.type, required this.value, - this.textColor, + this.color, this.iconSize = 13, }); @@ -27,7 +27,7 @@ class StatWidget extends StatelessWidget { StatType.play => Icons.play_circle_outlined, }; - Color color = textColor ?? + Color color = this.color ?? Theme.of(context).colorScheme.outline.withValues(alpha: 0.8); return Row( diff --git a/lib/common/widgets/video_card/video_card_h.dart b/lib/common/widgets/video_card/video_card_h.dart index b3da8283a..b3718877e 100644 --- a/lib/common/widgets/video_card/video_card_h.dart +++ b/lib/common/widgets/video_card/video_card_h.dart @@ -259,7 +259,7 @@ class VideoCardH extends StatelessWidget { children: [ if (showView) StatWidget( - type: StatType.view, + type: StatType.play, value: videoItem.stat.view, ), if (showDanmaku) diff --git a/lib/common/widgets/video_card/video_card_v.dart b/lib/common/widgets/video_card/video_card_v.dart index 7bffc6fee..a6bbf9deb 100644 --- a/lib/common/widgets/video_card/video_card_v.dart +++ b/lib/common/widgets/video_card/video_card_v.dart @@ -236,8 +236,8 @@ class VideoCardV extends StatelessWidget { return Row( children: [ StatWidget( + type: StatType.play, value: videoItem.stat.view, - type: StatType.view, ), if (videoItem.goto != 'picture') ...[ const SizedBox(width: 4), diff --git a/lib/pages/article/controller.dart b/lib/pages/article/controller.dart index ce7fb2f61..e7f92dd22 100644 --- a/lib/pages/article/controller.dart +++ b/lib/pages/article/controller.dart @@ -75,7 +75,7 @@ class ArticleController extends ReplyController { _queryContent(); } - Future queryOpus(opusId) async { + Future queryOpus(String opusId) async { final res = await DynamicsHttp.opusDetail(opusId: opusId); if (res.isSuccess) { final opusData = res.data; @@ -104,7 +104,7 @@ class ArticleController extends ReplyController { return false; } - Future queryRead(cvid) async { + Future queryRead(int cvid) async { final res = await DynamicsHttp.articleView(cvId: cvid); if (res.isSuccess) { articleData = res.data; diff --git a/lib/pages/article/view.dart b/lib/pages/article/view.dart index 6af7e52fc..8bb06cd60 100644 --- a/lib/pages/article/view.dart +++ b/lib/pages/article/view.dart @@ -527,7 +527,6 @@ class _ArticlePageState extends State child: Row( children: [ NetworkImgLayer( - // TODO Avatar width: 40, height: 40, type: ImageType.avatar, diff --git a/lib/pages/article_list/widgets/item.dart b/lib/pages/article_list/widgets/item.dart index 61235a70d..c43eb3857 100644 --- a/lib/pages/article_list/widgets/item.dart +++ b/lib/pages/article_list/widgets/item.dart @@ -82,18 +82,18 @@ class ArticleListItem extends StatelessWidget { children: [ StatWidget( value: item.stats?.view, - textColor: theme.colorScheme.outline, + color: theme.colorScheme.outline, type: StatType.view, ), StatWidget( type: StatType.like, value: item.stats?.like, - textColor: theme.colorScheme.outline, + color: theme.colorScheme.outline, ), StatWidget( type: StatType.reply, value: item.stats?.reply, - textColor: theme.colorScheme.outline, + color: theme.colorScheme.outline, ), ], ), diff --git a/lib/pages/common/common_publish_page.dart b/lib/pages/common/common_publish_page.dart index 7623d4dd5..525bd9594 100644 --- a/lib/pages/common/common_publish_page.dart +++ b/lib/pages/common/common_publish_page.dart @@ -198,7 +198,7 @@ abstract class CommonPublishPageState Future onCustomPublish({required String message, List? pictures}); - void onChooseEmote(emote) { + void onChooseEmote(dynamic emote) { enablePublish.value = true; final int cursorPosition = editController.selection.baseOffset; final String currentText = editController.text; diff --git a/lib/pages/danmaku/view.dart b/lib/pages/danmaku/view.dart index cd3d51c28..d8c6964a9 100644 --- a/lib/pages/danmaku/view.dart +++ b/lib/pages/danmaku/view.dart @@ -150,8 +150,8 @@ class _PlDanmakuState extends State { super.dispose(); } - double _getFontSize(isFullScreen) => - isFullScreen == false || widget.isPipMode == true + double _getFontSize(bool isFullScreen) => + !isFullScreen || widget.isPipMode == true ? 15 * playerController.fontSize : 15 * playerController.fontSizeFS; diff --git a/lib/pages/dynamics/controller.dart b/lib/pages/dynamics/controller.dart index 90ea7d588..160e4481c 100644 --- a/lib/pages/dynamics/controller.dart +++ b/lib/pages/dynamics/controller.dart @@ -104,7 +104,7 @@ class DynamicsController extends GetxController } late bool isQuerying = false; - Future queryFollowUp({type = 'init'}) async { + Future queryFollowUp({String type = 'init'}) async { if (isQuerying) return; isQuerying = true; if (!isLogin.value) { diff --git a/lib/pages/episode_panel/view.dart b/lib/pages/episode_panel/view.dart index 911f40738..c5128242c 100644 --- a/lib/pages/episode_panel/view.dart +++ b/lib/pages/episode_panel/view.dart @@ -517,7 +517,7 @@ class _EpisodePanelState extends CommonSlidePageState { children: [ StatWidget( value: view, - type: StatType.view, + type: StatType.play, ), if (danmaku != null) StatWidget( diff --git a/lib/pages/fav/article/widget/item.dart b/lib/pages/fav/article/widget/item.dart index b11588a21..1e7fe670a 100644 --- a/lib/pages/fav/article/widget/item.dart +++ b/lib/pages/fav/article/widget/item.dart @@ -90,7 +90,7 @@ class FavArticleItem extends StatelessWidget { StatWidget( type: StatType.like, value: item.stat!.like, - textColor: theme.colorScheme.outline, + color: theme.colorScheme.outline, ), Text( ' · ${item.pubTime}', diff --git a/lib/pages/fav/pgc/controller.dart b/lib/pages/fav/pgc/controller.dart index cc77ffdc3..4a0d2c81f 100644 --- a/lib/pages/fav/pgc/controller.dart +++ b/lib/pages/fav/pgc/controller.dart @@ -65,7 +65,7 @@ class FavPgcController SmartDialog.showToast(result['msg']); } - Future onUpdateList(followStatus) async { + Future onUpdateList(int followStatus) async { List dataList = loadingState.value.data!; Set updateList = dataList.where((item) => item.checked == true).toSet(); @@ -95,7 +95,7 @@ class FavPgcController SmartDialog.showToast(res['msg']); } - Future onUpdate(index, followStatus, seasonId) async { + Future onUpdate(int index, int followStatus, int? seasonId) async { var result = await VideoHttp.pgcUpdate( seasonId: [seasonId], status: followStatus, diff --git a/lib/pages/fav/topic/controller.dart b/lib/pages/fav/topic/controller.dart index 43168dbc1..b864eb92e 100644 --- a/lib/pages/fav/topic/controller.dart +++ b/lib/pages/fav/topic/controller.dart @@ -38,7 +38,7 @@ class FavTopicController Future> customGetData() => FavHttp.favTopic(page: page); - Future onRemove(index, id) async { + Future onRemove(int index, int? id) async { var res = await FavHttp.delFavTopic(id); if (res['status']) { loadingState diff --git a/lib/pages/follow/controller.dart b/lib/pages/follow/controller.dart index fef60426b..e006e704c 100644 --- a/lib/pages/follow/controller.dart +++ b/lib/pages/follow/controller.dart @@ -82,7 +82,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin { } } - Future onDelTag(tagid) async { + Future onDelTag(int? tagid) async { final res = await MemberHttp.delFollowTag(tagid); if (res['status']) { followState.value = LoadingState.loading(); diff --git a/lib/pages/follow/view.dart b/lib/pages/follow/view.dart index f04887a6e..b347a8c6c 100644 --- a/lib/pages/follow/view.dart +++ b/lib/pages/follow/view.dart @@ -74,7 +74,7 @@ class _FollowPageState extends State { ); } - bool _isCustomTag(tagid) { + bool _isCustomTag(int? tagid) { return tagid != null && tagid != 0 && tagid != -10 && tagid != -2; } diff --git a/lib/pages/later/widgets/video_card_h_later.dart b/lib/pages/later/widgets/video_card_h_later.dart index f233a8c9a..ead8a9573 100644 --- a/lib/pages/later/widgets/video_card_h_later.dart +++ b/lib/pages/later/widgets/video_card_h_later.dart @@ -176,7 +176,7 @@ class VideoCardHLater extends StatelessWidget { ), const Spacer(), StatWidget( - type: StatType.view, + type: StatType.play, value: videoItem.stat?.view, ), ] else ...[ @@ -207,7 +207,7 @@ class VideoCardHLater extends StatelessWidget { spacing: 8, children: [ StatWidget( - type: StatType.view, + type: StatType.play, value: videoItem.stat?.view, ), StatWidget( diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 55b4fd301..1b7a23cfe 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -155,12 +155,15 @@ class _LiveRoomPageState extends State future: _futureBuilderFuture, builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasData && snapshot.data['status']) { + final roomInfoH5 = _liveRoomController.roomInfoH5.value; return PLVideoPlayer( key: playerKey, fill: fill, alignment: alignment, plPlayerController: plPlayerController, headerControl: LiveHeaderControl( + title: roomInfoH5?.roomInfo?.title, + upName: roomInfoH5?.anchorInfo?.baseInfo?.uname, plPlayerController: plPlayerController, onSendDanmaku: onSendDanmaku, ), @@ -485,12 +488,7 @@ class _LiveRoomPageState extends State color: isFullScreen ? Colors.black : null, width: isFullScreen ? Get.size.width : videoWidth, height: isFullScreen ? Get.size.height : Get.size.width * 9 / 16, - child: MediaQuery.removePadding( - removeTop: true, - removeRight: true, - context: context, - child: videoPlayerPanel(fill: Colors.transparent), - ), + child: videoPlayerPanel(fill: Colors.transparent), ), ), Expanded( diff --git a/lib/pages/live_room/widgets/chat.dart b/lib/pages/live_room/widgets/chat.dart index fbd6f00d7..763034a10 100644 --- a/lib/pages/live_room/widgets/chat.dart +++ b/lib/pages/live_room/widgets/chat.dart @@ -102,7 +102,7 @@ class LiveRoomChat extends StatelessWidget { ); } - TextSpan _buildMsg(obj) { + TextSpan _buildMsg(dynamic obj) { dynamic emots = obj['emots']; dynamic uemote = obj['uemote']; List list = [ diff --git a/lib/pages/live_room/widgets/header_control.dart b/lib/pages/live_room/widgets/header_control.dart index baf1d31af..e4f85cf58 100644 --- a/lib/pages/live_room/widgets/header_control.dart +++ b/lib/pages/live_room/widgets/header_control.dart @@ -9,11 +9,15 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart class LiveHeaderControl extends StatelessWidget { const LiveHeaderControl({ + required this.title, + required this.upName, required this.plPlayerController, required this.onSendDanmaku, super.key, }); + final String? title; + final String? upName; final PlPlayerController plPlayerController; final VoidCallback onSendDanmaku; @@ -26,22 +30,41 @@ class LiveHeaderControl extends StatelessWidget { automaticallyImplyLeading: false, titleSpacing: 14, title: Row( - mainAxisAlignment: MainAxisAlignment.end, children: [ - SizedBox( - width: 42, - height: 34, - child: IconButton( - tooltip: '发弹幕', - style: ButtonStyle( - padding: WidgetStateProperty.all(EdgeInsets.zero), - ), - onPressed: onSendDanmaku, - icon: const Icon( - Icons.comment_outlined, - size: 19, - color: Colors.white, + if (title != null) + Expanded( + child: Column( + spacing: 5, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title!, + maxLines: 1, + style: const TextStyle( + fontSize: 15, height: 1, color: Colors.white), + ), + if (plPlayerController.isFullScreen.value && upName != null) + Text( + upName!, + maxLines: 1, + style: const TextStyle( + fontSize: 12, height: 1, color: Colors.white), + ), + ], ), + ) + else + const Spacer(), + IconButton( + tooltip: '发弹幕', + style: ButtonStyle( + padding: WidgetStateProperty.all(EdgeInsets.zero), + ), + onPressed: onSendDanmaku, + icon: const Icon( + Icons.comment_outlined, + size: 18, + color: Colors.white, ), ), Obx( @@ -62,33 +85,28 @@ class LiveHeaderControl extends StatelessWidget { ), const SizedBox(width: 10), if (Platform.isAndroid) ...[ - SizedBox( - width: 34, - height: 34, - child: IconButton( - tooltip: '画中画', - style: ButtonStyle( - padding: WidgetStateProperty.all(EdgeInsets.zero), - ), - onPressed: () async { - try { - var floating = Floating(); - if ((await floating.isPipAvailable) == true) { - plPlayerController.hiddenControls(false); - floating.enable( - plPlayerController.direction.value == 'vertical' - ? const EnableManual( - aspectRatio: Rational.vertical()) - : const EnableManual(), - ); - } - } catch (_) {} - }, - icon: const Icon( - Icons.picture_in_picture_outlined, - size: 18, - color: Colors.white, - ), + IconButton( + tooltip: '画中画', + style: ButtonStyle( + padding: WidgetStateProperty.all(EdgeInsets.zero), + ), + onPressed: () async { + try { + var floating = Floating(); + if ((await floating.isPipAvailable) == true) { + plPlayerController.hiddenControls(false); + floating.enable( + plPlayerController.direction.value == 'vertical' + ? const EnableManual(aspectRatio: Rational.vertical()) + : const EnableManual(), + ); + } + } catch (_) {} + }, + icon: const Icon( + Icons.picture_in_picture_outlined, + size: 18, + color: Colors.white, ), ), const SizedBox(width: 10), diff --git a/lib/pages/login/controller.dart b/lib/pages/login/controller.dart index 5acaec643..7efa59004 100644 --- a/lib/pages/login/controller.dart +++ b/lib/pages/login/controller.dart @@ -111,7 +111,7 @@ class LoginPageController extends GetxController } // 申请极验验证码 - void getCaptcha(geeGt, geeChallenge, onSuccess) { + void getCaptcha(String? geeGt, String? geeChallenge, VoidCallback onSuccess) { var registerData = Gt3RegisterData( challenge: geeChallenge, gt: geeGt, diff --git a/lib/pages/login/view.dart b/lib/pages/login/view.dart index 645a6d23b..43c26b774 100644 --- a/lib/pages/login/view.dart +++ b/lib/pages/login/view.dart @@ -536,7 +536,7 @@ class _LoginPageState extends State { }); } - Widget tabViewOuter(child) { + Widget tabViewOuter(Widget child) { return SingleChildScrollView( child: Align( alignment: Alignment.topCenter, diff --git a/lib/pages/member_article/widget/item.dart b/lib/pages/member_article/widget/item.dart index bf0440e29..5d74ecd40 100644 --- a/lib/pages/member_article/widget/item.dart +++ b/lib/pages/member_article/widget/item.dart @@ -87,12 +87,12 @@ class MemberArticleItem extends StatelessWidget { StatWidget( type: StatType.view, value: item.stats?.view, - textColor: outline, + color: outline, ), StatWidget( - type: StatType.play, + type: StatType.reply, value: item.stats?.reply, - textColor: outline, + color: outline, ), ], ), diff --git a/lib/pages/member_coin/widgets/item.dart b/lib/pages/member_coin/widgets/item.dart index 708c9c885..5f12eec85 100644 --- a/lib/pages/member_coin/widgets/item.dart +++ b/lib/pages/member_coin/widgets/item.dart @@ -93,7 +93,7 @@ class MemberCoinsItem extends StatelessWidget { Row( children: [ StatWidget( - type: StatType.view, + type: StatType.play, value: coinItem.stat.view, ), const SizedBox(width: 8), diff --git a/lib/pages/member_dynamics/controller.dart b/lib/pages/member_dynamics/controller.dart index be51cd0d0..21c4eed5d 100644 --- a/lib/pages/member_dynamics/controller.dart +++ b/lib/pages/member_dynamics/controller.dart @@ -55,7 +55,7 @@ class MemberDynamicsController mid: mid, ); - Future onRemove(dynamicId) async { + Future onRemove(dynamic dynamicId) async { var res = await MsgHttp.removeDynamic(dynIdStr: dynamicId); if (res['status']) { loadingState diff --git a/lib/pages/member_favorite/widget/item.dart b/lib/pages/member_favorite/widget/item.dart index f00b0df15..6d1693b07 100644 --- a/lib/pages/member_favorite/widget/item.dart +++ b/lib/pages/member_favorite/widget/item.dart @@ -2,7 +2,6 @@ import 'package:PiliPlus/common/constants.dart'; import 'package:PiliPlus/common/widgets/badge.dart'; import 'package:PiliPlus/common/widgets/image/image_save.dart'; import 'package:PiliPlus/common/widgets/image/network_img_layer.dart'; -import 'package:PiliPlus/models/common/badge_type.dart'; import 'package:PiliPlus/models_new/space/space_fav/list.dart'; import 'package:PiliPlus/models_new/sub/sub/list.dart'; import 'package:PiliPlus/models_new/sub/sub/upper.dart'; @@ -86,28 +85,19 @@ class MemberFavItem extends StatelessWidget { ), if (item.type == 21) const PBadge( - right: 3, - bottom: 3, + right: 6, + top: 6, text: '合集', + fontSize: 10, isBold: false, - size: PBadgeSize.small, ) - else if (item.type == 0 || item.type == 11) - Positioned( - right: 3, - bottom: 3, - child: Container( - padding: const EdgeInsets.all(5), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: theme.colorScheme.primary, - ), - child: Icon( - Icons.video_library_outlined, - size: 12, - color: theme.colorScheme.onPrimary, - ), - ), + else if (item.type == 11) + const PBadge( + right: 6, + top: 6, + text: '收藏夹', + fontSize: 10, + isBold: false, ), ], ); diff --git a/lib/pages/member_opus/widgets/space_opus_item.dart b/lib/pages/member_opus/widgets/space_opus_item.dart index a270a32eb..925f5fa2a 100644 --- a/lib/pages/member_opus/widgets/space_opus_item.dart +++ b/lib/pages/member_opus/widgets/space_opus_item.dart @@ -61,6 +61,7 @@ class SpaceOpusItem extends StatelessWidget { child: StatWidget( type: StatType.like, value: item.stat?.like, + color: Colors.white.withValues(alpha: 0.8), ), ), ), @@ -82,7 +83,7 @@ class SpaceOpusItem extends StatelessWidget { child: StatWidget( type: StatType.like, value: item.stat?.like, - textColor: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], diff --git a/lib/pages/member_upower_rank/controller.dart b/lib/pages/member_upower_rank/controller.dart index 8544d62bc..5697452b5 100644 --- a/lib/pages/member_upower_rank/controller.dart +++ b/lib/pages/member_upower_rank/controller.dart @@ -8,10 +8,10 @@ import 'package:get/get.dart'; class UpowerRankController extends CommonListController { - UpowerRankController(this.privilegeType); + UpowerRankController({this.privilegeType, required this.upMid}); int? privilegeType; - final upMid = Get.parameters['mid']; + final String upMid; final Rx name = Rx(null); final Rx?> tabs = Rx?>(null); int? memberTotal; diff --git a/lib/pages/member_upower_rank/view.dart b/lib/pages/member_upower_rank/view.dart index 83949bca9..fa2f0333e 100644 --- a/lib/pages/member_upower_rank/view.dart +++ b/lib/pages/member_upower_rank/view.dart @@ -12,8 +12,10 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; class UpowerRankPage extends StatefulWidget { - const UpowerRankPage({super.key, this.privilegeType}); + const UpowerRankPage({super.key, this.upMid, this.tag, this.privilegeType}); + final String? upMid; + final String? tag; final int? privilegeType; @override @@ -22,10 +24,24 @@ class UpowerRankPage extends StatefulWidget { class _UpowerRankPageState extends State with AutomaticKeepAliveClientMixin { - late final _controller = Get.put( - UpowerRankController(widget.privilegeType), - tag: Utils.generateRandomString(8), - ); + late final _upMid = Get.parameters['mid']!; + late final String _tag; + late final UpowerRankController _controller; + + @override + void initState() { + super.initState(); + _tag = widget.privilegeType == null + ? Utils.generateRandomString(8) + : '${widget.tag}${widget.privilegeType}'; + _controller = Get.put( + UpowerRankController( + privilegeType: widget.privilegeType, + upMid: widget.upMid ?? _upMid, + ), + tag: _tag, + ); + } @override Widget build(BuildContext context) { @@ -34,6 +50,7 @@ class _UpowerRankPageState extends State final child = refreshIndicator( onRefresh: _controller.onRefresh, child: CustomScrollView( + controller: _controller.scrollController, slivers: [ SliverPadding( padding: EdgeInsets.only( @@ -51,7 +68,7 @@ class _UpowerRankPageState extends State title: Obx(() => _controller.name.value == null ? const SizedBox.shrink() : Text( - '${_controller.name.value}充电排行榜${_controller.memberTotal == 0 ? '' : '(${_controller.memberTotal})'}')), + '${_controller.name.value} 充电排行榜${_controller.memberTotal == 0 ? '' : '(${_controller.memberTotal})'}')), ), body: SafeArea( top: false, @@ -63,32 +80,56 @@ class _UpowerRankPageState extends State () => _controller.tabs.value != null ? DefaultTabController( length: _controller.tabs.value!.length, - child: Column( - children: [ - TabBar( - isScrollable: true, - tabAlignment: TabAlignment.start, - tabs: _controller.tabs.value! - .map((e) => Tab( - text: - '${e.name!}(${e.memberTotal ?? 0})')) - .toList(), - ), - Expanded( - child: Material( - color: Colors.transparent, - child: tabBarView( - children: [ - KeepAliveWrapper( - builder: (context) => child), - ..._controller.tabs.value!.sublist(1).map( - (e) => UpowerRankPage( - privilegeType: e.privilegeType)) - ], + child: Builder( + builder: (context) { + return Column( + children: [ + TabBar( + isScrollable: true, + tabAlignment: TabAlignment.start, + tabs: _controller.tabs.value! + .map((e) => Tab( + text: + '${e.name!}(${e.memberTotal ?? 0})')) + .toList(), + onTap: (index) { + if (!DefaultTabController.of(context) + .indexIsChanging) { + try { + if (index == 0) { + _controller.animateToTop(); + } else { + Get.find( + tag: + '$_tag${_controller.tabs.value![index].privilegeType}') + .animateToTop(); + } + } catch (_) {} + } + }, ), - ), - ), - ], + Expanded( + child: Material( + color: Colors.transparent, + child: tabBarView( + children: [ + KeepAliveWrapper( + builder: (context) => child), + ..._controller.tabs.value! + .sublist(1) + .map((e) => UpowerRankPage( + upMid: _upMid, + tag: _tag, + privilegeType: + e.privilegeType, + )) + ], + ), + ), + ), + ], + ); + }, ), ) : child, @@ -104,6 +145,7 @@ class _UpowerRankPageState extends State Widget _bilidBody( ThemeData theme, LoadingState?> loadingState) { + late final width = MediaQuery.textScalerOf(context).scale(32); return switch (loadingState) { Loading() => widget.privilegeType == null ? const SliverToBoxAdapter(child: LinearProgressIndicator()) @@ -126,18 +168,23 @@ class _UpowerRankPageState extends State final item = response[index]; return ListTile( onTap: () => Get.toNamed('/member?mid=${item.mid}'), - leading: Text( - (index + 1).toString(), - style: TextStyle( - fontSize: 16, - fontStyle: FontStyle.italic, - fontWeight: FontWeight.bold, - color: switch (index) { - 0 => const Color(0xFFfdad13), - 1 => const Color(0xFF8aace1), - 2 => const Color(0xFFdfa777), - _ => theme.colorScheme.outline, - }, + leading: SizedBox( + width: width, + child: Center( + child: Text( + (index + 1).toString(), + style: TextStyle( + fontSize: 16, + fontStyle: FontStyle.italic, + fontWeight: FontWeight.bold, + color: switch (index) { + 0 => const Color(0xFFfdad13), + 1 => const Color(0xFF8aace1), + 2 => const Color(0xFFdfa777), + _ => theme.colorScheme.outline, + }, + ), + ), ), ), title: Row( diff --git a/lib/pages/member_video/widgets/video_card_h_member_video.dart b/lib/pages/member_video/widgets/video_card_h_member_video.dart index 8e7781f48..62aa0c7c5 100644 --- a/lib/pages/member_video/widgets/video_card_h_member_video.dart +++ b/lib/pages/member_video/widgets/video_card_h_member_video.dart @@ -225,7 +225,7 @@ class VideoCardHMemberVideo extends StatelessWidget { spacing: 8, children: [ StatWidget( - type: StatType.view, + type: StatType.play, value: videoItem.stat.view, ), StatWidget( diff --git a/lib/pages/rank/zone/widget/pgc_rank_item.dart b/lib/pages/rank/zone/widget/pgc_rank_item.dart index 1ec7f4bfc..103d54b1e 100644 --- a/lib/pages/rank/zone/widget/pgc_rank_item.dart +++ b/lib/pages/rank/zone/widget/pgc_rank_item.dart @@ -71,7 +71,7 @@ class PgcRankItem extends StatelessWidget { Row( children: [ StatWidget( - type: StatType.view, + type: StatType.play, value: item.stat!.view, ), const SizedBox(width: 8), diff --git a/lib/pages/save_panel/view.dart b/lib/pages/save_panel/view.dart index 8e857b182..e06de3570 100644 --- a/lib/pages/save_panel/view.dart +++ b/lib/pages/save_panel/view.dart @@ -35,7 +35,7 @@ class SavePanel extends StatefulWidget { @override State createState() => _SavePanelState(); - static void toSavePanel({upMid, item}) { + static void toSavePanel({dynamic upMid, dynamic item}) { Get.generalDialog( barrierLabel: '', barrierDismissible: true, @@ -161,7 +161,7 @@ class _SavePanelState extends State { } } - String parseDyn(item) { + String parseDyn(dynamic item) { String uri = ''; try { switch (item.type) { diff --git a/lib/pages/search_panel/all/controller.dart b/lib/pages/search_panel/all/controller.dart index f944c9031..8777ea16e 100644 --- a/lib/pages/search_panel/all/controller.dart +++ b/lib/pages/search_panel/all/controller.dart @@ -51,7 +51,7 @@ class SearchAllController pubEnd: pubEnd, ); - void onPushDetail(resultList) { + void onPushDetail(dynamic resultList) { try { int? aid = int.tryParse(keyword); if (aid != null && resultList.first.aid == aid) { diff --git a/lib/pages/search_panel/video/controller.dart b/lib/pages/search_panel/video/controller.dart index fabe17e41..11a46c4f3 100644 --- a/lib/pages/search_panel/video/controller.dart +++ b/lib/pages/search_panel/video/controller.dart @@ -61,10 +61,10 @@ class SearchVideoController return false; } - void onPushDetail(resultList) { + void onPushDetail(List? resultList) { try { int? aid = int.tryParse(keyword); - if (aid != null && resultList.first.aid == aid) { + if (aid != null && resultList?.firstOrNull?.aid == aid) { PiliScheme.videoPush(aid, null, showDialog: false); } } catch (_) {} diff --git a/lib/pages/setting/pages/display_mode.dart b/lib/pages/setting/pages/display_mode.dart index 7488c0ed4..70699bdd3 100644 --- a/lib/pages/setting/pages/display_mode.dart +++ b/lib/pages/setting/pages/display_mode.dart @@ -1,9 +1,9 @@ import 'package:PiliPlus/utils/storage.dart'; import 'package:flutter/foundation.dart' show kDebugMode; import 'package:flutter/material.dart'; -import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart' show PlatformException; import 'package:flutter_displaymode/flutter_displaymode.dart'; +import 'package:get/get.dart'; import 'package:hive/hive.dart'; class SetDisplayMode extends StatefulWidget { @@ -20,37 +20,20 @@ class _SetDisplayModeState extends State { Box get setting => GStorage.setting; - final ValueNotifier page = ValueNotifier(0); - late final PageController controller = PageController() - ..addListener(listener); - - void listener() { - page.value = controller.page!.round(); - } - @override void initState() { super.initState(); init(); - SchedulerBinding.instance.addPostFrameCallback((_) { - fetchAll(); - }); - } - - @override - void dispose() { - controller - ..removeListener(listener) - ..dispose(); - super.dispose(); } // 获取所有的mode Future fetchAll() async { preferred = await FlutterDisplayMode.preferred; active = await FlutterDisplayMode.active; - await setting.put(SettingBoxKey.displayMode, preferred.toString()); - setState(() {}); + setting.put(SettingBoxKey.displayMode, preferred.toString()); + if (mounted) { + setState(() {}); + } } // 初始化mode/手动设置 @@ -60,19 +43,17 @@ class _SetDisplayModeState extends State { } on PlatformException catch (e) { if (kDebugMode) debugPrint(e.toString()); } - var res = getDisplayModeType(modes); - preferred = modes.toList().firstWhere((el) => el == res); - FlutterDisplayMode.setPreferredMode(preferred!); - } - - DisplayMode getDisplayModeType(modes) { var value = setting.get(SettingBoxKey.displayMode); - DisplayMode f = DisplayMode.auto; if (value != null) { - f = modes.firstWhere((e) => e.toString() == value); + preferred = modes.firstWhereOrNull((e) => e.toString() == value); } - return f; + + preferred ??= DisplayMode.auto; + + FlutterDisplayMode.setPreferredMode(preferred!).whenComplete(() { + Future.delayed(const Duration(milliseconds: 100)).whenComplete(fetchAll); + }); } @override @@ -81,10 +62,10 @@ class _SetDisplayModeState extends State { appBar: AppBar(title: const Text('屏幕帧率设置')), body: SafeArea( top: false, + bottom: false, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (modes.isEmpty) const Text('Nothing here'), + children: [ Padding( padding: const EdgeInsets.only(left: 25, top: 10, bottom: 5), child: Text( @@ -95,20 +76,19 @@ class _SetDisplayModeState extends State { Expanded( child: ListView.builder( itemCount: modes.length, - itemBuilder: (context, int i) { - final DisplayMode mode = modes[i]; + itemBuilder: (context, index) { + final DisplayMode mode = modes[index]; return RadioListTile( value: mode, title: mode == DisplayMode.auto ? const Text('自动') - : Text('$mode${mode == active ? " [系统]" : ""}'), + : Text('$mode${mode == active ? ' [系统]' : ''}'), groupValue: preferred, - onChanged: (DisplayMode? newMode) async { - await FlutterDisplayMode.setPreferredMode(newMode!); - await Future.delayed( - const Duration(milliseconds: 100), - ); - await fetchAll(); + onChanged: (DisplayMode? newMode) { + FlutterDisplayMode.setPreferredMode(newMode!) + .whenComplete(() => + Future.delayed(const Duration(milliseconds: 100)) + .whenComplete(fetchAll)); }, ); }, diff --git a/lib/pages/setting/pages/play_speed_set.dart b/lib/pages/setting/pages/play_speed_set.dart index 4e1e9684a..6600ffdcb 100644 --- a/lib/pages/setting/pages/play_speed_set.dart +++ b/lib/pages/setting/pages/play_speed_set.dart @@ -168,7 +168,7 @@ class _PlaySpeedPageState extends State { } // - void menuAction(index, id) { + void menuAction(int index, int id) { double speed = speedList[index]; // 设置 if (id == 1) { diff --git a/lib/pages/video/controller.dart b/lib/pages/video/controller.dart index acc692675..fd3d7bcb7 100644 --- a/lib/pages/video/controller.dart +++ b/lib/pages/video/controller.dart @@ -226,7 +226,7 @@ class VideoDetailController extends GetxController imageStatus = true; } - void onDismissed(value) { + void onDismissed(int _) { imageStatus = false; } @@ -813,7 +813,7 @@ class VideoDetailController extends GetxController } } - void onAddItem(item) { + void onAddItem(dynamic item) { if (listData.contains(item)) return; listData.insert(0, item); listKey.currentState?.insertItem(0); @@ -841,7 +841,7 @@ class VideoDetailController extends GetxController }); } - Widget buildItem(item, Animation animation) { + Widget buildItem(dynamic item, Animation animation) { return Align( alignment: Alignment.centerLeft, child: SlideTransition( @@ -1063,10 +1063,10 @@ class VideoDetailController extends GetxController } Future playerInit({ - video, - audio, - seekToTime, - duration, + String? video, + String? audio, + Duration? seekToTime, + Duration? duration, bool? autoplay, }) async { await plPlayerController.setDataSource( @@ -1088,9 +1088,10 @@ class VideoDetailController extends GetxController showVP: showVP, dmTrend: dmTrend, seekTo: seekToTime ?? defaultST ?? playedTime, - duration: duration ?? data.timeLength == null - ? null - : Duration(milliseconds: data.timeLength!), + duration: duration ?? + (data.timeLength == null + ? null + : Duration(milliseconds: data.timeLength!)), // 宽>高 水平 否则 垂直 direction: direction.value, bvid: bvid, @@ -1414,7 +1415,7 @@ class VideoDetailController extends GetxController int? graphVersion; EdgeInfoData? steinEdgeInfo; late final RxBool showSteinEdgeInfo = false.obs; - Future getSteinEdgeInfo([edgeId]) async { + Future getSteinEdgeInfo([int? edgeId]) async { steinEdgeInfo = null; try { var res = await Request().get( @@ -1517,7 +1518,7 @@ class VideoDetailController extends GetxController } } - void updateMediaListHistory(aid) { + void updateMediaListHistory(int aid) { if (Get.arguments?['sortField'] != null) { VideoHttp.medialistHistory( desc: _mediaDesc ? 1 : 0, @@ -1561,7 +1562,7 @@ class VideoDetailController extends GetxController super.onClose(); } - void onReset([isStein]) { + void onReset([bool? isStein]) { playedTime = null; videoUrl = null; audioUrl = null; diff --git a/lib/pages/video/introduction/pgc/view.dart b/lib/pages/video/introduction/pgc/view.dart index 9d264b112..93d0b62d7 100644 --- a/lib/pages/video/introduction/pgc/view.dart +++ b/lib/pages/video/introduction/pgc/view.dart @@ -204,7 +204,7 @@ class _PgcIntroPageState extends State spacing: 6, children: [ StatWidget( - type: StatType.view, + type: StatType.play, value: item.stat!.views, ), StatWidget( diff --git a/lib/pages/video/introduction/pgc/widgets/intro_detail.dart b/lib/pages/video/introduction/pgc/widgets/intro_detail.dart index bd0d07b44..b6d4bbc55 100644 --- a/lib/pages/video/introduction/pgc/widgets/intro_detail.dart +++ b/lib/pages/video/introduction/pgc/widgets/intro_detail.dart @@ -110,7 +110,7 @@ class _IntroDetailState extends CommonCollapseSlidePageState { spacing: 6, children: [ StatWidget( - type: StatType.view, + type: StatType.play, value: widget.item.stat!.views, ), StatWidget( diff --git a/lib/pages/video/introduction/ugc/view.dart b/lib/pages/video/introduction/ugc/view.dart index e65aaaf7e..34ffd0735 100644 --- a/lib/pages/video/introduction/ugc/view.dart +++ b/lib/pages/video/introduction/ugc/view.dart @@ -45,7 +45,7 @@ class VideoIntroPanel extends StatefulWidget { final String heroTag; final Function showAiBottomSheet; final Function showEpisodes; - final ValueChanged onShowMemberPage; + final ValueChanged onShowMemberPage; @override State createState() => _VideoIntroPanelState(); @@ -97,7 +97,7 @@ class VideoInfo extends StatefulWidget { final String heroTag; final Function showAiBottomSheet; final Function showEpisodes; - final ValueChanged onShowMemberPage; + final ValueChanged onShowMemberPage; final VideoIntroController videoIntroController; const VideoInfo({ @@ -555,18 +555,18 @@ class _VideoInfoState extends State { spacing: 10, children: [ StatWidget( - type: StatType.view, + type: StatType.play, value: !widget.isLoading ? videoDetail.stat?.view : videoItem['stat']?.view, - textColor: theme.colorScheme.outline, + color: theme.colorScheme.outline, ), StatWidget( type: StatType.danmaku, value: !widget.isLoading ? videoDetail.stat?.danmaku : videoItem['stat']?.danmu, - textColor: theme.colorScheme.outline, + color: theme.colorScheme.outline, ), Text( Utils.dateFormat( diff --git a/lib/pages/video/member/view.dart b/lib/pages/video/member/view.dart index 01de96ede..7bfead262 100644 --- a/lib/pages/video/member/view.dart +++ b/lib/pages/video/member/view.dart @@ -229,7 +229,7 @@ class _HorizontalMemberPageState extends State { return Row( children: [ const SizedBox(width: 16), - _buildAvatar(memberInfoModel.face), + _buildAvatar(memberInfoModel.face!), const SizedBox(width: 10), Expanded(child: _buildInfo(theme, memberInfoModel)), const SizedBox(width: 16), @@ -388,7 +388,7 @@ class _HorizontalMemberPageState extends State { ); } - Hero _buildAvatar(face) => Hero( + Hero _buildAvatar(String face) => Hero( tag: face, child: GestureDetector( onTap: () { diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index 33f065203..fdfb81507 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -2055,7 +2055,7 @@ class _VideoDetailPageVState extends State ); } - void showEpisodes([index, season, episodes, bvid, aid, cid]) { + void showEpisodes([int? index, season, episodes, bvid, aid, cid]) { if (bvid == null) { videoDetailController.showMediaListPanel(context); return; @@ -2224,7 +2224,7 @@ class _VideoDetailPageVState extends State } } - void _onPopInvokedWithResult(didPop, result) { + void _onPopInvokedWithResult(bool didPop, result) { if (plPlayerController?.controlsLock.value == true) { plPlayerController?.onLockControl(false); return; @@ -2238,7 +2238,7 @@ class _VideoDetailPageVState extends State } } - void onShowMemberPage(mid) { + void onShowMemberPage(int? mid) { videoDetailController.childKey.currentState?.showBottomSheet( shape: const RoundedRectangleBorder(), (context) { diff --git a/lib/pages/whisper_detail/view.dart b/lib/pages/whisper_detail/view.dart index bfb1fcf01..b49fb3c18 100644 --- a/lib/pages/whisper_detail/view.dart +++ b/lib/pages/whisper_detail/view.dart @@ -214,7 +214,7 @@ class _WhisperDetailPageState ); } - Widget _buildInputView(theme) { + Widget _buildInputView(ThemeData theme) { return Container( padding: const EdgeInsets.symmetric(vertical: 8), decoration: BoxDecoration( diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index 3afdee17f..4f189203e 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -135,7 +135,7 @@ class ChatItem extends StatelessWidget { Widget messageContent({ required BuildContext context, required ThemeData theme, - required content, + required dynamic content, required Color textColor, }) { try { @@ -169,7 +169,7 @@ class ChatItem extends StatelessWidget { } } - Widget msgTypeCommonShareCard_14(content, Color textColor) { + Widget msgTypeCommonShareCard_14(dynamic content, Color textColor) { if (content['source'] == '直播') { return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -209,7 +209,7 @@ class ChatItem extends StatelessWidget { } } - Widget msgTypeArticleCard_12(content, Color textColor) { + Widget msgTypeArticleCard_12(dynamic content, Color textColor) { return GestureDetector( onTap: () => Get.toNamed( '/articlePage', @@ -443,7 +443,7 @@ class ChatItem extends StatelessWidget { ); } - Widget msgTypeShareV2_7(content, Color textColor) { + Widget msgTypeShareV2_7(dynamic content, Color textColor) { String? type; GestureTapCallback onTap; switch (content['source']) { @@ -589,7 +589,7 @@ class ChatItem extends StatelessWidget { } Widget msgTypeText_1({ - required content, + required dynamic content, required Color textColor, }) { late final style = TextStyle( @@ -717,7 +717,7 @@ class ChatItem extends StatelessWidget { ); } - Widget msgTypePictureCard_13(content) { + Widget msgTypePictureCard_13(dynamic content) { return Center( child: ConstrainedBox( constraints: const BoxConstraints(maxWidth: 400.0),