💄 Optimized notification list

This commit is contained in:
2024-10-16 22:32:44 +08:00
parent 6e00a99803
commit 9012566dbf
6 changed files with 62 additions and 8 deletions

View File

@ -4,20 +4,25 @@ import 'package:timeago/timeago.dart';
class RelativeDate extends StatelessWidget {
final DateTime date;
final TextStyle? style;
final bool isFull;
const RelativeDate(this.date, {super.key, this.isFull = false});
const RelativeDate(this.date, {super.key, this.style, this.isFull = false});
@override
Widget build(BuildContext context) {
if (isFull) {
return Text(DateFormat('y/M/d HH:mm').format(date));
return Text(
DateFormat('y/M/d HH:mm').format(date),
style: style,
);
}
return Text(
format(
date,
locale: 'en_short',
),
style: style,
);
}
}