fix attachment shape
This commit is contained in:
+32
-25
@@ -218,7 +218,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
Flex _buildTextField(BuildContext context) {
|
Flex _buildTextField(BuildContext context) {
|
||||||
return Flex(
|
return Flex(
|
||||||
direction: Axis.horizontal,
|
direction: Axis.horizontal,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (!_commandEnabled) _buildExpandActionsButton(),
|
if (!_commandEnabled) _buildExpandActionsButton(),
|
||||||
if (widget.actionsLocation == ActionsLocation.left)
|
if (widget.actionsLocation == ActionsLocation.left)
|
||||||
@@ -388,10 +388,7 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
autofocus: false,
|
autofocus: false,
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText:
|
hintText: _getHint(),
|
||||||
(_commandEnabled && _chosenCommand.name == 'giphy')
|
|
||||||
? 'Search GIFs'
|
|
||||||
: 'Write a message',
|
|
||||||
prefixText: _commandEnabled ? null : ' ',
|
prefixText: _commandEnabled ? null : ' ',
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.transparent)),
|
borderSide: BorderSide(color: Colors.transparent)),
|
||||||
@@ -443,6 +440,16 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _getHint() {
|
||||||
|
if (_commandEnabled && _chosenCommand.name == 'giphy') {
|
||||||
|
return 'Search GIFs';
|
||||||
|
}
|
||||||
|
if (_attachments.isNotEmpty) {
|
||||||
|
return 'Add a command or send';
|
||||||
|
}
|
||||||
|
return 'Write a message';
|
||||||
|
}
|
||||||
|
|
||||||
void _checkEmoji(String s, BuildContext context) {
|
void _checkEmoji(String s, BuildContext context) {
|
||||||
if (textEditingController.selection.isCollapsed &&
|
if (textEditingController.selection.isCollapsed &&
|
||||||
(s.isNotEmpty && s[textEditingController.selection.start - 1] == ':' ||
|
(s.isNotEmpty && s[textEditingController.selection.start - 1] == ':' ||
|
||||||
@@ -551,8 +558,10 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 8.0),
|
const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
child: Icon(StreamIcons.lightning,
|
child: Icon(
|
||||||
color: StreamChatTheme.of(context).accentColor),
|
StreamIcons.lightning,
|
||||||
|
color: StreamChatTheme.of(context).accentColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Instant Commands',
|
'Instant Commands',
|
||||||
@@ -1247,26 +1256,24 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCommandButton() {
|
Widget _buildCommandButton() {
|
||||||
return Center(
|
return InkWell(
|
||||||
child: InkWell(
|
child: Padding(
|
||||||
child: Padding(
|
padding:
|
||||||
padding: const EdgeInsets.only(
|
const EdgeInsets.only(left: 4.0, right: 8.0, top: 8.0, bottom: 8.0),
|
||||||
left: 4.0, right: 8.0, top: 8.0, bottom: 8.0),
|
child: Icon(
|
||||||
child: Icon(
|
StreamIcons.lightning,
|
||||||
StreamIcons.lightning,
|
color: Color(0xFF000000).withAlpha(128),
|
||||||
color: Color(0xFF000000).withAlpha(128),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onTap: () {
|
|
||||||
if (_commandsOverlay == null) {
|
|
||||||
_commandsOverlay = _buildCommandsOverlayEntry();
|
|
||||||
Overlay.of(context).insert(_commandsOverlay);
|
|
||||||
} else {
|
|
||||||
_commandsOverlay?.remove();
|
|
||||||
_commandsOverlay = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
onTap: () {
|
||||||
|
if (_commandsOverlay == null) {
|
||||||
|
_commandsOverlay = _buildCommandsOverlayEntry();
|
||||||
|
Overlay.of(context).insert(_commandsOverlay);
|
||||||
|
} else {
|
||||||
|
_commandsOverlay?.remove();
|
||||||
|
_commandsOverlay = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -585,14 +585,22 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
widget.message,
|
widget.message,
|
||||||
attachment,
|
attachment,
|
||||||
);
|
);
|
||||||
return wrapAttachmentWidget(context, attachmentWidget,
|
return wrapAttachmentWidget(
|
||||||
attachment: attachment);
|
context,
|
||||||
|
attachmentWidget,
|
||||||
|
attachment: attachment,
|
||||||
|
);
|
||||||
})?.toList() ??
|
})?.toList() ??
|
||||||
[];
|
[];
|
||||||
}
|
}
|
||||||
|
|
||||||
Padding wrapAttachmentWidget(BuildContext context, Widget attachmentWidget,
|
Padding wrapAttachmentWidget(
|
||||||
{Attachment attachment}) {
|
BuildContext context,
|
||||||
|
Widget attachmentWidget, {
|
||||||
|
Attachment attachment,
|
||||||
|
}) {
|
||||||
|
final attachmentShape =
|
||||||
|
widget.attachmentShape ?? widget.shape ?? _getDefaultShape(context);
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: 4,
|
bottom: 4,
|
||||||
@@ -605,13 +613,12 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
? Colors.white
|
? Colors.white
|
||||||
: _getBackgroundColor(),
|
: _getBackgroundColor(),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
shape: widget.attachmentShape ??
|
shape: attachmentShape,
|
||||||
widget.shape ??
|
|
||||||
_getDefaultShape(context),
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: widget.attachmentPadding,
|
padding: widget.attachmentPadding,
|
||||||
child: ClipRRect(
|
child: Material(
|
||||||
borderRadius: BorderRadius.circular(6),
|
clipBehavior: Clip.hardEdge,
|
||||||
|
shape: attachmentShape,
|
||||||
child: Transform(
|
child: Transform(
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
|||||||
Reference in New Issue
Block a user