Squircle Avatar

Pub Version Pub Points Pub Likes GitHub Stars MIT License

Supported Platforms Flutter & WASM Ready


A modern, highly customizable Squircle Avatar and shape widget for Flutter with built-in status badges, smooth superellipse curves, initials formatting, image support, gradients, and shadow effects.

Squircle Avatar Preview

Explore on Pub.dev β€’ GitHub Repository β€’ Report Issue β€’ API Documentation


✨ Features

  • 🟣 Squircle Shape: Continuous rectangle / superellipse smooth corner geometry (inspired by iOS & modern design systems).
  • πŸ”€ Initials Fallback: Automatic font scaling and formatting for user initials (e.g., "A", "JD").
  • πŸ–ΌοΈ Image Support: Compatible with NetworkImage, AssetImage, MemoryImage, etc.
  • 🟒 Status Indicator / Badge: Built-in online, offline, or custom status badge with configurable size, colors, borders, and positions.
  • 🎨 Gradients & Shadows: Rich styling options including borders, box shadows, and linear gradients.
  • πŸ‘† Interactivity: Built-in onTap and onLongPress gesture handlers.
  • πŸ“¦ SquircleContainer: Reusable container widget with squircle clipping and decorations.

πŸ“¦ Installation

Add squircle_avatar to your pubspec.yaml dependencies:

dependencies:
  squircle_avatar: ^1.0.1

Or run:

flutter pub add squircle_avatar

Import it in your Dart code:

import 'package:squircle_avatar/squircle_avatar.dart';

πŸš€ Usage Examples

1. Basic Squircle Avatar with Initials & Online Badge

SquircleAvatar(
  size: 48,
  initials: 'A',
  backgroundColor: const Color(0xFF8B5CF6),
  showBadge: true,
  badgeColor: const Color(0xFF4CAF50),
  onTap: () {
    print('Avatar tapped!');
  },
)

2. Squircle Avatar with Image

SquircleAvatar(
  size: 56,
  image: NetworkImage('https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=150'),
  showBadge: true,
  badgeColor: Colors.green,
  badgeBorderColor: Colors.white,
  badgeSize: 14,
)

3. Gradient Avatar with Box Shadow

SquircleAvatar(
  size: 50,
  initials: 'JD',
  gradient: const LinearGradient(
    colors: [Color(0xFF8B5CF6), Color(0xFFEC4899)],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  ),
  boxShadow: [
    BoxShadow(
      color: const Color(0xFF8B5CF6).withValues(alpha: 0.3),
      blurRadius: 10,
      offset: const Offset(0, 4),
    ),
  ],
)

4. Squircle Container Card

SquircleContainer(
  padding: const EdgeInsets.all(20),
  gradient: const LinearGradient(
    colors: [Color(0xFF8B5CF6), Color(0xFF6366F1)],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  ),
  boxShadow: [
    BoxShadow(
      color: const Color(0xFF8B5CF6).withValues(alpha: 0.3),
      blurRadius: 16,
      offset: const Offset(0, 8),
    ),
  ],
  child: const Text(
    'Premium Squircle Card',
    style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
  ),
)

βš™οΈ Properties Reference

SquircleAvatar

Property Type Default Description
size double 40.0 Width and height of the avatar.
borderRadius BorderRadius? BorderRadius.circular(size * 0.7) Squircle corner curve radius.
image ImageProvider? null Avatar image to display.
initials String? null Fallback text/initials if no image is given.
textStyle TextStyle? null Style for the initials text.
backgroundColor Color? Theme primaryColor Background fill color.
gradient Gradient? null Background gradient.
border BorderSide? null Border around the avatar.
boxShadow List<BoxShadow>? null Shadows cast by the avatar.
showBadge bool false Whether to display the status badge.
badgeColor Color Color(0xFF4CAF50) Badge indicator background color.
badgeSize double 12.0 Diameter of the badge indicator.
badgeBorderColor Color Colors.white Border color around the badge.
badgeBorderWidth double 2.0 Border width around the badge.
badgeAlignment Alignment Alignment.topRight Position of the badge.
badgeOffset Offset Offset.zero Fine-tune offset for badge location.
onTap VoidCallback? null Tap event callback.
onLongPress VoidCallback? null Long press event callback.

πŸ’– Support & Contribute

If you like this package, please consider giving it a πŸ‘ Like on pub.flutter-io.cn and a ⭐ Star on GitHub!

Contributions, bug reports, and feature requests are welcome at GitHub Issues.


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.