Skip to content

Commit fcd7f1a

Browse files
committed
rename another typo at InComing and also change to typing
1 parent 574876b commit fcd7f1a

12 files changed

+353
-425
lines changed

README.md

+203-150
Large diffs are not rendered by default.

example/lib/main.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class _ChatScreenState extends State<ChatScreen> {
117117
),
118118
onReloadButtonTap: () {},
119119
),
120-
typeIndicatorConfig: TypeIndicatorConfiguration(
120+
typingIndicatorConfig: TypingIndicatorConfiguration(
121121
flashingCircleBrightColor: theme.flashingCircleBrightColor,
122122
flashingCircleDarkColor: theme.flashingCircleDarkColor,
123123
),
@@ -206,7 +206,7 @@ class _ChatScreenState extends State<ChatScreen> {
206206
),
207207
),
208208
chatBubbleConfig: ChatBubbleConfiguration(
209-
outgoingChatBubbleConfig: ChatBubble(
209+
outgoingChatBubble: ChatBubble(
210210
linkPreviewConfig: LinkPreviewConfiguration(
211211
backgroundColor: theme.linkPreviewOutgoingChatColor,
212212
bodyStyle: theme.outgoingChatLinkBodyStyle,
@@ -215,7 +215,7 @@ class _ChatScreenState extends State<ChatScreen> {
215215
receiptsWidgetConfig: const ReceiptsWidgetConfig(showReceiptsIn: ShowReceiptsIn.all),
216216
color: theme.outgoingChatBubbleColor,
217217
),
218-
inComingChatBubbleConfig: ChatBubble(
218+
incomingChatBubble: ChatBubble(
219219
linkPreviewConfig: LinkPreviewConfiguration(
220220
linkStyle: TextStyle(
221221
color: theme.inComingChatBubbleTextColor,

lib/src/inherited_widgets/configurations_inherited_widgets.dart

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ConfigurationsInheritedWidget extends InheritedWidget {
1313
this.profileCircleConfig,
1414
this.swipeToReplyConfig,
1515
this.repliedMessageConfig,
16-
this.typeIndicatorConfig,
16+
this.typingIndicatorConfig,
1717
this.replyPopupConfig,
1818
this.emojiPickerSheetConfig,
1919
this.scrollToBottomButtonConfig,
@@ -43,7 +43,7 @@ class ConfigurationsInheritedWidget extends InheritedWidget {
4343
final RepliedMessageConfiguration? repliedMessageConfig;
4444

4545
/// Provides configuration of typing indicator's appearance.
46-
final TypeIndicatorConfiguration? typeIndicatorConfig;
46+
final TypingIndicatorConfiguration? typingIndicatorConfig;
4747

4848
/// Provides configuration for reply snack bar's appearance and options.
4949
final ReplyPopupConfiguration? replyPopupConfig;
@@ -54,10 +54,9 @@ class ConfigurationsInheritedWidget extends InheritedWidget {
5454
/// Provides a configuration for scroll to bottom button config
5555
final ScrollToBottomButtonConfig? scrollToBottomButtonConfig;
5656

57-
static ConfigurationsInheritedWidget? of(BuildContext context) => context
58-
.dependOnInheritedWidgetOfExactType<ConfigurationsInheritedWidget>();
57+
static ConfigurationsInheritedWidget? of(BuildContext context) =>
58+
context.dependOnInheritedWidgetOfExactType<ConfigurationsInheritedWidget>();
5959

6060
@override
61-
bool updateShouldNotify(covariant ConfigurationsInheritedWidget oldWidget) =>
62-
oldWidget != this;
61+
bool updateShouldNotify(covariant ConfigurationsInheritedWidget oldWidget) => oldWidget != this;
6362
}

lib/src/models/config_models/chat_bubble_configuration.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class ChatBubbleConfiguration {
3939
final Duration? longPressAnimationDuration;
4040

4141
/// Provides configuration of other users message's chat bubble.
42-
final ChatBubble? inComingChatBubbleConfig;
42+
final ChatBubble? incomingChatBubble;
4343

4444
/// Provides configuration of current user message's chat bubble.
45-
final ChatBubble? outgoingChatBubbleConfig;
45+
final ChatBubble? outgoingChatBubble;
4646

4747
/// Provides callback when user tap twice on chat bubble.
4848
final MessageCallBack? onDoubleTap;
@@ -54,8 +54,8 @@ class ChatBubbleConfiguration {
5454
this.margin,
5555
this.maxWidth,
5656
this.longPressAnimationDuration,
57-
this.inComingChatBubbleConfig,
58-
this.outgoingChatBubbleConfig,
57+
this.incomingChatBubble,
58+
this.outgoingChatBubble,
5959
this.onDoubleTap,
6060
this.receiptsWidgetConfig,
6161
});

lib/src/models/config_models/type_indicator_configuration.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
import 'package:flutter/material.dart';
2323

24-
class TypeIndicatorConfiguration {
24+
class TypingIndicatorConfiguration {
2525
/// Used for giving typing indicator size.
2626
final double? indicatorSize;
2727

@@ -34,7 +34,7 @@ class TypeIndicatorConfiguration {
3434
/// Used to give color of light circle dots.
3535
final Color? flashingCircleBrightColor;
3636

37-
const TypeIndicatorConfiguration({
37+
const TypingIndicatorConfiguration({
3838
this.indicatorSize,
3939
this.indicatorSpacing,
4040
this.flashingCircleDarkColor,

lib/src/widgets/chat_bubble_widget.dart

+31-65
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ class _ChatBubbleWidgetState extends State<ChatBubbleWidget> {
6969

7070
bool get isMessageBySender => widget.message.sentBy == currentUser?.id;
7171

72-
bool get isLastMessage =>
73-
chatController?.initialMessageList.last.id == widget.message.id;
72+
bool get isLastMessage => chatController?.initialMessageList.last.id == widget.message.id;
7473

7574
FeatureActiveConfig? featureActiveConfig;
7675
ChatController? chatController;
@@ -123,19 +122,16 @@ class _ChatBubbleWidgetState extends State<ChatBubbleWidget> {
123122
margin: chatBubbleConfig?.margin ?? const EdgeInsets.only(bottom: 10),
124123
child: Row(
125124
mainAxisSize: MainAxisSize.min,
126-
mainAxisAlignment:
127-
isMessageBySender ? MainAxisAlignment.end : MainAxisAlignment.start,
125+
mainAxisAlignment: isMessageBySender ? MainAxisAlignment.end : MainAxisAlignment.start,
128126
crossAxisAlignment: CrossAxisAlignment.end,
129127
children: [
130-
if (!isMessageBySender &&
131-
(featureActiveConfig?.enableOtherUserProfileAvatar ?? true))
128+
if (!isMessageBySender && (featureActiveConfig?.enableOtherUserProfileAvatar ?? true))
132129
profileCircle(messagedUser),
133130
Expanded(
134131
child: _messagesWidgetColumn(messagedUser),
135132
),
136133
if (isMessageBySender) ...[getReceipt()],
137-
if (isMessageBySender &&
138-
(featureActiveConfig?.enableCurrentUserProfileAvatar ?? true))
134+
if (isMessageBySender && (featureActiveConfig?.enableCurrentUserProfileAvatar ?? true))
139135
profileCircle(messagedUser),
140136
],
141137
),
@@ -152,8 +148,7 @@ class _ChatBubbleWidgetState extends State<ChatBubbleWidget> {
152148
imageUrl: messagedUser?.profilePhoto,
153149
imageType: messagedUser?.imageType,
154150
defaultAvatarImage: messagedUser?.defaultAvatarImage ?? profileImage,
155-
networkImageProgressIndicatorBuilder:
156-
messagedUser?.networkImageProgressIndicatorBuilder,
151+
networkImageProgressIndicatorBuilder: messagedUser?.networkImageProgressIndicatorBuilder,
157152
assetImageErrorBuilder: messagedUser?.assetImageErrorBuilder,
158153
networkImageErrorBuilder: messagedUser?.networkImageErrorBuilder,
159154
circleRadius: profileCircleConfig?.circleRadius,
@@ -164,49 +159,39 @@ class _ChatBubbleWidgetState extends State<ChatBubbleWidget> {
164159

165160
void onRightSwipe() {
166161
if (maxDuration != null) {
167-
widget.message.voiceMessageDuration =
168-
Duration(milliseconds: maxDuration!);
162+
widget.message.voiceMessageDuration = Duration(milliseconds: maxDuration!);
169163
}
170164
if (chatListConfig.swipeToReplyConfig?.onRightSwipe != null) {
171-
chatListConfig.swipeToReplyConfig?.onRightSwipe!(
172-
widget.message.message, widget.message.sentBy);
165+
chatListConfig.swipeToReplyConfig?.onRightSwipe!(widget.message.message, widget.message.sentBy);
173166
}
174167
widget.onSwipe(widget.message);
175168
}
176169

177170
void onLeftSwipe() {
178171
if (maxDuration != null) {
179-
widget.message.voiceMessageDuration =
180-
Duration(milliseconds: maxDuration!);
172+
widget.message.voiceMessageDuration = Duration(milliseconds: maxDuration!);
181173
}
182174
if (chatListConfig.swipeToReplyConfig?.onLeftSwipe != null) {
183-
chatListConfig.swipeToReplyConfig?.onLeftSwipe!(
184-
widget.message.message, widget.message.sentBy);
175+
chatListConfig.swipeToReplyConfig?.onLeftSwipe!(widget.message.message, widget.message.sentBy);
185176
}
186177
widget.onSwipe(widget.message);
187178
}
188179

189180
void _onAvatarTap(ChatUser? user) {
190-
if (chatListConfig.profileCircleConfig?.onAvatarTap != null &&
191-
user != null) {
181+
if (chatListConfig.profileCircleConfig?.onAvatarTap != null && user != null) {
192182
chatListConfig.profileCircleConfig?.onAvatarTap!(user);
193183
}
194184
}
195185

196186
Widget getReceipt() {
197-
final showReceipts = chatListConfig.chatBubbleConfig
198-
?.outgoingChatBubbleConfig?.receiptsWidgetConfig?.showReceiptsIn ??
187+
final showReceipts = chatListConfig.chatBubbleConfig?.outgoingChatBubble?.receiptsWidgetConfig?.showReceiptsIn ??
199188
ShowReceiptsIn.lastMessage;
200189
if (showReceipts == ShowReceiptsIn.all) {
201190
return ValueListenableBuilder(
202191
valueListenable: widget.message.statusNotifier,
203192
builder: (context, value, child) {
204-
if (ChatViewInheritedWidget.of(context)
205-
?.featureActiveConfig
206-
.receiptsBuilderVisibility ??
207-
true) {
208-
return chatListConfig.chatBubbleConfig?.outgoingChatBubbleConfig
209-
?.receiptsWidgetConfig?.receiptsBuilder
193+
if (ChatViewInheritedWidget.of(context)?.featureActiveConfig.receiptsBuilderVisibility ?? true) {
194+
return chatListConfig.chatBubbleConfig?.outgoingChatBubble?.receiptsWidgetConfig?.receiptsBuilder
210195
?.call(value) ??
211196
sendMessageAnimationBuilder(value);
212197
}
@@ -215,15 +200,10 @@ class _ChatBubbleWidgetState extends State<ChatBubbleWidget> {
215200
);
216201
} else if (showReceipts == ShowReceiptsIn.lastMessage && isLastMessage) {
217202
return ValueListenableBuilder(
218-
valueListenable:
219-
chatController!.initialMessageList.last.statusNotifier,
203+
valueListenable: chatController!.initialMessageList.last.statusNotifier,
220204
builder: (context, value, child) {
221-
if (ChatViewInheritedWidget.of(context)
222-
?.featureActiveConfig
223-
.receiptsBuilderVisibility ??
224-
true) {
225-
return chatListConfig.chatBubbleConfig?.outgoingChatBubbleConfig
226-
?.receiptsWidgetConfig?.receiptsBuilder
205+
if (ChatViewInheritedWidget.of(context)?.featureActiveConfig.receiptsBuilderVisibility ?? true) {
206+
return chatListConfig.chatBubbleConfig?.outgoingChatBubble?.receiptsWidgetConfig?.receiptsBuilder
227207
?.call(value) ??
228208
sendMessageAnimationBuilder(value);
229209
}
@@ -234,59 +214,48 @@ class _ChatBubbleWidgetState extends State<ChatBubbleWidget> {
234214
}
235215

236216
void _onAvatarLongPress(ChatUser? user) {
237-
if (chatListConfig.profileCircleConfig?.onAvatarLongPress != null &&
238-
user != null) {
217+
if (chatListConfig.profileCircleConfig?.onAvatarLongPress != null && user != null) {
239218
chatListConfig.profileCircleConfig?.onAvatarLongPress!(user);
240219
}
241220
}
242221

243222
Widget _messagesWidgetColumn(ChatUser? messagedUser) {
244223
return Column(
245-
crossAxisAlignment:
246-
isMessageBySender ? CrossAxisAlignment.end : CrossAxisAlignment.start,
224+
crossAxisAlignment: isMessageBySender ? CrossAxisAlignment.end : CrossAxisAlignment.start,
247225
children: [
248226
if ((chatController?.otherUsers.isNotEmpty ?? false) &&
249227
!isMessageBySender &&
250228
(featureActiveConfig?.enableOtherUserName ?? true))
251229
Padding(
252-
padding: chatListConfig
253-
.chatBubbleConfig?.inComingChatBubbleConfig?.padding ??
230+
padding: chatListConfig.chatBubbleConfig?.incomingChatBubble?.padding ??
254231
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
255232
child: Text(
256233
messagedUser?.name ?? '',
257-
style: chatListConfig.chatBubbleConfig?.inComingChatBubbleConfig
258-
?.senderNameTextStyle,
234+
style: chatListConfig.chatBubbleConfig?.incomingChatBubble?.senderNameTextStyle,
259235
),
260236
),
261237
if (replyMessage.isNotEmpty)
262-
chatListConfig.repliedMessageConfig?.repliedMessageWidgetBuilder !=
263-
null
264-
? chatListConfig.repliedMessageConfig!
265-
.repliedMessageWidgetBuilder!(widget.message.replyMessage)
238+
chatListConfig.repliedMessageConfig?.repliedMessageWidgetBuilder != null
239+
? chatListConfig.repliedMessageConfig!.repliedMessageWidgetBuilder!(widget.message.replyMessage)
266240
: ReplyMessageWidget(
267241
message: widget.message,
268242
repliedMessageConfig: chatListConfig.repliedMessageConfig,
269-
onTap: () => widget.onReplyTap
270-
?.call(widget.message.replyMessage.messageId),
243+
onTap: () => widget.onReplyTap?.call(widget.message.replyMessage.messageId),
271244
),
272245
SwipeToReply(
273246
isMessageByCurrentUser: isMessageBySender,
274247
onSwipe: isMessageBySender ? onLeftSwipe : onRightSwipe,
275248
child: MessageView(
276-
outgoingChatBubbleConfig:
277-
chatListConfig.chatBubbleConfig?.outgoingChatBubbleConfig,
278-
isLongPressEnable:
279-
(featureActiveConfig?.enableReactionPopup ?? true) ||
280-
(featureActiveConfig?.enableReplySnackBar ?? true),
281-
inComingChatBubbleConfig:
282-
chatListConfig.chatBubbleConfig?.inComingChatBubbleConfig,
249+
outgoingChatBubble: chatListConfig.chatBubbleConfig?.outgoingChatBubble,
250+
isLongPressEnable: (featureActiveConfig?.enableReactionPopup ?? true) ||
251+
(featureActiveConfig?.enableReplySnackBar ?? true),
252+
incomingChatBubble: chatListConfig.chatBubbleConfig?.incomingChatBubble,
283253
message: widget.message,
284254
isMessageBySender: isMessageBySender,
285255
messageConfig: chatListConfig.messageConfig,
286256
onLongPress: widget.onLongPress,
287257
chatBubbleMaxWidth: chatListConfig.chatBubbleConfig?.maxWidth,
288-
longPressAnimationDuration:
289-
chatListConfig.chatBubbleConfig?.longPressAnimationDuration,
258+
longPressAnimationDuration: chatListConfig.chatBubbleConfig?.longPressAnimationDuration,
290259
onDoubleTap: featureActiveConfig?.enableDoubleTapToLike ?? false
291260
? chatListConfig.chatBubbleConfig?.onDoubleTap ??
292261
(message) => currentUser != null
@@ -299,12 +268,9 @@ class _ChatBubbleWidgetState extends State<ChatBubbleWidget> {
299268
: null,
300269
shouldHighlight: widget.shouldHighlight,
301270
controller: chatController,
302-
highlightColor: chatListConfig.repliedMessageConfig
303-
?.repliedMsgAutoScrollConfig.highlightColor ??
304-
Colors.grey,
305-
highlightScale: chatListConfig.repliedMessageConfig
306-
?.repliedMsgAutoScrollConfig.highlightScale ??
307-
1.1,
271+
highlightColor:
272+
chatListConfig.repliedMessageConfig?.repliedMsgAutoScrollConfig.highlightColor ?? Colors.grey,
273+
highlightScale: chatListConfig.repliedMessageConfig?.repliedMsgAutoScrollConfig.highlightScale ?? 1.1,
308274
onMaxDuration: _onMaxDuration,
309275
),
310276
),

0 commit comments

Comments
 (0)