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