diff --git a/lib/common/constants.dart b/lib/common/constants.dart index 79745e3e..81712295 100644 --- a/lib/common/constants.dart +++ b/lib/common/constants.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; class StyleString { static const double cardSpace = 8; static const double safeSpace = 12; - static BorderRadius mdRadius = BorderRadius.circular(10); + static const BorderRadius mdRadius = BorderRadius.all(Radius.circular(10)); static const Radius imgRadius = Radius.circular(10); static const double aspectRatio = 16 / 10; } diff --git a/lib/common/skeleton/skeleton.dart b/lib/common/skeleton/skeleton.dart index b17a55fc..b208bf70 100644 --- a/lib/common/skeleton/skeleton.dart +++ b/lib/common/skeleton/skeleton.dart @@ -99,7 +99,7 @@ class ShimmerState extends State with SingleTickerProviderStateMixin { @override Widget build(BuildContext context) { - return widget.child ?? const SizedBox(); + return widget.child ?? const SizedBox.shrink(); } } @@ -165,7 +165,7 @@ class _ShimmerLoadingState extends State { final shimmer = Shimmer.of(context)!; if (!shimmer.isSized) { - return const SizedBox(); + return const SizedBox.shrink(); } final shimmerSize = shimmer.size; final gradient = shimmer.gradient; diff --git a/lib/common/widgets/http_error.dart b/lib/common/widgets/http_error.dart index 47bb733d..d369f00f 100644 --- a/lib/common/widgets/http_error.dart +++ b/lib/common/widgets/http_error.dart @@ -37,11 +37,12 @@ class HttpError extends StatelessWidget { ), const SizedBox(height: 30), Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 5), child: SelectableText( errMsg ?? '没有数据', textAlign: TextAlign.center, style: Theme.of(context).textTheme.titleSmall, + scrollPhysics: const NeverScrollableScrollPhysics(), ), ), if (onReload != null) diff --git a/lib/common/widgets/network_img_layer.dart b/lib/common/widgets/network_img_layer.dart index 8dbb861b..a503bed7 100644 --- a/lib/common/widgets/network_img_layer.dart +++ b/lib/common/widgets/network_img_layer.dart @@ -97,7 +97,7 @@ class NetworkImgLayer extends StatelessWidget { ), ), child: type == 'bg' - ? const SizedBox() + ? const SizedBox.shrink() : Center( child: Image.asset( type == 'avatar' diff --git a/lib/common/widgets/self_sized_horizontal_list.dart b/lib/common/widgets/self_sized_horizontal_list.dart index 19a94efb..7634620e 100644 --- a/lib/common/widgets/self_sized_horizontal_list.dart +++ b/lib/common/widgets/self_sized_horizontal_list.dart @@ -38,7 +38,7 @@ class _SelfSizedHorizontalListState extends State { if (height == null) { WidgetsBinding.instance.addPostFrameCallback((v) => setState(() {})); } - if (widget.itemCount == 0) return const SizedBox(); + if (widget.itemCount == 0) return const SizedBox.shrink(); if (isInit) { return Container( key: infoKey, diff --git a/lib/pages/dynamics/detail/view.dart b/lib/pages/dynamics/detail/view.dart index 54035b5a..5cdabbf8 100644 --- a/lib/pages/dynamics/detail/view.dart +++ b/lib/pages/dynamics/detail/view.dart @@ -780,69 +780,65 @@ class _DynamicDetailPageState extends State Widget replyList(LoadingState?> loadingState) { return switch (loadingState) { - Loading() => SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - return const VideoReplySkeleton(); - }, - childCount: 8, - ), + Loading() => SliverList.builder( + itemBuilder: (context, index) { + return const VideoReplySkeleton(); + }, + itemCount: 8, ), Success() => loadingState.response?.isNotEmpty == true - ? SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - if (index == loadingState.response!.length) { - _dynamicDetailController.onLoadMore(); - return Container( - alignment: Alignment.center, - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom), - height: 125, - child: Text( - _dynamicDetailController.isEnd.not - ? '加载中...' - : loadingState.response!.isEmpty - ? '还没有评论' - : '没有更多了', - style: TextStyle( - fontSize: 12, - color: Theme.of(context).colorScheme.outline, - ), + ? SliverList.builder( + itemBuilder: (context, index) { + if (index == loadingState.response!.length) { + _dynamicDetailController.onLoadMore(); + return Container( + alignment: Alignment.center, + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom), + height: 125, + child: Text( + _dynamicDetailController.isEnd.not + ? '加载中...' + : loadingState.response!.isEmpty + ? '还没有评论' + : '没有更多了', + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.outline, ), - ); - } else { - return ReplyItemGrpc( - replyItem: loadingState.response![index], - replyLevel: '1', - replyReply: (replyItem, id) => - replyReply(context, replyItem, id), - onReply: () { - _dynamicDetailController.onReply( - context, - replyItem: loadingState.response![index], - index: index, - ); - }, - onDelete: (subIndex) => - _dynamicDetailController.onRemove(index, subIndex), - upMid: _dynamicDetailController.upMid, - callback: _getImageCallback, - onCheckReply: (item) => - _dynamicDetailController.onCheckReply(context, item), - onToggleTop: (isUpTop, rpid) => - _dynamicDetailController.onToggleTop( - index, - _dynamicDetailController.oid, - _dynamicDetailController.type, - isUpTop, - rpid, - ), - ); - } - }, - childCount: loadingState.response!.length + 1, - ), + ), + ); + } else { + return ReplyItemGrpc( + replyItem: loadingState.response![index], + replyLevel: '1', + replyReply: (replyItem, id) => + replyReply(context, replyItem, id), + onReply: () { + _dynamicDetailController.onReply( + context, + replyItem: loadingState.response![index], + index: index, + ); + }, + onDelete: (subIndex) => + _dynamicDetailController.onRemove(index, subIndex), + upMid: _dynamicDetailController.upMid, + callback: _getImageCallback, + onCheckReply: (item) => + _dynamicDetailController.onCheckReply(context, item), + onToggleTop: (isUpTop, rpid) => + _dynamicDetailController.onToggleTop( + index, + _dynamicDetailController.oid, + _dynamicDetailController.type, + isUpTop, + rpid, + ), + ); + } + }, + itemCount: loadingState.response!.length + 1, ) : HttpError( onReload: _dynamicDetailController.onReload, diff --git a/lib/pages/dynamics/tab/view.dart b/lib/pages/dynamics/tab/view.dart index 563f85b3..8a39d53d 100644 --- a/lib/pages/dynamics/tab/view.dart +++ b/lib/pages/dynamics/tab/view.dart @@ -103,13 +103,11 @@ class _DynamicsTabPageState const SliverFillRemaining(), SliverConstrainedCrossAxis( maxExtent: Grid.smallCardWidth * 2, - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - return const DynamicCardSkeleton(); - }, - childCount: 10, - ), + sliver: SliverList.builder( + itemBuilder: (context, index) { + return const DynamicCardSkeleton(); + }, + itemCount: 10, ), ), const SliverFillRemaining() @@ -177,28 +175,25 @@ class _DynamicsTabPageState const SliverFillRemaining(), SliverConstrainedCrossAxis( maxExtent: Grid.smallCardWidth * 2, - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - if (index == - loadingState.response!.length - 1) { - controller.onLoadMore(); - } - final item = loadingState.response![index]; - if ((dynamicsController.tabController.index == - 4 && - dynamicsController.mid.value != -1) || - !dynamicsController.tempBannedList.contains( - item.modules?.moduleAuthor?.mid)) { - return DynamicPanel( - item: item, - onRemove: controller.onRemove, - ); - } - return const SizedBox.shrink(); - }, - childCount: loadingState.response!.length, - ), + sliver: SliverList.builder( + itemBuilder: (context, index) { + if (index == loadingState.response!.length - 1) { + controller.onLoadMore(); + } + final item = loadingState.response![index]; + if ((dynamicsController.tabController.index == + 4 && + dynamicsController.mid.value != -1) || + !dynamicsController.tempBannedList.contains( + item.modules?.moduleAuthor?.mid)) { + return DynamicPanel( + item: item, + onRemove: controller.onRemove, + ); + } + return const SizedBox.shrink(); + }, + itemCount: loadingState.response!.length, ), ), const SliverFillRemaining(), diff --git a/lib/pages/dynamics/widgets/additional_panel.dart b/lib/pages/dynamics/widgets/additional_panel.dart index 4a6d9d8c..6e0ee4d4 100644 --- a/lib/pages/dynamics/widgets/additional_panel.dart +++ b/lib/pages/dynamics/widgets/additional_panel.dart @@ -134,17 +134,17 @@ Widget addWidget(item, context, type, {floor = 1}) { ), ), ) - : const SizedBox() - : const SizedBox(); + : const SizedBox.shrink() + : const SizedBox.shrink(); case 'ADDITIONAL_TYPE_GOODS': // 商品 - return const SizedBox(); + return const SizedBox.shrink(); case 'ADDITIONAL_TYPE_MATCH': - return const SizedBox(); + return const SizedBox.shrink(); case 'ADDITIONAL_TYPE_COMMON': - return const SizedBox(); + return const SizedBox.shrink(); case 'ADDITIONAL_TYPE_VOTE': - return const SizedBox(); + return const SizedBox.shrink(); default: return const Text('11'); } diff --git a/lib/pages/dynamics/widgets/pic_panel.dart b/lib/pages/dynamics/widgets/pic_panel.dart index cc3892f7..eda77a37 100644 --- a/lib/pages/dynamics/widgets/pic_panel.dart +++ b/lib/pages/dynamics/widgets/pic_panel.dart @@ -6,7 +6,7 @@ Widget picWidget(item, context, callback) { item.modules.moduleDynamic.major.type == 'MAJOR_TYPE_OPUS') { /// fix 图片跟rich_node_panel重复 // pictures = item.modules.moduleDynamic.major.opus.pics; - return const SizedBox(); + return const SizedBox.shrink(); } return LayoutBuilder( builder: (context, constraints) => imageView( diff --git a/lib/pages/dynamics/widgets/up_panel.dart b/lib/pages/dynamics/widgets/up_panel.dart index 41b11396..e7c04784 100644 --- a/lib/pages/dynamics/widgets/up_panel.dart +++ b/lib/pages/dynamics/widgets/up_panel.dart @@ -70,36 +70,37 @@ class _UpPanelState extends State { ), ), const SliverToBoxAdapter(child: SizedBox(height: 10)), - SliverList( - delegate: SliverChildListDelegate( - [ - if (widget.dynamicsController.showLiveItems && - liveList.isNotEmpty) ...[ - for (int i = 0; i < liveList.length; i++) ...[ - upItemBuild(liveList[i], i) - ], - ], - upItemBuild(UpItem(face: '', uname: '全部动态', mid: -1), 0), - upItemBuild( - UpItem( - uname: '我', - face: widget.dynamicsController.face, - mid: widget.dynamicsController.ownerMid, - ), - 1, - ), - for (int i = 0; i < upList.length; i++) ...[ - upItemBuild(upList[i], i + 2) - ], - ], + if (widget.dynamicsController.showLiveItems && liveList.isNotEmpty) + SliverList.builder( + itemCount: liveList.length, + itemBuilder: (context, index) { + return upItemBuild(liveList[index]); + }, ), + SliverToBoxAdapter( + child: upItemBuild(UpItem(face: '', uname: '全部动态', mid: -1)), + ), + SliverToBoxAdapter( + child: upItemBuild( + UpItem( + uname: '我', + face: widget.dynamicsController.face, + mid: widget.dynamicsController.ownerMid, + ), + ), + ), + SliverList.builder( + itemCount: upList.length, + itemBuilder: (context, index) { + return upItemBuild(upList[index]); + }, ), const SliverToBoxAdapter(child: SizedBox(height: 200)), ], ); } - Widget upItemBuild(data, i) { + Widget upItemBuild(data) { bool isCurrent = widget.dynamicsController.currentMid == data.mid || widget.dynamicsController.currentMid == -1; return SizedBox( diff --git a/lib/pages/fav/video/fav_folder_sort_page.dart b/lib/pages/fav/video/fav_folder_sort_page.dart index 09967327..d7239141 100644 --- a/lib/pages/fav/video/fav_folder_sort_page.dart +++ b/lib/pages/fav/video/fav_folder_sort_page.dart @@ -112,7 +112,7 @@ class _FavFolderSortPageState extends State { } Widget get _buildBody { - return ReorderableListView( + return ReorderableListView.builder( key: _key, scrollController: _scrollController, onReorder: onReorder, @@ -120,26 +120,24 @@ class _FavFolderSortPageState extends State { footer: SizedBox( height: MediaQuery.of(context).padding.bottom + 80, ), - children: List.generate( - sortList.length, - (index) { - final item = sortList[index]; - final key = item.id.toString(); - return SizedBox( - key: Key(key), - height: 98, - child: FavItem( - heroTag: key, - favFolderItem: item, - onLongPress: index == 0 - ? () { - SmartDialog.showToast('默认收藏夹不支持排序'); - } - : null, - ), - ); - }, - ), + itemCount: sortList.length, + itemBuilder: (context, index) { + final item = sortList[index]; + final key = item.id.toString(); + return SizedBox( + key: Key(key), + height: 98, + child: FavItem( + heroTag: key, + favFolderItem: item, + onLongPress: index == 0 + ? () { + SmartDialog.showToast('默认收藏夹不支持排序'); + } + : null, + ), + ); + }, ); } } diff --git a/lib/pages/fav_detail/fav_sort_page.dart b/lib/pages/fav_detail/fav_sort_page.dart index 9709a8f8..1dd76c00 100644 --- a/lib/pages/fav_detail/fav_sort_page.dart +++ b/lib/pages/fav_detail/fav_sort_page.dart @@ -119,7 +119,7 @@ class _FavSortPageState extends State { } Widget get _buildBody { - return ReorderableListView( + return ReorderableListView.builder( key: _key, scrollController: _scrollController, onReorder: onReorder, @@ -127,18 +127,18 @@ class _FavSortPageState extends State { footer: SizedBox( height: MediaQuery.of(context).padding.bottom + 80, ), - children: sortList - .map( - (item) => SizedBox( - key: Key(item.id.toString()), - height: 98, - child: FavVideoCardH( - isSort: true, - videoItem: item, - ), - ), - ) - .toList(), + itemCount: sortList.length, + itemBuilder: (context, index) { + final item = sortList[index]; + return SizedBox( + key: Key(item.id.toString()), + height: 98, + child: FavVideoCardH( + isSort: true, + videoItem: item, + ), + ); + }, ); } } diff --git a/lib/pages/later/view.dart b/lib/pages/later/view.dart index 4ee1c4c2..b8725dd7 100644 --- a/lib/pages/later/view.dart +++ b/lib/pages/later/view.dart @@ -84,7 +84,7 @@ class _LaterPageState extends State label: const Text('播放全部'), icon: const Icon(Icons.playlist_play), ) - : const SizedBox(), + : const SizedBox.shrink(), ), body: SafeArea( top: false, diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 8da5ae36..9e12d727 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -370,7 +370,7 @@ class _LiveRoomPageState extends State future: _futureBuilder, builder: (context, snapshot) { if (snapshot.data == null) { - return const SizedBox(); + return const SizedBox.shrink(); } Map data = snapshot.data as Map; if (data['status']) { @@ -449,7 +449,7 @@ class _LiveRoomPageState extends State ), ); } else { - return const SizedBox(); + return const SizedBox.shrink(); } }, ), diff --git a/lib/pages/member_dynamics/view.dart b/lib/pages/member_dynamics/view.dart index 5b9099f9..d99c683d 100644 --- a/lib/pages/member_dynamics/view.dart +++ b/lib/pages/member_dynamics/view.dart @@ -75,13 +75,11 @@ class _MemberDynamicsPageState extends State const SliverFillRemaining(), SliverConstrainedCrossAxis( maxExtent: Grid.smallCardWidth * 2, - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - return const DynamicCardSkeleton(); - }, - childCount: 10, - ), + sliver: SliverList.builder( + itemBuilder: (context, index) { + return const DynamicCardSkeleton(); + }, + itemCount: 10, ), ), const SliverFillRemaining() @@ -137,21 +135,18 @@ class _MemberDynamicsPageState extends State const SliverFillRemaining(), SliverConstrainedCrossAxis( maxExtent: Grid.smallCardWidth * 2, - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - if (index == - loadingState.response!.length - 1) { - _memberDynamicController.onLoadMore(); - } - return DynamicPanel( - item: loadingState.response![index], - onRemove: _memberDynamicController.onRemove, - onSetTop: _memberDynamicController.onSetTop, - ); - }, - childCount: loadingState.response!.length, - ), + sliver: SliverList.builder( + itemBuilder: (context, index) { + if (index == loadingState.response!.length - 1) { + _memberDynamicController.onLoadMore(); + } + return DynamicPanel( + item: loadingState.response![index], + onRemove: _memberDynamicController.onRemove, + onSetTop: _memberDynamicController.onSetTop, + ); + }, + itemCount: loadingState.response!.length, ), ), const SliverFillRemaining(), diff --git a/lib/pages/member_search/search_dynamic.dart b/lib/pages/member_search/search_dynamic.dart index 71ea3759..d692b8f3 100644 --- a/lib/pages/member_search/search_dynamic.dart +++ b/lib/pages/member_search/search_dynamic.dart @@ -59,13 +59,11 @@ class _SearchDynamicState extends State const SliverFillRemaining(), SliverConstrainedCrossAxis( maxExtent: Grid.smallCardWidth * 2, - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - return const DynamicCardSkeleton(); - }, - childCount: 10, - ), + sliver: SliverList.builder( + itemBuilder: (context, index) { + return const DynamicCardSkeleton(); + }, + itemCount: 10, ), ), const SliverFillRemaining() @@ -120,21 +118,19 @@ class _SearchDynamicState extends State const SliverFillRemaining(), SliverConstrainedCrossAxis( maxExtent: Grid.smallCardWidth * 2, - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - if (index == loadingState.response!.length - 1) { - EasyThrottle.throttle('member_dynamics', - const Duration(milliseconds: 1000), () { - widget.ctr.searchDynamic(false); - }); - } - return DynamicPanel( - item: loadingState.response![index], - ); - }, - childCount: loadingState.response!.length, - ), + sliver: SliverList.builder( + itemBuilder: (context, index) { + if (index == loadingState.response!.length - 1) { + EasyThrottle.throttle('member_dynamics', + const Duration(milliseconds: 1000), () { + widget.ctr.searchDynamic(false); + }); + } + return DynamicPanel( + item: loadingState.response![index], + ); + }, + itemCount: loadingState.response!.length, ), ), const SliverFillRemaining(), diff --git a/lib/pages/setting/navigation_bar_set.dart b/lib/pages/setting/navigation_bar_set.dart index 1dcc9be6..7824a54f 100644 --- a/lib/pages/setting/navigation_bar_set.dart +++ b/lib/pages/setting/navigation_bar_set.dart @@ -71,7 +71,6 @@ class _NavigationbarSetPageState extends State { ), body: ReorderableListView( onReorder: onReorder, - physics: const NeverScrollableScrollPhysics(), footer: SizedBox( height: MediaQuery.of(context).padding.bottom + 30, ), diff --git a/lib/pages/setting/pages/home_tabbar_set.dart b/lib/pages/setting/pages/home_tabbar_set.dart index 1a148ffe..7b7e8253 100644 --- a/lib/pages/setting/pages/home_tabbar_set.dart +++ b/lib/pages/setting/pages/home_tabbar_set.dart @@ -83,7 +83,6 @@ class _TabbarSetPageState extends State { ), body: ReorderableListView( onReorder: onReorder, - physics: const NeverScrollableScrollPhysics(), footer: SizedBox( height: MediaQuery.of(context).padding.bottom + 30, child: const Align( diff --git a/lib/pages/video/detail/introduction/widgets/season.dart b/lib/pages/video/detail/introduction/widgets/season.dart index e1519773..e0b2a51b 100644 --- a/lib/pages/video/detail/introduction/widgets/season.dart +++ b/lib/pages/video/detail/introduction/widgets/season.dart @@ -86,7 +86,7 @@ class _SeasonPanelState extends State { @override Widget build(BuildContext context) { if (episodes.isEmpty) { - return const SizedBox(); + return const SizedBox.shrink(); } return Builder(builder: (BuildContext context) { return Container( diff --git a/lib/pages/video/detail/note/note_list_page.dart b/lib/pages/video/detail/note/note_list_page.dart index dfd8b893..b869944a 100644 --- a/lib/pages/video/detail/note/note_list_page.dart +++ b/lib/pages/video/detail/note/note_list_page.dart @@ -135,13 +135,11 @@ class _NoteListPageState extends CommonSlidePageState { Loading() => CustomScrollView( physics: const NeverScrollableScrollPhysics(), slivers: [ - SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return const VideoReplySkeleton(); - }, - childCount: 8, - ), + SliverList.builder( + itemBuilder: (context, index) { + return const VideoReplySkeleton(); + }, + itemCount: 8, ) ], ), diff --git a/lib/pages/video/detail/reply/view.dart b/lib/pages/video/detail/reply/view.dart index efe684da..e353fff1 100644 --- a/lib/pages/video/detail/reply/view.dart +++ b/lib/pages/video/detail/reply/view.dart @@ -196,71 +196,67 @@ class _VideoReplyPanelState extends State Widget _buildBody(LoadingState loadingState) { return switch (loadingState) { - Loading() => SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, index) { - return const VideoReplySkeleton(); - }, - childCount: 5, - ), + Loading() => SliverList.builder( + itemBuilder: (BuildContext context, index) { + return const VideoReplySkeleton(); + }, + itemCount: 5, ), Success() => loadingState.response?.isNotEmpty == true - ? SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, index) { - double bottom = MediaQuery.of(context).padding.bottom; - if (index == loadingState.response.length) { - _videoReplyController.onLoadMore(); - return Container( - alignment: Alignment.center, - padding: EdgeInsets.only(bottom: bottom), - height: bottom + 100, - child: Text( - _videoReplyController.isEnd.not - ? '加载中...' - : loadingState.response.isEmpty - ? '还没有评论' - : '没有更多了', - style: TextStyle( - fontSize: 12, - color: Theme.of(context).colorScheme.outline, - ), + ? SliverList.builder( + itemBuilder: (context, index) { + double bottom = MediaQuery.of(context).padding.bottom; + if (index == loadingState.response.length) { + _videoReplyController.onLoadMore(); + return Container( + alignment: Alignment.center, + padding: EdgeInsets.only(bottom: bottom), + height: bottom + 100, + child: Text( + _videoReplyController.isEnd.not + ? '加载中...' + : loadingState.response.isEmpty + ? '还没有评论' + : '没有更多了', + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.outline, ), - ); - } else { - return ReplyItemGrpc( - replyItem: loadingState.response[index], - replyLevel: widget.replyLevel, - replyReply: widget.replyReply, - onReply: () { - _videoReplyController.onReply( - context, - replyItem: loadingState.response[index], - index: index, - ); - }, - onDelete: (subIndex) => - _videoReplyController.onRemove(index, subIndex), - upMid: _videoReplyController.upMid, - getTag: () => heroTag, - onViewImage: widget.onViewImage, - onDismissed: widget.onDismissed, - callback: widget.callback, - onCheckReply: (item) => - _videoReplyController.onCheckReply(context, item), - onToggleTop: (isUpTop, rpid) => - _videoReplyController.onToggleTop( - index, - _videoReplyController.aid, - ReplyType.video.index, - isUpTop, - rpid, - ), - ); - } - }, - childCount: loadingState.response.length + 1, - ), + ), + ); + } else { + return ReplyItemGrpc( + replyItem: loadingState.response[index], + replyLevel: widget.replyLevel, + replyReply: widget.replyReply, + onReply: () { + _videoReplyController.onReply( + context, + replyItem: loadingState.response[index], + index: index, + ); + }, + onDelete: (subIndex) => + _videoReplyController.onRemove(index, subIndex), + upMid: _videoReplyController.upMid, + getTag: () => heroTag, + onViewImage: widget.onViewImage, + onDismissed: widget.onDismissed, + callback: widget.callback, + onCheckReply: (item) => + _videoReplyController.onCheckReply(context, item), + onToggleTop: (isUpTop, rpid) => + _videoReplyController.onToggleTop( + index, + _videoReplyController.aid, + ReplyType.video.index, + isUpTop, + rpid, + ), + ); + } + }, + itemCount: loadingState.response.length + 1, ) : HttpError( errMsg: '还没有评论', diff --git a/lib/pages/video/detail/reply_reply/view.dart b/lib/pages/video/detail/reply_reply/view.dart index 6dcb727e..88ca0c68 100644 --- a/lib/pages/video/detail/reply_reply/view.dart +++ b/lib/pages/video/detail/reply_reply/view.dart @@ -391,13 +391,11 @@ class _VideoReplyReplyPanelState shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), slivers: [ - SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return const VideoReplySkeleton(); - }, - childCount: 8, - ), + SliverList.builder( + itemBuilder: (context, index) { + return const VideoReplySkeleton(); + }, + itemCount: 8, ) ], ), diff --git a/lib/pages/video/detail/view_v.dart b/lib/pages/video/detail/view_v.dart index 2e9c96f3..645eb130 100644 --- a/lib/pages/video/detail/view_v.dart +++ b/lib/pages/video/detail/view_v.dart @@ -1226,7 +1226,7 @@ class _VideoDetailPageVState extends State Widget get childWhenEnabled => Obx( () => !videoDetailController.autoPlay.value - ? const SizedBox() + ? const SizedBox.shrink() : PLVideoPlayer( key: Key(heroTag), plPlayerController: plPlayerController!, diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index 1b49f919..526ac6d9 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -782,7 +782,7 @@ class HeaderControlState extends State { Icons.done, color: Theme.of(context).colorScheme.primary, ) - : const SizedBox(), + : const SizedBox.shrink(), ), ] ], @@ -858,7 +858,7 @@ class HeaderControlState extends State { Icons.done, color: Theme.of(context).colorScheme.primary, ) - : const SizedBox(), + : const SizedBox.shrink(), ), ] ], @@ -1832,7 +1832,7 @@ class HeaderControlState extends State { Icons.done, color: Theme.of(context).colorScheme.primary, ) - : const SizedBox(), + : const SizedBox.shrink(), ) ], ], @@ -2014,7 +2014,7 @@ class HeaderControlState extends State { } clock?.cancel(); clock = null; - return SizedBox.shrink(); + return const SizedBox.shrink(); }, ), if (videoDetailCtr.enableSponsorBlock == true) diff --git a/lib/pages/whisper_detail/view.dart b/lib/pages/whisper_detail/view.dart index 4adc87fd..4cd53a8c 100644 --- a/lib/pages/whisper_detail/view.dart +++ b/lib/pages/whisper_detail/view.dart @@ -130,7 +130,9 @@ class _WhisperDetailPageState reverse: true, itemCount: loadingState.response!.length, padding: const EdgeInsets.only(bottom: 12), - physics: const AlwaysScrollableScrollPhysics(), + physics: const AlwaysScrollableScrollPhysics( + parent: ClampingScrollPhysics(), + ), controller: _whisperDetailController.scrollController, itemBuilder: (context, int index) { if (index == loadingState.response!.length - 1) { diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index 9c0682da..8d9b2846 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -458,7 +458,7 @@ class ChatItem extends StatelessWidget { return isSystem ? messageContent(context) : isRevoke - ? const SizedBox() + ? const SizedBox.shrink() : GestureDetector( onLongPress: () { Feedback.forLongPress(context); diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 07459e05..3c2f878f 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -1270,24 +1270,6 @@ class _PLVideoPlayerState extends State ), ), - // Obx(() { - // if (_.buffered.value == Duration.zero) { - // return Positioned.fill( - // child: Container( - // color: Colors.black, - // child: Center( - // child: Image.asset( - // 'assets/images/loading.gif', - // height: 25, - // ), - // ), - // ), - // ); - // } else { - // return Container(); - // } - // }), - // 头部、底部控制条 Obx( () => Positioned.fill(