|
@@ -1,8 +1,5 @@
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
-import 'package:flutter/material.dart';
|
|
|
import 'package:intl/intl.dart';
|
|
|
-import 'package:photos/core/constants.dart';
|
|
|
-import 'package:photos/theme/ente_theme.dart';
|
|
|
|
|
|
const Set<int> monthWith31Days = {1, 3, 5, 7, 8, 10, 12};
|
|
|
const Set<int> monthWith30Days = {4, 6, 9, 11};
|
|
@@ -68,24 +65,6 @@ bool areFromSameDay(int firstCreationTime, int secondCreationTime) {
|
|
|
firstDate.day == secondDate.day;
|
|
|
}
|
|
|
|
|
|
-//Thu, 30 Jun
|
|
|
-String getDayAndMonth(DateTime dateTime) {
|
|
|
- return _days[dateTime.weekday]! +
|
|
|
- ", " +
|
|
|
- dateTime.day.toString() +
|
|
|
- " " +
|
|
|
- _months[dateTime.month]!;
|
|
|
-}
|
|
|
-
|
|
|
-//30 Jun, 2022
|
|
|
-String getDateAndMonthAndYear(DateTime dateTime) {
|
|
|
- return dateTime.day.toString() +
|
|
|
- " " +
|
|
|
- _months[dateTime.month]! +
|
|
|
- ", " +
|
|
|
- dateTime.year.toString();
|
|
|
-}
|
|
|
-
|
|
|
// Create link default names:
|
|
|
// Same day: "Dec 19, 2022"
|
|
|
// Same month: "Dec 19 - 22, 2022"
|
|
@@ -166,16 +145,6 @@ String getFormattedDate(DateTime dateTime) {
|
|
|
getAbbreviationOfYear(dateTime);
|
|
|
}
|
|
|
|
|
|
-String getFullDate(DateTime dateTime) {
|
|
|
- return getDay(dateTime) +
|
|
|
- ", " +
|
|
|
- getMonth(dateTime) +
|
|
|
- " " +
|
|
|
- dateTime.day.toString() +
|
|
|
- " " +
|
|
|
- dateTime.year.toString();
|
|
|
-}
|
|
|
-
|
|
|
String daysLeft(int futureTime) {
|
|
|
final int daysLeft = ((futureTime - DateTime.now().microsecondsSinceEpoch) /
|
|
|
Duration.microsecondsPerDay)
|
|
@@ -233,52 +202,6 @@ bool isLeapYear(DateTime dateTime) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-Widget getDayWidget(
|
|
|
- BuildContext context,
|
|
|
- int timestamp,
|
|
|
- int photoGridSize,
|
|
|
-) {
|
|
|
- final colorScheme = getEnteColorScheme(context);
|
|
|
- final textTheme = getEnteTextTheme(context);
|
|
|
- final textStyle =
|
|
|
- photoGridSize < photoGridSizeMax ? textTheme.body : textTheme.small;
|
|
|
- final double horizontalPadding =
|
|
|
- photoGridSize < photoGridSizeMax ? 12.0 : 8.0;
|
|
|
- final double verticalPadding = photoGridSize < photoGridSizeMax ? 12.0 : 14.0;
|
|
|
- return Padding(
|
|
|
- padding: EdgeInsets.symmetric(
|
|
|
- horizontal: horizontalPadding,
|
|
|
- vertical: verticalPadding,
|
|
|
- ),
|
|
|
- child: Container(
|
|
|
- alignment: Alignment.centerLeft,
|
|
|
- child: Text(
|
|
|
- getDayTitle(timestamp),
|
|
|
- style: (getDayTitle(timestamp) == "Today")
|
|
|
- ? textStyle
|
|
|
- : textStyle.copyWith(color: colorScheme.textMuted),
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
-}
|
|
|
-
|
|
|
-String getDayTitle(int timestamp) {
|
|
|
- final date = DateTime.fromMicrosecondsSinceEpoch(timestamp);
|
|
|
- final now = DateTime.now();
|
|
|
- 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) {
|
|
|
- title += " " + date.year.toString();
|
|
|
- }
|
|
|
- return title;
|
|
|
-}
|
|
|
-
|
|
|
String secondsToHHMMSS(int value) {
|
|
|
int h, m, s;
|
|
|
h = value ~/ 3600;
|