mod: 更多回复键盘弹起样式

This commit is contained in:
guozhigq
2023-05-26 18:39:27 +08:00
parent bd8cf24fff
commit abf0272314
5 changed files with 34 additions and 49 deletions

View File

@ -47,8 +47,7 @@ class VideoDetailController extends GetxController {
showReplyReplyPanel() { showReplyReplyPanel() {
PersistentBottomSheetController<void>? ctr = scaffoldKey.currentState?.showBottomSheet<void>((BuildContext context) { PersistentBottomSheetController<void>? ctr = scaffoldKey.currentState?.showBottomSheet<void>((BuildContext context) {
return return VideoReplyReplyPanel(
VideoReplyReplyPanel(
oid: oid, oid: oid,
rpid: fRpid, rpid: fRpid,
closePanel: ()=> { closePanel: ()=> {

View File

@ -23,7 +23,7 @@ class ReplyItem extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(12, 6, 8, 0), padding: const EdgeInsets.fromLTRB(12, 2, 8, 0),
child: content(context), child: content(context),
), ),
// Divider( // Divider(

View File

@ -69,8 +69,7 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
); );
if (result['status']) { if (result['status']) {
SmartDialog.showToast(result['data']['success_toast']); SmartDialog.showToast(result['data']['success_toast']);
} else { } else {}
}
} }
@override @override
@ -95,45 +94,24 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: MediaQuery.of(context).size.height - MediaQuery.of(context).size.width * 9 / 16 - 48, height: MediaQuery.of(context).size.height -
MediaQuery.of(context).size.width * 9 / 16 -
45,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16), topLeft: Radius.circular(16),
topRight: Radius.circular(16), topRight: Radius.circular(16),
), ),
color: Theme.of(context).colorScheme.background), color: Theme.of(context).colorScheme.background,
),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
SizedBox(
height: 55,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(width: 20),
Text('发表评论', style: Theme.of(context).textTheme.titleMedium),
const Spacer(),
IconButton(
onPressed: () => Get.back(),
icon: const Icon(Icons.close),
),
const SizedBox(width: 12),
],
),
),
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
Expanded( Expanded(
child: Container( child: Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 12, right: 15, left: 15, bottom: 10), top: 6, right: 15, left: 15, bottom: 10),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(16),
),
child: Form( child: Form(
key: _formKey, key: _formKey,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
@ -182,13 +160,14 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
)), )),
), ),
const Spacer(), const Spacer(),
TextButton(onPressed: () => submitReplyAdd(), child: const Text('发送')) TextButton(
onPressed: () => submitReplyAdd(), child: const Text('发送'))
], ],
), ),
), ),
AnimatedSize( AnimatedSize(
curve: Curves.easeInOut, curve: Curves.easeInOut,
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 300),
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: _keyboardHeight, height: _keyboardHeight,

View File

@ -60,7 +60,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: Get.size.height - Get.size.width * 9 / 16 - 48, height: Get.size.height - Get.size.width * 9 / 16 - 45,
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [
@ -101,6 +101,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)),
SliverToBoxAdapter( SliverToBoxAdapter(
child: ReplyItem( child: ReplyItem(
replyItem: widget.firstFloor, replyItem: widget.firstFloor,
@ -109,7 +110,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: Divider( child: Divider(
height: 30, height: 20,
color: Theme.of(context).dividerColor.withOpacity(0.1), color: Theme.of(context).dividerColor.withOpacity(0.1),
thickness: 6, thickness: 6,
), ),
@ -137,19 +138,22 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
height: MediaQuery.of(context) height: MediaQuery.of(context)
.padding .padding
.bottom + .bottom +
60, 100,
child: Center( child: Center(
child: Obx(() => Text( child: Obx(
_videoReplyReplyController () => Text(_videoReplyReplyController
.noMore.value .noMore.value
? '没有更多了' ? '没有更多了'
: '加载中')), : '加载中'),
),
), ),
); );
} else { } else {
return ReplyItem( return Material(
replyItem: _videoReplyReplyController child: ReplyItem(
.replyList[index], replyItem: _videoReplyReplyController
.replyList[index],
),
); );
} }
}, },

View File

@ -40,6 +40,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
child: Stack( child: Stack(
children: [ children: [
Scaffold( Scaffold(
resizeToAvoidBottomInset: false,
key: videoDetailController.scaffoldKey, key: videoDetailController.scaffoldKey,
body: ExtendedNestedScrollView( body: ExtendedNestedScrollView(
headerSliverBuilder: headerSliverBuilder:
@ -55,6 +56,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
MediaQuery.of(context).size.width * 9 / 16, MediaQuery.of(context).size.width * 9 / 16,
collapsedHeight: collapsedHeight:
MediaQuery.of(context).size.width * 9 / 16, MediaQuery.of(context).size.width * 9 / 16,
backgroundColor: Colors.black,
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
background: Padding( background: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
@ -68,6 +70,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
return Hero( return Hero(
tag: videoDetailController.heroTag, tag: videoDetailController.heroTag,
child: NetworkImgLayer( child: NetworkImgLayer(
type: 'emote',
src: videoDetailController.videoItem['pic'], src: videoDetailController.videoItem['pic'],
width: maxWidth, width: maxWidth,
height: maxHeight, height: maxHeight,