From 83787846c90673ca6d657b7021efdb5ca4a47a7c Mon Sep 17 00:00:00 2001 From: Neevash Ramdial Date: Sat, 14 Nov 2020 14:47:48 -0400 Subject: [PATCH 1/4] expose builder for empty state --- lib/src/channel_list_view.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index f88eefbe..b716fff6 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -63,6 +63,7 @@ class ChannelListView extends StatefulWidget { this.channelPreviewBuilder, this.separatorBuilder, this.errorBuilder, + this.emptyBuilder, this.onImageTap, this.pullToRefresh = true, }) : super(key: key); @@ -70,6 +71,9 @@ class ChannelListView extends StatefulWidget { /// The builder that will be used in case of error final Widget Function(Error error) errorBuilder; + /// The builder used when the channel list is empty. + final WidgetBuilder emptyBuilder; + /// The query filters to use. /// You can query on any of the custom fields you've defined on the [Channel]. /// You can also filter other built-in channel fields. @@ -231,7 +235,11 @@ class _ChannelListViewState extends State final channels = snapshot.data; - if (channels.isEmpty) { + if (channels.isEmpty && widget.emptyBuilder != null) { + return widget.emptyBuilder(context); + } + + if (channels.isEmpty && widget.emptyBuilder == null) { return LayoutBuilder( builder: (context, viewportConstraints) { return SingleChildScrollView( From 13604cee386afcb31dd2b6fd061d2dfcba00b0e1 Mon Sep 17 00:00:00 2001 From: Neevash Ramdial Date: Sun, 15 Nov 2020 21:32:53 -0400 Subject: [PATCH 2/4] Change material type to transparent --- lib/src/message_input.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 13f8291c..78833c8c 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -605,10 +605,10 @@ class MessageInputState extends State { Material _buildAttachmentButton() { return Material( clipBehavior: Clip.hardEdge, + type: MaterialType.transparency, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(32), ), - color: Colors.transparent, child: IconButton( onPressed: () { showAttachmentModal(); From 78e23bc256f7ddb6f369559c59ae66e42d611ec5 Mon Sep 17 00:00:00 2001 From: Neevash Ramdial Date: Sun, 15 Nov 2020 21:33:51 -0400 Subject: [PATCH 3/4] expose input text style --- lib/src/message_input.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 78833c8c..729866ee 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -93,6 +93,7 @@ class MessageInput extends StatefulWidget { this.actions, this.actionsLocation = ActionsLocation.left, this.attachmentThumbnailBuilders, + this.inputTextStyle, }) : super(key: key); /// Message to edit @@ -138,6 +139,10 @@ class MessageInput extends StatefulWidget { /// Map that defines a thumbnail builder for an attachment type final Map attachmentThumbnailBuilders; + /// Text style used in message text field. If null, [MessageInput] uses + /// `Theme.of(context).textTheme.bodyText2`. + final TextStyle inputTextStyle; + @override MessageInputState createState() => MessageInputState(); @@ -276,10 +281,12 @@ class MessageInputState extends State { _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, ), From 77d62eefddc14813461d9e2a2ce963bee6613667 Mon Sep 17 00:00:00 2001 From: Neevash Ramdial Date: Sun, 15 Nov 2020 21:34:14 -0400 Subject: [PATCH 4/4] expose style option for attachment icon --- lib/src/message_input.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 729866ee..20a2bdf6 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -94,6 +94,7 @@ class MessageInput extends StatefulWidget { this.actionsLocation = ActionsLocation.left, this.attachmentThumbnailBuilders, this.inputTextStyle, + this.attachmentIconColor }) : super(key: key); /// Message to edit @@ -143,6 +144,9 @@ class MessageInput extends StatefulWidget { /// `Theme.of(context).textTheme.bodyText2`. final TextStyle inputTextStyle; + /// Color used for attachment icon. + final Color attachmentIconColor; + @override MessageInputState createState() => MessageInputState(); @@ -622,6 +626,7 @@ class MessageInputState extends State { }, icon: Icon( Icons.add_circle_outline, + color: widget.attachmentIconColor, ), ), );