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,
|
||||
|
||||
Reference in New Issue
Block a user