fix messageinput

This commit is contained in:
Salvatore Giordano
2021-05-17 11:30:05 +02:00
parent 625c2f0ad2
commit 2263dc097b
@@ -463,58 +463,57 @@ class MessageInputState extends State<MessageInput> {
); );
} }
Widget _buildExpandActionsButton() => Padding( Widget _buildExpandActionsButton() {
padding: const EdgeInsets.symmetric(horizontal: 8), final channel = StreamChannel.of(context).channel;
child: AnimatedCrossFade( return Padding(
crossFadeState: _actionsShrunk padding: const EdgeInsets.symmetric(horizontal: 8),
? CrossFadeState.showFirst child: AnimatedCrossFade(
: CrossFadeState.showSecond, crossFadeState: _actionsShrunk
firstChild: IconButton( ? CrossFadeState.showFirst
onPressed: () => setState(() => _actionsShrunk = false), : CrossFadeState.showSecond,
icon: Transform.rotate( firstChild: IconButton(
angle: (widget.actionsLocation == ActionsLocation.right || onPressed: () => setState(() => _actionsShrunk = false),
widget.actionsLocation == ActionsLocation.rightInside) icon: Transform.rotate(
? pi angle: (widget.actionsLocation == ActionsLocation.right ||
: 0, widget.actionsLocation == ActionsLocation.rightInside)
child: StreamSvgIcon.emptyCircleLeft( ? pi
color: StreamChatTheme.of(context) : 0,
.messageInputTheme child: StreamSvgIcon.emptyCircleLeft(
.expandButtonColor, color: StreamChatTheme.of(context)
), .messageInputTheme
.expandButtonColor,
), ),
padding: const EdgeInsets.all(0),
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
),
splashRadius: 24,
), ),
secondChild: widget.disableAttachments && padding: const EdgeInsets.all(0),
!widget.showCommandsButton && constraints: const BoxConstraints.tightFor(
widget.actions?.isNotEmpty != true height: 24,
? const Offstage() width: 24,
: FittedBox( ),
child: Row( splashRadius: 24,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
if (!widget.disableAttachments) _buildAttachmentButton(),
if (widget.showCommandsButton &&
widget.editMessage == null &&
StreamChannel.of(context)
.channel
.config
?.commands
.isNotEmpty ==
true)
_buildCommandButton(),
...widget.actions ?? [],
].insertBetween(const SizedBox(width: 8)),
),
),
duration: const Duration(milliseconds: 300),
alignment: Alignment.center,
), ),
); secondChild: widget.disableAttachments &&
!widget.showCommandsButton &&
widget.actions?.isNotEmpty != true
? const Offstage()
: FittedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
if (!widget.disableAttachments) _buildAttachmentButton(),
if (widget.showCommandsButton &&
widget.editMessage == null &&
channel.state != null &&
channel.config?.commands.isNotEmpty == true)
_buildCommandButton(),
...widget.actions ?? [],
].insertBetween(const SizedBox(width: 8)),
),
),
duration: const Duration(milliseconds: 300),
alignment: Alignment.center,
),
);
}
Expanded _buildTextInput(BuildContext context) { Expanded _buildTextInput(BuildContext context) {
final theme = StreamChatTheme.of(context); final theme = StreamChatTheme.of(context);