Browse Source

Show simpler strings for certain days

Vishnu Mohandas 4 năm trước cách đây
mục cha
commit
c83bca34c3
1 tập tin đã thay đổi với 9 bổ sung1 xóa
  1. 9 1
      lib/ui/gallery.dart

+ 9 - 1
lib/ui/gallery.dart

@@ -242,8 +242,16 @@ class _GalleryState extends State<Gallery> {
   }
   }
 
 
   Widget _getDay(int timestamp) {
   Widget _getDay(int timestamp) {
-    var date = DateTime.fromMicrosecondsSinceEpoch(timestamp);
+    final date = DateTime.fromMicrosecondsSinceEpoch(timestamp);
+    final now = DateTime.now();
     var title = getDayAndMonth(date);
     var title = getDayAndMonth(date);
+    if (date.year == now.year && date.month == now.month) {
+      if (date.day == now.day) {
+        title = "Today";
+      } else if (date.day == now.day - 1) {
+        title = "Yesterday";
+      }
+    }
     if (date.year != DateTime.now().year) {
     if (date.year != DateTime.now().year) {
       title += " " + date.year.toString();
       title += " " + date.year.toString();
     }
     }