fix: 动态回复页面键盘收起后无法返回

This commit is contained in:
guozhigq
2024-04-18 23:33:55 +08:00
parent 6edd0aa702
commit 3e105804d7

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),
),
),
),
],
),
),
);
}
}