AvatarTheme class
Theme configuration for Avatar and related avatar components.
AvatarTheme provides styling options for avatar components including size, border radius, colors, and badge positioning. It enables consistent avatar styling across an application while allowing per-instance customization.
Used with ComponentTheme to apply theme values throughout the widget tree.
Example:
ComponentTheme<AvatarTheme>(
data: AvatarTheme(
size: 48.0,
borderRadius: 8.0,
backgroundColor: Colors.grey.shade200,
badgeAlignment: Alignment.topRight,
textStyle: TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
),
child: MyAvatarWidget(),
);
Constructors
- AvatarTheme({double? size, double? borderRadius, Color? backgroundColor, AlignmentGeometry? badgeAlignment, double? badgeGap, TextStyle? textStyle})
-
Creates an AvatarTheme with the specified styling options.
const
Properties
- backgroundColor → Color?
-
Background color for avatar containers when displaying initials.
final
- badgeAlignment → AlignmentGeometry?
-
Alignment of badge relative to the main avatar.
final
- badgeGap → double?
-
Spacing between avatar and badge components.
final
- borderRadius → double?
-
Border radius for avatar corners in logical pixels.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → double?
-
Default size for avatar components in logical pixels.
final
- textStyle → TextStyle?
-
Text style for avatar initials display.
final
Methods
-
copyWith(
{ValueGetter< double?> ? size, ValueGetter<double?> ? borderRadius, ValueGetter<Color?> ? backgroundColor, ValueGetter<AlignmentGeometry?> ? badgeAlignment, ValueGetter<double?> ? badgeGap, ValueGetter<TextStyle?> ? textStyle}) → AvatarTheme - Creates a copy of this theme with the given values replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override