chore: Change same enivornment to one hour
This commit is contained in:
parent
c76a5fd030
commit
d088a7c154
1 changed files with 2 additions and 9 deletions
|
|
@ -21,17 +21,10 @@ extension DateTimeExtension on DateTime {
|
||||||
return millisecondsSinceEpoch <= other.millisecondsSinceEpoch;
|
return millisecondsSinceEpoch <= other.millisecondsSinceEpoch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Two message events can belong to the same environment. That means that they
|
|
||||||
/// don't need to display the time they were sent because they are close
|
|
||||||
/// enaugh.
|
|
||||||
static const minutesBetweenEnvironments = 10;
|
|
||||||
|
|
||||||
/// Checks if two DateTimes are close enough to belong to the same
|
/// Checks if two DateTimes are close enough to belong to the same
|
||||||
/// environment.
|
/// environment.
|
||||||
bool sameEnvironment(DateTime prevTime) {
|
bool sameEnvironment(DateTime prevTime) =>
|
||||||
return millisecondsSinceEpoch - prevTime.millisecondsSinceEpoch <
|
prevTime.difference(this) < const Duration(hours: 1);
|
||||||
1000 * 60 * minutesBetweenEnvironments;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns a simple time String.
|
/// Returns a simple time String.
|
||||||
String localizedTimeOfDay(BuildContext context) =>
|
String localizedTimeOfDay(BuildContext context) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue