refactor(ui): Update some UI and fix some bugs

This commit is contained in:
anhtunz
2025-01-11 16:43:19 +07:00
parent c2c685da86
commit a17831d0ac
16 changed files with 688 additions and 464 deletions

View File

@@ -92,27 +92,41 @@ class _BellScreenState extends State<BellScreen> {
},
child: Column(
children: [
ListTile(
title: Text(
getBellEvent(
context,
bellSnapshot.data![index]
.itemDetail!.sourceName!,
bellSnapshot
.data![index].eventType!,
bellSnapshot.data![index]
.itemDetail!.targetName!,
),
overflow: TextOverflow.ellipsis,
maxLines: 3,
style:
const TextStyle(fontSize: 15),
Container(
decoration: BoxDecoration(
color: bellSnapshot
.data![index].status! ==
1
? Theme.of(context)
.appBarTheme
.backgroundColor
: Theme.of(context)
.colorScheme
.outlineVariant,
),
trailing: Text(
timeAgo(
context,
bellSnapshot
.data![index].createdAt!,
child: ListTile(
// style: ListTileS,
title: Text(
getBellEvent(
context,
bellSnapshot.data![index]
.itemDetail!.sourceName!,
bellSnapshot
.data![index].eventType!,
bellSnapshot.data![index]
.itemDetail!.targetName!,
),
overflow: TextOverflow.ellipsis,
maxLines: 3,
style:
const TextStyle(fontSize: 15),
),
trailing: Text(
timeAgo(
context,
bellSnapshot
.data![index].createdAt!,
),
),
),
),
@@ -176,26 +190,6 @@ class _BellScreenState extends State<BellScreen> {
check = false;
}
bool checkStatus(List<BellItems> bells) {
for (var bell in bells) {
if (bell.status == 0) {
return false;
}
}
return true;
}
Future<Color> colorByTheme(int status) async {
String theme = await apiServices.checkTheme();
if (theme == AppThemes.LIGHT.name && status == 1) {
return Colors.white;
} else if (theme == AppThemes.DARK.name && status == 1) {
return Colors.black;
} else {
return const Color.fromARGB(255, 90, 175, 214);
}
}
String timeAgo(BuildContext context, DateTime dateTime) {
final duration = DateTime.now().difference(dateTime);