Skip to content

Commit

Permalink
update Avatar colors
Browse files Browse the repository at this point in the history
3003h committed Aug 25, 2024
1 parent 572e8f4 commit d735ac4
Showing 3 changed files with 64 additions and 7 deletions.
61 changes: 61 additions & 0 deletions lib/const/theme_colors.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:eros_fe/common/colors.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_boring_avatars/flutter_boring_avatars.dart';

import 'const.dart';

@@ -213,6 +214,66 @@ class ThemeColors {
.map((e) => e.value)
.toList();

static BoringAvatarPalette boringAvatarPalette = BoringAvatarPalette(
richAvatarColorList,
);

static List<Color> avatarColorFromCatList = catColor.entries
.where((e) => e.key != 'default')
.map((e) => e.value)
.toList()
..shuffle();

static List<Color> avatarColorList = <Color>[
CupertinoColors.systemRed,
CupertinoColors.systemOrange,
CupertinoColors.systemYellow,
CupertinoColors.systemGreen,
CupertinoColors.systemTeal,
CupertinoColors.systemBlue,
CupertinoColors.systemIndigo,
CupertinoColors.systemPurple,
CupertinoColors.systemPink,
]..shuffle();

static List<Color> richAvatarColorList = <Color>[
Color(0xFFFF5252), // Red
Color(0xFFFF4081), // Pink
Color(0xFFE040FB), // Purple
Color(0xFF7C4DFF), // Deep Purple
Color(0xFF536DFE), // Indigo
Color(0xFF448AFF), // Blue
Color(0xFF40C4FF), // Light Blue
Color(0xFF18FFFF), // Cyan
Color(0xFF64FFDA), // Teal
Color(0xFF69F0AE), // Green
Color(0xFFB2FF59), // Light Green
Color(0xFFFFEB3B), // Yellow
Color(0xFFFFC107), // Amber
Color(0xFFFF9800), // Orange
Color(0xFFFF5722), // Deep Orange
Color(0xFF000000), // Black
Color(0xFFFFFFFF), // White
Color(0xFF9E9E9E), // Gray
Color(0xFF795548), // Brown
Color(0xFF607D8B), // Blue Grey
Color(0xFFD32F2F), // Dark Red
Color(0xFFC2185B), // Dark Pink
Color(0xFF7B1FA2), // Dark Purple
Color(0xFF512DA8), // Dark Deep Purple
Color(0xFF303F9F), // Dark Indigo
Color(0xFF1976D2), // Dark Blue
Color(0xFF0288D1), // Dark Light Blue
Color(0xFF0097A7), // Dark Cyan
Color(0xFF00796B), // Dark Teal
Color(0xFF388E3C), // Dark Green
Color(0xFF689F38), // Dark Light Green
Color(0xFFFBC02D), // Dark Yellow
Color(0xFFFFA000), // Dark Amber
Color(0xFFF57C00), // Dark Orange
Color(0xFFE64A19), // Dark Deep Orange
]..shuffle();

// 画廊类型主题色
static const Map<String, Color> catColor = <String, Color>{
'Doujinshi': CupertinoDynamicColor.withBrightness(
4 changes: 1 addition & 3 deletions lib/pages/gallery/view/comment_item.dart
Original file line number Diff line number Diff line change
@@ -451,9 +451,7 @@ class _CommentUser extends StatelessWidget {
? BoringAvatar(
name: _name,
// colors: [...ThemeColors.catColorList],
palette: BoringAvatarPalette(
ThemeColors.catColorList..shuffle(),
),
palette: ThemeColors.boringAvatarPalette,
type: _ehSettingService.boringAvatarsType,
// square: true,
)
6 changes: 2 additions & 4 deletions lib/pages/setting/avatar_setting_page.dart
Original file line number Diff line number Diff line change
@@ -276,9 +276,7 @@ class _BoringAvatar extends StatelessWidget {
duration: const Duration(milliseconds: 300),
name: _username,
// colors: ThemeColors.catColorList,
palette: BoringAvatarPalette(
ThemeColors.catColorList..shuffle(),
),
palette: ThemeColors.boringAvatarPalette,
type: type,
// square: true,
),
@@ -323,7 +321,7 @@ class _TextAvatar extends StatelessWidget {
duration: const Duration(milliseconds: 300),
child: TextAvatar(
name: _username,
colors: ThemeColors.catColorList,
colors: ThemeColors.richAvatarColorList,
type: type,
radius: radius,
),

0 comments on commit d735ac4

Please sign in to comment.