refactor(ui, core): Deprecate v3
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// {@macro avatar_theme_data}
|
||||
@Deprecated("Use 'StreamAvatarThemeData' instead")
|
||||
typedef AvatarThemeData = StreamAvatarThemeData;
|
||||
|
||||
/// {@template avatar_theme_data}
|
||||
/// A style that overrides the default appearance of various avatar widgets.
|
||||
/// {@endtemplate}
|
||||
// ignore: prefer-match-file-name
|
||||
class AvatarThemeData with Diagnosticable {
|
||||
/// Creates an [AvatarThemeData].
|
||||
const AvatarThemeData({
|
||||
class StreamAvatarThemeData with Diagnosticable {
|
||||
/// Creates an [StreamAvatarThemeData].
|
||||
const StreamAvatarThemeData({
|
||||
BoxConstraints? constraints,
|
||||
BorderRadius? borderRadius,
|
||||
}) : _constraints = constraints,
|
||||
@@ -25,12 +31,12 @@ class AvatarThemeData with Diagnosticable {
|
||||
/// Get border radius
|
||||
BorderRadius get borderRadius => _borderRadius ?? BorderRadius.circular(20);
|
||||
|
||||
/// Copy this [AvatarThemeData] to another.
|
||||
AvatarThemeData copyWith({
|
||||
/// Copy this [StreamAvatarThemeData] to another.
|
||||
StreamAvatarThemeData copyWith({
|
||||
BoxConstraints? constraints,
|
||||
BorderRadius? borderRadius,
|
||||
}) =>
|
||||
AvatarThemeData(
|
||||
StreamAvatarThemeData(
|
||||
constraints: constraints ?? _constraints,
|
||||
borderRadius: borderRadius ?? _borderRadius,
|
||||
);
|
||||
@@ -38,12 +44,12 @@ class AvatarThemeData with Diagnosticable {
|
||||
/// Linearly interpolate between two [UserAvatar] themes.
|
||||
///
|
||||
/// All the properties must be non-null.
|
||||
AvatarThemeData lerp(
|
||||
AvatarThemeData a,
|
||||
AvatarThemeData b,
|
||||
StreamAvatarThemeData lerp(
|
||||
StreamAvatarThemeData a,
|
||||
StreamAvatarThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
AvatarThemeData(
|
||||
StreamAvatarThemeData(
|
||||
borderRadius: BorderRadius.lerp(a.borderRadius, b.borderRadius, t),
|
||||
constraints: BoxConstraints.lerp(a.constraints, b.constraints, t),
|
||||
);
|
||||
@@ -51,7 +57,7 @@ class AvatarThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AvatarThemeData &&
|
||||
other is StreamAvatarThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
_constraints == other._constraints &&
|
||||
_borderRadius == other._borderRadius;
|
||||
@@ -59,8 +65,8 @@ class AvatarThemeData with Diagnosticable {
|
||||
@override
|
||||
int get hashCode => _constraints.hashCode ^ _borderRadius.hashCode;
|
||||
|
||||
/// Merges one [AvatarThemeData] with the another
|
||||
AvatarThemeData merge(AvatarThemeData? other) {
|
||||
/// Merges one [StreamAvatarThemeData] with the another
|
||||
StreamAvatarThemeData merge(StreamAvatarThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
constraints: other._constraints,
|
||||
|
||||
@@ -4,27 +4,33 @@ import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
import 'package:stream_chat_flutter/src/theme/avatar_theme.dart';
|
||||
import 'package:stream_chat_flutter/src/theme/themes.dart';
|
||||
|
||||
/// {@macro channel_header_theme}
|
||||
@Deprecated("Use 'StreamChannelHeaderTheme' instead")
|
||||
typedef ChannelHeaderTheme = StreamChannelHeaderTheme;
|
||||
|
||||
/// {@template channel_header_theme}
|
||||
/// Overrides the default style of [ChannelHeader] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ChannelHeaderThemeData], which is used to configure this theme.
|
||||
class ChannelHeaderTheme extends InheritedTheme {
|
||||
/// Creates a [ChannelHeaderTheme].
|
||||
/// * [StreamChannelHeaderThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamChannelHeaderTheme extends InheritedTheme {
|
||||
/// Creates a [StreamChannelHeaderTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const ChannelHeaderTheme({
|
||||
const StreamChannelHeaderTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final ChannelHeaderThemeData data;
|
||||
final StreamChannelHeaderThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [ChannelHeaderTheme] widget, then
|
||||
/// If there is no enclosing [StreamChannelHeaderTheme] widget, then
|
||||
/// [StreamChatThemeData.channelTheme.channelHeaderTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -32,34 +38,40 @@ class ChannelHeaderTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// final theme = ChannelHeaderTheme.of(context);
|
||||
/// ```
|
||||
static ChannelHeaderThemeData of(BuildContext context) {
|
||||
static StreamChannelHeaderThemeData of(BuildContext context) {
|
||||
final channelHeaderTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<ChannelHeaderTheme>();
|
||||
context.dependOnInheritedWidgetOfExactType<StreamChannelHeaderTheme>();
|
||||
return channelHeaderTheme?.data ??
|
||||
StreamChatTheme.of(context).channelHeaderTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
ChannelHeaderTheme(data: data, child: child);
|
||||
StreamChannelHeaderTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ChannelHeaderTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamChannelHeaderTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro channel_header_theme_data}
|
||||
@Deprecated("Use 'StreamChannelHeaderThemeData' instead")
|
||||
typedef ChannelHeaderThemeData = StreamChannelHeaderThemeData;
|
||||
|
||||
/// {@template channel_header_theme_data}
|
||||
/// A style that overrides the default appearance of [ChannelHeader]s when used
|
||||
/// with [ChannelHeaderTheme] or with the overall [StreamChatTheme]'s
|
||||
/// with [StreamChannelHeaderTheme] or with the overall [StreamChatTheme]'s
|
||||
/// [StreamChatThemeData.channelHeaderTheme].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ChannelHeaderTheme], the theme which is configured with this class.
|
||||
/// * [StreamChannelHeaderTheme], the theme which is configured with this class.
|
||||
/// * [StreamChatThemeData.channelHeaderTheme], which can be used to override
|
||||
/// the default style for [ChannelHeader]s below the overall [StreamChatTheme].
|
||||
class ChannelHeaderThemeData with Diagnosticable {
|
||||
/// Creates a [ChannelHeaderThemeData]
|
||||
const ChannelHeaderThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamChannelHeaderThemeData with Diagnosticable {
|
||||
/// Creates a [StreamChannelHeaderThemeData]
|
||||
const StreamChannelHeaderThemeData({
|
||||
this.titleStyle,
|
||||
this.subtitleStyle,
|
||||
this.avatarTheme,
|
||||
@@ -73,43 +85,43 @@ class ChannelHeaderThemeData with Diagnosticable {
|
||||
final TextStyle? subtitleStyle;
|
||||
|
||||
/// Theme for avatar
|
||||
final AvatarThemeData? avatarTheme;
|
||||
final StreamAvatarThemeData? avatarTheme;
|
||||
|
||||
/// Color for [ChannelHeaderThemeData]
|
||||
/// Color for [StreamChannelHeaderThemeData]
|
||||
final Color? color;
|
||||
|
||||
/// Copy with theme
|
||||
ChannelHeaderThemeData copyWith({
|
||||
StreamChannelHeaderThemeData copyWith({
|
||||
TextStyle? titleStyle,
|
||||
TextStyle? subtitleStyle,
|
||||
AvatarThemeData? avatarTheme,
|
||||
StreamAvatarThemeData? avatarTheme,
|
||||
Color? color,
|
||||
}) =>
|
||||
ChannelHeaderThemeData(
|
||||
StreamChannelHeaderThemeData(
|
||||
titleStyle: titleStyle ?? this.titleStyle,
|
||||
subtitleStyle: subtitleStyle ?? this.subtitleStyle,
|
||||
avatarTheme: avatarTheme ?? this.avatarTheme,
|
||||
color: color ?? this.color,
|
||||
);
|
||||
|
||||
/// Linearly interpolate between two [ChannelHeaderThemeData].
|
||||
/// Linearly interpolate between two [StreamChannelHeaderThemeData].
|
||||
///
|
||||
/// All the properties must be non-null.
|
||||
ChannelHeaderThemeData lerp(
|
||||
ChannelHeaderThemeData a,
|
||||
ChannelHeaderThemeData b,
|
||||
StreamChannelHeaderThemeData lerp(
|
||||
StreamChannelHeaderThemeData a,
|
||||
StreamChannelHeaderThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
ChannelHeaderThemeData(
|
||||
StreamChannelHeaderThemeData(
|
||||
titleStyle: TextStyle.lerp(a.titleStyle, b.titleStyle, t),
|
||||
subtitleStyle: TextStyle.lerp(a.subtitleStyle, b.subtitleStyle, t),
|
||||
avatarTheme:
|
||||
const AvatarThemeData().lerp(a.avatarTheme!, b.avatarTheme!, t),
|
||||
avatarTheme: const StreamAvatarThemeData()
|
||||
.lerp(a.avatarTheme!, b.avatarTheme!, t),
|
||||
color: Color.lerp(a.color, b.color, t),
|
||||
);
|
||||
|
||||
/// Merge with other [ChannelHeaderThemeData]
|
||||
ChannelHeaderThemeData merge(ChannelHeaderThemeData? other) {
|
||||
/// Merge with other [StreamChannelHeaderThemeData]
|
||||
StreamChannelHeaderThemeData merge(StreamChannelHeaderThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
titleStyle: titleStyle?.merge(other.titleStyle) ?? other.titleStyle,
|
||||
@@ -123,7 +135,7 @@ class ChannelHeaderThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is ChannelHeaderThemeData &&
|
||||
other is StreamChannelHeaderThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
titleStyle == other.titleStyle &&
|
||||
subtitleStyle == other.subtitleStyle &&
|
||||
|
||||
@@ -3,27 +3,33 @@ import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
import 'package:stream_chat_flutter/src/theme/avatar_theme.dart';
|
||||
|
||||
/// {@macro channel_list_header_theme}
|
||||
@Deprecated("Use 'StreamChannelListHeaderTheme' instead")
|
||||
typedef ChannelListHeaderTheme = StreamChannelListHeaderTheme;
|
||||
|
||||
/// {@template channel_list_header_theme}
|
||||
/// Overrides the default style of [ChannelListHeader] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ChannelListHeaderThemeData], which is used to configure this theme.
|
||||
class ChannelListHeaderTheme extends InheritedTheme {
|
||||
/// Creates a [ChannelListHeaderTheme].
|
||||
/// * [StreamChannelListHeaderThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamChannelListHeaderTheme extends InheritedTheme {
|
||||
/// Creates a [StreamChannelListHeaderTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const ChannelListHeaderTheme({
|
||||
const StreamChannelListHeaderTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final ChannelListHeaderThemeData data;
|
||||
final StreamChannelListHeaderThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [ChannelListHeaderTheme] widget, then
|
||||
/// If there is no enclosing [StreamChannelListHeaderTheme] widget, then
|
||||
/// [StreamChatThemeData.channelListHeaderTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -31,26 +37,32 @@ class ChannelListHeaderTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// final theme = ChannelListHeaderTheme.of(context);
|
||||
/// ```
|
||||
static ChannelListHeaderThemeData of(BuildContext context) {
|
||||
final channelListHeaderTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<ChannelListHeaderTheme>();
|
||||
static StreamChannelListHeaderThemeData of(BuildContext context) {
|
||||
final channelListHeaderTheme = context
|
||||
.dependOnInheritedWidgetOfExactType<StreamChannelListHeaderTheme>();
|
||||
return channelListHeaderTheme?.data ??
|
||||
StreamChatTheme.of(context).channelListHeaderTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
ChannelListHeaderTheme(data: data, child: child);
|
||||
StreamChannelListHeaderTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ChannelListHeaderTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamChannelListHeaderTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro channel_list_header_theme_data}
|
||||
@Deprecated("Use ''StreamChannelListHeaderThemeData' instead")
|
||||
typedef ChannelListHeaderThemeData = StreamChannelListHeaderThemeData;
|
||||
|
||||
/// {@template channel_list_header_theme_data}
|
||||
/// Theme dedicated to the [ChannelListHeader]
|
||||
class ChannelListHeaderThemeData with Diagnosticable {
|
||||
/// Returns a new [ChannelListHeaderThemeData]
|
||||
const ChannelListHeaderThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamChannelListHeaderThemeData with Diagnosticable {
|
||||
/// Returns a new [StreamChannelListHeaderThemeData]
|
||||
const StreamChannelListHeaderThemeData({
|
||||
this.titleStyle,
|
||||
this.avatarTheme,
|
||||
this.color,
|
||||
@@ -60,39 +72,41 @@ class ChannelListHeaderThemeData with Diagnosticable {
|
||||
final TextStyle? titleStyle;
|
||||
|
||||
/// Theme dedicated to the userAvatar
|
||||
final AvatarThemeData? avatarTheme;
|
||||
final StreamAvatarThemeData? avatarTheme;
|
||||
|
||||
/// Background color of the appbar
|
||||
final Color? color;
|
||||
|
||||
/// Returns a new [ChannelListHeaderThemeData] replacing some of its
|
||||
/// Returns a new [StreamChannelListHeaderThemeData] replacing some of its
|
||||
/// properties
|
||||
ChannelListHeaderThemeData copyWith({
|
||||
StreamChannelListHeaderThemeData copyWith({
|
||||
TextStyle? titleStyle,
|
||||
AvatarThemeData? avatarTheme,
|
||||
StreamAvatarThemeData? avatarTheme,
|
||||
Color? color,
|
||||
}) =>
|
||||
ChannelListHeaderThemeData(
|
||||
StreamChannelListHeaderThemeData(
|
||||
titleStyle: titleStyle ?? this.titleStyle,
|
||||
avatarTheme: avatarTheme ?? this.avatarTheme,
|
||||
color: color ?? this.color,
|
||||
);
|
||||
|
||||
/// Linearly interpolate from one [ChannelListHeaderThemeData] to another.
|
||||
ChannelListHeaderThemeData lerp(
|
||||
ChannelListHeaderThemeData a,
|
||||
ChannelListHeaderThemeData b,
|
||||
/// Linearly interpolate from one [StreamChannelListHeaderThemeData] to another.
|
||||
StreamChannelListHeaderThemeData lerp(
|
||||
StreamChannelListHeaderThemeData a,
|
||||
StreamChannelListHeaderThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
ChannelListHeaderThemeData(
|
||||
avatarTheme:
|
||||
const AvatarThemeData().lerp(a.avatarTheme!, b.avatarTheme!, t),
|
||||
StreamChannelListHeaderThemeData(
|
||||
avatarTheme: const StreamAvatarThemeData()
|
||||
.lerp(a.avatarTheme!, b.avatarTheme!, t),
|
||||
color: Color.lerp(a.color, b.color, t),
|
||||
titleStyle: TextStyle.lerp(a.titleStyle, b.titleStyle, t),
|
||||
);
|
||||
|
||||
/// Merges [this] [ChannelListHeaderThemeData] with the [other]
|
||||
ChannelListHeaderThemeData merge(ChannelListHeaderThemeData? other) {
|
||||
/// Merges [this] [StreamChannelListHeaderThemeData] with the [other]
|
||||
StreamChannelListHeaderThemeData merge(
|
||||
StreamChannelListHeaderThemeData? other,
|
||||
) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
titleStyle: titleStyle?.merge(other.titleStyle) ?? other.titleStyle,
|
||||
@@ -104,7 +118,7 @@ class ChannelListHeaderThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is ChannelListHeaderThemeData &&
|
||||
other is StreamChannelListHeaderThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
titleStyle == other.titleStyle &&
|
||||
avatarTheme == other.avatarTheme &&
|
||||
|
||||
@@ -2,27 +2,33 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// {@macro channel_list_view_theme}
|
||||
@Deprecated("Use 'StreamChannelListViewTheme' instead")
|
||||
typedef ChannelListViewTheme = StreamChannelListViewTheme;
|
||||
|
||||
/// {@template channel_list_view_theme}
|
||||
/// Overrides the default style of [ChannelListView] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ChannelListViewThemeData], which is used to configure this theme.
|
||||
class ChannelListViewTheme extends InheritedTheme {
|
||||
/// Creates a [ChannelListViewTheme].
|
||||
/// * [StreamChannelListViewThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamChannelListViewTheme extends InheritedTheme {
|
||||
/// Creates a [StreamChannelListViewTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const ChannelListViewTheme({
|
||||
const StreamChannelListViewTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final ChannelListViewThemeData data;
|
||||
final StreamChannelListViewThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [ChannelListViewTheme] widget, then
|
||||
/// If there is no enclosing [StreamChannelListViewTheme] widget, then
|
||||
/// [StreamChatThemeData.channelListViewTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -30,63 +36,69 @@ class ChannelListViewTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// ChannelListViewTheme theme = ChannelListViewTheme.of(context);
|
||||
/// ```
|
||||
static ChannelListViewThemeData of(BuildContext context) {
|
||||
final channelListViewTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<ChannelListViewTheme>();
|
||||
static StreamChannelListViewThemeData of(BuildContext context) {
|
||||
final channelListViewTheme = context
|
||||
.dependOnInheritedWidgetOfExactType<StreamChannelListViewTheme>();
|
||||
return channelListViewTheme?.data ??
|
||||
StreamChatTheme.of(context).channelListViewTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
ChannelListViewTheme(data: data, child: child);
|
||||
StreamChannelListViewTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ChannelListViewTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamChannelListViewTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro channel_list_view_theme_data}
|
||||
@Deprecated("Use 'StreamChannelListViewThemeData' instead")
|
||||
typedef ChannelListViewThemeData = StreamChannelListViewThemeData;
|
||||
|
||||
/// {@template channel_list_view_theme_data}
|
||||
/// A style that overrides the default appearance of [ChannelListView]s when
|
||||
/// used with [ChannelListViewTheme] or with the overall [StreamChatTheme]'s
|
||||
/// used with [StreamChannelListViewTheme] or with the overall [StreamChatTheme]'s
|
||||
/// [StreamChatThemeData.channelListViewTheme].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ChannelListViewTheme], the theme which is configured with this class.
|
||||
/// * [StreamChannelListViewTheme], the theme which is configured with this class.
|
||||
/// * [StreamChatThemeData.channelListViewTheme], which can be used to override
|
||||
/// the default style for [ChannelListView]s below the overall
|
||||
/// [StreamChatTheme].
|
||||
class ChannelListViewThemeData with Diagnosticable {
|
||||
/// Creates a [ChannelListViewThemeData].
|
||||
const ChannelListViewThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamChannelListViewThemeData with Diagnosticable {
|
||||
/// Creates a [StreamChannelListViewThemeData].
|
||||
const StreamChannelListViewThemeData({
|
||||
this.backgroundColor,
|
||||
});
|
||||
|
||||
/// The color of the [ChannelListView] background.
|
||||
final Color? backgroundColor;
|
||||
|
||||
/// Copies this [ChannelListViewThemeData] to another.
|
||||
ChannelListViewThemeData copyWith({
|
||||
/// Copies this [StreamChannelListViewThemeData] to another.
|
||||
StreamChannelListViewThemeData copyWith({
|
||||
Color? backgroundColor,
|
||||
}) =>
|
||||
ChannelListViewThemeData(
|
||||
StreamChannelListViewThemeData(
|
||||
backgroundColor: backgroundColor ?? this.backgroundColor,
|
||||
);
|
||||
|
||||
/// Linearly interpolate between two [ChannelListViewThemeData] themes.
|
||||
/// Linearly interpolate between two [StreamChannelListViewThemeData] themes.
|
||||
///
|
||||
/// All the properties must be non-null.
|
||||
ChannelListViewThemeData lerp(
|
||||
ChannelListViewThemeData a,
|
||||
ChannelListViewThemeData b,
|
||||
StreamChannelListViewThemeData lerp(
|
||||
StreamChannelListViewThemeData a,
|
||||
StreamChannelListViewThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
ChannelListViewThemeData(
|
||||
StreamChannelListViewThemeData(
|
||||
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
|
||||
);
|
||||
|
||||
/// Merges one [ChannelListViewThemeData] with another.
|
||||
ChannelListViewThemeData merge(ChannelListViewThemeData? other) {
|
||||
/// Merges one [StreamChannelListViewThemeData] with another.
|
||||
StreamChannelListViewThemeData merge(StreamChannelListViewThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
backgroundColor: other.backgroundColor,
|
||||
@@ -96,7 +108,7 @@ class ChannelListViewThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is ChannelListViewThemeData &&
|
||||
other is StreamChannelListViewThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
backgroundColor == other.backgroundColor;
|
||||
|
||||
|
||||
@@ -3,27 +3,33 @@ import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
import 'package:stream_chat_flutter/src/theme/avatar_theme.dart';
|
||||
|
||||
/// {@macro channel_preview_theme}
|
||||
@Deprecated("Use 'StreamChannelPreviewTheme' instead")
|
||||
typedef ChannelPreviewTheme = StreamChannelPreviewTheme;
|
||||
|
||||
/// {@template channel_preview_theme}
|
||||
/// Overrides the default style of [ChannelPreview] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ChannelPreviewThemeData], which is used to configure this theme.
|
||||
class ChannelPreviewTheme extends InheritedTheme {
|
||||
/// Creates a [ChannelPreviewTheme].
|
||||
/// * [StreamChannelPreviewThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamChannelPreviewTheme extends InheritedTheme {
|
||||
/// Creates a [StreamChannelPreviewTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const ChannelPreviewTheme({
|
||||
const StreamChannelPreviewTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final ChannelPreviewThemeData data;
|
||||
final StreamChannelPreviewThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [ChannelPreviewTheme] widget, then
|
||||
/// If there is no enclosing [StreamChannelPreviewTheme] widget, then
|
||||
/// [StreamChatThemeData.channelPreviewTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -31,34 +37,40 @@ class ChannelPreviewTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// final theme = ChannelPreviewTheme.of(context);
|
||||
/// ```
|
||||
static ChannelPreviewThemeData of(BuildContext context) {
|
||||
static StreamChannelPreviewThemeData of(BuildContext context) {
|
||||
final channelPreviewTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<ChannelPreviewTheme>();
|
||||
context.dependOnInheritedWidgetOfExactType<StreamChannelPreviewTheme>();
|
||||
return channelPreviewTheme?.data ??
|
||||
StreamChatTheme.of(context).channelPreviewTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
ChannelPreviewTheme(data: data, child: child);
|
||||
StreamChannelPreviewTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ChannelPreviewTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamChannelPreviewTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro channel_preview_theme_data}
|
||||
@Deprecated("Use 'StreamChannelPreviewThemeData' instead")
|
||||
typedef ChannelPreviewThemeData = StreamChannelPreviewThemeData;
|
||||
|
||||
/// {@template channel_preview_theme_data}
|
||||
/// A style that overrides the default appearance of [ChannelPreview]s when used
|
||||
/// with [ChannelPreviewTheme] or with the overall [StreamChatTheme]'s
|
||||
/// with [StreamChannelPreviewTheme] or with the overall [StreamChatTheme]'s
|
||||
/// [StreamChatThemeData.channelPreviewTheme].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [ChannelPreviewTheme], the theme which is configured with this class.
|
||||
/// * [StreamChannelPreviewTheme], the theme which is configured with this class.
|
||||
/// * [StreamChatThemeData.channelPreviewTheme], which can be used to override
|
||||
/// the default style for [ChannelHeader]s below the overall [StreamChatTheme].
|
||||
class ChannelPreviewThemeData with Diagnosticable {
|
||||
/// Creates a [ChannelPreviewThemeData].
|
||||
const ChannelPreviewThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamChannelPreviewThemeData with Diagnosticable {
|
||||
/// Creates a [StreamChannelPreviewThemeData].
|
||||
const StreamChannelPreviewThemeData({
|
||||
this.titleStyle,
|
||||
this.subtitleStyle,
|
||||
this.lastMessageAtStyle,
|
||||
@@ -77,7 +89,7 @@ class ChannelPreviewThemeData with Diagnosticable {
|
||||
final TextStyle? lastMessageAtStyle;
|
||||
|
||||
/// Avatar theme
|
||||
final AvatarThemeData? avatarTheme;
|
||||
final StreamAvatarThemeData? avatarTheme;
|
||||
|
||||
/// Unread counter color
|
||||
final Color? unreadCounterColor;
|
||||
@@ -86,15 +98,15 @@ class ChannelPreviewThemeData with Diagnosticable {
|
||||
final double? indicatorIconSize;
|
||||
|
||||
/// Copy with theme
|
||||
ChannelPreviewThemeData copyWith({
|
||||
StreamChannelPreviewThemeData copyWith({
|
||||
TextStyle? titleStyle,
|
||||
TextStyle? subtitleStyle,
|
||||
TextStyle? lastMessageAtStyle,
|
||||
AvatarThemeData? avatarTheme,
|
||||
StreamAvatarThemeData? avatarTheme,
|
||||
Color? unreadCounterColor,
|
||||
double? indicatorIconSize,
|
||||
}) =>
|
||||
ChannelPreviewThemeData(
|
||||
StreamChannelPreviewThemeData(
|
||||
titleStyle: titleStyle ?? this.titleStyle,
|
||||
subtitleStyle: subtitleStyle ?? this.subtitleStyle,
|
||||
lastMessageAtStyle: lastMessageAtStyle ?? this.lastMessageAtStyle,
|
||||
@@ -103,15 +115,15 @@ class ChannelPreviewThemeData with Diagnosticable {
|
||||
indicatorIconSize: indicatorIconSize ?? this.indicatorIconSize,
|
||||
);
|
||||
|
||||
/// Linearly interpolate one [ChannelPreviewThemeData] to another.
|
||||
ChannelPreviewThemeData lerp(
|
||||
ChannelPreviewThemeData a,
|
||||
ChannelPreviewThemeData b,
|
||||
/// Linearly interpolate one [StreamChannelPreviewThemeData] to another.
|
||||
StreamChannelPreviewThemeData lerp(
|
||||
StreamChannelPreviewThemeData a,
|
||||
StreamChannelPreviewThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
ChannelPreviewThemeData(
|
||||
avatarTheme:
|
||||
const AvatarThemeData().lerp(a.avatarTheme!, b.avatarTheme!, t),
|
||||
StreamChannelPreviewThemeData(
|
||||
avatarTheme: const StreamAvatarThemeData()
|
||||
.lerp(a.avatarTheme!, b.avatarTheme!, t),
|
||||
indicatorIconSize: a.indicatorIconSize,
|
||||
lastMessageAtStyle:
|
||||
TextStyle.lerp(a.lastMessageAtStyle, b.lastMessageAtStyle, t),
|
||||
@@ -122,7 +134,7 @@ class ChannelPreviewThemeData with Diagnosticable {
|
||||
);
|
||||
|
||||
/// Merge with theme
|
||||
ChannelPreviewThemeData merge(ChannelPreviewThemeData? other) {
|
||||
StreamChannelPreviewThemeData merge(StreamChannelPreviewThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
titleStyle: titleStyle?.merge(other.titleStyle) ?? other.titleStyle,
|
||||
@@ -138,7 +150,7 @@ class ChannelPreviewThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is ChannelPreviewThemeData &&
|
||||
other is StreamChannelPreviewThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
titleStyle == other.titleStyle &&
|
||||
subtitleStyle == other.subtitleStyle &&
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// {@macro color_theme}
|
||||
@Deprecated("Use 'StreamColorTheme' instead")
|
||||
typedef ColorTheme = StreamColorTheme;
|
||||
|
||||
/// {@template color_theme}
|
||||
/// Theme that holds colors
|
||||
class ColorTheme {
|
||||
/// {@endtemplate}
|
||||
class StreamColorTheme {
|
||||
/// Initialise with light theme
|
||||
ColorTheme.light({
|
||||
StreamColorTheme.light({
|
||||
this.textHighEmphasis = const Color(0xff000000),
|
||||
this.textLowEmphasis = const Color(0xff7a7a7a),
|
||||
this.disabled = const Color(0xffdbdbdb),
|
||||
@@ -55,7 +61,7 @@ class ColorTheme {
|
||||
}) : brightness = Brightness.light;
|
||||
|
||||
/// Initialise with dark theme
|
||||
ColorTheme.dark({
|
||||
StreamColorTheme.dark({
|
||||
this.textHighEmphasis = const Color(0xffffffff),
|
||||
this.textLowEmphasis = const Color(0xff7a7a7a),
|
||||
this.disabled = const Color(0xff2d2f2f),
|
||||
@@ -169,7 +175,7 @@ class ColorTheme {
|
||||
final Brightness brightness;
|
||||
|
||||
/// Copy with theme
|
||||
ColorTheme copyWith({
|
||||
StreamColorTheme copyWith({
|
||||
Brightness brightness = Brightness.light,
|
||||
Color? textHighEmphasis,
|
||||
Color? textLowEmphasis,
|
||||
@@ -192,7 +198,7 @@ class ColorTheme {
|
||||
Gradient? bgGradient,
|
||||
}) =>
|
||||
brightness == Brightness.light
|
||||
? ColorTheme.light(
|
||||
? StreamColorTheme.light(
|
||||
textHighEmphasis: textHighEmphasis ?? this.textHighEmphasis,
|
||||
textLowEmphasis: textLowEmphasis ?? this.textLowEmphasis,
|
||||
disabled: disabled ?? this.disabled,
|
||||
@@ -213,7 +219,7 @@ class ColorTheme {
|
||||
overlayDark: overlayDark ?? this.overlayDark,
|
||||
bgGradient: bgGradient ?? this.bgGradient,
|
||||
)
|
||||
: ColorTheme.dark(
|
||||
: StreamColorTheme.dark(
|
||||
textHighEmphasis: textHighEmphasis ?? this.textHighEmphasis,
|
||||
textLowEmphasis: textLowEmphasis ?? this.textLowEmphasis,
|
||||
disabled: disabled ?? this.disabled,
|
||||
@@ -236,7 +242,7 @@ class ColorTheme {
|
||||
);
|
||||
|
||||
/// Merge color theme
|
||||
ColorTheme merge(ColorTheme? other) {
|
||||
StreamColorTheme merge(StreamColorTheme? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
textHighEmphasis: other.textHighEmphasis,
|
||||
|
||||
@@ -2,27 +2,33 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// {@macro gallery_footer_theme}
|
||||
@Deprecated("Use 'StreamGalleryFooterTheme' instead")
|
||||
typedef GalleryFooterTheme = StreamGalleryFooterTheme;
|
||||
|
||||
/// {@template gallery_footer_theme}
|
||||
/// Overrides the default style of [GalleryFooter] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [GalleryFooterThemeData], which is used to configure this theme.
|
||||
class GalleryFooterTheme extends InheritedTheme {
|
||||
/// Creates an [GalleryFooterTheme].
|
||||
/// * [StreamGalleryFooterThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamGalleryFooterTheme extends InheritedTheme {
|
||||
/// Creates an [StreamGalleryFooterTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const GalleryFooterTheme({
|
||||
const StreamGalleryFooterTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final GalleryFooterThemeData data;
|
||||
final StreamGalleryFooterThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [GalleryFooterTheme] widget, then
|
||||
/// If there is no enclosing [StreamGalleryFooterTheme] widget, then
|
||||
/// [StreamChatThemeData.galleryFooterTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -30,34 +36,40 @@ class GalleryFooterTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// ImageFooterTheme theme = ImageFooterTheme.of(context);
|
||||
/// ```
|
||||
static GalleryFooterThemeData of(BuildContext context) {
|
||||
static StreamGalleryFooterThemeData of(BuildContext context) {
|
||||
final imageFooterTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<GalleryFooterTheme>();
|
||||
context.dependOnInheritedWidgetOfExactType<StreamGalleryFooterTheme>();
|
||||
return imageFooterTheme?.data ??
|
||||
StreamChatTheme.of(context).galleryFooterTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
GalleryFooterTheme(data: data, child: child);
|
||||
StreamGalleryFooterTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(GalleryFooterTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamGalleryFooterTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro gallery_footer_theme_data}
|
||||
@Deprecated("Use 'StreamGalleryFooterThemeData' instead")
|
||||
typedef GalleryFooterThemeData = StreamGalleryFooterThemeData;
|
||||
|
||||
/// {@template gallery_footer_theme_data}
|
||||
/// A style that overrides the default appearance of [GalleryFooter]s when used
|
||||
/// with [GalleryFooterTheme] or with the overall [StreamChatTheme]'s
|
||||
/// with [StreamGalleryFooterTheme] or with the overall [StreamChatTheme]'s
|
||||
/// [StreamChatThemeData.galleryFooterTheme].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [GalleryFooterTheme], the theme which is configured with this class.
|
||||
/// * [StreamGalleryFooterTheme], the theme which is configured with this class.
|
||||
/// * [StreamChatThemeData.galleryFooterTheme], which can be used to override
|
||||
/// the default style for [GalleryFooter]s below the overall [StreamChatTheme].
|
||||
class GalleryFooterThemeData with Diagnosticable {
|
||||
/// Creates an [GalleryFooterThemeData].
|
||||
const GalleryFooterThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamGalleryFooterThemeData with Diagnosticable {
|
||||
/// Creates an [StreamGalleryFooterThemeData].
|
||||
const StreamGalleryFooterThemeData({
|
||||
this.backgroundColor,
|
||||
this.shareIconColor,
|
||||
this.titleTextStyle,
|
||||
@@ -108,8 +120,8 @@ class GalleryFooterThemeData with Diagnosticable {
|
||||
/// Defaults to [ColorTheme.textHighEmphasis].
|
||||
final Color? bottomSheetCloseIconColor;
|
||||
|
||||
/// Copies this [GalleryFooterThemeData] to another.
|
||||
GalleryFooterThemeData copyWith({
|
||||
/// Copies this [StreamGalleryFooterThemeData] to another.
|
||||
StreamGalleryFooterThemeData copyWith({
|
||||
Color? backgroundColor,
|
||||
Color? shareIconColor,
|
||||
TextStyle? titleTextStyle,
|
||||
@@ -119,7 +131,7 @@ class GalleryFooterThemeData with Diagnosticable {
|
||||
TextStyle? bottomSheetPhotosTextStyle,
|
||||
Color? bottomSheetCloseIconColor,
|
||||
}) =>
|
||||
GalleryFooterThemeData(
|
||||
StreamGalleryFooterThemeData(
|
||||
backgroundColor: backgroundColor ?? this.backgroundColor,
|
||||
shareIconColor: shareIconColor ?? this.shareIconColor,
|
||||
titleTextStyle: titleTextStyle ?? this.titleTextStyle,
|
||||
@@ -137,12 +149,12 @@ class GalleryFooterThemeData with Diagnosticable {
|
||||
/// Linearly interpolate between two [GalleryFooter] themes.
|
||||
///
|
||||
/// All the properties must be non-null.
|
||||
GalleryFooterThemeData lerp(
|
||||
GalleryFooterThemeData a,
|
||||
GalleryFooterThemeData b,
|
||||
StreamGalleryFooterThemeData lerp(
|
||||
StreamGalleryFooterThemeData a,
|
||||
StreamGalleryFooterThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
GalleryFooterThemeData(
|
||||
StreamGalleryFooterThemeData(
|
||||
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
|
||||
shareIconColor: Color.lerp(a.shareIconColor, b.shareIconColor, t),
|
||||
titleTextStyle: TextStyle.lerp(a.titleTextStyle, b.titleTextStyle, t),
|
||||
@@ -167,8 +179,8 @@ class GalleryFooterThemeData with Diagnosticable {
|
||||
),
|
||||
);
|
||||
|
||||
/// Merges one [GalleryFooterThemeData] with another.
|
||||
GalleryFooterThemeData merge(GalleryFooterThemeData? other) {
|
||||
/// Merges one [StreamGalleryFooterThemeData] with another.
|
||||
StreamGalleryFooterThemeData merge(StreamGalleryFooterThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
backgroundColor: other.backgroundColor,
|
||||
@@ -185,7 +197,7 @@ class GalleryFooterThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is GalleryFooterThemeData &&
|
||||
other is StreamGalleryFooterThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
backgroundColor == other.backgroundColor &&
|
||||
shareIconColor == other.shareIconColor &&
|
||||
|
||||
@@ -2,27 +2,33 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// {@macro gallery_header_them}
|
||||
@Deprecated("Use 'StreamGalleryHeaderTheme' instead")
|
||||
typedef GalleryHeaderTheme = StreamGalleryHeaderTheme;
|
||||
|
||||
/// {@template gallery_header_theme}
|
||||
/// Overrides the default style of [GalleryHeader] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [GalleryHeaderThemeData], which is used to configure this theme.
|
||||
class GalleryHeaderTheme extends InheritedTheme {
|
||||
/// Creates a [GalleryHeaderTheme].
|
||||
/// * [StreamGalleryHeaderThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamGalleryHeaderTheme extends InheritedTheme {
|
||||
/// Creates a [StreamGalleryHeaderTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const GalleryHeaderTheme({
|
||||
const StreamGalleryHeaderTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final GalleryHeaderThemeData data;
|
||||
final StreamGalleryHeaderThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [GalleryHeaderTheme] widget, then
|
||||
/// If there is no enclosing [StreamGalleryHeaderTheme] widget, then
|
||||
/// [StreamChatThemeData.galleryHeaderTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -30,34 +36,40 @@ class GalleryHeaderTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// ImageHeaderTheme theme = ImageHeaderTheme.of(context);
|
||||
/// ```
|
||||
static GalleryHeaderThemeData of(BuildContext context) {
|
||||
static StreamGalleryHeaderThemeData of(BuildContext context) {
|
||||
final galleryHeaderTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<GalleryHeaderTheme>();
|
||||
context.dependOnInheritedWidgetOfExactType<StreamGalleryHeaderTheme>();
|
||||
return galleryHeaderTheme?.data ??
|
||||
StreamChatTheme.of(context).galleryHeaderTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
GalleryHeaderTheme(data: data, child: child);
|
||||
StreamGalleryHeaderTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(GalleryHeaderTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamGalleryHeaderTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro gallery_header_theme_data}
|
||||
@Deprecated("Use 'StreamGalleryHeaderThemeData' instead")
|
||||
typedef GalleryHeaderThemeData = StreamGalleryHeaderThemeData;
|
||||
|
||||
/// {@template gallery_header_theme_data}
|
||||
/// A style that overrides the default appearance of [GalleryHeader]s when used
|
||||
/// with [GalleryHeaderTheme] or with the overall [StreamChatTheme]'s
|
||||
/// with [StreamGalleryHeaderTheme] or with the overall [StreamChatTheme]'s
|
||||
/// [StreamChatThemeData.galleryHeaderTheme].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [GalleryHeaderTheme], the theme which is configured with this class.
|
||||
/// * [StreamGalleryHeaderTheme], the theme which is configured with this class.
|
||||
/// * [StreamChatThemeData.galleryHeaderTheme], which can be used to override
|
||||
/// the default style for [GalleryHeader]s below the overall [StreamChatTheme].
|
||||
class GalleryHeaderThemeData with Diagnosticable {
|
||||
/// Creates an [GalleryHeaderThemeData].
|
||||
const GalleryHeaderThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamGalleryHeaderThemeData with Diagnosticable {
|
||||
/// Creates an [StreamGalleryHeaderThemeData].
|
||||
const StreamGalleryHeaderThemeData({
|
||||
this.closeButtonColor,
|
||||
this.backgroundColor,
|
||||
this.iconMenuPointColor,
|
||||
@@ -92,8 +104,8 @@ class GalleryHeaderThemeData with Diagnosticable {
|
||||
///
|
||||
final Color? bottomSheetBarrierColor;
|
||||
|
||||
/// Copies this [GalleryHeaderThemeData] to another.
|
||||
GalleryHeaderThemeData copyWith({
|
||||
/// Copies this [StreamGalleryHeaderThemeData] to another.
|
||||
StreamGalleryHeaderThemeData copyWith({
|
||||
Color? closeButtonColor,
|
||||
Color? backgroundColor,
|
||||
Color? iconMenuPointColor,
|
||||
@@ -101,7 +113,7 @@ class GalleryHeaderThemeData with Diagnosticable {
|
||||
TextStyle? subtitleTextStyle,
|
||||
Color? bottomSheetBarrierColor,
|
||||
}) =>
|
||||
GalleryHeaderThemeData(
|
||||
StreamGalleryHeaderThemeData(
|
||||
closeButtonColor: closeButtonColor ?? this.closeButtonColor,
|
||||
backgroundColor: backgroundColor ?? this.backgroundColor,
|
||||
iconMenuPointColor: iconMenuPointColor ?? this.iconMenuPointColor,
|
||||
@@ -114,12 +126,12 @@ class GalleryHeaderThemeData with Diagnosticable {
|
||||
/// Linearly interpolate between two [GalleryHeader] themes.
|
||||
///
|
||||
/// All the properties must be non-null.
|
||||
GalleryHeaderThemeData lerp(
|
||||
GalleryHeaderThemeData a,
|
||||
GalleryHeaderThemeData b,
|
||||
StreamGalleryHeaderThemeData lerp(
|
||||
StreamGalleryHeaderThemeData a,
|
||||
StreamGalleryHeaderThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
GalleryHeaderThemeData(
|
||||
StreamGalleryHeaderThemeData(
|
||||
closeButtonColor: Color.lerp(a.closeButtonColor, b.closeButtonColor, t),
|
||||
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
|
||||
iconMenuPointColor:
|
||||
@@ -131,8 +143,8 @@ class GalleryHeaderThemeData with Diagnosticable {
|
||||
Color.lerp(a.bottomSheetBarrierColor, b.bottomSheetBarrierColor, t),
|
||||
);
|
||||
|
||||
/// Merges one [GalleryHeaderThemeData] with the another
|
||||
GalleryHeaderThemeData merge(GalleryHeaderThemeData? other) {
|
||||
/// Merges one [StreamGalleryHeaderThemeData] with the another
|
||||
StreamGalleryHeaderThemeData merge(StreamGalleryHeaderThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
closeButtonColor: other.closeButtonColor,
|
||||
@@ -147,7 +159,7 @@ class GalleryHeaderThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is GalleryHeaderThemeData &&
|
||||
other is StreamGalleryHeaderThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
closeButtonColor == other.closeButtonColor &&
|
||||
backgroundColor == other.backgroundColor &&
|
||||
|
||||
@@ -5,27 +5,33 @@ import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/src/extension.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// {@macro message_input_theme}
|
||||
@Deprecated("Use 'StreamMessageInputTheme' instead")
|
||||
typedef MessageInputTheme = StreamMessageInputTheme;
|
||||
|
||||
/// {@template message_input_theme}
|
||||
/// Overrides the default style of [MessageInput] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [MessageInputThemeData], which is used to configure this theme.
|
||||
class MessageInputTheme extends InheritedTheme {
|
||||
/// Creates a [MessageInputTheme].
|
||||
/// * [StreamMessageInputThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamMessageInputTheme extends InheritedTheme {
|
||||
/// Creates a [StreamMessageInputTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const MessageInputTheme({
|
||||
const StreamMessageInputTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final MessageInputThemeData data;
|
||||
final StreamMessageInputThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [MessageInputTheme] widget, then
|
||||
/// If there is no enclosing [StreamMessageInputTheme] widget, then
|
||||
/// [StreamChatThemeData.messageInputTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -33,28 +39,34 @@ class MessageInputTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// final theme = MessageInputTheme.of(context);
|
||||
/// ```
|
||||
static MessageInputThemeData of(BuildContext context) {
|
||||
static StreamMessageInputThemeData of(BuildContext context) {
|
||||
final messageInputTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<MessageInputTheme>();
|
||||
context.dependOnInheritedWidgetOfExactType<StreamMessageInputTheme>();
|
||||
return messageInputTheme?.data ??
|
||||
StreamChatTheme.of(context).messageInputTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
MessageInputTheme(data: data, child: child);
|
||||
StreamMessageInputTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(MessageInputTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamMessageInputTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro message_input_theme_data}
|
||||
@Deprecated("Use 'StreamMessageInputThemeData' instead")
|
||||
typedef MessageInputThemeData = StreamMessageInputThemeData;
|
||||
|
||||
/// {@template message_input_theme_data}
|
||||
/// A style that overrides the default appearance of [MessageInput] widgets
|
||||
/// when used with [MessageInputTheme] or with the overall [StreamChatTheme]'s
|
||||
/// when used with [StreamMessageInputTheme] or with the overall [StreamChatTheme]'s
|
||||
/// [StreamChatThemeData.messageInputTheme].
|
||||
class MessageInputThemeData with Diagnosticable {
|
||||
/// Creates a [MessageInputThemeData].
|
||||
const MessageInputThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamMessageInputThemeData with Diagnosticable {
|
||||
/// Creates a [StreamMessageInputThemeData].
|
||||
const StreamMessageInputThemeData({
|
||||
this.sendAnimationDuration,
|
||||
this.actionButtonColor,
|
||||
this.sendButtonColor,
|
||||
@@ -121,8 +133,8 @@ class MessageInputThemeData with Diagnosticable {
|
||||
/// Shadow for the [MessageInput] widget
|
||||
final BoxShadow? shadow;
|
||||
|
||||
/// Returns a new [MessageInputThemeData] replacing some of its properties
|
||||
MessageInputThemeData copyWith({
|
||||
/// Returns a new [StreamMessageInputThemeData] replacing some of its properties
|
||||
StreamMessageInputThemeData copyWith({
|
||||
Duration? sendAnimationDuration,
|
||||
Color? inputBackgroundColor,
|
||||
Color? actionButtonColor,
|
||||
@@ -140,7 +152,7 @@ class MessageInputThemeData with Diagnosticable {
|
||||
double? elevation,
|
||||
BoxShadow? shadow,
|
||||
}) =>
|
||||
MessageInputThemeData(
|
||||
StreamMessageInputThemeData(
|
||||
sendAnimationDuration:
|
||||
sendAnimationDuration ?? this.sendAnimationDuration,
|
||||
inputBackgroundColor: inputBackgroundColor ?? this.inputBackgroundColor,
|
||||
@@ -161,13 +173,13 @@ class MessageInputThemeData with Diagnosticable {
|
||||
shadow: shadow ?? this.shadow,
|
||||
);
|
||||
|
||||
/// Linearly interpolate from one [MessageInputThemeData] to another.
|
||||
MessageInputThemeData lerp(
|
||||
MessageInputThemeData a,
|
||||
MessageInputThemeData b,
|
||||
/// Linearly interpolate from one [StreamMessageInputThemeData] to another.
|
||||
StreamMessageInputThemeData lerp(
|
||||
StreamMessageInputThemeData a,
|
||||
StreamMessageInputThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
MessageInputThemeData(
|
||||
StreamMessageInputThemeData(
|
||||
actionButtonColor:
|
||||
Color.lerp(a.actionButtonColor, b.actionButtonColor, t),
|
||||
actionButtonIdleColor:
|
||||
@@ -194,8 +206,8 @@ class MessageInputThemeData with Diagnosticable {
|
||||
shadow: BoxShadow.lerp(a.shadow, b.shadow, t),
|
||||
);
|
||||
|
||||
/// Merges [this] [MessageInputThemeData] with the [other]
|
||||
MessageInputThemeData merge(MessageInputThemeData? other) {
|
||||
/// Merges [this] [StreamMessageInputThemeData] with the [other]
|
||||
StreamMessageInputThemeData merge(StreamMessageInputThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
sendAnimationDuration: other.sendAnimationDuration,
|
||||
@@ -222,7 +234,7 @@ class MessageInputThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is MessageInputThemeData &&
|
||||
other is StreamMessageInputThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
sendAnimationDuration == other.sendAnimationDuration &&
|
||||
sendButtonColor == other.sendButtonColor &&
|
||||
|
||||
@@ -2,27 +2,33 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// {@macro message_list_view_theme}
|
||||
@Deprecated("Use 'StreamMessageListViewTheme' instead")
|
||||
typedef MessageListViewTheme = StreamMessageListViewTheme;
|
||||
|
||||
/// {@template message_list_view_theme}
|
||||
/// Overrides the default style of [MessageListView] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [MessageListViewThemeData], which is used to configure this theme.
|
||||
class MessageListViewTheme extends InheritedTheme {
|
||||
/// Creates a [MessageListViewTheme].
|
||||
/// * [StreamMessageListViewThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamMessageListViewTheme extends InheritedTheme {
|
||||
/// Creates a [StreamMessageListViewTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const MessageListViewTheme({
|
||||
const StreamMessageListViewTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final MessageListViewThemeData data;
|
||||
final StreamMessageListViewThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [MessageListViewTheme] widget, then
|
||||
/// If there is no enclosing [StreamMessageListViewTheme] widget, then
|
||||
/// [StreamChatThemeData.messageListViewTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -30,35 +36,41 @@ class MessageListViewTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// MessageListViewTheme theme = MessageListViewTheme.of(context);
|
||||
/// ```
|
||||
static MessageListViewThemeData of(BuildContext context) {
|
||||
final messageListViewTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<MessageListViewTheme>();
|
||||
static StreamMessageListViewThemeData of(BuildContext context) {
|
||||
final messageListViewTheme = context
|
||||
.dependOnInheritedWidgetOfExactType<StreamMessageListViewTheme>();
|
||||
return messageListViewTheme?.data ??
|
||||
StreamChatTheme.of(context).messageListViewTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
MessageListViewTheme(data: data, child: child);
|
||||
StreamMessageListViewTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(MessageListViewTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamMessageListViewTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro message_list_view_theme_data}
|
||||
@Deprecated("Use 'StreamMessageListViewThemeData' instead")
|
||||
typedef MessageListViewThemeData = StreamMessageListViewThemeData;
|
||||
|
||||
/// {@template message_list_view_theme_data}
|
||||
/// A style that overrides the default appearance of [MessageListView]s when
|
||||
/// used with [MessageListViewTheme] or with the overall [StreamChatTheme]'s
|
||||
/// used with [StreamMessageListViewTheme] or with the overall [StreamChatTheme]'s
|
||||
/// [StreamChatThemeData.messageListViewTheme].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [MessageListViewTheme], the theme which is configured with this class.
|
||||
/// * [StreamMessageListViewTheme], the theme which is configured with this class.
|
||||
/// * [StreamChatThemeData.messageListViewTheme], which can be used to override
|
||||
/// the default style for [MessageListView]s below the overall
|
||||
/// [StreamChatTheme].
|
||||
class MessageListViewThemeData with Diagnosticable {
|
||||
/// Creates a [MessageListViewThemeData].
|
||||
const MessageListViewThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamMessageListViewThemeData with Diagnosticable {
|
||||
/// Creates a [StreamMessageListViewThemeData].
|
||||
const StreamMessageListViewThemeData({
|
||||
this.backgroundColor,
|
||||
this.backgroundImage,
|
||||
});
|
||||
@@ -69,12 +81,12 @@ class MessageListViewThemeData with Diagnosticable {
|
||||
/// The image of the [MessageListView] background.
|
||||
final DecorationImage? backgroundImage;
|
||||
|
||||
/// Copies this [MessageListViewThemeData] to another.
|
||||
MessageListViewThemeData copyWith({
|
||||
/// Copies this [StreamMessageListViewThemeData] to another.
|
||||
StreamMessageListViewThemeData copyWith({
|
||||
Color? backgroundColor,
|
||||
DecorationImage? backgroundImage,
|
||||
}) =>
|
||||
MessageListViewThemeData(
|
||||
StreamMessageListViewThemeData(
|
||||
backgroundColor: backgroundColor ?? this.backgroundColor,
|
||||
backgroundImage: backgroundImage ?? this.backgroundImage,
|
||||
);
|
||||
@@ -82,18 +94,18 @@ class MessageListViewThemeData with Diagnosticable {
|
||||
/// Linearly interpolate between two [MessageListView] themes.
|
||||
///
|
||||
/// All the properties must be non-null.
|
||||
MessageListViewThemeData lerp(
|
||||
MessageListViewThemeData a,
|
||||
MessageListViewThemeData b,
|
||||
StreamMessageListViewThemeData lerp(
|
||||
StreamMessageListViewThemeData a,
|
||||
StreamMessageListViewThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
MessageListViewThemeData(
|
||||
StreamMessageListViewThemeData(
|
||||
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
|
||||
backgroundImage: t < 0.5 ? a.backgroundImage : b.backgroundImage,
|
||||
);
|
||||
|
||||
/// Merges one [MessageListViewThemeData] with another.
|
||||
MessageListViewThemeData merge(MessageListViewThemeData? other) {
|
||||
/// Merges one [StreamMessageListViewThemeData] with another.
|
||||
StreamMessageListViewThemeData merge(StreamMessageListViewThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
backgroundColor: other.backgroundColor,
|
||||
@@ -104,7 +116,7 @@ class MessageListViewThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is MessageListViewThemeData &&
|
||||
other is StreamMessageListViewThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
backgroundColor == other.backgroundColor &&
|
||||
backgroundImage == other.backgroundImage;
|
||||
|
||||
@@ -2,23 +2,29 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// {@macro message_search_list_view_theme}
|
||||
@Deprecated("Use 'StreamMessageSearchListViewTheme' instead")
|
||||
typedef MessageSearchListViewTheme = StreamMessageSearchListViewTheme;
|
||||
|
||||
/// {@template message_search_list_view_theme}
|
||||
/// Overrides the default style of [MessageSearchListView] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [UserListViewThemeData], which is used to configure this theme.
|
||||
class MessageSearchListViewTheme extends InheritedTheme {
|
||||
/// {@endtemplate}
|
||||
class StreamMessageSearchListViewTheme extends InheritedTheme {
|
||||
/// Creates a [UserListViewTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const MessageSearchListViewTheme({
|
||||
const StreamMessageSearchListViewTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final MessageSearchListViewThemeData data;
|
||||
final StreamMessageSearchListViewThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
@@ -30,64 +36,72 @@ class MessageSearchListViewTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// MessageSearchListViewTheme theme = MessageSearchListViewTheme.of(context);
|
||||
/// ```
|
||||
static MessageSearchListViewThemeData of(BuildContext context) {
|
||||
static StreamMessageSearchListViewThemeData of(BuildContext context) {
|
||||
final messageSearchListViewTheme = context
|
||||
.dependOnInheritedWidgetOfExactType<MessageSearchListViewTheme>();
|
||||
.dependOnInheritedWidgetOfExactType<StreamMessageSearchListViewTheme>();
|
||||
return messageSearchListViewTheme?.data ??
|
||||
StreamChatTheme.of(context).messageSearchListViewTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
MessageSearchListViewTheme(data: data, child: child);
|
||||
StreamMessageSearchListViewTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(MessageSearchListViewTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamMessageSearchListViewTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro message_search_list_view_theme_data}
|
||||
@Deprecated("Use 'StreamMessageSearchListViewThemeData' instead")
|
||||
typedef MessageSearchListViewThemeData = StreamMessageSearchListViewThemeData;
|
||||
|
||||
/// {@macro message_search_list_view_theme_data}
|
||||
/// A style that overrides the default appearance of [MessageSearchListView]s
|
||||
/// when used with [MessageSearchListView] or with the overall
|
||||
/// [StreamChatTheme]'s [StreamChatThemeData.messageSearchListViewTheme].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [MessageSearchListViewTheme], the theme which is configured with this
|
||||
/// * [StreamMessageSearchListViewTheme], the theme which is configured with this
|
||||
/// class.
|
||||
/// * [StreamChatThemeData.messageSearchListViewTheme], which can be used to
|
||||
/// override the default style for [UserListView]s below the overall
|
||||
/// [StreamChatTheme].
|
||||
class MessageSearchListViewThemeData with Diagnosticable {
|
||||
/// Creates a [MessageSearchListViewThemeData].
|
||||
const MessageSearchListViewThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamMessageSearchListViewThemeData with Diagnosticable {
|
||||
/// Creates a [StreamMessageSearchListViewThemeData].
|
||||
const StreamMessageSearchListViewThemeData({
|
||||
this.backgroundColor,
|
||||
});
|
||||
|
||||
/// The color of the [MessageSearchListView] background.
|
||||
final Color? backgroundColor;
|
||||
|
||||
/// Copies this [MessageSearchListViewThemeData] to another.
|
||||
MessageSearchListViewThemeData copyWith({
|
||||
/// Copies this [StreamMessageSearchListViewThemeData] to another.
|
||||
StreamMessageSearchListViewThemeData copyWith({
|
||||
Color? backgroundColor,
|
||||
}) =>
|
||||
MessageSearchListViewThemeData(
|
||||
StreamMessageSearchListViewThemeData(
|
||||
backgroundColor: backgroundColor ?? this.backgroundColor,
|
||||
);
|
||||
|
||||
/// Linearly interpolate between two [UserListViewThemeData] themes.
|
||||
///
|
||||
/// All the properties must be non-null.
|
||||
MessageSearchListViewThemeData lerp(
|
||||
MessageSearchListViewThemeData a,
|
||||
MessageSearchListViewThemeData b,
|
||||
StreamMessageSearchListViewThemeData lerp(
|
||||
StreamMessageSearchListViewThemeData a,
|
||||
StreamMessageSearchListViewThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
MessageSearchListViewThemeData(
|
||||
StreamMessageSearchListViewThemeData(
|
||||
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
|
||||
);
|
||||
|
||||
/// Merges one [MessageSearchListViewThemeData] with another.
|
||||
MessageSearchListViewThemeData merge(MessageSearchListViewThemeData? other) {
|
||||
/// Merges one [StreamMessageSearchListViewThemeData] with another.
|
||||
StreamMessageSearchListViewThemeData merge(
|
||||
StreamMessageSearchListViewThemeData? other,
|
||||
) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
backgroundColor: other.backgroundColor,
|
||||
@@ -97,7 +111,7 @@ class MessageSearchListViewThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is MessageSearchListViewThemeData &&
|
||||
other is StreamMessageSearchListViewThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
backgroundColor == other.backgroundColor;
|
||||
|
||||
|
||||
@@ -2,11 +2,17 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/src/theme/avatar_theme.dart';
|
||||
|
||||
/// {@macro message_theme_data}
|
||||
@Deprecated("Use 'StreamMessageThemeData' instead")
|
||||
typedef MessageThemeData = StreamMessageThemeData;
|
||||
|
||||
/// {@template message_theme_data}
|
||||
/// Class for getting message theme
|
||||
/// {@endtemplate}
|
||||
// ignore: prefer-match-file-name
|
||||
class MessageThemeData with Diagnosticable {
|
||||
/// Creates a [MessageThemeData].
|
||||
const MessageThemeData({
|
||||
class StreamMessageThemeData with Diagnosticable {
|
||||
/// Creates a [StreamMessageThemeData].
|
||||
const StreamMessageThemeData({
|
||||
this.repliesStyle,
|
||||
this.messageTextStyle,
|
||||
this.messageAuthorStyle,
|
||||
@@ -52,13 +58,13 @@ class MessageThemeData with Diagnosticable {
|
||||
final Color? reactionsMaskColor;
|
||||
|
||||
/// Theme of the avatar
|
||||
final AvatarThemeData? avatarTheme;
|
||||
final StreamAvatarThemeData? avatarTheme;
|
||||
|
||||
/// Background color for messages with url attachments.
|
||||
final Color? linkBackgroundColor;
|
||||
|
||||
/// Copy with a theme
|
||||
MessageThemeData copyWith({
|
||||
StreamMessageThemeData copyWith({
|
||||
TextStyle? messageTextStyle,
|
||||
TextStyle? messageAuthorStyle,
|
||||
TextStyle? messageLinksStyle,
|
||||
@@ -66,13 +72,13 @@ class MessageThemeData with Diagnosticable {
|
||||
TextStyle? repliesStyle,
|
||||
Color? messageBackgroundColor,
|
||||
Color? messageBorderColor,
|
||||
AvatarThemeData? avatarTheme,
|
||||
StreamAvatarThemeData? avatarTheme,
|
||||
Color? reactionsBackgroundColor,
|
||||
Color? reactionsBorderColor,
|
||||
Color? reactionsMaskColor,
|
||||
Color? linkBackgroundColor,
|
||||
}) =>
|
||||
MessageThemeData(
|
||||
StreamMessageThemeData(
|
||||
messageTextStyle: messageTextStyle ?? this.messageTextStyle,
|
||||
messageAuthorStyle: messageAuthorStyle ?? this.messageAuthorStyle,
|
||||
messageLinksStyle: messageLinksStyle ?? this.messageLinksStyle,
|
||||
@@ -89,11 +95,15 @@ class MessageThemeData with Diagnosticable {
|
||||
linkBackgroundColor: linkBackgroundColor ?? this.linkBackgroundColor,
|
||||
);
|
||||
|
||||
/// Linearly interpolate from one [MessageThemeData] to another.
|
||||
MessageThemeData lerp(MessageThemeData a, MessageThemeData b, double t) =>
|
||||
MessageThemeData(
|
||||
avatarTheme:
|
||||
const AvatarThemeData().lerp(a.avatarTheme!, b.avatarTheme!, t),
|
||||
/// Linearly interpolate from one [StreamMessageThemeData] to another.
|
||||
StreamMessageThemeData lerp(
|
||||
StreamMessageThemeData a,
|
||||
StreamMessageThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
StreamMessageThemeData(
|
||||
avatarTheme: const StreamAvatarThemeData()
|
||||
.lerp(a.avatarTheme!, b.avatarTheme!, t),
|
||||
createdAtStyle: TextStyle.lerp(a.createdAtStyle, b.createdAtStyle, t),
|
||||
messageAuthorStyle:
|
||||
TextStyle.lerp(a.messageAuthorStyle, b.messageAuthorStyle, t),
|
||||
@@ -120,7 +130,7 @@ class MessageThemeData with Diagnosticable {
|
||||
);
|
||||
|
||||
/// Merge with a theme
|
||||
MessageThemeData merge(MessageThemeData? other) {
|
||||
StreamMessageThemeData merge(StreamMessageThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
messageTextStyle: messageTextStyle?.merge(other.messageTextStyle) ??
|
||||
@@ -146,7 +156,7 @@ class MessageThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is MessageThemeData &&
|
||||
other is StreamMessageThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
messageTextStyle == other.messageTextStyle &&
|
||||
messageAuthorStyle == other.messageAuthorStyle &&
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// {@macro text_theme}
|
||||
@Deprecated("Use 'StreamTextTheme' instead")
|
||||
typedef TextTheme = StreamTextTheme;
|
||||
|
||||
/// {@template text_theme}
|
||||
/// Class for holding text theme
|
||||
class TextTheme {
|
||||
/// {@endtemplate}
|
||||
class StreamTextTheme {
|
||||
/// Initialise light text theme
|
||||
TextTheme.light({
|
||||
StreamTextTheme.light({
|
||||
this.title = const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -46,7 +52,7 @@ class TextTheme {
|
||||
});
|
||||
|
||||
/// Initialise with dark theme
|
||||
TextTheme.dark({
|
||||
StreamTextTheme.dark({
|
||||
this.title = const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -113,7 +119,7 @@ class TextTheme {
|
||||
final TextStyle captionBold;
|
||||
|
||||
/// Copy with theme
|
||||
TextTheme copyWith({
|
||||
StreamTextTheme copyWith({
|
||||
Brightness brightness = Brightness.light,
|
||||
TextStyle? body,
|
||||
TextStyle? title,
|
||||
@@ -125,7 +131,7 @@ class TextTheme {
|
||||
TextStyle? captionBold,
|
||||
}) =>
|
||||
brightness == Brightness.light
|
||||
? TextTheme.light(
|
||||
? StreamTextTheme.light(
|
||||
body: body ?? this.body,
|
||||
title: title ?? this.title,
|
||||
headlineBold: headlineBold ?? this.headlineBold,
|
||||
@@ -135,7 +141,7 @@ class TextTheme {
|
||||
footnote: footnote ?? this.footnote,
|
||||
captionBold: captionBold ?? this.captionBold,
|
||||
)
|
||||
: TextTheme.dark(
|
||||
: StreamTextTheme.dark(
|
||||
body: body ?? this.body,
|
||||
title: title ?? this.title,
|
||||
headlineBold: headlineBold ?? this.headlineBold,
|
||||
@@ -147,7 +153,7 @@ class TextTheme {
|
||||
);
|
||||
|
||||
/// Merge text theme
|
||||
TextTheme merge(TextTheme? other) {
|
||||
StreamTextTheme merge(StreamTextTheme? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
body: body.merge(other.body),
|
||||
|
||||
@@ -2,27 +2,33 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
|
||||
/// {@macro user_list_view_theme}
|
||||
@Deprecated("Use 'StreamUserListViewTheme' instead")
|
||||
typedef UserListViewTheme = StreamUserListViewTheme;
|
||||
|
||||
/// {@template user_list_view_theme}
|
||||
/// Overrides the default style of [UserListView] descendants.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [UserListViewThemeData], which is used to configure this theme.
|
||||
class UserListViewTheme extends InheritedTheme {
|
||||
/// Creates a [UserListViewTheme].
|
||||
/// * [StreamUserListViewThemeData], which is used to configure this theme.
|
||||
/// {@endtemplate}
|
||||
class StreamUserListViewTheme extends InheritedTheme {
|
||||
/// Creates a [StreamUserListViewTheme].
|
||||
///
|
||||
/// The [data] parameter must not be null.
|
||||
const UserListViewTheme({
|
||||
const StreamUserListViewTheme({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
/// The configuration of this theme.
|
||||
final UserListViewThemeData data;
|
||||
final StreamUserListViewThemeData data;
|
||||
|
||||
/// The closest instance of this class that encloses the given context.
|
||||
///
|
||||
/// If there is no enclosing [UserListViewTheme] widget, then
|
||||
/// If there is no enclosing [StreamUserListViewTheme] widget, then
|
||||
/// [StreamChatThemeData.userListViewTheme] is used.
|
||||
///
|
||||
/// Typical usage is as follows:
|
||||
@@ -30,35 +36,41 @@ class UserListViewTheme extends InheritedTheme {
|
||||
/// ```dart
|
||||
/// UserListViewTheme theme = UserListViewTheme.of(context);
|
||||
/// ```
|
||||
static UserListViewThemeData of(BuildContext context) {
|
||||
static StreamUserListViewThemeData of(BuildContext context) {
|
||||
final userListViewTheme =
|
||||
context.dependOnInheritedWidgetOfExactType<UserListViewTheme>();
|
||||
context.dependOnInheritedWidgetOfExactType<StreamUserListViewTheme>();
|
||||
return userListViewTheme?.data ??
|
||||
StreamChatTheme.of(context).userListViewTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget wrap(BuildContext context, Widget child) =>
|
||||
UserListViewTheme(data: data, child: child);
|
||||
StreamUserListViewTheme(data: data, child: child);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(UserListViewTheme oldWidget) =>
|
||||
bool updateShouldNotify(StreamUserListViewTheme oldWidget) =>
|
||||
data != oldWidget.data;
|
||||
}
|
||||
|
||||
/// {@macro user_list_view_theme_data}
|
||||
@Deprecated("Use 'StreamUserListViewThemeData' instead")
|
||||
typedef UserListViewThemeData = StreamUserListViewThemeData;
|
||||
|
||||
/// {@template user_list_view_theme_data}
|
||||
/// A style that overrides the default appearance of [UserListView]s when
|
||||
/// used with [UserListViewTheme] or with the overall [StreamChatTheme]'s
|
||||
/// used with [StreamUserListViewTheme] or with the overall [StreamChatTheme]'s
|
||||
/// [StreamChatThemeData.userListViewTheme].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [UserListViewTheme], the theme which is configured with this class.
|
||||
/// * [StreamUserListViewTheme], the theme which is configured with this class.
|
||||
/// * [StreamChatThemeData.userListViewTheme], which can be used to override
|
||||
/// the default style for [UserListView]s below the overall
|
||||
/// [StreamChatTheme].
|
||||
class UserListViewThemeData with Diagnosticable {
|
||||
/// Creates a [UserListViewThemeData].
|
||||
const UserListViewThemeData({
|
||||
/// {@endtemplate}
|
||||
class StreamUserListViewThemeData with Diagnosticable {
|
||||
/// Creates a [StreamUserListViewThemeData].
|
||||
const StreamUserListViewThemeData({
|
||||
this.backgroundColor,
|
||||
});
|
||||
|
||||
@@ -66,27 +78,27 @@ class UserListViewThemeData with Diagnosticable {
|
||||
final Color? backgroundColor;
|
||||
|
||||
/// Copies this [ChannelListViewThemeData] to another.
|
||||
UserListViewThemeData copyWith({
|
||||
StreamUserListViewThemeData copyWith({
|
||||
Color? backgroundColor,
|
||||
}) =>
|
||||
UserListViewThemeData(
|
||||
StreamUserListViewThemeData(
|
||||
backgroundColor: backgroundColor ?? this.backgroundColor,
|
||||
);
|
||||
|
||||
/// Linearly interpolate between two [UserListViewThemeData] themes.
|
||||
/// Linearly interpolate between two [StreamUserListViewThemeData] themes.
|
||||
///
|
||||
/// All the properties must be non-null.
|
||||
UserListViewThemeData lerp(
|
||||
UserListViewThemeData a,
|
||||
UserListViewThemeData b,
|
||||
StreamUserListViewThemeData lerp(
|
||||
StreamUserListViewThemeData a,
|
||||
StreamUserListViewThemeData b,
|
||||
double t,
|
||||
) =>
|
||||
UserListViewThemeData(
|
||||
StreamUserListViewThemeData(
|
||||
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
|
||||
);
|
||||
|
||||
/// Merges one [UserListViewThemeData] with another.
|
||||
UserListViewThemeData merge(UserListViewThemeData? other) {
|
||||
/// Merges one [StreamUserListViewThemeData] with another.
|
||||
StreamUserListViewThemeData merge(StreamUserListViewThemeData? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
backgroundColor: other.backgroundColor,
|
||||
@@ -96,7 +108,7 @@ class UserListViewThemeData with Diagnosticable {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserListViewThemeData &&
|
||||
other is StreamUserListViewThemeData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
backgroundColor == other.backgroundColor;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user