Skip to content

Avatar ​

A circular image component for user profile pictures, with a fallback to initials or an icon when there's no image. Three shapes — circular, square, rounded — share the same parameters.

View source on GitHub ↗

CLI ​

Install this component into your project:

avatar
$flutter_beautify add avatar

Variants ​

FBAvatar.circular() · FBAvatar.square() · FBAvatar.rounded() — the plain FBAvatar(...) constructor forwards to .circular().

Key parameters ​

ParameterTypeDefault
imageUrlString?—
initialsString?— used when imageUrl is null
sizedouble48
backgroundColorColor?ambient colorScheme.primary
onTapVoidCallback?—

Usage ​

dart
import 'package:your_app/widgets/avatar.dart';

FBAvatar.circular(
  imageUrl: user.photoUrl,
  size: 56,
  onTap: () => openProfile(user.id),
);

Released under the MIT License.