mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 01:11:36 +03:00
chore: bump line length to 120 (#20191)
This commit is contained in:
@@ -22,15 +22,13 @@ extension LogOnError<T> on AsyncValue<T> {
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
return onLoading?.call() ??
|
||||
const Center(child: ImmichLoadingIndicator());
|
||||
return onLoading?.call() ?? const Center(child: ImmichLoadingIndicator());
|
||||
}
|
||||
}
|
||||
|
||||
if (hasError && !hasValue) {
|
||||
_asyncErrorLogger.severe('Could not load value', error, stackTrace);
|
||||
return onError?.call(error, stackTrace) ??
|
||||
ScaffoldErrorBody(errorMsg: error?.toString());
|
||||
return onError?.call(error, stackTrace) ?? ScaffoldErrorBody(errorMsg: error?.toString());
|
||||
}
|
||||
|
||||
return onData(requireValue);
|
||||
|
||||
@@ -60,6 +60,5 @@ extension ContextHelper on BuildContext {
|
||||
FocusScopeNode get focusScope => FocusScope.of(this);
|
||||
|
||||
// Show SnackBars from the current context
|
||||
void showSnackBar(SnackBar snackBar) =>
|
||||
ScaffoldMessenger.of(this).showSnackBar(snackBar);
|
||||
void showSnackBar(SnackBar snackBar) => ScaffoldMessenger.of(this).showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
@@ -57,9 +57,7 @@ extension DateRangeFormatting on DateTime {
|
||||
final localeString = locale?.toString() ?? 'en_US';
|
||||
|
||||
// Check if it's a single date (same day)
|
||||
if (startDate.year == endDate.year &&
|
||||
startDate.month == endDate.month &&
|
||||
startDate.day == endDate.day) {
|
||||
if (startDate.year == endDate.year && startDate.month == endDate.month && startDate.day == endDate.day) {
|
||||
if (startDate.year == currentYear) {
|
||||
// Single date of this year: "Aug 28"
|
||||
return DateFormat.MMMd(localeString).format(startDate);
|
||||
|
||||
@@ -12,9 +12,7 @@ extension DurationExtension on String {
|
||||
/// Parses and returns the string of format HH:MM:SS as a duration object else null
|
||||
Duration? toDuration() {
|
||||
try {
|
||||
final parts = split(':')
|
||||
.map((e) => double.parse(e).toInt())
|
||||
.toList(growable: false);
|
||||
final parts = split(':').map((e) => double.parse(e).toInt()).toList(growable: false);
|
||||
return Duration(hours: parts[0], minutes: parts[1], seconds: parts[2]);
|
||||
} catch (e) {
|
||||
return null;
|
||||
|
||||
@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
extension ImmichColorSchemeExtensions on ColorScheme {
|
||||
bool get _isDarkMode => brightness == Brightness.dark;
|
||||
Color get onSurfaceSecondary => _isDarkMode
|
||||
? onSurface.darken(amount: .3)
|
||||
: onSurface.lighten(amount: .3);
|
||||
Color get onSurfaceSecondary => _isDarkMode ? onSurface.darken(amount: .3) : onSurface.lighten(amount: .3);
|
||||
}
|
||||
|
||||
extension ColorExtensions on Color {
|
||||
|
||||
@@ -40,8 +40,7 @@ String _translateHelper(
|
||||
try {
|
||||
final translatedMessage = key.tr(context: context);
|
||||
return args != null
|
||||
? MessageFormat(translatedMessage, locale: Intl.defaultLocale ?? 'en')
|
||||
.format(args)
|
||||
? MessageFormat(translatedMessage, locale: Intl.defaultLocale ?? 'en').format(args)
|
||||
: translatedMessage;
|
||||
} catch (e) {
|
||||
debugPrint('Translation failed for key "$key". Error: $e');
|
||||
|
||||
Reference in New Issue
Block a user