This commit is contained in:
guozhigq
2023-07-26 22:04:56 +08:00
parent 5b46123f3f
commit ca12be5373
19 changed files with 311 additions and 215 deletions

BIN
assets/images/noface.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -11,7 +11,7 @@ class CustomToast extends StatelessWidget {
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 20), EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 20),
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 10), padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primaryContainer.withOpacity(0.8), color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),
child: Text(msg, child: Text(msg,

View File

@ -63,7 +63,9 @@ class NetworkImgLayer extends StatelessWidget {
height: height ?? double.infinity, height: height ?? double.infinity,
child: Center( child: Center(
child: Image.asset( child: Image.asset(
'assets/images/loading.png', type == 'avatar'
? 'assets/images/noface.jpeg'
: 'assets/images/loading.png',
width: 300, width: 300,
height: 300, height: 300,
)), )),

View File

@ -54,7 +54,7 @@ class ReplyHttp {
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return { return {
'status': true, 'status': true,
'data': res.data['data'], 'data': ReplyData.fromJson(res.data['data']),
}; };
} else { } else {
Map errMap = { Map errMap = {

View File

@ -2,6 +2,7 @@ import 'package:get/get.dart';
import 'package:pilipala/http/reply.dart'; import 'package:pilipala/http/reply.dart';
import 'package:pilipala/models/common/reply_sort_type.dart'; import 'package:pilipala/models/common/reply_sort_type.dart';
import 'package:pilipala/models/video/reply/item.dart'; import 'package:pilipala/models/video/reply/item.dart';
import 'package:pilipala/utils/feed_back.dart';
class DynamicDetailController extends GetxController { class DynamicDetailController extends GetxController {
DynamicDetailController(this.oid, this.type); DynamicDetailController(this.oid, this.type);
@ -41,32 +42,23 @@ class DynamicDetailController extends GetxController {
sort: sortType.index, sort: sortType.index,
); );
if (res['status']) { if (res['status']) {
List<ReplyItemModel> replies = res['data'].replies;
acount.value = res['data'].page.acount; acount.value = res['data'].page.acount;
if (res['data'].replies.isNotEmpty) { if (replies.isNotEmpty) {
currentPage = currentPage + 1; currentPage++;
noMore.value = '加载中...'; noMore.value = '加载中...';
if (res['data'].replies.isEmpty) { if (replies.length < 20) {
noMore.value = '没有更多了'; noMore.value = '没有更多了';
return;
} }
} else { } else {
if (currentPage == 0) { noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
noMore.value = '还没有评论';
} else {
noMore.value = '没有更多了';
return;
}
} }
List<ReplyItemModel> replies = res['data'].replies;
if (reqType == 'init') { if (reqType == 'init') {
// 添加置顶回复 // 添加置顶回复
if (res['data'].upper.top != null) { if (res['data'].upper.top != null) {
bool flag = false; bool flag = res['data']
for (var i = 0; i < res['data'].topReplies.length; i++) { .topReplies
if (res['data'].topReplies[i].rpid == res['data'].upper.top.rpid) { .any((reply) => reply.rpid == res['data'].upper.top.rpid);
flag = true;
}
}
if (!flag) { if (!flag) {
replies.insert(0, res['data'].upper.top); replies.insert(0, res['data'].upper.top);
} }
@ -76,9 +68,6 @@ class DynamicDetailController extends GetxController {
} else { } else {
replyList.addAll(replies); replyList.addAll(replies);
} }
if (replyList.length == acount.value) {
noMore.value = '没有更多了';
}
} }
isLoadingMore = false; isLoadingMore = false;
return res; return res;
@ -86,6 +75,7 @@ class DynamicDetailController extends GetxController {
// 排序搜索评论 // 排序搜索评论
queryBySort() { queryBySort() {
feedBack();
switch (sortType) { switch (sortType) {
case ReplySortType.time: case ReplySortType.time:
sortType = ReplySortType.like; sortType = ReplySortType.like;

View File

@ -143,7 +143,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage> {
), ),
), ),
height: 45, height: 45,
padding: const EdgeInsets.only(left: 15, right: 12), padding: const EdgeInsets.only(left: 12, right: 6),
child: Row( child: Row(
children: [ children: [
Obx( Obx(
@ -168,9 +168,11 @@ class _DynamicDetailPageState extends State<DynamicDetailPage> {
child: TextButton.icon( child: TextButton.icon(
onPressed: () => onPressed: () =>
_dynamicDetailController!.queryBySort(), _dynamicDetailController!.queryBySort(),
icon: const Icon(Icons.sort, size: 17), icon: const Icon(Icons.sort, size: 16),
label: Obx(() => Text( label: Obx(() => Text(
_dynamicDetailController!.sortTypeLabel.value)), _dynamicDetailController!.sortTypeLabel.value,
style: const TextStyle(fontSize: 13),
)),
), ),
) )
], ],
@ -187,7 +189,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage> {
if (snapshot.data['status']) { if (snapshot.data['status']) {
// 请求成功 // 请求成功
return Obx( return Obx(
() => _dynamicDetailController!.replyList.isEmpty () => _dynamicDetailController!.replyList.isEmpty &&
_dynamicDetailController!.isLoadingMore
? SliverList( ? SliverList(
delegate: delegate:
SliverChildBuilderDelegate((context, index) { SliverChildBuilderDelegate((context, index) {
@ -210,9 +213,18 @@ class _DynamicDetailPageState extends State<DynamicDetailPage> {
.bottom + .bottom +
100, 100,
child: Center( child: Center(
child: Obx(() => Text( child: Obx(
() => Text(
_dynamicDetailController! _dynamicDetailController!
.noMore.value)), .noMore.value,
style: TextStyle(
fontSize: 12,
color: Theme.of(context)
.colorScheme
.outline,
),
),
),
), ),
); );
} else { } else {

View File

@ -16,6 +16,7 @@ import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import 'package:pilipala/utils/utils.dart'; import 'package:pilipala/utils/utils.dart';
import 'widgets/action_item.dart';
import 'widgets/action_row_item.dart'; import 'widgets/action_row_item.dart';
import 'widgets/fav_panel.dart'; import 'widgets/fav_panel.dart';
import 'widgets/intro_detail.dart'; import 'widgets/intro_detail.dart';
@ -157,11 +158,10 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
? widget.videoDetail!.title ? widget.videoDetail!.title
: videoItem['title'], : videoItem['title'],
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 16,
letterSpacing: 0.3,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
maxLines: 2, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
@ -228,8 +228,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
], ],
), ),
), ),
const SizedBox(height: 6), const SizedBox(height: 7),
// 点赞收藏转发 // 点赞收藏转发 布局样式1
SingleChildScrollView( SingleChildScrollView(
padding: const EdgeInsets.only(top: 7, bottom: 7), padding: const EdgeInsets.only(top: 7, bottom: 7),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@ -239,6 +239,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
videoDetailCtr, videoDetailCtr,
), ),
), ),
// 点赞收藏转发 布局样式2
// actionGrid(context, videoIntroController),
// 合集 // 合集
if (!widget.loadingStatus && if (!widget.loadingStatus &&
widget.videoDetail!.ugcSeason != null) ...[ widget.videoDetail!.ugcSeason != null) ...[
@ -246,105 +248,103 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
widget.videoDetail!.pages!.first.cid, sheetHeight) widget.videoDetail!.pages!.first.cid, sheetHeight)
], ],
GestureDetector( GestureDetector(
onTap: () { onTap: () {
feedBack(); feedBack();
int mid = !widget.loadingStatus int mid = !widget.loadingStatus
? widget.videoDetail!.owner!.mid ? widget.videoDetail!.owner!.mid
: videoItem['owner'].mid; : videoItem['owner'].mid;
String face = !widget.loadingStatus String face = !widget.loadingStatus
? widget.videoDetail!.owner!.face ? widget.videoDetail!.owner!.face
: videoItem['owner'].face; : videoItem['owner'].face;
Get.toNamed('/member?mid=$mid', arguments: { Get.toNamed('/member?mid=$mid', arguments: {
'face': face, 'face': face,
'heroTag': (mid + 99).toString() 'heroTag': (mid + 99).toString()
}); });
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 12, bottom: 12, left: 4, right: 4), top: 12, bottom: 12, left: 4, right: 4),
child: Row( child: Row(
children: [ children: [
NetworkImgLayer( NetworkImgLayer(
type: 'avatar', type: 'avatar',
src: !widget.loadingStatus src: !widget.loadingStatus
? widget.videoDetail!.owner!.face ? widget.videoDetail!.owner!.face
: videoItem['owner'].face, : videoItem['owner'].face,
width: 34, width: 34,
height: 34, height: 34,
fadeInDuration: Duration.zero, fadeInDuration: Duration.zero,
fadeOutDuration: Duration.zero, fadeOutDuration: Duration.zero,
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
Text( Text(
!widget.loadingStatus !widget.loadingStatus
? widget.videoDetail!.owner!.name ? widget.videoDetail!.owner!.name
: videoItem['owner'].name, : videoItem['owner'].name,
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 13),
), ),
const SizedBox(width: 10), const SizedBox(width: 6),
Text( Text(
widget.loadingStatus widget.loadingStatus
? '-' ? '-'
: Utils.numFormat(videoIntroController : Utils.numFormat(
.userStat['follower']), videoIntroController.userStat['follower']),
style: TextStyle( style: TextStyle(
fontSize: t.textTheme.labelSmall!.fontSize, fontSize: t.textTheme.labelSmall!.fontSize,
color: t.colorScheme.outline), color: t.colorScheme.outline),
), ),
const Spacer(), const Spacer(),
AnimatedOpacity( AnimatedOpacity(
opacity: widget.loadingStatus ? 0 : 1, opacity: widget.loadingStatus ? 0 : 1,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
child: SizedBox( child: SizedBox(
height: 32, height: 32,
child: Obx( child: Obx(
() => videoIntroController () => videoIntroController
.followStatus.isNotEmpty .followStatus.isNotEmpty
? TextButton( ? TextButton(
onPressed: () => videoIntroController onPressed: () => videoIntroController
.actionRelationMod(), .actionRelationMod(),
style: TextButton.styleFrom( style: TextButton.styleFrom(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 8, right: 8), left: 8, right: 8),
foregroundColor: foregroundColor:
videoIntroController videoIntroController.followStatus[
.followStatus[ 'attribute'] !=
'attribute'] != 0
0 ? t.colorScheme.outline
? t.colorScheme.outline : t.colorScheme.onPrimary,
: t.colorScheme.onPrimary, backgroundColor: videoIntroController
backgroundColor: .followStatus[
videoIntroController 'attribute'] !=
.followStatus[ 0
'attribute'] != ? t.colorScheme.onInverseSurface
0 : t.colorScheme
? t.colorScheme .primary, // 设置按钮背景色
.onInverseSurface
: t.colorScheme
.primary, // 设置按钮背景色
),
child: Text(
videoIntroController.followStatus[
'attribute'] !=
0
? '已关注'
: '关注',
style: TextStyle(
fontSize: t.textTheme
.labelMedium!.fontSize),
),
)
: ElevatedButton(
onPressed: () => videoIntroController
.actionRelationMod(),
child: const Text('关注'),
), ),
), child: Text(
videoIntroController.followStatus[
'attribute'] !=
0
? '已关注'
: '关注',
style: TextStyle(
fontSize: t.textTheme.labelMedium!
.fontSize),
),
)
: ElevatedButton(
onPressed: () => videoIntroController
.actionRelationMod(),
child: const Text('关注'),
),
), ),
), ),
], ),
), ],
)), ),
),
),
], ],
) )
: const SizedBox( : const SizedBox(
@ -357,6 +357,73 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
); );
} }
Widget actionGrid(BuildContext context, videoIntroController) {
return LayoutBuilder(builder: (context, constraints) {
return Padding(
padding: const EdgeInsets.only(top: 6, bottom: 10),
child: SizedBox(
height: constraints.maxWidth / 5 * 0.8,
child: GridView.count(
primary: false,
padding: const EdgeInsets.all(0),
crossAxisCount: 5,
childAspectRatio: 1.25,
children: <Widget>[
Obx(
() => ActionItem(
icon: const Icon(FontAwesomeIcons.thumbsUp),
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
onTap: () => videoIntroController.actionLikeVideo(),
selectStatus: videoIntroController.hasLike.value,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? widget.videoDetail!.stat!.like!.toString()
: '-'),
),
ActionItem(
icon: const Icon(FontAwesomeIcons.clock),
onTap: () => videoIntroController.actionShareVideo(),
selectStatus: false,
loadingStatus: widget.loadingStatus,
text: '稍后再看'),
Obx(
() => ActionItem(
icon: const Icon(FontAwesomeIcons.b),
selectIcon: const Icon(FontAwesomeIcons.b),
onTap: () => videoIntroController.actionCoinVideo(),
selectStatus: videoIntroController.hasCoin.value,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? widget.videoDetail!.stat!.coin!.toString()
: '-'),
),
Obx(
() => ActionItem(
icon: const Icon(FontAwesomeIcons.star),
selectIcon: const Icon(FontAwesomeIcons.solidStar),
// onTap: () => videoIntroController.actionFavVideo(),
onTap: () => showFavBottomSheet(),
selectStatus: videoIntroController.hasFav.value,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? widget.videoDetail!.stat!.favorite!.toString()
: '-'),
),
ActionItem(
icon: const Icon(FontAwesomeIcons.shareFromSquare),
onTap: () => videoIntroController.actionShareVideo(),
selectStatus: false,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? widget.videoDetail!.stat!.share!.toString()
: '-'),
],
),
),
);
});
}
Widget actionRow(BuildContext context, videoIntroController, videoDetailCtr) { Widget actionRow(BuildContext context, videoIntroController, videoDetailCtr) {
return Row(children: [ return Row(children: [
Obx( Obx(

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pilipala/common/constants.dart'; import 'package:pilipala/common/constants.dart';
import 'package:pilipala/utils/feed_back.dart';
class ActionItem extends StatelessWidget { class ActionItem extends StatelessWidget {
final Icon? icon; final Icon? icon;
@ -22,7 +23,10 @@ class ActionItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: () => onTap!(), onTap: () => {
feedBack(),
onTap!(),
},
borderRadius: StyleString.mdRadius, borderRadius: StyleString.mdRadius,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -30,20 +34,27 @@ class ActionItem extends StatelessWidget {
const SizedBox(height: 4), const SizedBox(height: 4),
selectStatus selectStatus
? Icon(selectIcon!.icon!, ? Icon(selectIcon!.icon!,
size: 21, color: Theme.of(context).primaryColor) size: 18, color: Theme.of(context).colorScheme.primary)
: Icon(icon!.icon!, : Icon(icon!.icon!,
size: 21, color: Theme.of(context).colorScheme.outline), size: 18, color: Theme.of(context).colorScheme.outline),
const SizedBox(height: 4), const SizedBox(height: 6),
AnimatedOpacity( AnimatedOpacity(
opacity: loadingStatus! ? 0 : 1, opacity: loadingStatus! ? 0 : 1,
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
child: Text( child: AnimatedSwitcher(
text ?? '', duration: const Duration(milliseconds: 300),
style: TextStyle( transitionBuilder: (Widget child, Animation<double> animation) {
color: selectStatus return ScaleTransition(scale: animation, child: child);
? Theme.of(context).primaryColor },
: Theme.of(context).colorScheme.outline, child: Text(
fontSize: Theme.of(context).textTheme.labelSmall?.fontSize), text ?? '',
key: ValueKey<String>(text ?? ''),
style: TextStyle(
color: selectStatus
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize),
),
), ),
), ),
], ],

View File

@ -33,7 +33,7 @@ class ActionRowItem extends StatelessWidget {
onTap!(), onTap!(),
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(13, 6.5, 15, 6.3), padding: const EdgeInsets.fromLTRB(15, 7, 15, 7),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -62,7 +62,7 @@ class ActionRowItem extends StatelessWidget {
? Theme.of(context).colorScheme.primary ? Theme.of(context).colorScheme.primary
: null, : null,
fontSize: fontSize:
Theme.of(context).textTheme.labelSmall!.fontSize), Theme.of(context).textTheme.labelMedium!.fontSize),
), ),
), ),
), ),

View File

@ -51,23 +51,21 @@ class IntroDetail extends StatelessWidget {
Text( Text(
videoDetail!.title, videoDetail!.title,
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 16,
letterSpacing: 0.5,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Row( Row(
children: [ children: [
const SizedBox(width: 2),
StatView( StatView(
theme: 'black', theme: 'gray',
view: videoDetail!.stat!.view, view: videoDetail!.stat!.view,
size: 'medium', size: 'medium',
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
StatDanMu( StatDanMu(
theme: 'black', theme: 'gray',
danmu: videoDetail!.stat!.danmaku, danmu: videoDetail!.stat!.danmaku,
size: 'medium', size: 'medium',
), ),
@ -75,7 +73,10 @@ class IntroDetail extends StatelessWidget {
Text( Text(
Utils.dateFormat(videoDetail!.pubdate, Utils.dateFormat(videoDetail!.pubdate,
formatType: 'detail'), formatType: 'detail'),
style: const TextStyle(fontSize: 12), style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.outline,
),
), ),
], ],
), ),

View File

@ -68,7 +68,7 @@ class MenuRow extends StatelessWidget {
onTap!(), onTap!(),
}, },
child: Container( child: Container(
padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 5.5), padding: const EdgeInsets.fromLTRB(13, 5.5, 13, 4.5),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(30)), borderRadius: const BorderRadius.all(Radius.circular(30)),
border: Border.all( border: Border.all(
@ -85,7 +85,11 @@ class MenuRow extends StatelessWidget {
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
child: Text( child: Text(
text!, text!,
style: const TextStyle(fontSize: 13), style: TextStyle(
fontSize: 13,
color: selectStatus
? Theme.of(context).colorScheme.onBackground
: Theme.of(context).colorScheme.outline),
), ),
), ),
], ],

View File

@ -7,9 +7,10 @@ Widget seasonPanel(UgcSeason ugcSeason, cid, sheetHeight) {
int currentIndex = episodes.indexWhere((e) => e.cid == cid); int currentIndex = episodes.indexWhere((e) => e.cid == cid);
return Container( return Container(
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
top: 15, top: 8,
left: 2, left: 2,
right: 2, right: 2,
bottom: 2,
), ),
child: Material( child: Material(
color: Theme.of(context).colorScheme.onInverseSurface, color: Theme.of(context).colorScheme.onInverseSurface,
@ -88,11 +89,11 @@ Widget seasonPanel(UgcSeason ugcSeason, cid, sheetHeight) {
Image.asset( Image.asset(
'assets/images/live.gif', 'assets/images/live.gif',
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
height: 11, height: 12,
), ),
const SizedBox(width: 4), const SizedBox(width: 10),
Text( Text(
'${currentIndex + 1} / ${ugcSeason.epCount}', '${currentIndex + 1}/${ugcSeason.epCount}',
style: Theme.of(context).textTheme.labelMedium, style: Theme.of(context).textTheme.labelMedium,
), ),
const SizedBox(width: 6), const SizedBox(width: 6),

View File

@ -33,23 +33,17 @@ class VideoReplyController extends GetxController {
Future queryReplyList({type = 'init'}) async { Future queryReplyList({type = 'init'}) async {
isLoadingMore = true; isLoadingMore = true;
var res = replyLevel == '1' var res = await ReplyHttp.replyList(
? await ReplyHttp.replyList( oid: aid!,
oid: aid!, pageNum: currentPage + 1,
pageNum: ++currentPage, type: ReplyType.video.index,
type: ReplyType.video.index, sort: sortType.index,
sort: sortType.index, );
)
: await ReplyHttp.replyReplyList(
oid: aid!,
root: rpid!,
pageNum: ++currentPage,
type: ReplyType.video.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) {
noMore.value = '加载中'; currentPage++;
noMore.value = '加载中...';
if (replyList.length == res['data'].page.acount) { if (replyList.length == res['data'].page.acount) {
noMore.value = '没有更多了'; noMore.value = '没有更多了';
} }

View File

@ -167,10 +167,10 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
child: TextButton.icon( child: TextButton.icon(
onPressed: () => onPressed: () =>
_videoReplyController.queryBySort(), _videoReplyController.queryBySort(),
icon: const Icon(Icons.sort, size: 15), icon: const Icon(Icons.sort, size: 16),
label: Obx(() => Text( label: Obx(() => Text(
_videoReplyController.sortTypeLabel.value, _videoReplyController.sortTypeLabel.value,
style: const TextStyle(fontSize: 12), style: const TextStyle(fontSize: 13),
)), )),
), ),
) )
@ -207,9 +207,18 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
EdgeInsets.only(bottom: bottom), EdgeInsets.only(bottom: bottom),
height: bottom + 100, height: bottom + 100,
child: Center( child: Center(
child: Obx(() => Text( child: Obx(
() => Text(
_videoReplyController _videoReplyController
.noMore.value)), .noMore.value,
style: TextStyle(
fontSize: 12,
color: Theme.of(context)
.colorScheme
.outline,
),
),
),
), ),
); );
} else { } else {

View File

@ -187,7 +187,9 @@ class ReplyItem extends StatelessWidget {
TextSpan( TextSpan(
children: [ children: [
if (replyItem!.isTop!) if (replyItem!.isTop!)
const WidgetSpan(child: UpTag(tagText: 'TOP')), const WidgetSpan(
alignment: PlaceholderAlignment.top,
child: UpTag(tagText: 'TOP')),
buildContent(context, replyItem!, replyReply, null), buildContent(context, replyItem!, replyReply, null),
], ],
), ),

View File

@ -17,7 +17,7 @@ class VideoReplyReplyController extends GetxController {
// 当前页 // 当前页
int currentPage = 0; int currentPage = 0;
bool isLoadingMore = false; bool isLoadingMore = false;
RxBool noMore = false.obs; RxString noMore = ''.obs;
// 当前回复的回复 // 当前回复的回复
ReplyItemModel? currentReplyItem; ReplyItemModel? currentReplyItem;
@ -38,27 +38,25 @@ class VideoReplyReplyController extends GetxController {
} }
isLoadingMore = true; isLoadingMore = true;
var res = await ReplyHttp.replyReplyList( var res = await ReplyHttp.replyReplyList(
oid: aid!, oid: aid!,
root: rpid!, root: rpid!,
pageNum: currentPage + 1, pageNum: currentPage + 1,
type: replyType.index); type: replyType.index,
);
if (res['status']) { if (res['status']) {
res['data'] = ReplyData.fromJson(res['data']); List<ReplyItemModel> replies = res['data'].replies;
if (res['data'].replies.isNotEmpty) { if (replies.isNotEmpty) {
currentPage = currentPage + 1; noMore.value = '加载中...';
noMore.value = false; if (replyList.length == res['data'].page.count) {
} else { noMore.value = '没有更多了';
if (currentPage == 0) {
} else {
noMore.value = true;
return;
} }
} else {
// 未登录状态replies可能返回null
noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
} }
if (res['data'].replies.length >= res['data'].page.count) { currentPage++;
noMore.value = true;
}
if (type == 'init') { if (type == 'init') {
List<ReplyItemModel> replies = res['data'].replies; // List<ReplyItemModel> replies = res['data'].replies;
// 添加置顶回复 // 添加置顶回复
// if (res['data'].upper.top != null) { // if (res['data'].upper.top != null) {
// bool flag = false; // bool flag = false;
@ -71,12 +69,12 @@ class VideoReplyReplyController extends GetxController {
// replies.insert(0, res['data'].upper.top); // replies.insert(0, res['data'].upper.top);
// } // }
// } // }
replies.insertAll(0, res['data'].topReplies); // replies.insertAll(0, res['data'].topReplies);
res['data'].replies = replies; // res['data'].replies = replies;
replyList.value = res['data'].replies!; replyList.value = replies;
} else { } else {
replyList.addAll(res['data'].replies!); replyList.addAll(replies);
res['data'].replies.addAll(replyList); // res['data'].replies.addAll(replyList);
} }
} }
isLoadingMore = false; isLoadingMore = false;

View File

@ -85,12 +85,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( const Text('评论详情'),
'评论详情',
style: Theme.of(context).textTheme.titleMedium,
),
IconButton( IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close, size: 20),
onPressed: () { onPressed: () {
_videoReplyReplyController.currentPage = 0; _videoReplyReplyController.currentPage = 0;
widget.closePanel!(); widget.closePanel!();
@ -115,7 +112,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
controller: _videoReplyReplyController.scrollController, controller: _videoReplyReplyController.scrollController,
slivers: <Widget>[ slivers: <Widget>[
if (widget.firstFloor != null) ...[ if (widget.firstFloor != null) ...[
const SliverToBoxAdapter(child: SizedBox(height: 10)), // const SliverToBoxAdapter(child: SizedBox(height: 10)),
SliverToBoxAdapter( SliverToBoxAdapter(
child: ReplyItem( child: ReplyItem(
replyItem: widget.firstFloor, replyItem: widget.firstFloor,
@ -160,10 +157,16 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
100, 100,
child: Center( child: Center(
child: Obx( child: Obx(
() => Text(_videoReplyReplyController () => Text(
.noMore.value _videoReplyReplyController
? '没有更多了' .noMore.value,
: '加载中'), style: TextStyle(
fontSize: 12,
color: Theme.of(context)
.colorScheme
.outline,
),
),
), ),
), ),
); );

View File

@ -430,9 +430,11 @@ packages:
flutter_meedu_media_kit: flutter_meedu_media_kit:
dependency: "direct main" dependency: "direct main"
description: description:
path: "/Users/rr/Desktop/code/flutter_meedu_media_kit/package" path: package
relative: false ref: feature-custom
source: path resolved-ref: d1d6d62f0059ec3501e21c9a94e72dae827162e9
url: "https://github.com/guozhigq/flutter_meedu_media_kit.git"
source: git
version: "4.2.12" version: "4.2.12"
flutter_smart_dialog: flutter_smart_dialog:
dependency: "direct main" dependency: "direct main"

View File

@ -81,11 +81,11 @@ dependencies:
dismissible_page: ^1.0.2 dismissible_page: ^1.0.2
# 媒体播放 # 媒体播放
flutter_meedu_media_kit: flutter_meedu_media_kit:
path: /Users/rr/Desktop/code/flutter_meedu_media_kit/package # path: /Users/rr/Desktop/code/flutter_meedu_media_kit/package
# git: git:
# url: https://github.com/guozhigq/flutter_meedu_media_kit.git url: https://github.com/guozhigq/flutter_meedu_media_kit.git
# ref: feature-custom ref: feature-custom
# path: package path: package
custom_sliding_segmented_control: ^1.7.5 custom_sliding_segmented_control: ^1.7.5
# 加密 # 加密
crypto: ^3.0.3 crypto: ^3.0.3