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,
|
||||
firstChild: _buildSendButton(context),
|
||||
secondChild: _buildIdleSendButton(context),
|
||||
duration: Duration(milliseconds: 300),
|
||||
duration:
|
||||
StreamChatTheme.of(context).messageInputTheme.sendAnimationDuration,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -60,6 +60,9 @@ class StreamChatThemeData {
|
||||
/// Theme of other users messages
|
||||
final MessageTheme otherMessageTheme;
|
||||
|
||||
/// Theme of other users messages
|
||||
final MessageInputTheme messageInputTheme;
|
||||
|
||||
/// The widget that will be built when the channel image is unavailable
|
||||
final Widget Function(BuildContext, Channel) defaultChannelImage;
|
||||
|
||||
@@ -80,6 +83,7 @@ class StreamChatThemeData {
|
||||
this.channelTheme,
|
||||
this.otherMessageTheme,
|
||||
this.ownMessageTheme,
|
||||
this.messageInputTheme,
|
||||
this.defaultChannelImage,
|
||||
this.defaultUserImage,
|
||||
this.primaryIconTheme,
|
||||
@@ -108,6 +112,7 @@ class StreamChatThemeData {
|
||||
ChannelTheme channelTheme,
|
||||
MessageTheme ownMessageTheme,
|
||||
MessageTheme otherMessageTheme,
|
||||
MessageInputTheme messageInputTheme,
|
||||
Widget Function(BuildContext, Channel) defaultChannelImage,
|
||||
Widget Function(BuildContext, User) defaultUserImage,
|
||||
IconThemeData primaryIconTheme,
|
||||
@@ -123,6 +128,7 @@ class StreamChatThemeData {
|
||||
channelTheme: channelTheme ?? this.channelTheme,
|
||||
ownMessageTheme: ownMessageTheme ?? this.ownMessageTheme,
|
||||
otherMessageTheme: otherMessageTheme ?? this.otherMessageTheme,
|
||||
messageInputTheme: messageInputTheme ?? this.messageInputTheme,
|
||||
reactionIcons: reactionIcons ?? this.reactionIcons,
|
||||
);
|
||||
|
||||
@@ -143,6 +149,8 @@ class StreamChatThemeData {
|
||||
other.ownMessageTheme,
|
||||
otherMessageTheme: otherMessageTheme?.merge(other.otherMessageTheme) ??
|
||||
other.otherMessageTheme,
|
||||
messageInputTheme: messageInputTheme?.merge(other.messageInputTheme) ??
|
||||
other.messageInputTheme,
|
||||
reactionIcons: other.reactionIcons,
|
||||
);
|
||||
}
|
||||
@@ -248,6 +256,9 @@ class StreamChatThemeData {
|
||||
),
|
||||
),
|
||||
),
|
||||
messageInputTheme: MessageInputTheme(
|
||||
sendAnimationDuration: Duration(milliseconds: 7000),
|
||||
),
|
||||
reactionIcons: [
|
||||
ReactionIcon(
|
||||
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 {
|
||||
final double sigmaX;
|
||||
final double sigmaY;
|
||||
|
||||
Reference in New Issue
Block a user