diff --git a/CHANGELOG.md b/CHANGELOG.md index a73c857..ca60a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Add a enableGroupChatCreation boolean to the userstory configuration to enable or disable group chat creation - Change the ChatTranslations constructor to require all translations or use the ChatTranslations.empty constructor if you don't want to specify all translations - Remove the Divider between the users on the new chat screen +- Add option to set a custom padding around the list of chats ## 1.4.3 diff --git a/packages/flutter_chat_view/lib/src/config/chat_options.dart b/packages/flutter_chat_view/lib/src/config/chat_options.dart index 54fb1fb..7b49173 100644 --- a/packages/flutter_chat_view/lib/src/config/chat_options.dart +++ b/packages/flutter_chat_view/lib/src/config/chat_options.dart @@ -19,6 +19,7 @@ class ChatOptions { this.groupAvatarBuilder = _createGroupAvatar, this.noChatsPlaceholderBuilder = _createNoChatsPlaceholder, this.noUsersPlaceholderBuilder = _createNoUsersPlaceholder, + this.paddingAroundChatList, }); /// Builder function for the new chat button. @@ -47,6 +48,9 @@ class ChatOptions { /// Builder function for the placeholder shown when no users are available. final NoUsersPlaceholderBuilder noUsersPlaceholderBuilder; + + /// The padding around the chat list. + final EdgeInsets? paddingAroundChatList; } Widget _createNewChatButton( diff --git a/packages/flutter_chat_view/lib/src/screens/chat_screen.dart b/packages/flutter_chat_view/lib/src/screens/chat_screen.dart index baf76aa..1260af5 100644 --- a/packages/flutter_chat_view/lib/src/screens/chat_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/chat_screen.dart @@ -119,7 +119,8 @@ class _ChatScreenState extends State { child: ListView( controller: controller, physics: const AlwaysScrollableScrollPhysics(), - padding: const EdgeInsets.fromLTRB(28, 16, 28, 0), + padding: widget.options.paddingAroundChatList ?? + const EdgeInsets.fromLTRB(28, 16, 28, 0), children: [ StreamBuilder>( stream: widget.service.chatOverviewService.getChatsStream(),