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.actionsLocation = ActionsLocation.left,
this.attachmentThumbnailBuilders,
this.inputTextStyle,
this.attachmentIconColor
}) : super(key: key);
/// Message to edit
@@ -138,6 +140,13 @@ class MessageInput extends StatefulWidget {
/// Map that defines a thumbnail builder for an attachment type
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
MessageInputState createState() => MessageInputState();
@@ -276,10 +285,12 @@ class MessageInputState extends State<MessageInput> {
_typingStarted = true;
});
},
style: Theme.of(context).textTheme.bodyText2,
style: widget.inputTextStyle ?? Theme.of(context).textTheme.bodyText2,
autofocus: false,
decoration: InputDecoration(
hintText: 'Write a message',
hintStyle: widget.inputTextStyle ??
Theme.of(context).textTheme.bodyText2,
prefixText: ' ',
border: InputBorder.none,
),
@@ -605,16 +616,17 @@ class MessageInputState extends State<MessageInput> {
Material _buildAttachmentButton() {
return Material(
clipBehavior: Clip.hardEdge,
type: MaterialType.transparency,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
),
color: Colors.transparent,
child: IconButton(
onPressed: () {
showAttachmentModal();
},
icon: Icon(
Icons.add_circle_outline,
color: widget.attachmentIconColor,
),
),
);