lint theme
This commit is contained in:
@@ -11,8 +11,7 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
|||||||
|
|
||||||
/// Inherited widget providing the [StreamChatThemeData] to the widget tree
|
/// Inherited widget providing the [StreamChatThemeData] to the widget tree
|
||||||
class StreamChatTheme extends InheritedWidget {
|
class StreamChatTheme extends InheritedWidget {
|
||||||
final StreamChatThemeData data;
|
/// Constructor for creating a [StreamChatTheme]
|
||||||
|
|
||||||
const StreamChatTheme({
|
const StreamChatTheme({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.data,
|
required this.data,
|
||||||
@@ -22,10 +21,11 @@ class StreamChatTheme extends InheritedWidget {
|
|||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Theme data
|
||||||
|
final StreamChatThemeData data;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool updateShouldNotify(StreamChatTheme old) {
|
bool updateShouldNotify(StreamChatTheme old) => data != old.data;
|
||||||
return data != old.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Use this method to get the current [StreamChatThemeData] instance
|
/// Use this method to get the current [StreamChatThemeData] instance
|
||||||
static StreamChatThemeData of(BuildContext context) {
|
static StreamChatThemeData of(BuildContext context) {
|
||||||
@@ -43,42 +43,6 @@ class StreamChatTheme extends InheritedWidget {
|
|||||||
|
|
||||||
/// Theme data
|
/// Theme data
|
||||||
class StreamChatThemeData {
|
class StreamChatThemeData {
|
||||||
/// The text themes used in the widgets
|
|
||||||
final TextTheme textTheme;
|
|
||||||
|
|
||||||
/// The color themes used in the widgets
|
|
||||||
final ColorTheme colorTheme;
|
|
||||||
|
|
||||||
/// Theme of the [ChannelPreview]
|
|
||||||
final ChannelPreviewTheme channelPreviewTheme;
|
|
||||||
|
|
||||||
/// Theme of the [ChannelListHeader]
|
|
||||||
final ChannelListHeaderTheme channelListHeaderTheme;
|
|
||||||
|
|
||||||
/// Theme of the chat widgets dedicated to a channel
|
|
||||||
final ChannelTheme channelTheme;
|
|
||||||
|
|
||||||
/// Theme of the current user messages
|
|
||||||
final MessageTheme ownMessageTheme;
|
|
||||||
|
|
||||||
/// Theme of other users messages
|
|
||||||
final MessageTheme otherMessageTheme;
|
|
||||||
|
|
||||||
/// Theme dedicated to the [MessageInput] widget
|
|
||||||
final MessageInputTheme messageInputTheme;
|
|
||||||
|
|
||||||
/// The widget that will be built when the channel image is unavailable
|
|
||||||
final Widget Function(BuildContext, Channel) defaultChannelImage;
|
|
||||||
|
|
||||||
/// The widget that will be built when the user image is unavailable
|
|
||||||
final Widget Function(BuildContext, User) defaultUserImage;
|
|
||||||
|
|
||||||
/// Primary icon theme
|
|
||||||
final IconThemeData primaryIconTheme;
|
|
||||||
|
|
||||||
/// Assets used for rendering reactions
|
|
||||||
final List<ReactionIcon> reactionIcons;
|
|
||||||
|
|
||||||
/// Create a theme from scratch
|
/// Create a theme from scratch
|
||||||
factory StreamChatThemeData({
|
factory StreamChatThemeData({
|
||||||
Brightness? brightness,
|
Brightness? brightness,
|
||||||
@@ -121,12 +85,15 @@ class StreamChatThemeData {
|
|||||||
return defaultData.merge(customizedData);
|
return defaultData.merge(customizedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Theme initialised with light
|
||||||
factory StreamChatThemeData.light() =>
|
factory StreamChatThemeData.light() =>
|
||||||
StreamChatThemeData(brightness: Brightness.light);
|
StreamChatThemeData(brightness: Brightness.light);
|
||||||
|
|
||||||
|
/// Theme initialised with dark
|
||||||
factory StreamChatThemeData.dark() =>
|
factory StreamChatThemeData.dark() =>
|
||||||
StreamChatThemeData(brightness: Brightness.dark);
|
StreamChatThemeData(brightness: Brightness.dark);
|
||||||
|
|
||||||
|
/// Raw theme init
|
||||||
const StreamChatThemeData.raw({
|
const StreamChatThemeData.raw({
|
||||||
required this.textTheme,
|
required this.textTheme,
|
||||||
required this.colorTheme,
|
required this.colorTheme,
|
||||||
@@ -154,7 +121,44 @@ class StreamChatThemeData {
|
|||||||
return defaultTheme.merge(customizedTheme);
|
return defaultTheme.merge(customizedTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a copy of [StreamChatThemeData] with specified attributes overridden.
|
/// The text themes used in the widgets
|
||||||
|
final TextTheme textTheme;
|
||||||
|
|
||||||
|
/// The color themes used in the widgets
|
||||||
|
final ColorTheme colorTheme;
|
||||||
|
|
||||||
|
/// Theme of the [ChannelPreview]
|
||||||
|
final ChannelPreviewTheme channelPreviewTheme;
|
||||||
|
|
||||||
|
/// Theme of the [ChannelListHeader]
|
||||||
|
final ChannelListHeaderTheme channelListHeaderTheme;
|
||||||
|
|
||||||
|
/// Theme of the chat widgets dedicated to a channel
|
||||||
|
final ChannelTheme channelTheme;
|
||||||
|
|
||||||
|
/// Theme of the current user messages
|
||||||
|
final MessageTheme ownMessageTheme;
|
||||||
|
|
||||||
|
/// Theme of other users messages
|
||||||
|
final MessageTheme otherMessageTheme;
|
||||||
|
|
||||||
|
/// Theme dedicated to the [MessageInput] widget
|
||||||
|
final MessageInputTheme messageInputTheme;
|
||||||
|
|
||||||
|
/// The widget that will be built when the channel image is unavailable
|
||||||
|
final Widget Function(BuildContext, Channel) defaultChannelImage;
|
||||||
|
|
||||||
|
/// The widget that will be built when the user image is unavailable
|
||||||
|
final Widget Function(BuildContext, User) defaultUserImage;
|
||||||
|
|
||||||
|
/// Primary icon theme
|
||||||
|
final IconThemeData primaryIconTheme;
|
||||||
|
|
||||||
|
/// Assets used for rendering reactions
|
||||||
|
final List<ReactionIcon> reactionIcons;
|
||||||
|
|
||||||
|
/// Creates a copy of [StreamChatThemeData] with specified attributes
|
||||||
|
/// overridden.
|
||||||
StreamChatThemeData copyWith({
|
StreamChatThemeData copyWith({
|
||||||
TextTheme? textTheme,
|
TextTheme? textTheme,
|
||||||
ColorTheme? colorTheme,
|
ColorTheme? colorTheme,
|
||||||
@@ -185,6 +189,7 @@ class StreamChatThemeData {
|
|||||||
reactionIcons: reactionIcons ?? this.reactionIcons,
|
reactionIcons: reactionIcons ?? this.reactionIcons,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Merge themes
|
||||||
StreamChatThemeData merge(StreamChatThemeData? other) {
|
StreamChatThemeData merge(StreamChatThemeData? other) {
|
||||||
if (other == null) return this;
|
if (other == null) return this;
|
||||||
return copyWith(
|
return copyWith(
|
||||||
@@ -204,6 +209,8 @@ class StreamChatThemeData {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create theme from color and text theme
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
static StreamChatThemeData fromColorAndTextTheme(
|
static StreamChatThemeData fromColorAndTextTheme(
|
||||||
ColorTheme colorTheme,
|
ColorTheme colorTheme,
|
||||||
TextTheme textTheme,
|
TextTheme textTheme,
|
||||||
@@ -213,7 +220,7 @@ class StreamChatThemeData {
|
|||||||
textTheme: textTheme,
|
textTheme: textTheme,
|
||||||
colorTheme: colorTheme,
|
colorTheme: colorTheme,
|
||||||
primaryIconTheme: IconThemeData(color: colorTheme.black.withOpacity(.5)),
|
primaryIconTheme: IconThemeData(color: colorTheme.black.withOpacity(.5)),
|
||||||
defaultChannelImage: (context, channel) => SizedBox(),
|
defaultChannelImage: (context, channel) => const SizedBox(),
|
||||||
defaultUserImage: (context, user) => Center(
|
defaultUserImage: (context, user) => Center(
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
filterQuality: FilterQuality.high,
|
filterQuality: FilterQuality.high,
|
||||||
@@ -225,14 +232,14 @@ class StreamChatThemeData {
|
|||||||
unreadCounterColor: colorTheme.accentRed,
|
unreadCounterColor: colorTheme.accentRed,
|
||||||
avatarTheme: AvatarTheme(
|
avatarTheme: AvatarTheme(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
constraints: BoxConstraints.tightFor(
|
constraints: const BoxConstraints.tightFor(
|
||||||
height: 40,
|
height: 40,
|
||||||
width: 40,
|
width: 40,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: textTheme.bodyBold,
|
title: textTheme.bodyBold,
|
||||||
subtitle: textTheme.footnote.copyWith(
|
subtitle: textTheme.footnote.copyWith(
|
||||||
color: Color(0xff7A7A7A),
|
color: const Color(0xff7A7A7A),
|
||||||
),
|
),
|
||||||
lastMessageAt: textTheme.footnote.copyWith(
|
lastMessageAt: textTheme.footnote.copyWith(
|
||||||
color: colorTheme.black.withOpacity(.5),
|
color: colorTheme.black.withOpacity(.5),
|
||||||
@@ -241,7 +248,7 @@ class StreamChatThemeData {
|
|||||||
channelListHeaderTheme: ChannelListHeaderTheme(
|
channelListHeaderTheme: ChannelListHeaderTheme(
|
||||||
avatarTheme: AvatarTheme(
|
avatarTheme: AvatarTheme(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
constraints: BoxConstraints.tightFor(
|
constraints: const BoxConstraints.tightFor(
|
||||||
height: 40,
|
height: 40,
|
||||||
width: 40,
|
width: 40,
|
||||||
),
|
),
|
||||||
@@ -253,7 +260,7 @@ class StreamChatThemeData {
|
|||||||
channelHeaderTheme: ChannelHeaderTheme(
|
channelHeaderTheme: ChannelHeaderTheme(
|
||||||
avatarTheme: AvatarTheme(
|
avatarTheme: AvatarTheme(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
constraints: BoxConstraints.tightFor(
|
constraints: const BoxConstraints.tightFor(
|
||||||
height: 40,
|
height: 40,
|
||||||
width: 40,
|
width: 40,
|
||||||
),
|
),
|
||||||
@@ -261,7 +268,7 @@ class StreamChatThemeData {
|
|||||||
color: colorTheme.white,
|
color: colorTheme.white,
|
||||||
title: textTheme.headlineBold,
|
title: textTheme.headlineBold,
|
||||||
subtitle: textTheme.footnote.copyWith(
|
subtitle: textTheme.footnote.copyWith(
|
||||||
color: Color(0xff7A7A7A),
|
color: const Color(0xff7A7A7A),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -277,7 +284,7 @@ class StreamChatThemeData {
|
|||||||
messageBorderColor: colorTheme.greyGainsboro,
|
messageBorderColor: colorTheme.greyGainsboro,
|
||||||
avatarTheme: AvatarTheme(
|
avatarTheme: AvatarTheme(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
constraints: BoxConstraints.tightFor(
|
constraints: const BoxConstraints.tightFor(
|
||||||
height: 32,
|
height: 32,
|
||||||
width: 32,
|
width: 32,
|
||||||
),
|
),
|
||||||
@@ -301,7 +308,7 @@ class StreamChatThemeData {
|
|||||||
messageBorderColor: colorTheme.greyWhisper,
|
messageBorderColor: colorTheme.greyWhisper,
|
||||||
avatarTheme: AvatarTheme(
|
avatarTheme: AvatarTheme(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
constraints: BoxConstraints.tightFor(
|
constraints: const BoxConstraints.tightFor(
|
||||||
height: 32,
|
height: 32,
|
||||||
width: 32,
|
width: 32,
|
||||||
),
|
),
|
||||||
@@ -309,7 +316,7 @@ class StreamChatThemeData {
|
|||||||
),
|
),
|
||||||
messageInputTheme: MessageInputTheme(
|
messageInputTheme: MessageInputTheme(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
sendAnimationDuration: Duration(milliseconds: 300),
|
sendAnimationDuration: const Duration(milliseconds: 300),
|
||||||
actionButtonColor: colorTheme.accentBlue,
|
actionButtonColor: colorTheme.accentBlue,
|
||||||
actionButtonIdleColor: colorTheme.grey,
|
actionButtonIdleColor: colorTheme.grey,
|
||||||
expandButtonColor: colorTheme.accentBlue,
|
expandButtonColor: colorTheme.accentBlue,
|
||||||
@@ -356,16 +363,9 @@ class StreamChatThemeData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Class for holding text theme
|
||||||
class TextTheme {
|
class TextTheme {
|
||||||
final TextStyle title;
|
/// Initialise light text theme
|
||||||
final TextStyle headlineBold;
|
|
||||||
final TextStyle headline;
|
|
||||||
final TextStyle bodyBold;
|
|
||||||
final TextStyle body;
|
|
||||||
final TextStyle footnoteBold;
|
|
||||||
final TextStyle footnote;
|
|
||||||
final TextStyle captionBold;
|
|
||||||
|
|
||||||
TextTheme.light({
|
TextTheme.light({
|
||||||
this.title = const TextStyle(
|
this.title = const TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
@@ -408,6 +408,7 @@ class TextTheme {
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Initialise with dark theme
|
||||||
TextTheme.dark({
|
TextTheme.dark({
|
||||||
this.title = const TextStyle(
|
this.title = const TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
@@ -450,6 +451,31 @@ class TextTheme {
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Text theme for title
|
||||||
|
final TextStyle title;
|
||||||
|
|
||||||
|
/// Body Text theme for headline
|
||||||
|
final TextStyle headlineBold;
|
||||||
|
|
||||||
|
/// Text theme for headline
|
||||||
|
final TextStyle headline;
|
||||||
|
|
||||||
|
/// Bold Text theme for body
|
||||||
|
final TextStyle bodyBold;
|
||||||
|
|
||||||
|
/// Text theme body
|
||||||
|
final TextStyle body;
|
||||||
|
|
||||||
|
/// Bold Text theme for footnote
|
||||||
|
final TextStyle footnoteBold;
|
||||||
|
|
||||||
|
/// Text theme for footnote
|
||||||
|
final TextStyle footnote;
|
||||||
|
|
||||||
|
/// Bold Text theme for caption
|
||||||
|
final TextStyle captionBold;
|
||||||
|
|
||||||
|
/// Copy with theme
|
||||||
TextTheme copyWith({
|
TextTheme copyWith({
|
||||||
Brightness brightness = Brightness.light,
|
Brightness brightness = Brightness.light,
|
||||||
TextStyle? body,
|
TextStyle? body,
|
||||||
@@ -460,30 +486,30 @@ class TextTheme {
|
|||||||
TextStyle? footnoteBold,
|
TextStyle? footnoteBold,
|
||||||
TextStyle? footnote,
|
TextStyle? footnote,
|
||||||
TextStyle? captionBold,
|
TextStyle? captionBold,
|
||||||
}) {
|
}) =>
|
||||||
return brightness == Brightness.light
|
brightness == Brightness.light
|
||||||
? TextTheme.light(
|
? TextTheme.light(
|
||||||
body: body ?? this.body,
|
body: body ?? this.body,
|
||||||
title: title ?? this.title,
|
title: title ?? this.title,
|
||||||
headlineBold: headlineBold ?? this.headlineBold,
|
headlineBold: headlineBold ?? this.headlineBold,
|
||||||
headline: headline ?? this.headline,
|
headline: headline ?? this.headline,
|
||||||
bodyBold: bodyBold ?? this.bodyBold,
|
bodyBold: bodyBold ?? this.bodyBold,
|
||||||
footnoteBold: footnoteBold ?? this.footnoteBold,
|
footnoteBold: footnoteBold ?? this.footnoteBold,
|
||||||
footnote: footnote ?? this.footnote,
|
footnote: footnote ?? this.footnote,
|
||||||
captionBold: captionBold ?? this.captionBold,
|
captionBold: captionBold ?? this.captionBold,
|
||||||
)
|
)
|
||||||
: TextTheme.dark(
|
: TextTheme.dark(
|
||||||
body: body ?? this.body,
|
body: body ?? this.body,
|
||||||
title: title ?? this.title,
|
title: title ?? this.title,
|
||||||
headlineBold: headlineBold ?? this.headlineBold,
|
headlineBold: headlineBold ?? this.headlineBold,
|
||||||
headline: headline ?? this.headline,
|
headline: headline ?? this.headline,
|
||||||
bodyBold: bodyBold ?? this.bodyBold,
|
bodyBold: bodyBold ?? this.bodyBold,
|
||||||
footnoteBold: footnoteBold ?? this.footnoteBold,
|
footnoteBold: footnoteBold ?? this.footnoteBold,
|
||||||
footnote: footnote ?? this.footnote,
|
footnote: footnote ?? this.footnote,
|
||||||
captionBold: captionBold ?? this.captionBold,
|
captionBold: captionBold ?? this.captionBold,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
|
/// Merge text theme
|
||||||
TextTheme merge(TextTheme? other) {
|
TextTheme merge(TextTheme? other) {
|
||||||
if (other == null) return this;
|
if (other == null) return this;
|
||||||
return copyWith(
|
return copyWith(
|
||||||
@@ -499,28 +525,9 @@ class TextTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Theme that holds colors
|
||||||
class ColorTheme {
|
class ColorTheme {
|
||||||
final Color black;
|
/// Initialise with light theme
|
||||||
final Color grey;
|
|
||||||
final Color greyGainsboro;
|
|
||||||
final Color greyWhisper;
|
|
||||||
final Color whiteSmoke;
|
|
||||||
final Color whiteSnow;
|
|
||||||
final Color white;
|
|
||||||
final Color blueAlice;
|
|
||||||
final Color accentBlue;
|
|
||||||
final Color accentRed;
|
|
||||||
final Color accentGreen;
|
|
||||||
final Effect borderTop;
|
|
||||||
final Effect borderBottom;
|
|
||||||
final Effect shadowIconButton;
|
|
||||||
final Effect modalShadow;
|
|
||||||
final Color highlight;
|
|
||||||
final Color overlay;
|
|
||||||
final Color overlayDark;
|
|
||||||
final Gradient bgGradient;
|
|
||||||
final Brightness brightness;
|
|
||||||
|
|
||||||
ColorTheme.light({
|
ColorTheme.light({
|
||||||
this.black = const Color(0xff000000),
|
this.black = const Color(0xff000000),
|
||||||
this.grey = const Color(0xff7a7a7a),
|
this.grey = const Color(0xff7a7a7a),
|
||||||
@@ -552,6 +559,7 @@ class ColorTheme {
|
|||||||
sigmaX: 0, sigmaY: 0, color: Color(0xff000000), alpha: 1, blur: 8),
|
sigmaX: 0, sigmaY: 0, color: Color(0xff000000), alpha: 1, blur: 8),
|
||||||
}) : brightness = Brightness.light;
|
}) : brightness = Brightness.light;
|
||||||
|
|
||||||
|
/// Initialise with dark theme
|
||||||
ColorTheme.dark({
|
ColorTheme.dark({
|
||||||
this.black = const Color(0xffffffff),
|
this.black = const Color(0xffffffff),
|
||||||
this.grey = const Color(0xff7a7a7a),
|
this.grey = const Color(0xff7a7a7a),
|
||||||
@@ -605,6 +613,67 @@ class ColorTheme {
|
|||||||
),
|
),
|
||||||
}) : brightness = Brightness.dark;
|
}) : brightness = Brightness.dark;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color black;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color grey;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color greyGainsboro;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color greyWhisper;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color whiteSmoke;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color whiteSnow;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color white;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color blueAlice;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color accentBlue;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color accentRed;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color accentGreen;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Effect borderTop;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Effect borderBottom;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Effect shadowIconButton;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Effect modalShadow;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color highlight;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color overlay;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color overlayDark;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Gradient bgGradient;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Brightness brightness;
|
||||||
|
|
||||||
|
/// Copy with theme
|
||||||
ColorTheme copyWith({
|
ColorTheme copyWith({
|
||||||
Brightness brightness = Brightness.light,
|
Brightness brightness = Brightness.light,
|
||||||
Color? black,
|
Color? black,
|
||||||
@@ -626,52 +695,52 @@ class ColorTheme {
|
|||||||
Color? overlay,
|
Color? overlay,
|
||||||
Color? overlayDark,
|
Color? overlayDark,
|
||||||
Gradient? bgGradient,
|
Gradient? bgGradient,
|
||||||
}) {
|
}) =>
|
||||||
return brightness == Brightness.light
|
brightness == Brightness.light
|
||||||
? ColorTheme.light(
|
? ColorTheme.light(
|
||||||
black: black ?? this.black,
|
black: black ?? this.black,
|
||||||
grey: grey ?? this.grey,
|
grey: grey ?? this.grey,
|
||||||
greyGainsboro: greyGainsboro ?? this.greyGainsboro,
|
greyGainsboro: greyGainsboro ?? this.greyGainsboro,
|
||||||
greyWhisper: greyWhisper ?? this.greyWhisper,
|
greyWhisper: greyWhisper ?? this.greyWhisper,
|
||||||
whiteSmoke: whiteSmoke ?? this.whiteSmoke,
|
whiteSmoke: whiteSmoke ?? this.whiteSmoke,
|
||||||
whiteSnow: whiteSnow ?? this.whiteSnow,
|
whiteSnow: whiteSnow ?? this.whiteSnow,
|
||||||
white: white ?? this.white,
|
white: white ?? this.white,
|
||||||
blueAlice: blueAlice ?? this.blueAlice,
|
blueAlice: blueAlice ?? this.blueAlice,
|
||||||
accentBlue: accentBlue ?? this.accentBlue,
|
accentBlue: accentBlue ?? this.accentBlue,
|
||||||
accentRed: accentRed ?? this.accentRed,
|
accentRed: accentRed ?? this.accentRed,
|
||||||
accentGreen: accentGreen ?? this.accentGreen,
|
accentGreen: accentGreen ?? this.accentGreen,
|
||||||
borderTop: borderTop ?? this.borderTop,
|
borderTop: borderTop ?? this.borderTop,
|
||||||
borderBottom: borderBottom ?? this.borderBottom,
|
borderBottom: borderBottom ?? this.borderBottom,
|
||||||
shadowIconButton: shadowIconButton ?? this.shadowIconButton,
|
shadowIconButton: shadowIconButton ?? this.shadowIconButton,
|
||||||
modalShadow: modalShadow ?? this.modalShadow,
|
modalShadow: modalShadow ?? this.modalShadow,
|
||||||
highlight: highlight ?? this.highlight,
|
highlight: highlight ?? this.highlight,
|
||||||
overlay: overlay ?? this.overlay,
|
overlay: overlay ?? this.overlay,
|
||||||
overlayDark: overlayDark ?? this.overlayDark,
|
overlayDark: overlayDark ?? this.overlayDark,
|
||||||
bgGradient: bgGradient ?? this.bgGradient,
|
bgGradient: bgGradient ?? this.bgGradient,
|
||||||
)
|
)
|
||||||
: ColorTheme.dark(
|
: ColorTheme.dark(
|
||||||
black: black ?? this.black,
|
black: black ?? this.black,
|
||||||
grey: grey ?? this.grey,
|
grey: grey ?? this.grey,
|
||||||
greyGainsboro: greyGainsboro ?? this.greyGainsboro,
|
greyGainsboro: greyGainsboro ?? this.greyGainsboro,
|
||||||
greyWhisper: greyWhisper ?? this.greyWhisper,
|
greyWhisper: greyWhisper ?? this.greyWhisper,
|
||||||
whiteSmoke: whiteSmoke ?? this.whiteSmoke,
|
whiteSmoke: whiteSmoke ?? this.whiteSmoke,
|
||||||
whiteSnow: whiteSnow ?? this.whiteSnow,
|
whiteSnow: whiteSnow ?? this.whiteSnow,
|
||||||
white: white ?? this.white,
|
white: white ?? this.white,
|
||||||
blueAlice: blueAlice ?? this.blueAlice,
|
blueAlice: blueAlice ?? this.blueAlice,
|
||||||
accentBlue: accentBlue ?? this.accentBlue,
|
accentBlue: accentBlue ?? this.accentBlue,
|
||||||
accentRed: accentRed ?? this.accentRed,
|
accentRed: accentRed ?? this.accentRed,
|
||||||
accentGreen: accentGreen ?? this.accentGreen,
|
accentGreen: accentGreen ?? this.accentGreen,
|
||||||
borderTop: borderTop ?? this.borderTop,
|
borderTop: borderTop ?? this.borderTop,
|
||||||
borderBottom: borderBottom ?? this.borderBottom,
|
borderBottom: borderBottom ?? this.borderBottom,
|
||||||
shadowIconButton: shadowIconButton ?? this.shadowIconButton,
|
shadowIconButton: shadowIconButton ?? this.shadowIconButton,
|
||||||
modalShadow: modalShadow ?? this.modalShadow,
|
modalShadow: modalShadow ?? this.modalShadow,
|
||||||
highlight: highlight ?? this.highlight,
|
highlight: highlight ?? this.highlight,
|
||||||
overlay: overlay ?? this.overlay,
|
overlay: overlay ?? this.overlay,
|
||||||
overlayDark: overlayDark ?? this.overlayDark,
|
overlayDark: overlayDark ?? this.overlayDark,
|
||||||
bgGradient: bgGradient ?? this.bgGradient,
|
bgGradient: bgGradient ?? this.bgGradient,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
|
/// Merge color theme
|
||||||
ColorTheme merge(ColorTheme? other) {
|
ColorTheme merge(ColorTheme? other) {
|
||||||
if (other == null) return this;
|
if (other == null) return this;
|
||||||
return copyWith(
|
return copyWith(
|
||||||
@@ -700,13 +769,14 @@ class ColorTheme {
|
|||||||
|
|
||||||
/// Channel theme data
|
/// Channel theme data
|
||||||
class ChannelTheme {
|
class ChannelTheme {
|
||||||
/// Theme of the [ChannelHeader] widget
|
/// Constructor for creating [ChannelTheme]
|
||||||
final ChannelHeaderTheme channelHeaderTheme;
|
|
||||||
|
|
||||||
ChannelTheme({
|
ChannelTheme({
|
||||||
required this.channelHeaderTheme,
|
required this.channelHeaderTheme,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Theme of the [ChannelHeader] widget
|
||||||
|
final ChannelHeaderTheme channelHeaderTheme;
|
||||||
|
|
||||||
/// Creates a copy of [ChannelTheme] with specified attributes overridden.
|
/// Creates a copy of [ChannelTheme] with specified attributes overridden.
|
||||||
ChannelTheme copyWith({
|
ChannelTheme copyWith({
|
||||||
ChannelHeaderTheme? channelHeaderTheme,
|
ChannelHeaderTheme? channelHeaderTheme,
|
||||||
@@ -715,6 +785,7 @@ class ChannelTheme {
|
|||||||
channelHeaderTheme: channelHeaderTheme ?? this.channelHeaderTheme,
|
channelHeaderTheme: channelHeaderTheme ?? this.channelHeaderTheme,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Merge with theme
|
||||||
ChannelTheme merge(ChannelTheme? other) {
|
ChannelTheme merge(ChannelTheme? other) {
|
||||||
if (other == null) return this;
|
if (other == null) return this;
|
||||||
return copyWith(
|
return copyWith(
|
||||||
@@ -723,28 +794,30 @@ class ChannelTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Theme for avatar
|
||||||
class AvatarTheme {
|
class AvatarTheme {
|
||||||
final BoxConstraints? _constraints;
|
/// Constructor for creating [AvatarTheme]
|
||||||
final BorderRadius? _borderRadius;
|
|
||||||
|
|
||||||
BoxConstraints get constraints {
|
|
||||||
return _constraints ??
|
|
||||||
BoxConstraints.tightFor(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
BorderRadius get borderRadius {
|
|
||||||
return _borderRadius ?? BorderRadius.circular(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
AvatarTheme({
|
AvatarTheme({
|
||||||
BoxConstraints? constraints,
|
BoxConstraints? constraints,
|
||||||
BorderRadius? borderRadius,
|
BorderRadius? borderRadius,
|
||||||
}) : _constraints = constraints,
|
}) : _constraints = constraints,
|
||||||
_borderRadius = borderRadius;
|
_borderRadius = borderRadius;
|
||||||
|
|
||||||
|
final BoxConstraints? _constraints;
|
||||||
|
final BorderRadius? _borderRadius;
|
||||||
|
|
||||||
|
/// Get constraints for avatar
|
||||||
|
BoxConstraints get constraints =>
|
||||||
|
_constraints ??
|
||||||
|
const BoxConstraints.tightFor(
|
||||||
|
height: 32,
|
||||||
|
width: 32,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Get border radius
|
||||||
|
BorderRadius get borderRadius => _borderRadius ?? BorderRadius.circular(20);
|
||||||
|
|
||||||
|
/// Copy with another theme
|
||||||
AvatarTheme copyWith({
|
AvatarTheme copyWith({
|
||||||
BoxConstraints? constraints,
|
BoxConstraints? constraints,
|
||||||
BorderRadius? borderRadius,
|
BorderRadius? borderRadius,
|
||||||
@@ -754,6 +827,7 @@ class AvatarTheme {
|
|||||||
borderRadius: borderRadius ?? _borderRadius,
|
borderRadius: borderRadius ?? _borderRadius,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Merge with another AvatarTheme
|
||||||
AvatarTheme merge(AvatarTheme? other) {
|
AvatarTheme merge(AvatarTheme? other) {
|
||||||
if (other == null) return this;
|
if (other == null) return this;
|
||||||
return copyWith(
|
return copyWith(
|
||||||
@@ -763,19 +837,9 @@ class AvatarTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Class for getting message theme
|
||||||
class MessageTheme {
|
class MessageTheme {
|
||||||
final TextStyle? messageText;
|
/// Constructor into [MessageTheme]
|
||||||
final TextStyle? messageAuthor;
|
|
||||||
final TextStyle? messageLinks;
|
|
||||||
final TextStyle? createdAt;
|
|
||||||
final TextStyle? replies;
|
|
||||||
final Color? messageBackgroundColor;
|
|
||||||
final Color? messageBorderColor;
|
|
||||||
final Color? reactionsBackgroundColor;
|
|
||||||
final Color? reactionsBorderColor;
|
|
||||||
final Color? reactionsMaskColor;
|
|
||||||
final AvatarTheme? avatarTheme;
|
|
||||||
|
|
||||||
const MessageTheme({
|
const MessageTheme({
|
||||||
this.replies,
|
this.replies,
|
||||||
this.messageText,
|
this.messageText,
|
||||||
@@ -790,6 +854,40 @@ class MessageTheme {
|
|||||||
this.createdAt,
|
this.createdAt,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Text style for message text
|
||||||
|
final TextStyle? messageText;
|
||||||
|
|
||||||
|
/// Text style for message author
|
||||||
|
final TextStyle? messageAuthor;
|
||||||
|
|
||||||
|
/// Text style for message links
|
||||||
|
final TextStyle? messageLinks;
|
||||||
|
|
||||||
|
/// Text style for created at text
|
||||||
|
final TextStyle? createdAt;
|
||||||
|
|
||||||
|
/// Text style for replies
|
||||||
|
final TextStyle? replies;
|
||||||
|
|
||||||
|
/// Color for messageBackgroundColor
|
||||||
|
final Color? messageBackgroundColor;
|
||||||
|
|
||||||
|
/// Color for message border color
|
||||||
|
final Color? messageBorderColor;
|
||||||
|
|
||||||
|
/// Color for reactions
|
||||||
|
final Color? reactionsBackgroundColor;
|
||||||
|
|
||||||
|
/// Colors reaction border
|
||||||
|
final Color? reactionsBorderColor;
|
||||||
|
|
||||||
|
/// Color for reaction mask
|
||||||
|
final Color? reactionsMaskColor;
|
||||||
|
|
||||||
|
/// Theme of the avatar
|
||||||
|
final AvatarTheme? avatarTheme;
|
||||||
|
|
||||||
|
/// Copy with a theme
|
||||||
MessageTheme copyWith({
|
MessageTheme copyWith({
|
||||||
TextStyle? messageText,
|
TextStyle? messageText,
|
||||||
TextStyle? messageAuthor,
|
TextStyle? messageAuthor,
|
||||||
@@ -819,6 +917,7 @@ class MessageTheme {
|
|||||||
reactionsMaskColor: reactionsMaskColor ?? this.reactionsMaskColor,
|
reactionsMaskColor: reactionsMaskColor ?? this.reactionsMaskColor,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Merge with a theme
|
||||||
MessageTheme merge(MessageTheme? other) {
|
MessageTheme merge(MessageTheme? other) {
|
||||||
if (other == null) return this;
|
if (other == null) return this;
|
||||||
return copyWith(
|
return copyWith(
|
||||||
@@ -839,14 +938,9 @@ class MessageTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Theme for channel preview
|
||||||
class ChannelPreviewTheme {
|
class ChannelPreviewTheme {
|
||||||
final TextStyle? title;
|
/// Constructor for creating [ChannelPreviewTheme]
|
||||||
final TextStyle? subtitle;
|
|
||||||
final TextStyle? lastMessageAt;
|
|
||||||
final AvatarTheme? avatarTheme;
|
|
||||||
final Color? unreadCounterColor;
|
|
||||||
final double? indicatorIconSize;
|
|
||||||
|
|
||||||
const ChannelPreviewTheme({
|
const ChannelPreviewTheme({
|
||||||
this.title,
|
this.title,
|
||||||
this.subtitle,
|
this.subtitle,
|
||||||
@@ -856,6 +950,25 @@ class ChannelPreviewTheme {
|
|||||||
this.indicatorIconSize,
|
this.indicatorIconSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Theme for title
|
||||||
|
final TextStyle? title;
|
||||||
|
|
||||||
|
/// Theme for subtitle
|
||||||
|
final TextStyle? subtitle;
|
||||||
|
|
||||||
|
/// Theme of last message at
|
||||||
|
final TextStyle? lastMessageAt;
|
||||||
|
|
||||||
|
/// Avatar theme
|
||||||
|
final AvatarTheme? avatarTheme;
|
||||||
|
|
||||||
|
/// Unread counter color
|
||||||
|
final Color? unreadCounterColor;
|
||||||
|
|
||||||
|
/// Indicator icon size
|
||||||
|
final double? indicatorIconSize;
|
||||||
|
|
||||||
|
/// Copy with theme
|
||||||
ChannelPreviewTheme copyWith({
|
ChannelPreviewTheme copyWith({
|
||||||
TextStyle? title,
|
TextStyle? title,
|
||||||
TextStyle? subtitle,
|
TextStyle? subtitle,
|
||||||
@@ -873,6 +986,7 @@ class ChannelPreviewTheme {
|
|||||||
indicatorIconSize: indicatorIconSize ?? this.indicatorIconSize,
|
indicatorIconSize: indicatorIconSize ?? this.indicatorIconSize,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Merge with theme
|
||||||
ChannelPreviewTheme merge(ChannelPreviewTheme? other) {
|
ChannelPreviewTheme merge(ChannelPreviewTheme? other) {
|
||||||
if (other == null) return this;
|
if (other == null) return this;
|
||||||
return copyWith(
|
return copyWith(
|
||||||
@@ -886,12 +1000,9 @@ class ChannelPreviewTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Theme for [ChannelHeader]
|
||||||
class ChannelHeaderTheme {
|
class ChannelHeaderTheme {
|
||||||
final TextStyle? title;
|
/// Constructor for creating a [ChannelHeaderTheme]
|
||||||
final TextStyle? subtitle;
|
|
||||||
final AvatarTheme? avatarTheme;
|
|
||||||
final Color? color;
|
|
||||||
|
|
||||||
const ChannelHeaderTheme({
|
const ChannelHeaderTheme({
|
||||||
this.title,
|
this.title,
|
||||||
this.subtitle,
|
this.subtitle,
|
||||||
@@ -899,6 +1010,19 @@ class ChannelHeaderTheme {
|
|||||||
this.color,
|
this.color,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Theme for title
|
||||||
|
final TextStyle? title;
|
||||||
|
|
||||||
|
/// Theme for subtitle
|
||||||
|
final TextStyle? subtitle;
|
||||||
|
|
||||||
|
/// Theme for avatar
|
||||||
|
final AvatarTheme? avatarTheme;
|
||||||
|
|
||||||
|
/// Color for [ChannelHeaderTheme]
|
||||||
|
final Color? color;
|
||||||
|
|
||||||
|
/// Copy with theme
|
||||||
ChannelHeaderTheme copyWith({
|
ChannelHeaderTheme copyWith({
|
||||||
TextStyle? title,
|
TextStyle? title,
|
||||||
TextStyle? subtitle,
|
TextStyle? subtitle,
|
||||||
@@ -912,6 +1036,7 @@ class ChannelHeaderTheme {
|
|||||||
color: color ?? this.color,
|
color: color ?? this.color,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Merge with other [ChannelHeaderTheme]
|
||||||
ChannelHeaderTheme merge(ChannelHeaderTheme? other) {
|
ChannelHeaderTheme merge(ChannelHeaderTheme? other) {
|
||||||
if (other == null) return this;
|
if (other == null) return this;
|
||||||
return copyWith(
|
return copyWith(
|
||||||
@@ -925,6 +1050,13 @@ class ChannelHeaderTheme {
|
|||||||
|
|
||||||
/// Theme dedicated to the [ChannelListHeader]
|
/// Theme dedicated to the [ChannelListHeader]
|
||||||
class ChannelListHeaderTheme {
|
class ChannelListHeaderTheme {
|
||||||
|
/// Returns a new [ChannelListHeaderTheme]
|
||||||
|
const ChannelListHeaderTheme({
|
||||||
|
this.title,
|
||||||
|
this.avatarTheme,
|
||||||
|
this.color,
|
||||||
|
});
|
||||||
|
|
||||||
/// Style of the title text
|
/// Style of the title text
|
||||||
final TextStyle? title;
|
final TextStyle? title;
|
||||||
|
|
||||||
@@ -934,13 +1066,6 @@ class ChannelListHeaderTheme {
|
|||||||
/// Background color of the appbar
|
/// Background color of the appbar
|
||||||
final Color? color;
|
final Color? color;
|
||||||
|
|
||||||
/// Returns a new [ChannelListHeaderTheme]
|
|
||||||
const ChannelListHeaderTheme({
|
|
||||||
this.title,
|
|
||||||
this.avatarTheme,
|
|
||||||
this.color,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// Returns a new [ChannelListHeaderTheme] replacing some of its properties
|
/// Returns a new [ChannelListHeaderTheme] replacing some of its properties
|
||||||
ChannelListHeaderTheme copyWith({
|
ChannelListHeaderTheme copyWith({
|
||||||
TextStyle? title,
|
TextStyle? title,
|
||||||
@@ -966,6 +1091,22 @@ class ChannelListHeaderTheme {
|
|||||||
|
|
||||||
/// Defines the theme dedicated to the [MessageInput] widget
|
/// Defines the theme dedicated to the [MessageInput] widget
|
||||||
class MessageInputTheme {
|
class MessageInputTheme {
|
||||||
|
/// Returns a new [MessageInputTheme]
|
||||||
|
const MessageInputTheme({
|
||||||
|
this.sendAnimationDuration,
|
||||||
|
this.actionButtonColor,
|
||||||
|
this.sendButtonColor,
|
||||||
|
this.actionButtonIdleColor,
|
||||||
|
this.sendButtonIdleColor,
|
||||||
|
this.inputBackground,
|
||||||
|
this.inputTextStyle,
|
||||||
|
this.inputDecoration,
|
||||||
|
this.activeBorderGradient,
|
||||||
|
this.idleBorderGradient,
|
||||||
|
this.borderRadius,
|
||||||
|
this.expandButtonColor,
|
||||||
|
});
|
||||||
|
|
||||||
/// Duration of the [MessageInput] send button animation
|
/// Duration of the [MessageInput] send button animation
|
||||||
final Duration? sendAnimationDuration;
|
final Duration? sendAnimationDuration;
|
||||||
|
|
||||||
@@ -1002,22 +1143,6 @@ class MessageInputTheme {
|
|||||||
/// Border radius of [MessageInput]
|
/// Border radius of [MessageInput]
|
||||||
final BorderRadius? borderRadius;
|
final BorderRadius? borderRadius;
|
||||||
|
|
||||||
/// Returns a new [MessageInputTheme]
|
|
||||||
const MessageInputTheme({
|
|
||||||
this.sendAnimationDuration,
|
|
||||||
this.actionButtonColor,
|
|
||||||
this.sendButtonColor,
|
|
||||||
this.actionButtonIdleColor,
|
|
||||||
this.sendButtonIdleColor,
|
|
||||||
this.inputBackground,
|
|
||||||
this.inputTextStyle,
|
|
||||||
this.inputDecoration,
|
|
||||||
this.activeBorderGradient,
|
|
||||||
this.idleBorderGradient,
|
|
||||||
this.borderRadius,
|
|
||||||
this.expandButtonColor,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// Returns a new [MessageInputTheme] replacing some of its properties
|
/// Returns a new [MessageInputTheme] replacing some of its properties
|
||||||
MessageInputTheme copyWith({
|
MessageInputTheme copyWith({
|
||||||
Duration? sendAnimationDuration,
|
Duration? sendAnimationDuration,
|
||||||
@@ -1071,13 +1196,9 @@ class MessageInputTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Effect store
|
||||||
class Effect {
|
class Effect {
|
||||||
final double? sigmaX;
|
/// Constructor for creating [Effect]
|
||||||
final double? sigmaY;
|
|
||||||
final Color? color;
|
|
||||||
final double? alpha;
|
|
||||||
final double? blur;
|
|
||||||
|
|
||||||
const Effect({
|
const Effect({
|
||||||
this.sigmaX,
|
this.sigmaX,
|
||||||
this.sigmaY,
|
this.sigmaY,
|
||||||
@@ -1086,6 +1207,22 @@ class Effect {
|
|||||||
this.blur,
|
this.blur,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
///
|
||||||
|
final double? sigmaX;
|
||||||
|
|
||||||
|
///
|
||||||
|
final double? sigmaY;
|
||||||
|
|
||||||
|
///
|
||||||
|
final Color? color;
|
||||||
|
|
||||||
|
///
|
||||||
|
final double? alpha;
|
||||||
|
|
||||||
|
///
|
||||||
|
final double? blur;
|
||||||
|
|
||||||
|
/// Copy with new effect
|
||||||
Effect copyWith({
|
Effect copyWith({
|
||||||
double? sigmaX,
|
double? sigmaX,
|
||||||
double? sigmaY,
|
double? sigmaY,
|
||||||
|
|||||||
Reference in New Issue
Block a user