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