profile_name_avatar 0.0.3 copy "profile_name_avatar: ^0.0.3" to clipboard
profile_name_avatar: ^0.0.3 copied to clipboard

A simple widget to show user initials in a circular avatar with background color.

🧑‍🎨 Profile Name Avatar #

A flexible Flutter widget for displaying user profile images with graceful fallbacks.
If the provided image fails to load, it will show a placeholder image (if provided), or fall back to a beautifully styled avatar with the user's name.


✨ Features #

  • ✅ Load profile images from both network and local assets
  • 🖼 Fallback to placeholder image if the profile image fails
  • 🔤 Fallback to name-based avatar (initials or up to 4 letters)
  • 🎨 Auto-generated background color from name hash
  • ⚙️ Customizable radius, text style, and background color
  • ⚡ Built-in image caching with cached_network_image

📦 Installation #

Add this to your pubspec.yaml:

dependencies:
  profile_name_avatar: ^0.0.3

Usage #

import 'package:profile_name_avatar/profile_name_avatar.dart';

ProfileImage(
  imageSource: "https://example.com/avatar.jpg",
  placeholder: "assets/images/placeholder.png",     // Fallback when imagesource fail
  fallbackName: "J D",                              // Used when image & placeholder fail
  radius: 100,                                      // Optional
  textStyle: TextStyle(                             // Optional
    fontSize: 24,
    fontWeight: FontWeight.bold,
    color: Colors.white,
  ),
  backgroundColor: Colors.orange,                   // Optional
)

Example #

Profile Avatar Screenshot

If image view is not needed

import 'package:profile_name_avatar/profile_name_avatar.dart';
ProfileAvatar(
  name: 'S S',
  radius: 40,
)

Example #

Profile Avatar Screenshot

6
likes
150
points
46
downloads

Publisher

unverified uploader

Weekly Downloads

A simple widget to show user initials in a circular avatar with background color.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cached_network_image, flutter

More

Packages that depend on profile_name_avatar