mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-09-19 22:08:49 +00:00
Show message files
This commit is contained in:
@@ -39,16 +39,20 @@ String diffTimeToStr(int amount) {
|
||||
|
||||
// Years
|
||||
final years = (amount / (60 * 60 * 24 * 365)).floor();
|
||||
return years == 1 ? tr("1 year") : tr("%years% years",
|
||||
args: {"years": years.toString()});
|
||||
return years == 1
|
||||
? tr("1 year")
|
||||
: tr("%years% years", args: {"years": years.toString()});
|
||||
}
|
||||
|
||||
String diffTimeFromNowToStr(int date) {
|
||||
return diffTimeToStr(time() - date);
|
||||
}
|
||||
|
||||
|
||||
/// Return properly formatted date and time
|
||||
String dateTimeToString(DateTime time) {
|
||||
return "${time.day}:${time.month}:${time.year} ${time.hour}:${time.minute}";
|
||||
}
|
||||
}
|
||||
|
||||
/// Format a [Duration] in the form "MM:SS"
|
||||
String formatDuration(Duration d) =>
|
||||
"${d.inMinutes < 10 ? "0" + d.inMinutes.toString() : d.inMinutes.toString()}:${d.inSeconds % 60 < 10 ? "0" + (d.inSeconds % 60).toString() : (d.inSeconds % 60).toString()}";
|
||||
|
11
lib/utils/log_utils.dart
Normal file
11
lib/utils/log_utils.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
/// Log utilities
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
void logError(dynamic e, StackTrace s) {
|
||||
if (e is Exception) {
|
||||
print("Exception: $e\n$s");
|
||||
} else {
|
||||
print("Error: $e\n$s");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user