From 59760352a26476e930853e378b91e7fb84d036e0 Mon Sep 17 00:00:00 2001 From: Georgiy Voloshin <114863993+Zhorenty@users.noreply.github.com> Date: Mon, 2 Sep 2024 08:07:10 +0300 Subject: [PATCH] Add customization options for padding in chat area (#628) Co-authored-by: Georgiy Voloshin --- lib/src/chat_theme.dart | 10 ++++++++++ lib/src/widgets/chat_list.dart | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/src/chat_theme.dart b/lib/src/chat_theme.dart index 6d237f354..e7547acc7 100644 --- a/lib/src/chat_theme.dart +++ b/lib/src/chat_theme.dart @@ -61,6 +61,7 @@ abstract class ChatTheme { required this.backgroundColor, this.bubbleMargin, required this.dateDividerMargin, + required this.chatContentMargin, required this.dateDividerTextStyle, required this.deliveredIcon, required this.documentIcon, @@ -132,6 +133,9 @@ abstract class ChatTheme { /// Margin around date dividers. final EdgeInsets dateDividerMargin; + /// Margin inside chat area. + final EdgeInsets chatContentMargin; + /// Text style of the date dividers. final TextStyle dateDividerTextStyle; @@ -325,6 +329,9 @@ class DefaultChatTheme extends ChatTheme { bottom: 32, top: 16, ), + super.chatContentMargin = const EdgeInsets.only( + bottom: 4, + ), super.dateDividerTextStyle = const TextStyle( color: neutral2, fontSize: 12, @@ -499,6 +506,9 @@ class DarkChatTheme extends ChatTheme { bottom: 32, top: 16, ), + super.chatContentMargin = const EdgeInsets.only( + bottom: 4, + ), super.dateDividerTextStyle = const TextStyle( color: neutral7, fontSize: 12, diff --git a/lib/src/widgets/chat_list.dart b/lib/src/widgets/chat_list.dart index 4115514ab..f9c899765 100644 --- a/lib/src/widgets/chat_list.dart +++ b/lib/src/widgets/chat_list.dart @@ -296,7 +296,7 @@ class _ChatListState extends State ), ), SliverPadding( - padding: const EdgeInsets.only(bottom: 4), + padding: InheritedChatTheme.of(context).theme.chatContentMargin, sliver: SliverAnimatedList( findChildIndexCallback: (Key key) { if (key is ValueKey) {