diff --git a/lib/common/widgets/custom_toast.dart b/lib/common/widgets/custom_toast.dart index f6c473f8..78b47e5b 100644 --- a/lib/common/widgets/custom_toast.dart +++ b/lib/common/widgets/custom_toast.dart @@ -13,7 +13,7 @@ class CustomToast extends StatelessWidget { .get(SettingBoxKey.defaultToastOp, defaultValue: 1.0) as double; return Container( margin: - EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 30), + EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom + 30), padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 10), decoration: BoxDecoration( color: diff --git a/lib/common/widgets/dynamic_sliver_appbar_medium.dart b/lib/common/widgets/dynamic_sliver_appbar_medium.dart index 606666b7..900bb1c8 100644 --- a/lib/common/widgets/dynamic_sliver_appbar_medium.dart +++ b/lib/common/widgets/dynamic_sliver_appbar_medium.dart @@ -123,7 +123,7 @@ class _DynamicSliverAppBarMediumState extends State { @override Widget build(BuildContext context) { - final orientation = MediaQuery.of(context).orientation; + final orientation = MediaQuery.orientationOf(context); if (orientation != _orientation) { _orientation = orientation; _height = 0; diff --git a/lib/common/widgets/image/nine_grid_view.dart b/lib/common/widgets/image/nine_grid_view.dart index 73c70276..08d2ce17 100644 --- a/lib/common/widgets/image/nine_grid_view.dart +++ b/lib/common/widgets/image/nine_grid_view.dart @@ -134,7 +134,7 @@ class _NineGridViewState extends State { return Rect.fromLTRB(0, 0, padding.horizontal, padding.vertical); } double width = widget.width ?? - (MediaQuery.of(context).size.width - widget.margin.horizontal); + (MediaQuery.sizeOf(context).width - widget.margin.horizontal); width = width - padding.horizontal; double space = widget.space; double itemW; @@ -389,11 +389,11 @@ class _NineGridViewState extends State { /// get big image size. Rect _getBigImgSize(double originalWidth, double originalHeight) { double width = widget.width ?? - (MediaQuery.of(context).size.width - widget.margin.horizontal); + (MediaQuery.sizeOf(context).width - widget.margin.horizontal); width = width - widget.padding.horizontal; double itemW = (width - widget.space * 2) / 3; - //double devicePixelRatio = MediaQuery.of(context)?.devicePixelRatio ?? 3; + // double devicePixelRatio = MediaQuery.devicePixelRatioOf(context); double devicePixelRatio = 1.0; double tempWidth = originalWidth / devicePixelRatio; double tempHeight = originalHeight / devicePixelRatio; diff --git a/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart b/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart index bbfb0a27..dfa7f261 100644 --- a/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart +++ b/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart @@ -271,7 +271,7 @@ class _InteractiveviewerGalleryState extends State children: [ InteractiveViewerBoundary( controller: _transformationController, - boundaryWidth: MediaQuery.of(context).size.width, + boundaryWidth: MediaQuery.sizeOf(context).width, onScaleChanged: _onScaleChanged, onLeftBoundaryHit: _onLeftBoundaryHit, onRightBoundaryHit: _onRightBoundaryHit, diff --git a/lib/pages/article/view.dart b/lib/pages/article/view.dart index 8bb06cd6..d02b0e7d 100644 --- a/lib/pages/article/view.dart +++ b/lib/pages/article/view.dart @@ -595,7 +595,7 @@ class _ArticlePageState extends State return Container( alignment: Alignment.center, margin: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom), + bottom: MediaQuery.paddingOf(context).bottom), height: 125, child: Text( _articleCtr.isEnd ? '没有更多了' : '加载中...', @@ -608,7 +608,7 @@ class _ArticlePageState extends State } else { return ReplyItemGrpc( replyItem: response[index], - replyLevel: '1', + replyLevel: 1, replyReply: (replyItem, id) => replyReply(context, replyItem, id), onReply: () => _articleCtr.onReply( @@ -827,7 +827,7 @@ class _ArticlePageState extends State child: Padding( padding: EdgeInsets.only( right: 14, - bottom: MediaQuery.of(context).padding.bottom + 14, + bottom: MediaQuery.paddingOf(context).bottom + 14, ), child: button(), ), @@ -872,7 +872,7 @@ class _ArticlePageState extends State bottom: 14 + (_articleCtr.stats.value != null ? 0 - : MediaQuery.of(context).padding.bottom), + : MediaQuery.paddingOf(context).bottom), ), child: button(), ), diff --git a/lib/pages/common/common_search_page.dart b/lib/pages/common/common_search_page.dart index 43c44c45..78688111 100644 --- a/lib/pages/common/common_search_page.dart +++ b/lib/pages/common/common_search_page.dart @@ -55,7 +55,7 @@ abstract class CommonSearchPageState slivers: [ SliverPadding( padding: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom + 80, + bottom: MediaQuery.paddingOf(context).bottom + 80, ), sliver: Obx(() => _buildBody(controller.loadingState.value)), ), diff --git a/lib/pages/dynamics/widgets/author_panel.dart b/lib/pages/dynamics/widgets/author_panel.dart index 6fc8aacf..2168ebe1 100644 --- a/lib/pages/dynamics/widgets/author_panel.dart +++ b/lib/pages/dynamics/widgets/author_panel.dart @@ -242,7 +242,7 @@ class AuthorPanel extends StatelessWidget { final theme = Theme.of(context); return Padding( padding: - EdgeInsets.only(bottom: MediaQuery.of(context1).padding.bottom), + EdgeInsets.only(bottom: MediaQuery.paddingOf(context1).bottom), child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/pages/dynamics_detail/view.dart b/lib/pages/dynamics_detail/view.dart index 0a3fa21a..5141c037 100644 --- a/lib/pages/dynamics_detail/view.dart +++ b/lib/pages/dynamics_detail/view.dart @@ -709,7 +709,7 @@ class _DynamicDetailPageState extends State return Container( alignment: Alignment.center, margin: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom), + bottom: MediaQuery.paddingOf(context).bottom), height: 125, child: Text( _controller.isEnd ? '没有更多了' : '加载中...', @@ -722,7 +722,7 @@ class _DynamicDetailPageState extends State } else { return ReplyItemGrpc( replyItem: response[index], - replyLevel: '1', + replyLevel: 1, replyReply: (replyItem, id) => replyReply(context, replyItem, id), onReply: () => _controller.onReply( diff --git a/lib/pages/dynamics_repost/view.dart b/lib/pages/dynamics_repost/view.dart index 1a57e20a..7838dd38 100644 --- a/lib/pages/dynamics_repost/view.dart +++ b/lib/pages/dynamics_repost/view.dart @@ -355,7 +355,7 @@ class _RepostPanelState extends CommonPublishPageState { ), ), ), - SizedBox(height: 10 + MediaQuery.of(context).padding.bottom), + SizedBox(height: 10 + MediaQuery.paddingOf(context).bottom), ]; @override diff --git a/lib/pages/emote/view.dart b/lib/pages/emote/view.dart index 21b03c68..0182f71f 100644 --- a/lib/pages/emote/view.dart +++ b/lib/pages/emote/view.dart @@ -145,7 +145,7 @@ class _EmotePanelState extends State ), ], ), - SizedBox(height: MediaQuery.of(context).padding.bottom), + SizedBox(height: MediaQuery.paddingOf(context).bottom), ], ) : _errorWidget(), diff --git a/lib/pages/episode_panel/view.dart b/lib/pages/episode_panel/view.dart index adaa9aae..76cf3c5b 100644 --- a/lib/pages/episode_panel/view.dart +++ b/lib/pages/episode_panel/view.dart @@ -281,7 +281,7 @@ class _EpisodePanelState extends CommonSlidePageState { builder: (context) => ScrollablePositionedList.separated( padding: EdgeInsets.only( top: 7, - bottom: MediaQuery.of(context).padding.bottom + 80, + bottom: MediaQuery.paddingOf(context).bottom + 80, ), reverse: _isReversed[tabIndex], itemCount: episodes.length, diff --git a/lib/pages/fav_detail/view.dart b/lib/pages/fav_detail/view.dart index 097a319a..bf53f8c8 100644 --- a/lib/pages/fav_detail/view.dart +++ b/lib/pages/fav_detail/view.dart @@ -73,7 +73,7 @@ class _FavDetailPageState extends State { _buildHeader(theme), SliverPadding( padding: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom + 85, + bottom: MediaQuery.paddingOf(context).bottom + 85, ), sliver: Obx(() => _buildBody( theme, _favDetailController.loadingState.value)), @@ -306,7 +306,7 @@ class _FavDetailPageState extends State { return FlexibleSpaceBar( background: Padding( padding: EdgeInsets.only( - top: kToolbarHeight + MediaQuery.of(context).padding.top + 10, + top: kToolbarHeight + MediaQuery.paddingOf(context).top + 10, left: 14, right: 20, bottom: 10, diff --git a/lib/pages/fav_folder_sort/view.dart b/lib/pages/fav_folder_sort/view.dart index e8b1cf05..b3edba64 100644 --- a/lib/pages/fav_folder_sort/view.dart +++ b/lib/pages/fav_folder_sort/view.dart @@ -116,7 +116,7 @@ class _FavFolderSortPageState extends State { onReorder: onReorder, physics: const AlwaysScrollableScrollPhysics(), footer: SizedBox( - height: MediaQuery.of(context).padding.bottom + 80, + height: MediaQuery.paddingOf(context).bottom + 80, ), itemCount: sortList.length, itemBuilder: (context, index) { diff --git a/lib/pages/fav_panel/view.dart b/lib/pages/fav_panel/view.dart index 6dd77ba1..a234258d 100644 --- a/lib/pages/fav_panel/view.dart +++ b/lib/pages/fav_panel/view.dart @@ -150,7 +150,7 @@ class _FavPanelState extends State { left: 20, right: 20, top: 12, - bottom: MediaQuery.of(context).padding.bottom + 12, + bottom: MediaQuery.paddingOf(context).bottom + 12, ), child: Row( mainAxisAlignment: MainAxisAlignment.end, diff --git a/lib/pages/fav_sort/view.dart b/lib/pages/fav_sort/view.dart index ae8a0f0d..b486aa61 100644 --- a/lib/pages/fav_sort/view.dart +++ b/lib/pages/fav_sort/view.dart @@ -125,7 +125,7 @@ class _FavSortPageState extends State { onReorder: onReorder, physics: const AlwaysScrollableScrollPhysics(), footer: SizedBox( - height: MediaQuery.of(context).padding.bottom + 80, + height: MediaQuery.paddingOf(context).bottom + 80, ), itemCount: sortList.length, itemBuilder: (context, index) { diff --git a/lib/pages/group_panel/view.dart b/lib/pages/group_panel/view.dart index 3f9be2ff..e08b4b4a 100644 --- a/lib/pages/group_panel/view.dart +++ b/lib/pages/group_panel/view.dart @@ -159,7 +159,7 @@ class _GroupPanelState extends State { left: 20, right: 20, top: 12, - bottom: MediaQuery.of(context).padding.bottom + 12, + bottom: MediaQuery.paddingOf(context).bottom + 12, ), child: Row( mainAxisAlignment: MainAxisAlignment.end, diff --git a/lib/pages/history/view.dart b/lib/pages/history/view.dart index 86390c75..6eca5f58 100644 --- a/lib/pages/history/view.dart +++ b/lib/pages/history/view.dart @@ -245,7 +245,7 @@ class _HistoryPageState extends State SliverPadding( padding: EdgeInsets.only( top: StyleString.safeSpace - 5, - bottom: MediaQuery.of(context).padding.bottom + 80, + bottom: MediaQuery.paddingOf(context).bottom + 80, ), sliver: Obx(() => _buildBody(_historyController.loadingState.value)), diff --git a/lib/pages/hot/view.dart b/lib/pages/hot/view.dart index aef7631d..6f484b15 100644 --- a/lib/pages/hot/view.dart +++ b/lib/pages/hot/view.dart @@ -132,7 +132,7 @@ class _HotPageState extends CommonPageState SliverPadding( padding: EdgeInsets.only( top: StyleString.safeSpace - 5, - bottom: MediaQuery.of(context).padding.bottom + 80, + bottom: MediaQuery.paddingOf(context).bottom + 80, ), sliver: Obx( () => _buildBody(controller.loadingState.value), diff --git a/lib/pages/later/child_view.dart b/lib/pages/later/child_view.dart index 1cc43b3b..5f455b3f 100644 --- a/lib/pages/later/child_view.dart +++ b/lib/pages/later/child_view.dart @@ -45,7 +45,7 @@ class _LaterViewChildPageState extends State SliverPadding( padding: EdgeInsets.only( top: 7, - bottom: MediaQuery.of(context).padding.bottom + 85, + bottom: MediaQuery.paddingOf(context).bottom + 85, ), sliver: Obx( () => _buildBody(_laterController.loadingState.value), diff --git a/lib/pages/live_emote/view.dart b/lib/pages/live_emote/view.dart index 8715d383..475119d8 100644 --- a/lib/pages/live_emote/view.dart +++ b/lib/pages/live_emote/view.dart @@ -130,7 +130,7 @@ class _LiveEmotePanelState extends State ) .toList(), ), - SizedBox(height: MediaQuery.of(context).padding.bottom), + SizedBox(height: MediaQuery.paddingOf(context).bottom), ], ) : _errorWidget(), diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 0a0c8375..66a15f6e 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -538,7 +538,7 @@ class _LiveRoomPageState extends State left: 10, top: 10, right: 10, - bottom: 25 + MediaQuery.of(context).padding.bottom, + bottom: 25 + MediaQuery.paddingOf(context).bottom, ), decoration: const BoxDecoration( borderRadius: BorderRadius.only( diff --git a/lib/pages/member/widget/user_info_card.dart b/lib/pages/member/widget/user_info_card.dart index 2c611f8b..93867c37 100644 --- a/lib/pages/member/widget/user_info_card.dart +++ b/lib/pages/member/widget/user_info_card.dart @@ -49,6 +49,7 @@ class UserInfoCard extends StatelessWidget { }) { return GestureDetector( onTap: onTap, + behavior: HitTestBehavior.opaque, child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/pages/member_dynamics/view.dart b/lib/pages/member_dynamics/view.dart index 143bc315..fdf3dc02 100644 --- a/lib/pages/member_dynamics/view.dart +++ b/lib/pages/member_dynamics/view.dart @@ -47,7 +47,7 @@ class _MemberDynamicsPageState extends State super.build(context); return widget.mid == null ? Scaffold( - appBar: AppBar(title: const Text('Ta的动态')), + appBar: AppBar(title: const Text('我的动态')), body: _buildBody, ) : _buildBody; diff --git a/lib/pages/member_home/view.dart b/lib/pages/member_home/view.dart index 8f19303f..75bd6966 100644 --- a/lib/pages/member_home/view.dart +++ b/lib/pages/member_home/view.dart @@ -218,7 +218,7 @@ class _MemberHomeState extends State ], SliverToBoxAdapter( child: SizedBox( - height: 80 + MediaQuery.of(context).padding.bottom, + height: 80 + MediaQuery.paddingOf(context).bottom, ), ), ], diff --git a/lib/pages/member_pgc/view.dart b/lib/pages/member_pgc/view.dart index 3086bfc9..a06bfdd1 100644 --- a/lib/pages/member_pgc/view.dart +++ b/lib/pages/member_pgc/view.dart @@ -50,7 +50,7 @@ class _MemberBangumiState extends State right: StyleString.safeSpace, top: StyleString.safeSpace, bottom: StyleString.safeSpace + - MediaQuery.of(context).padding.bottom + + MediaQuery.paddingOf(context).bottom + 80, ), sliver: Obx( diff --git a/lib/pages/member_video/view.dart b/lib/pages/member_video/view.dart index 68d8f0bf..8bdefada 100644 --- a/lib/pages/member_video/view.dart +++ b/lib/pages/member_video/view.dart @@ -69,7 +69,7 @@ class _MemberVideoState extends State slivers: [ SliverPadding( padding: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom + 80, + bottom: MediaQuery.paddingOf(context).bottom + 80, ), sliver: Obx( () => _buildBody(theme, _controller.loadingState.value)), diff --git a/lib/pages/rank/zone/view.dart b/lib/pages/rank/zone/view.dart index 8fa3fb21..c28598d2 100644 --- a/lib/pages/rank/zone/view.dart +++ b/lib/pages/rank/zone/view.dart @@ -45,7 +45,7 @@ class _ZonePageState extends CommonPageState SliverPadding( padding: EdgeInsets.only( top: StyleString.safeSpace - 5, - bottom: MediaQuery.of(context).padding.bottom + 80, + bottom: MediaQuery.paddingOf(context).bottom + 80, ), sliver: Obx(() => _buildBody(controller.loadingState.value)), ), diff --git a/lib/pages/save_panel/view.dart b/lib/pages/save_panel/view.dart index e06de357..1fd2999f 100644 --- a/lib/pages/save_panel/view.dart +++ b/lib/pages/save_panel/view.dart @@ -314,7 +314,7 @@ class _SavePanelState extends State { IgnorePointer( child: ReplyItemGrpc( replyItem: _item, - replyLevel: '', + replyLevel: 0, needDivider: false, upMid: widget.upMid, ), diff --git a/lib/pages/search_panel/article/controller.dart b/lib/pages/search_panel/article/controller.dart index 8e51f719..cb9d8b55 100644 --- a/lib/pages/search_panel/article/controller.dart +++ b/lib/pages/search_panel/article/controller.dart @@ -78,7 +78,7 @@ class SearchArticleController top: 20, left: 16, right: 16, - bottom: 80 + MediaQuery.of(context).padding.bottom, + bottom: 80 + MediaQuery.paddingOf(context).bottom, ), child: Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/pages/search_panel/user/controller.dart b/lib/pages/search_panel/user/controller.dart index 067ccf2f..6c549827 100644 --- a/lib/pages/search_panel/user/controller.dart +++ b/lib/pages/search_panel/user/controller.dart @@ -50,7 +50,7 @@ class SearchUserController top: 20, left: 16, right: 16, - bottom: 80 + MediaQuery.of(context).padding.bottom, + bottom: 80 + MediaQuery.paddingOf(context).bottom, ), child: Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/pages/search_panel/video/controller.dart b/lib/pages/search_panel/video/controller.dart index 11a46c4f..403e826a 100644 --- a/lib/pages/search_panel/video/controller.dart +++ b/lib/pages/search_panel/video/controller.dart @@ -216,7 +216,7 @@ class SearchVideoController top: 20, left: 16, right: 16, - bottom: 80 + MediaQuery.of(context).padding.bottom, + bottom: 80 + MediaQuery.paddingOf(context).bottom, ), child: Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/pages/setting/pages/bar_set.dart b/lib/pages/setting/pages/bar_set.dart index 2c392105..18a641e5 100644 --- a/lib/pages/setting/pages/bar_set.dart +++ b/lib/pages/setting/pages/bar_set.dart @@ -68,7 +68,7 @@ class _BarSetPageState extends State { body: ReorderableListView( onReorder: onReorder, footer: SizedBox( - height: MediaQuery.of(context).padding.bottom + 30, + height: MediaQuery.paddingOf(context).bottom + 30, child: const Align( alignment: Alignment.centerRight, child: Text('*长按拖动排序 ')), ), diff --git a/lib/pages/setting/widgets/model.dart b/lib/pages/setting/widgets/model.dart index fb99d86d..daad6db2 100644 --- a/lib/pages/setting/widgets/model.dart +++ b/lib/pages/setting/widgets/model.dart @@ -251,7 +251,7 @@ List get styleSettings => [ leading: const Icon(Icons.calendar_view_week_outlined), title: '列表宽度(dp)限制', getSubtitle: () => - '当前:${GStorage.smallCardWidth.toInt()}dp,屏幕宽度:${MediaQuery.of(Get.context!).size.width.toPrecision(2)}dp。宽度越小列数越多。', + '当前:${GStorage.smallCardWidth.toInt()}dp,屏幕宽度:${Get.mediaQuery.size.width.toPrecision(2)}dp。宽度越小列数越多。', ), SettingsModel( settingsType: SettingsType.sw1tch, diff --git a/lib/pages/subscription/view.dart b/lib/pages/subscription/view.dart index 910dbba7..07ba3ceb 100644 --- a/lib/pages/subscription/view.dart +++ b/lib/pages/subscription/view.dart @@ -34,7 +34,7 @@ class _SubPageState extends State { Obx(() => _buildBody(_subController.loadingState.value)), SliverToBoxAdapter( child: SizedBox( - height: MediaQuery.of(context).padding.bottom + 80, + height: MediaQuery.paddingOf(context).bottom + 80, ), ), ], diff --git a/lib/pages/subscription_detail/view.dart b/lib/pages/subscription_detail/view.dart index 5a44ee05..025d8180 100644 --- a/lib/pages/subscription_detail/view.dart +++ b/lib/pages/subscription_detail/view.dart @@ -122,7 +122,7 @@ class _SubDetailPageState extends State { ), ), padding: EdgeInsets.only( - top: kToolbarHeight + MediaQuery.of(context).padding.top + 10, + top: kToolbarHeight + MediaQuery.paddingOf(context).top + 10, left: 12, right: 12, bottom: 12, diff --git a/lib/pages/video/introduction/pgc/view.dart b/lib/pages/video/introduction/pgc/view.dart index 93d0b62d..4655e01d 100644 --- a/lib/pages/video/introduction/pgc/view.dart +++ b/lib/pages/video/introduction/pgc/view.dart @@ -71,7 +71,7 @@ class _PgcIntroPageState extends State final ThemeData theme = Theme.of(context); final item = pgcIntroController.pgcItem; final isLandscape = - MediaQuery.of(context).orientation == Orientation.landscape; + MediaQuery.orientationOf(context) == Orientation.landscape; return SliverPadding( padding: EdgeInsets.only( left: StyleString.safeSpace, diff --git a/lib/pages/video/member/view.dart b/lib/pages/video/member/view.dart index e0ec57d6..1a21931d 100644 --- a/lib/pages/video/member/view.dart +++ b/lib/pages/video/member/view.dart @@ -180,7 +180,7 @@ class _HorizontalMemberPageState extends State { Success(:var response) => response?.isNotEmpty == true ? SliverPadding( padding: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom + 80, + bottom: MediaQuery.paddingOf(context).bottom + 80, ), sliver: SliverGrid( gridDelegate: Grid.videoCardHDelegate(context), diff --git a/lib/pages/video/pay_coins/view.dart b/lib/pages/video/pay_coins/view.dart index 37703f3f..92abe88b 100644 --- a/lib/pages/video/pay_coins/view.dart +++ b/lib/pages/video/pay_coins/view.dart @@ -433,7 +433,7 @@ class _PayCoinsPageState extends State ), SizedBox( height: (isV ? 50 : 10) + - MediaQuery.of(context).padding.bottom), + MediaQuery.paddingOf(context).bottom), ], ), ), diff --git a/lib/pages/video/reply/view.dart b/lib/pages/video/reply/view.dart index 94f886a4..9421ce4c 100644 --- a/lib/pages/video/reply/view.dart +++ b/lib/pages/video/reply/view.dart @@ -17,7 +17,7 @@ class VideoReplyPanel extends StatefulWidget { final String? bvid; final int oid; final int rpid; - final String replyLevel; + final int replyLevel; final String heroTag; final Function(ReplyInfo replyItem, int? rpid) replyReply; final VoidCallback? onViewImage; @@ -30,7 +30,7 @@ class VideoReplyPanel extends StatefulWidget { this.bvid, required this.oid, this.rpid = 0, - this.replyLevel = '1', + this.replyLevel = 1, required this.heroTag, required this.replyReply, this.onViewImage, @@ -163,7 +163,7 @@ class _VideoReplyPanelState extends State ], ), Positioned( - bottom: MediaQuery.of(context).padding.bottom + 14, + bottom: MediaQuery.paddingOf(context).bottom + 14, right: 14, child: SlideTransition( position: _videoReplyController.anim, @@ -198,7 +198,7 @@ class _VideoReplyPanelState extends State Success(:var response) => response?.isNotEmpty == true ? SliverList.builder( itemBuilder: (context, index) { - double bottom = MediaQuery.of(context).padding.bottom; + double bottom = MediaQuery.paddingOf(context).bottom; if (index == response.length) { _videoReplyController.onLoadMore(); return Container( diff --git a/lib/pages/video/reply/widgets/reply_item_grpc.dart b/lib/pages/video/reply/widgets/reply_item_grpc.dart index b70dcadd..3901ffb0 100644 --- a/lib/pages/video/reply/widgets/reply_item_grpc.dart +++ b/lib/pages/video/reply/widgets/reply_item_grpc.dart @@ -51,7 +51,7 @@ class ReplyItemGrpc extends StatelessWidget { this.onToggleTop, }); final ReplyInfo replyItem; - final String replyLevel; + final int replyLevel; final Function(ReplyInfo replyItem, int? rpid)? replyReply; final bool needDivider; final VoidCallback? onReply; @@ -230,7 +230,7 @@ class ReplyItemGrpc extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - replyLevel == '' + replyLevel == 0 ? DateTime.fromMillisecondsSinceEpoch( replyItem.ctime.toInt() * 1000) .toString() @@ -259,7 +259,7 @@ class ReplyItemGrpc extends StatelessWidget { Padding( padding: EdgeInsets.only( top: 10, - left: replyLevel == '' ? 6 : 45, + left: replyLevel == 0 ? 6 : 45, right: 6, bottom: 4, ), @@ -272,7 +272,7 @@ class ReplyItemGrpc extends StatelessWidget { ); TextPainter? textPainter; bool? didExceedMaxLines; - if (replyLevel == '1' && GlobalData().replyLengthLimit != 0) { + if (replyLevel == 1 && GlobalData().replyLengthLimit != 0) { textPainter = TextPainter( text: TextSpan(text: text, style: style), maxLines: GlobalData().replyLengthLimit, @@ -316,12 +316,10 @@ class ReplyItemGrpc extends StatelessWidget { ), ), // 操作区域 - if (replyLevel != '') + if (replyLevel != 0) buttonAction(context, theme, replyItem.replyControl), // 一楼的评论 - if (replyLevel == '1' && - (replyItem.replies.isNotEmpty || - replyItem.replyControl.subReplyEntryText.isNotEmpty)) ...[ + if (replyLevel == 1 && replyItem.replies.isNotEmpty) ...[ Padding( padding: const EdgeInsets.only(top: 5, bottom: 12), child: replyItemRow(context, theme), @@ -397,9 +395,7 @@ class ReplyItemGrpc extends StatelessWidget { color: theme.colorScheme.secondary, fontSize: theme.textTheme.labelMedium!.fontSize), ), - if (replyLevel == '2' && - needDivider && - replyItem.id != replyItem.dialog) + if (replyLevel == 2 && needDivider && replyItem.id != replyItem.dialog) SizedBox( height: 32, child: TextButton( @@ -424,8 +420,8 @@ class ReplyItemGrpc extends StatelessWidget { Widget replyItemRow(BuildContext context, ThemeData theme) { final bool extraRow = replyItem.replies.length < replyItem.count.toInt(); - return Container( - margin: const EdgeInsets.only(left: 42, right: 4, top: 0), + return Padding( + padding: const EdgeInsets.only(left: 42, right: 4), child: Material( color: theme.colorScheme.onInverseSurface, borderRadius: const BorderRadius.all(Radius.circular(6)), @@ -1132,7 +1128,7 @@ class ReplyItemGrpc extends StatelessWidget { leading: Icon(Icons.error_outline, color: errorColor, size: 19), title: Text('举报', style: style!.copyWith(color: errorColor)), ), - if (replyLevel == '1' && !isSubReply && ownerMid == upMid) + if (replyLevel == 1 && !isSubReply && ownerMid == upMid) ListTile( onTap: () => menuActionHandler('top'), minLeadingWidth: 0, diff --git a/lib/pages/video/reply_reply/view.dart b/lib/pages/video/reply_reply/view.dart index b4336ab2..bdf48756 100644 --- a/lib/pages/video/reply_reply/view.dart +++ b/lib/pages/video/reply_reply/view.dart @@ -178,7 +178,7 @@ class _VideoReplyReplyPanelState if (index == 0) { return ReplyItemGrpc( replyItem: firstFloor!, - replyLevel: '2', + replyLevel: 2, needDivider: false, onReply: () => _onReply(firstFloor!, -1), upMid: _videoReplyReplyController.upMid, @@ -384,8 +384,8 @@ class _VideoReplyReplyPanelState _videoReplyReplyController.onLoadMore(); return Container( alignment: Alignment.center, - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom), + margin: + EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom), height: 125, child: Text( _videoReplyReplyController.isEnd ? '没有更多了' : '加载中...', @@ -426,7 +426,7 @@ class _VideoReplyReplyPanelState Widget _replyItem(ReplyInfo replyItem, int index) { return ReplyItemGrpc( replyItem: replyItem, - replyLevel: widget.isDialogue ? '3' : '2', + replyLevel: widget.isDialogue ? 3 : 2, onReply: () => _onReply(replyItem, index), onDelete: (subIndex) { _videoReplyReplyController.onRemove(index, null); diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index e8c5958b..89ccf790 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -624,7 +624,7 @@ class _VideoDetailPageVState extends State ? height - (!isPortrait || removeSafeArea ? 0 - : MediaQuery.of(this.context).padding.top) + : MediaQuery.paddingOf(this.context).top) : videoDetailController.isExpanding || videoDetailController.isCollapsing ? animHeight diff --git a/lib/pages/video/widgets/app_bar.dart b/lib/pages/video/widgets/app_bar.dart index 4060fd93..07f17b4d 100644 --- a/lib/pages/video/widgets/app_bar.dart +++ b/lib/pages/video/widgets/app_bar.dart @@ -15,7 +15,7 @@ class ScrollAppBar extends StatelessWidget { @override Widget build(BuildContext context) { - final double statusBarHeight = MediaQuery.of(context).padding.top; + final double statusBarHeight = MediaQuery.paddingOf(context).top; final videoHeight = MediaQuery.sizeOf(context).width * 9 / 16; double scrollDistance = scrollVal; if (scrollVal > videoHeight - kToolbarHeight) { diff --git a/lib/pages/video/widgets/header_control.dart b/lib/pages/video/widgets/header_control.dart index c9f2ec75..4f96f481 100644 --- a/lib/pages/video/widgets/header_control.dart +++ b/lib/pages/video/widgets/header_control.dart @@ -1863,7 +1863,7 @@ class HeaderControlState extends State { onPressed: () { if (isFullScreen) { widget.controller.triggerFullScreen(status: false); - } else if (MediaQuery.of(context).orientation == + } else if (MediaQuery.orientationOf(context) == Orientation.landscape && !horizontalScreen) { verticalScreenForTwoSeconds(); @@ -1874,7 +1874,7 @@ class HeaderControlState extends State { ), ), if (!isFullScreen || - MediaQuery.of(context).orientation != Orientation.portrait) + MediaQuery.orientationOf(context) != Orientation.portrait) SizedBox( width: 42, height: 34, @@ -1895,7 +1895,7 @@ class HeaderControlState extends State { (isFullScreen || (!isFullScreen && !horizontalScreen && - MediaQuery.of(context).orientation == + MediaQuery.orientationOf(context) == Orientation.landscape))) Expanded( child: Column( @@ -1996,7 +1996,7 @@ class HeaderControlState extends State { Obx( () { if ((isFullScreen || !horizontalScreen) && - MediaQuery.of(context).orientation == + MediaQuery.orientationOf(context) == Orientation.landscape) { startClock(); return Text( diff --git a/lib/utils/extension.dart b/lib/utils/extension.dart index e576e58b..081f5bf8 100644 --- a/lib/utils/extension.dart +++ b/lib/utils/extension.dart @@ -19,14 +19,14 @@ extension ImageExtension on num? { if (this == null || this == 0) { return null; } - return (this! * MediaQuery.of(context).devicePixelRatio).round(); + return (this! * MediaQuery.devicePixelRatioOf(context)).round(); } } extension ScrollControllerExt on ScrollController { void animToTop() { if (!hasClients) return; - if (offset >= MediaQuery.of(Get.context!).size.height * 7) { + if (offset >= Get.mediaQuery.size.height * 7) { jumpTo(0); } else { animateTo(0,