Merge pull request #136 from GetStream/nash/expose_message_input_styling

Expose addition input styling options
This commit is contained in:
Salvatore Giordano
2020-11-16 10:12:29 +01:00
committed by GitHub
+14 -2
View File
@@ -93,6 +93,8 @@ class MessageInput extends StatefulWidget {
this.actions, this.actions,
this.actionsLocation = ActionsLocation.left, this.actionsLocation = ActionsLocation.left,
this.attachmentThumbnailBuilders, this.attachmentThumbnailBuilders,
this.inputTextStyle,
this.attachmentIconColor
}) : super(key: key); }) : super(key: key);
/// Message to edit /// Message to edit
@@ -138,6 +140,13 @@ class MessageInput extends StatefulWidget {
/// Map that defines a thumbnail builder for an attachment type /// Map that defines a thumbnail builder for an attachment type
final Map<String, AttachmentThumbnailBuilder> attachmentThumbnailBuilders; final Map<String, AttachmentThumbnailBuilder> attachmentThumbnailBuilders;
/// Text style used in message text field. If null, [MessageInput] uses
/// `Theme.of(context).textTheme.bodyText2`.
final TextStyle inputTextStyle;
/// Color used for attachment icon.
final Color attachmentIconColor;
@override @override
MessageInputState createState() => MessageInputState(); MessageInputState createState() => MessageInputState();
@@ -276,10 +285,12 @@ class MessageInputState extends State<MessageInput> {
_typingStarted = true; _typingStarted = true;
}); });
}, },
style: Theme.of(context).textTheme.bodyText2, style: widget.inputTextStyle ?? Theme.of(context).textTheme.bodyText2,
autofocus: false, autofocus: false,
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Write a message', hintText: 'Write a message',
hintStyle: widget.inputTextStyle ??
Theme.of(context).textTheme.bodyText2,
prefixText: ' ', prefixText: ' ',
border: InputBorder.none, border: InputBorder.none,
), ),
@@ -605,16 +616,17 @@ class MessageInputState extends State<MessageInput> {
Material _buildAttachmentButton() { Material _buildAttachmentButton() {
return Material( return Material(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
type: MaterialType.transparency,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
color: Colors.transparent,
child: IconButton( child: IconButton(
onPressed: () { onPressed: () {
showAttachmentModal(); showAttachmentModal();
}, },
icon: Icon( icon: Icon(
Icons.add_circle_outline, Icons.add_circle_outline,
color: widget.attachmentIconColor,
), ),
), ),
); );