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

View File

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

View File

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