搜尋套件、儲存庫與 APP 分類

flutter_boring_avatars 封面
套件詳情v2.1.0

flutter_boring_avatars

乏味的頭像可以根據使用者名稱和色彩調色板產生獨特的頭像。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2480
喜歡數
54
Pub 分數
160

安裝套件

flutter pub add flutter_boring_avatars

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Flutter Boring Avatars 從使用者名稱和色彩調色盤產生獨特且視覺上區別的頭像。它提供一種簡單、可自訂的方式,在應用程式中顯示個人檔案圖片,無需依賴外部影像來源。這些頭像透過演算法創造,以確保獨特性與跨平台的一致性。非常適合用於即時通訊介面、使用者資料或任何需要簡潔、極簡頭像解決方案的應用程式。支援所有主要的 Flutter 平台,包含 Android、iOS、Web、macOS、Windows 與 Linux。

適用情境

  • 使用者資料顯示
  • 聊天介面
  • 匿名用戶表示
  • 極簡主義使用者介面設計
  • 多使用者儀表板

主要特色

  • 基於使用者名稱的頭像產生
  • 可自定色彩調色板
  • 跨平台支援
  • 獨特的頭像圖案
  • 輕量且易於整合

適合對象

  • 簡單的個人資料圖片需要
  • 使用者眾多的應用程式
  • 注重設計的應用程式
  • 低帶寬環境
  • 原型設計和最小可行產品

使用建議

  • 除了顏色和使用者名稱外,自訂選項有限
  • 不適用於品牌化身
  • 無內建影像回退
  • 依賴於確定性演算法以確保唯一性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Github

flutter_boring_avatars

Pub Version (including pre-releases)

English | 中文

Features

Boring avatars can generate unique avatars based on the username and color palette.

This project is a Flutter implementation of Boring Avatars.

It differs from the original project in its implementation, using Canvas for rendering and adding transition animations.

Check out the Web Demo to experience the effect.

Screenshots

preview1.png

Installation

Add the dependency in your pubspec.yaml file:

dependencies:
  flutter_boring_avatars: any # or the latest version on Pub

Usage

Get a simple avatar

BoringAvatar(name: "Maria Mitchell", type: BoringAvatarType.marble);

Get an animated avatar that has a nice transition animation when the name changes

AnimatedBoringAvatar(
  name: "Maria Mitchell",
  type: BoringAvatarType.marble,
  duration: const Duration(milliseconds: 300),
)

Get an avatar with a custom color palette

final colorPalette = BoringAvatarPalette(Color(0xffA3A948), Color(0xffEDB92E), Color(0xffF85931), Color(0xffCE1836), Color(0xff009989));

BoringAvatar(name: "Maria Mitchell", palette: colorPalette);

Set default type and palette, applicable only for BoringAvatar and AnimatedBoringAvatar

build(context) {
  return DefaultBoringAvatarStyle(
    type: BoringAvatarType.marble, 
    palette: colorPalette,
    child: Column(
      children: [
        BoringAvatar(name: "Maria Mitchell"),
        BoringAvatar(name: "Alexis Brooks"),
        BoringAvatar(name: "Justin Gray"),
      ]
    ),
  );
}

Use ShapeBorder to control the avatar shape and add a border

BoringAvatar(
  name: "Maria Mitchell",
  type: BoringAvatarType.marble,
  shape: OvalBorder(), // or RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))
);

Use the avatar for Decoration, it also supports transition animations when used in AnimatedContainer

Container(
  decoration: BoringAvatarDecoration(
    avatarData: BoringAvatarData.generate(name: name),
  ),
);

Export the avatar as an image

final avatarData = BoringAvatarData.generate(name: name);
final image = await avatarData.toImage(size: const Size.square(256));
final pngByteData = await image.toByteData(format: ImageByteFormat.png);

Thanks

Thanks to the developers of Boring Avatars.

The example uses the beautiful palette project from Matt DesLauriers.

If you like this project, please give me a star.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。