- 登录: QQ/163/126/189/搜狐/Gmail/Outlook/Yahoo/iCloud/企业邮/自定义, 自动识别+测试连接 - 收信: IMAP 多文件夹同步/未读/星标/搜索(本地+服务器) - 读信: HTML渲染/CID内嵌图/原文查看/附件下载 - 写信: 收件人/抄送/密送/附件/富文本/草稿/回复转发 - 存储: SQLite + 系统安全存储(DPAPI/Keychain/Keystore) - 测试: 单元测试 + Mock IMAP/SMTP 服务器集成测试(23项全过) - 可迁移: Windows/Android/iOS/macOS/Linux 一套代码
44 lines
996 B
Dart
44 lines
996 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// 账户头像(首字母 + 主题色)
|
|
class AccountAvatar extends StatelessWidget {
|
|
final String name;
|
|
final Color color;
|
|
final double size;
|
|
|
|
const AccountAvatar({
|
|
super.key,
|
|
required this.name,
|
|
required this.color,
|
|
this.size = 32,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final letter = name.trim().isNotEmpty ? name.trim()[0].toUpperCase() : '?';
|
|
return Container(
|
|
width: size,
|
|
height: size,
|
|
decoration: BoxDecoration(
|
|
color: color,
|
|
shape: BoxShape.circle,
|
|
),
|
|
alignment: Alignment.center,
|
|
child: Text(
|
|
letter,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: size * 0.45,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// 邮箱地址大写首字母
|
|
String avatarLetter(String email) {
|
|
final name = email.split('@').first;
|
|
return name.isNotEmpty ? name[0].toUpperCase() : '?';
|
|
}
|