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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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