Add file uploads for photos and family icons

This commit is contained in:
kihong.kim
2026-01-24 22:31:38 +09:00
parent 29881aa442
commit 9e6a265a7a
15 changed files with 761 additions and 133 deletions

View File

@@ -101,6 +101,7 @@ class TodoListWidget extends StatelessWidget {
orElse: () => const FamilyMember(
id: '',
name: 'Unknown',
iconUrl: '',
emoji: '👤',
color: '#888888',
order: 0,
@@ -110,9 +111,16 @@ class TodoListWidget extends StatelessWidget {
// Parse color
Color memberColor;
try {
memberColor = Color(
int.parse(member.color.replaceAll('#', '0xFF')),
);
String cleanHex =
member.color.replaceAll('#', '').replaceAll('0x', '');
if (cleanHex.length == 6) {
cleanHex = 'FF$cleanHex';
}
if (cleanHex.length == 8) {
memberColor = Color(int.parse('0x$cleanHex'));
} else {
memberColor = Colors.grey;
}
} catch (_) {
memberColor = Colors.grey;
}
@@ -121,10 +129,24 @@ class TodoListWidget extends StatelessWidget {
contentPadding: EdgeInsets.zero,
leading: CircleAvatar(
backgroundColor: memberColor.withOpacity(0.2),
child: Text(
member.emoji,
style: const TextStyle(fontSize: 20),
),
backgroundImage: member.iconUrl.isNotEmpty
? NetworkImage(member.iconUrl)
: null,
child: member.iconUrl.isEmpty
? (member.name.isNotEmpty
? Text(
member.name[0].toUpperCase(),
style: TextStyle(
color: memberColor,
fontWeight: FontWeight.bold,
fontSize: 20,
),
)
: Icon(
Icons.person,
color: memberColor,
))
: null,
),
title: Text(
todo.title,