mod: 无评论时状态处理

This commit is contained in:
guozhigq
2023-08-03 15:31:03 +08:00
parent 87ddd8a343
commit 8e6950eb8e
7 changed files with 60 additions and 54 deletions

View File

@ -8,59 +8,52 @@ class VideoCardVSkeleton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Skeleton(
child: Card(
elevation: 0.8,
shape: RoundedRectangleBorder(
borderRadius: StyleString.mdRadius,
),
margin: EdgeInsets.zero,
child: Column(
children: [
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (context, boxConstraints) {
return Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
),
);
},
),
child: Column(
children: [
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (context, boxConstraints) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface,
borderRadius:
BorderRadius.circular(StyleString.imgRadius.x)),
);
},
),
Padding(
// 多列
padding: const EdgeInsets.fromLTRB(8, 8, 6, 7),
// 单列
// padding: const EdgeInsets.fromLTRB(14, 10, 4, 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
// const SizedBox(height: 6),
Container(
width: 200,
height: 13,
margin: const EdgeInsets.only(bottom: 5),
color: Theme.of(context).colorScheme.background,
),
Container(
width: 150,
height: 13,
margin: const EdgeInsets.only(bottom: 12),
color: Theme.of(context).colorScheme.background,
),
Container(
width: 80,
height: 12,
color: Theme.of(context).colorScheme.background,
),
],
),
),
Padding(
// 多列
padding: const EdgeInsets.fromLTRB(4, 5, 6, 6),
// 单列
// padding: const EdgeInsets.fromLTRB(14, 10, 4, 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// const SizedBox(height: 6),
Container(
width: 200,
height: 13,
margin: const EdgeInsets.only(bottom: 5),
color: Theme.of(context).colorScheme.onInverseSurface,
),
Container(
width: 150,
height: 13,
margin: const EdgeInsets.only(bottom: 12),
color: Theme.of(context).colorScheme.onInverseSurface,
),
Container(
width: 80,
height: 12,
color: Theme.of(context).colorScheme.onInverseSurface,
),
],
),
],
),
),
],
),
);
}

View File

@ -60,7 +60,7 @@ class NetworkImgLayer extends StatelessWidget {
Widget placeholder(context) {
return Container(
color: Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.6),
color: Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.4),
width: width ?? double.infinity,
height: height ?? double.infinity,
child: Center(

View File

@ -7,6 +7,7 @@ class ReplyHttp {
required int oid,
required int pageNum,
required int type,
int? ps,
int sort = 1,
}) async {
var res = await Request().get(Api.replyList, data: {
@ -14,6 +15,7 @@ class ReplyHttp {
'pn': pageNum,
'type': type,
'sort': sort,
'ps': ps ?? 20
});
if (res.data['code'] == 0) {
return {

View File

@ -117,6 +117,7 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
),
),
child: PageView(
physics: const NeverScrollableScrollPhysics(),
controller: _pageController,
onPageChanged: (index) {
selectedIndex = index;

View File

@ -72,6 +72,7 @@ class SSearchController extends GetxController {
// 手动刷新
historyList.refresh();
histiryWord.put('cacheList', historyCacheList);
searchFocusNode.unfocus();
Get.toNamed('/searchResult', parameters: {'keyword': searchKeyWord.value});
}

View File

@ -24,6 +24,7 @@ class VideoReplyController extends GetxController {
int currentPage = 0;
bool isLoadingMore = false;
RxString noMore = ''.obs;
int ps = 20;
// 当前回复的回复
ReplyItemModel? currentReplyItem;
@ -36,14 +37,21 @@ class VideoReplyController extends GetxController {
var res = await ReplyHttp.replyList(
oid: aid!,
pageNum: currentPage + 1,
ps: ps,
type: ReplyType.video.index,
sort: sortType.index,
);
if (res['status']) {
List<ReplyItemModel> replies = res['data'].replies;
if (replies.isNotEmpty) {
currentPage++;
noMore.value = '加载中...';
/// 第一页回复数小于20
if (currentPage == 0 && replies.length < 20) {
noMore.value = '没有更多了';
}
currentPage++;
if (replyList.length == res['data'].page.acount) {
noMore.value = '没有更多了';
}

View File

@ -189,7 +189,8 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
if (data['status']) {
// 请求成功
return Obx(
() => _videoReplyController.replyList.isEmpty
() => _videoReplyController.isLoadingMore &&
_videoReplyController.replyList.isEmpty
? SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {