feat: Added message input theme and send button animation duration
This commit is contained in:
@@ -392,7 +392,8 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
: CrossFadeState.showSecond,
|
: CrossFadeState.showSecond,
|
||||||
firstChild: _buildSendButton(context),
|
firstChild: _buildSendButton(context),
|
||||||
secondChild: _buildIdleSendButton(context),
|
secondChild: _buildIdleSendButton(context),
|
||||||
duration: Duration(milliseconds: 300),
|
duration:
|
||||||
|
StreamChatTheme.of(context).messageInputTheme.sendAnimationDuration,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ class StreamChatThemeData {
|
|||||||
/// Theme of other users messages
|
/// Theme of other users messages
|
||||||
final MessageTheme otherMessageTheme;
|
final MessageTheme otherMessageTheme;
|
||||||
|
|
||||||
|
/// Theme of other users messages
|
||||||
|
final MessageInputTheme messageInputTheme;
|
||||||
|
|
||||||
/// The widget that will be built when the channel image is unavailable
|
/// The widget that will be built when the channel image is unavailable
|
||||||
final Widget Function(BuildContext, Channel) defaultChannelImage;
|
final Widget Function(BuildContext, Channel) defaultChannelImage;
|
||||||
|
|
||||||
@@ -80,6 +83,7 @@ class StreamChatThemeData {
|
|||||||
this.channelTheme,
|
this.channelTheme,
|
||||||
this.otherMessageTheme,
|
this.otherMessageTheme,
|
||||||
this.ownMessageTheme,
|
this.ownMessageTheme,
|
||||||
|
this.messageInputTheme,
|
||||||
this.defaultChannelImage,
|
this.defaultChannelImage,
|
||||||
this.defaultUserImage,
|
this.defaultUserImage,
|
||||||
this.primaryIconTheme,
|
this.primaryIconTheme,
|
||||||
@@ -108,6 +112,7 @@ class StreamChatThemeData {
|
|||||||
ChannelTheme channelTheme,
|
ChannelTheme channelTheme,
|
||||||
MessageTheme ownMessageTheme,
|
MessageTheme ownMessageTheme,
|
||||||
MessageTheme otherMessageTheme,
|
MessageTheme otherMessageTheme,
|
||||||
|
MessageInputTheme messageInputTheme,
|
||||||
Widget Function(BuildContext, Channel) defaultChannelImage,
|
Widget Function(BuildContext, Channel) defaultChannelImage,
|
||||||
Widget Function(BuildContext, User) defaultUserImage,
|
Widget Function(BuildContext, User) defaultUserImage,
|
||||||
IconThemeData primaryIconTheme,
|
IconThemeData primaryIconTheme,
|
||||||
@@ -123,6 +128,7 @@ class StreamChatThemeData {
|
|||||||
channelTheme: channelTheme ?? this.channelTheme,
|
channelTheme: channelTheme ?? this.channelTheme,
|
||||||
ownMessageTheme: ownMessageTheme ?? this.ownMessageTheme,
|
ownMessageTheme: ownMessageTheme ?? this.ownMessageTheme,
|
||||||
otherMessageTheme: otherMessageTheme ?? this.otherMessageTheme,
|
otherMessageTheme: otherMessageTheme ?? this.otherMessageTheme,
|
||||||
|
messageInputTheme: messageInputTheme ?? this.messageInputTheme,
|
||||||
reactionIcons: reactionIcons ?? this.reactionIcons,
|
reactionIcons: reactionIcons ?? this.reactionIcons,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -143,6 +149,8 @@ class StreamChatThemeData {
|
|||||||
other.ownMessageTheme,
|
other.ownMessageTheme,
|
||||||
otherMessageTheme: otherMessageTheme?.merge(other.otherMessageTheme) ??
|
otherMessageTheme: otherMessageTheme?.merge(other.otherMessageTheme) ??
|
||||||
other.otherMessageTheme,
|
other.otherMessageTheme,
|
||||||
|
messageInputTheme: messageInputTheme?.merge(other.messageInputTheme) ??
|
||||||
|
other.messageInputTheme,
|
||||||
reactionIcons: other.reactionIcons,
|
reactionIcons: other.reactionIcons,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -248,6 +256,9 @@ class StreamChatThemeData {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
messageInputTheme: MessageInputTheme(
|
||||||
|
sendAnimationDuration: Duration(milliseconds: 7000),
|
||||||
|
),
|
||||||
reactionIcons: [
|
reactionIcons: [
|
||||||
ReactionIcon(
|
ReactionIcon(
|
||||||
type: 'love',
|
type: 'love',
|
||||||
@@ -873,6 +884,27 @@ class ChannelHeaderTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MessageInputTheme {
|
||||||
|
final Duration sendAnimationDuration;
|
||||||
|
|
||||||
|
const MessageInputTheme({
|
||||||
|
this.sendAnimationDuration,
|
||||||
|
});
|
||||||
|
|
||||||
|
MessageInputTheme copyWith({Duration sendAnimationDuration}) =>
|
||||||
|
MessageInputTheme(
|
||||||
|
sendAnimationDuration:
|
||||||
|
sendAnimationDuration ?? this.sendAnimationDuration,
|
||||||
|
);
|
||||||
|
|
||||||
|
MessageInputTheme merge(MessageInputTheme other) {
|
||||||
|
if (other == null) return this;
|
||||||
|
return copyWith(
|
||||||
|
sendAnimationDuration: other.sendAnimationDuration,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Effect {
|
class Effect {
|
||||||
final double sigmaX;
|
final double sigmaX;
|
||||||
final double sigmaY;
|
final double sigmaY;
|
||||||
|
|||||||
Reference in New Issue
Block a user