Merge branch 'main' into fix

This commit is contained in:
guozhigq
2024-04-19 23:28:00 +08:00
2 changed files with 224 additions and 252 deletions

View File

@ -16,6 +16,7 @@ import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/id_utils.dart';
import '../../../models/video/reply/item.dart';
import '../widgets/dynamic_panel.dart';
class DynamicDetailPage extends StatefulWidget {
@ -210,9 +211,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
onRefresh: () async {
await _dynamicDetailController.queryReplyList();
},
child: Stack(
children: [
CustomScrollView(
child: CustomScrollView(
controller: scrollController,
slivers: [
if (action != 'comment')
@ -230,9 +229,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
border: Border(
top: BorderSide(
width: 0.6,
color: Theme.of(context)
.dividerColor
.withOpacity(0.05),
color: Theme.of(context).dividerColor.withOpacity(0.05),
),
),
),
@ -264,8 +261,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
_dynamicDetailController.queryBySort(),
icon: const Icon(Icons.sort, size: 16),
label: Obx(() => Text(
_dynamicDetailController
.sortTypeLabel.value,
_dynamicDetailController.sortTypeLabel.value,
style: const TextStyle(fontSize: 13),
)),
),
@ -282,22 +278,22 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
if (snapshot.connectionState == ConnectionState.done) {
Map data = snapshot.data as Map;
if (snapshot.data['status']) {
RxList<ReplyItemModel> replyList =
_dynamicDetailController.replyList;
// 请求成功
return Obx(
() => _dynamicDetailController.replyList.isEmpty &&
() => replyList.isEmpty &&
_dynamicDetailController.isLoadingMore
? SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
delegate:
SliverChildBuilderDelegate((context, index) {
return const VideoReplySkeleton();
}, childCount: 8),
)
: SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index ==
_dynamicDetailController
.replyList.length) {
if (index == replyList.length) {
return Container(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context)
@ -324,25 +320,21 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
);
} else {
return ReplyItem(
replyItem: _dynamicDetailController
.replyList[index],
replyItem: replyList[index],
showReplyRow: true,
replyLevel: '1',
replyReply: (replyItem) =>
replyReply(replyItem),
replyType:
ReplyType.values[replyType],
replyType: ReplyType.values[replyType],
addReply: (replyItem) {
_dynamicDetailController
.replyList[index].replies!
replyList[index]
.replies!
.add(replyItem);
},
);
}
},
childCount: _dynamicDetailController
.replyList.length +
1,
childCount: replyList.length + 1,
),
),
);
@ -365,17 +357,17 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
)
],
),
Positioned(
bottom: MediaQuery.of(context).padding.bottom + 14,
right: 14,
child: SlideTransition(
),
floatingActionButton: SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, 2),
end: const Offset(0, 0),
).animate(CurvedAnimation(
).animate(
CurvedAnimation(
parent: fabAnimationCtr,
curve: Curves.easeInOut,
)),
),
),
child: FloatingActionButton(
heroTag: null,
onPressed: () {
@ -397,8 +389,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
// 完成评论,数据添加
if (value != null && value['data'] != null)
{
_dynamicDetailController.replyList
.add(value['data']),
_dynamicDetailController.replyList.add(value['data']),
_dynamicDetailController.acount.value++
}
},
@ -408,10 +399,6 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
child: const Icon(Icons.reply),
),
),
),
],
),
),
);
}
}

View File

@ -49,7 +49,7 @@ class AiDetail extends StatelessWidget {
child: SingleChildScrollView(
child: Column(
children: [
Text(
SelectableText(
modelResult!.summary!,
style: const TextStyle(
fontSize: 15,
@ -60,13 +60,15 @@ class AiDetail extends StatelessWidget {
const SizedBox(height: 20),
ListView.builder(
shrinkWrap: true,
itemCount: modelResult!.outline!.length,
physics: const NeverScrollableScrollPhysics(),
itemCount: modelResult!.outline!.length,
itemBuilder: (context, index) {
final outline = modelResult!.outline![index];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
modelResult!.outline![index].title!,
SelectableText(
outline.title!,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
@ -77,16 +79,31 @@ class AiDetail extends StatelessWidget {
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: modelResult!
.outline![index].partOutline!.length,
itemCount: outline.partOutline!.length,
itemBuilder: (context, i) {
final part = outline.partOutline![i];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
children: [
RichText(
text: TextSpan(
GestureDetector(
onTap: () {
try {
final controller =
Get.find<VideoDetailController>(
tag: Get.arguments['heroTag'],
);
controller.plPlayerController.seekTo(
Duration(
seconds: Utils.duration(
Utils.tampToSeektime(
part.timestamp!),
).toInt(),
),
);
} catch (_) {}
},
child: SelectableText.rich(
TextSpan(
style: TextStyle(
fontSize: 13,
color: Theme.of(context)
@ -97,56 +114,24 @@ class AiDetail extends StatelessWidget {
children: [
TextSpan(
text: Utils.tampToSeektime(
modelResult!
.outline![index]
.partOutline![i]
.timestamp!),
part.timestamp!),
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary,
),
recognizer: TapGestureRecognizer()
..onTap = () {
// 跳转到指定位置
try {
Get.find<VideoDetailController>(
tag: Get.arguments[
'heroTag'])
.plPlayerController
.seekTo(
Duration(
seconds:
Utils.duration(
Utils.tampToSeektime(modelResult!
.outline![
index]
.partOutline![
i]
.timestamp!)
.toString(),
),
),
);
} catch (_) {}
},
),
const TextSpan(text: ' '),
TextSpan(
text: modelResult!
.outline![index]
.partOutline![i]
.content!),
TextSpan(text: part.content!),
],
),
),
],
),
const SizedBox(height: 20),
],
);
},
),
const SizedBox(height: 20),
],
);
},