opt: playall safeArea

This commit is contained in:
guozhigq
2024-10-20 15:08:15 +08:00
parent 7c4dd6027b
commit 9841633240
3 changed files with 21 additions and 15 deletions

View File

@ -21,6 +21,7 @@ class FavDetailController extends GetxController {
RxString loadingText = '加载中...'.obs; RxString loadingText = '加载中...'.obs;
RxInt mediaCount = 0.obs; RxInt mediaCount = 0.obs;
late String isOwner; late String isOwner;
late bool hasMore = true;
@override @override
void onInit() { void onInit() {
@ -35,7 +36,7 @@ class FavDetailController extends GetxController {
} }
Future<dynamic> queryUserFavFolderDetail({type = 'init'}) async { Future<dynamic> queryUserFavFolderDetail({type = 'init'}) async {
if (type == 'onLoad' && favList.length >= mediaCount.value) { if (type == 'onLoad' && !hasMore) {
loadingText.value = '没有更多了'; loadingText.value = '没有更多了';
return; return;
} }
@ -47,17 +48,18 @@ class FavDetailController extends GetxController {
); );
if (res['status']) { if (res['status']) {
favInfo.value = res['data'].info; favInfo.value = res['data'].info;
hasMore = res['data'].hasMore;
if (currentPage == 1 && type == 'init') { if (currentPage == 1 && type == 'init') {
favList.value = res['data'].medias; favList.value = res['data'].medias;
mediaCount.value = res['data'].info['media_count']; mediaCount.value = res['data'].info['media_count'];
} else if (type == 'onLoad') { } else if (type == 'onLoad') {
favList.addAll(res['data'].medias); favList.addAll(res['data'].medias);
} }
if (favList.length >= mediaCount.value) { if (!hasMore) {
loadingText.value = '没有更多了'; loadingText.value = '没有更多了';
} }
currentPage += 1;
} }
currentPage += 1;
isLoadingMore = false; isLoadingMore = false;
return res; return res;
} }

View File

@ -193,7 +193,9 @@ class _FavDetailPageState extends State<FavDetailPage> {
padding: const EdgeInsets.only(top: 15, bottom: 8, left: 14), padding: const EdgeInsets.only(top: 15, bottom: 8, left: 14),
child: Obx( child: Obx(
() => Text( () => Text(
'${_favDetailController.mediaCount}条视频', _favDetailController.mediaCount > 0
? '${_favDetailController.mediaCount}条视频'
: '',
style: TextStyle( style: TextStyle(
fontSize: fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize, Theme.of(context).textTheme.labelMedium!.fontSize,
@ -215,7 +217,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
List favList = _favDetailController.favList; List favList = _favDetailController.favList;
return Obx( return Obx(
() => favList.isEmpty () => favList.isEmpty
? const SliverToBoxAdapter(child: SizedBox()) ? const NoData()
: SliverList( : SliverList(
delegate: delegate:
SliverChildBuilderDelegate((context, index) { SliverChildBuilderDelegate((context, index) {
@ -247,18 +249,20 @@ class _FavDetailPageState extends State<FavDetailPage> {
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: Container( child: Container(
height: MediaQuery.of(context).padding.bottom + 60, height: MediaQuery.of(context).padding.bottom + 90,
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom), bottom: MediaQuery.of(context).padding.bottom),
child: Center( child: Center(
child: Obx( child: Obx(() {
() => Text( final mediaCount = _favDetailController.mediaCount;
_favDetailController.loadingText.value, final loadingText = _favDetailController.loadingText.value;
style: TextStyle( final textColor = Theme.of(context).colorScheme.outline;
color: Theme.of(context).colorScheme.outline,
fontSize: 13), return Text(
), mediaCount > 0 ? loadingText : '',
), style: TextStyle(color: textColor, fontSize: 13),
);
}),
), ),
), ),
) )

View File

@ -129,7 +129,7 @@ class _LaterPageState extends State<LaterPage> {
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: SizedBox( child: SizedBox(
height: MediaQuery.of(context).padding.bottom + 10, height: MediaQuery.of(context).padding.bottom + 80,
), ),
) )
], ],