fix(ui): Make the send button's bottom padding adhere to the pickers

This commit is contained in:
PapaTutuWawa 2022-12-16 22:54:31 +01:00
parent eba17880d0
commit 1cd3dabcea

View File

@ -273,15 +273,19 @@ class ConversationBottomRowState extends State<ConversationBottomRow> {
), ),
), ),
Positioned( BlocBuilder<ConversationBloc, ConversationState>(
right: 8, buildWhen: (prev, next) => prev.sendButtonState != next.sendButtonState ||
bottom: 8, prev.isDragging != next.isDragging ||
child: BlocBuilder<ConversationBloc, ConversationState>( prev.isLocked != next.isLocked ||
buildWhen: (prev, next) => prev.sendButtonState != next.sendButtonState || prev.emojiPickerVisible != next.emojiPickerVisible ||
prev.isDragging != next.isDragging || prev.stickerPickerVisible != next.stickerPickerVisible,
prev.isLocked != next.isLocked, builder: (context, state) {
builder: (context, state) { return Positioned(
return Visibility( right: 8,
bottom: state.emojiPickerVisible || state.stickerPickerVisible ?
258 /* 8 (Regular padding) + 250 (Height of the pickers) */ :
8,
child: Visibility(
visible: !state.isDragging && !state.isLocked, visible: !state.isDragging && !state.isLocked,
child: LongPressDraggable<int>( child: LongPressDraggable<int>(
data: 1, data: 1,
@ -331,25 +335,25 @@ class ConversationBottomRowState extends State<ConversationBottomRow> {
onPressed: () { onPressed: () {
switch (state.sendButtonState) { switch (state.sendButtonState) {
case SendButtonState.audio: case SendButtonState.audio:
Vibrate.feedback(FeedbackType.heavy); Vibrate.feedback(FeedbackType.heavy);
Fluttertoast.showToast( Fluttertoast.showToast(
msg: t.warnings.conversation.holdForLonger, msg: t.warnings.conversation.holdForLonger,
gravity: ToastGravity.SNACKBAR, gravity: ToastGravity.SNACKBAR,
toastLength: Toast.LENGTH_SHORT, toastLength: Toast.LENGTH_SHORT,
); );
return; return;
case SendButtonState.cancelCorrection: case SendButtonState.cancelCorrection:
context.read<ConversationBloc>().add( context.read<ConversationBloc>().add(
MessageEditCancelledEvent(), MessageEditCancelledEvent(),
); );
widget.controller.text = ''; widget.controller.text = '';
return; return;
case SendButtonState.send: case SendButtonState.send:
context.read<ConversationBloc>().add( context.read<ConversationBloc>().add(
MessageSentEvent(), MessageSentEvent(),
); );
widget.controller.text = ''; widget.controller.text = '';
return; return;
} }
}, },
child: Icon( child: Icon(
@ -359,9 +363,9 @@ class ConversationBottomRowState extends State<ConversationBottomRow> {
), ),
), ),
), ),
); ),
}, );
), },
), ),
Positioned( Positioned(