Skip to content

Commit

Permalink
Add customization options for padding in chat area (#628)
Browse files Browse the repository at this point in the history
Co-authored-by: Georgiy Voloshin <[email protected]>
  • Loading branch information
Zhorenty and GeorgiyVoloshin authored Sep 2, 2024
1 parent 9744437 commit 5976035
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/src/chat_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class _ChatListState extends State<ChatList>
),
),
SliverPadding(
padding: const EdgeInsets.only(bottom: 4),
padding: InheritedChatTheme.of(context).theme.chatContentMargin,
sliver: SliverAnimatedList(
findChildIndexCallback: (Key key) {
if (key is ValueKey<Object>) {
Expand Down

0 comments on commit 5976035

Please sign in to comment.