chore: bump line length to 120 (#20191)

This commit is contained in:
shenlong 2025-07-25 08:07:22 +05:30 committed by GitHub
parent 977c9b96ba
commit ad65e9011a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
517 changed files with 4520 additions and 9514 deletions

View file

@ -19,9 +19,7 @@ class AlbumPreviewPage extends HookConsumerWidget {
final assets = useState<List<Asset>>([]);
getAssetsInAlbum() async {
assets.value = await ref
.read(albumMediaRepositoryProvider)
.getAssets(album.localId!);
assets.value = await ref.read(albumMediaRepositoryProvider).getAssets(album.localId!);
}
useEffect(

View file

@ -19,8 +19,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final selectedBackupAlbums = ref.watch(backupProvider).selectedBackupAlbums;
final excludedBackupAlbums = ref.watch(backupProvider).excludedBackupAlbums;
final enableSyncUploadAlbum =
useAppSettingsState(AppSettingsEnum.syncAlbums);
final enableSyncUploadAlbum = useAppSettingsState(AppSettingsEnum.syncAlbums);
final isDarkTheme = context.isDarkTheme;
final albums = ref.watch(backupProvider).availableAlbums;
@ -85,8 +84,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
buildSelectedAlbumNameChip() {
return selectedBackupAlbums.map((album) {
void removeSelection() =>
ref.read(backupProvider.notifier).removeAlbumForBackup(album);
void removeSelection() => ref.read(backupProvider.notifier).removeAlbumForBackup(album);
return Padding(
padding: const EdgeInsets.only(right: 8.0),
@ -117,9 +115,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
buildExcludedAlbumNameChip() {
return excludedBackupAlbums.map((album) {
void removeSelection() {
ref
.watch(backupProvider.notifier)
.removeExcludedAlbumForBackup(album);
ref.watch(backupProvider.notifier).removeExcludedAlbumForBackup(album);
}
return GestureDetector(
@ -215,11 +211,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
title: Text(
"backup_album_selection_page_albums_device".tr(
namedArgs: {
'count': ref
.watch(backupProvider)
.availableAlbums
.length
.toString(),
'count': ref.watch(backupProvider).availableAlbums.length.toString(),
},
),
style: context.textTheme.titleSmall,

View file

@ -30,11 +30,8 @@ class BackupControllerPage extends HookConsumerWidget {
final hasAnyAlbum = backupState.selectedBackupAlbums.isNotEmpty;
final didGetBackupInfo = useState(false);
bool hasExclusiveAccess =
backupState.backupProgress != BackUpProgressEnum.inBackground;
bool shouldBackup = backupState.allUniqueAssets.length -
backupState.selectedAlbumsBackupAssetsIds.length ==
0 ||
bool hasExclusiveAccess = backupState.backupProgress != BackUpProgressEnum.inBackground;
bool shouldBackup = backupState.allUniqueAssets.length - backupState.selectedAlbumsBackupAssetsIds.length == 0 ||
!hasExclusiveAccess
? false
: true;
@ -48,9 +45,7 @@ class BackupControllerPage extends HookConsumerWidget {
ref.watch(iOSBackgroundSettingsProvider.notifier).refresh();
}
ref
.watch(websocketProvider.notifier)
.stopListenToEvent('on_upload_success');
ref.watch(websocketProvider.notifier).stopListenToEvent('on_upload_success');
return () {
WakelockPlus.disable();
@ -61,8 +56,7 @@ class BackupControllerPage extends HookConsumerWidget {
useEffect(
() {
if (backupState.backupProgress == BackUpProgressEnum.idle &&
!didGetBackupInfo.value) {
if (backupState.backupProgress == BackUpProgressEnum.idle && !didGetBackupInfo.value) {
ref.watch(backupProvider.notifier).getBackupInfo();
didGetBackupInfo.value = true;
}
@ -183,9 +177,7 @@ class BackupControllerPage extends HookConsumerWidget {
onPressed: () async {
await context.pushRoute(const BackupAlbumSelectionRoute());
// waited until returning from selection
await ref
.read(backupProvider.notifier)
.backupAlbumSelectionDone();
await ref.read(backupProvider.notifier).backupAlbumSelectionDone();
// waited until backup albums are stored in DB
ref.read(albumProvider.notifier).refreshDeviceAlbums();
},
@ -203,8 +195,7 @@ class BackupControllerPage extends HookConsumerWidget {
void startBackup() {
ref.watch(errorBackupListProvider.notifier).empty();
if (ref.watch(backupProvider).backupProgress !=
BackUpProgressEnum.inBackground) {
if (ref.watch(backupProvider).backupProgress != BackUpProgressEnum.inBackground) {
ref.watch(backupProvider.notifier).startBackupProcess();
}
}
@ -216,8 +207,7 @@ class BackupControllerPage extends HookConsumerWidget {
),
child: Container(
child: backupState.backupProgress == BackUpProgressEnum.inProgress ||
backupState.backupProgress ==
BackUpProgressEnum.manualInProgress
backupState.backupProgress == BackUpProgressEnum.manualInProgress
? ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.grey[50],
@ -225,8 +215,7 @@ class BackupControllerPage extends HookConsumerWidget {
// padding: const EdgeInsets.all(14),
),
onPressed: () {
if (backupState.backupProgress ==
BackUpProgressEnum.manualInProgress) {
if (backupState.backupProgress == BackUpProgressEnum.manualInProgress) {
ref.read(manualUploadProvider.notifier).cancelBackup();
} else {
ref.read(backupProvider.notifier).cancelBackup();

View file

@ -39,9 +39,7 @@ class _DriftBackupPageState extends ConsumerState<DriftBackupPage> {
return;
}
await ref
.read(driftBackupProvider.notifier)
.getBackupStatus(currentUser.id);
await ref.read(driftBackupProvider.notifier).getBackupStatus(currentUser.id);
await ref.read(driftBackupProvider.notifier).backup(currentUser.id);
}
@ -224,9 +222,7 @@ class _BackupAlbumSelectionCard extends ConsumerWidget {
if (currentUser == null) {
return;
}
ref
.read(driftBackupProvider.notifier)
.getBackupStatus(currentUser.id);
ref.read(driftBackupProvider.notifier).getBackupStatus(currentUser.id);
},
child: const Text(
"select",
@ -245,8 +241,7 @@ class _TotalCard extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final totalCount =
ref.watch(driftBackupProvider.select((p) => p.totalCount));
final totalCount = ref.watch(driftBackupProvider.select((p) => p.totalCount));
return BackupInfoCard(
title: "total".tr(),
@ -261,8 +256,7 @@ class _BackupCard extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final backupCount =
ref.watch(driftBackupProvider.select((p) => p.backupCount));
final backupCount = ref.watch(driftBackupProvider.select((p) => p.backupCount));
return BackupInfoCard(
title: "backup_controller_page_backup".tr(),
@ -277,8 +271,7 @@ class _RemainderCard extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final remainderCount =
ref.watch(driftBackupProvider.select((p) => p.remainderCount));
final remainderCount = ref.watch(driftBackupProvider.select((p) => p.remainderCount));
return BackupInfoCard(
title: "backup_controller_page_remainder".tr(),
subtitle: "backup_controller_page_remainder_sub".tr(),

View file

@ -21,12 +21,10 @@ class DriftBackupAlbumSelectionPage extends ConsumerStatefulWidget {
const DriftBackupAlbumSelectionPage({super.key});
@override
ConsumerState<DriftBackupAlbumSelectionPage> createState() =>
_DriftBackupAlbumSelectionPageState();
ConsumerState<DriftBackupAlbumSelectionPage> createState() => _DriftBackupAlbumSelectionPageState();
}
class _DriftBackupAlbumSelectionPageState
extends ConsumerState<DriftBackupAlbumSelectionPage> {
class _DriftBackupAlbumSelectionPageState extends ConsumerState<DriftBackupAlbumSelectionPage> {
String _searchQuery = '';
bool _isSearchMode = false;
int _initialTotalAssetCount = 0;
@ -42,13 +40,10 @@ class _DriftBackupAlbumSelectionPageState
_searchController = TextEditingController();
_searchFocusNode = FocusNode();
_enableSyncUploadAlbum.value = ref
.read(appSettingsServiceProvider)
.getSetting(AppSettingsEnum.syncAlbums);
_enableSyncUploadAlbum.value = ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.syncAlbums);
ref.read(backupAlbumProvider.notifier).getAll();
_initialTotalAssetCount =
ref.read(driftBackupProvider.select((p) => p.totalCount));
_initialTotalAssetCount = ref.read(driftBackupProvider.select((p) => p.totalCount));
}
@override
@ -69,12 +64,8 @@ class _DriftBackupAlbumSelectionPageState
return album.name.toLowerCase().contains(_searchQuery.toLowerCase());
}).toList();
final selectedBackupAlbums = albums
.where((album) => album.backupSelection == BackupSelection.selected)
.toList();
final excludedBackupAlbums = albums
.where((album) => album.backupSelection == BackupSelection.excluded)
.toList();
final selectedBackupAlbums = albums.where((album) => album.backupSelection == BackupSelection.selected).toList();
final excludedBackupAlbums = albums.where((album) => album.backupSelection == BackupSelection.excluded).toList();
handleSyncAlbumToggle(bool isEnable) async {
if (isEnable) {
@ -98,16 +89,11 @@ class _DriftBackupAlbumSelectionPageState
return;
}
await ref
.read(driftBackupProvider.notifier)
.getBackupStatus(currentUser.id);
final currentTotalAssetCount =
ref.read(driftBackupProvider.select((p) => p.totalCount));
await ref.read(driftBackupProvider.notifier).getBackupStatus(currentUser.id);
final currentTotalAssetCount = ref.read(driftBackupProvider.select((p) => p.totalCount));
if (currentTotalAssetCount != _initialTotalAssetCount) {
final isBackupEnabled = ref
.read(appSettingsServiceProvider)
.getSetting(AppSettingsEnum.enableBackup);
final isBackupEnabled = ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.enableBackup);
if (!isBackupEnabled) {
return;
@ -132,8 +118,7 @@ class _DriftBackupAlbumSelectionPageState
autofocus: true,
controller: _searchController,
focusNode: _searchFocusNode,
onChanged: (value) =>
setState(() => _searchQuery = value.trim()),
onChanged: (value) => setState(() => _searchQuery = value.trim()),
)
: const Text(
"backup_album_selection_page_select_albums",
@ -195,8 +180,7 @@ class _DriftBackupAlbumSelectionPageState
SettingsSwitchListTile(
valueNotifier: _enableSyncUploadAlbum,
title: "sync_albums".t(context: context),
subtitle: "sync_upload_album_setting_subtitle"
.t(context: context),
subtitle: "sync_upload_album_setting_subtitle".t(context: context),
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
titleStyle: context.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.bold,
@ -238,8 +222,7 @@ class _DriftBackupAlbumSelectionPageState
builder: (BuildContext context) {
return AlertDialog(
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(10)),
borderRadius: BorderRadius.all(Radius.circular(10)),
),
elevation: 5,
title: Text(
@ -428,8 +411,7 @@ class _SelectedAlbumNameChips extends ConsumerWidget {
),
),
backgroundColor: context.primaryColor,
deleteIconColor:
context.isDarkTheme ? Colors.black : Colors.white,
deleteIconColor: context.isDarkTheme ? Colors.black : Colors.white,
deleteIcon: const Icon(
Icons.cancel_rounded,
size: 15,
@ -504,9 +486,7 @@ class _SelectAllButton extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final canSelectAll = filteredAlbums
.where((album) => album.backupSelection != BackupSelection.selected)
.isNotEmpty;
final canSelectAll = filteredAlbums.where((album) => album.backupSelection != BackupSelection.selected).isNotEmpty;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
@ -518,9 +498,7 @@ class _SelectAllButton extends ConsumerWidget {
? () {
for (final album in filteredAlbums) {
if (album.backupSelection != BackupSelection.selected) {
ref
.read(backupAlbumProvider.notifier)
.selectAlbum(album);
ref.read(backupAlbumProvider.notifier).selectAlbum(album);
}
}
}
@ -544,9 +522,7 @@ class _SelectAllButton extends ConsumerWidget {
? () {
for (final album in filteredAlbums) {
if (album.backupSelection == BackupSelection.selected) {
ref
.read(backupAlbumProvider.notifier)
.deselectAlbum(album);
ref.read(backupAlbumProvider.notifier).deselectAlbum(album);
}
}
}

View file

@ -27,9 +27,7 @@ class DriftUploadDetailPage extends ConsumerWidget {
elevation: 0,
scrolledUnderElevation: 1,
),
body: uploadItems.isEmpty
? _buildEmptyState(context)
: _buildUploadList(uploadItems),
body: uploadItems.isEmpty ? _buildEmptyState(context) : _buildUploadList(uploadItems),
);
}
@ -79,9 +77,7 @@ class DriftUploadDetailPage extends ConsumerWidget {
return Card(
elevation: 0,
color: item.isFailed != null
? context.colorScheme.errorContainer
: context.colorScheme.surfaceContainer,
color: item.isFailed != null ? context.colorScheme.errorContainer : context.colorScheme.surfaceContainer,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(
Radius.circular(16),
@ -119,8 +115,7 @@ class DriftUploadDetailPage extends ConsumerWidget {
Text(
'Tap for more details',
style: context.textTheme.bodySmall?.copyWith(
color: context.colorScheme.onSurface
.withValues(alpha: 0.6),
color: context.colorScheme.onSurface.withValues(alpha: 0.6),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@ -163,13 +158,10 @@ class DriftUploadDetailPage extends ConsumerWidget {
tween: Tween<double>(begin: 0.0, end: progress),
duration: const Duration(milliseconds: 300),
builder: (context, value, _) => CircularProgressIndicator(
backgroundColor:
context.colorScheme.outline.withValues(alpha: 0.2),
backgroundColor: context.colorScheme.outline.withValues(alpha: 0.2),
strokeWidth: 3,
value: value,
color: isCompleted
? context.colorScheme.primary
: context.colorScheme.secondary,
color: isCompleted ? context.colorScheme.primary : context.colorScheme.secondary,
),
),
),
@ -279,12 +271,10 @@ class FileDetailDialog extends ConsumerWidget {
height: 128,
decoration: BoxDecoration(
border: Border.all(
color: context.colorScheme.outline
.withValues(alpha: 0.2),
color: context.colorScheme.outline.withValues(alpha: 0.2),
width: 1,
),
borderRadius:
const BorderRadius.all(Radius.circular(12)),
borderRadius: const BorderRadius.all(Radius.circular(12)),
),
child: asset != null
? Thumbnail(
@ -314,8 +304,7 @@ class FileDetailDialog extends ConsumerWidget {
"File Size",
formatHumanReadableBytes(uploadStatus.fileSize, 2),
),
if (asset.width != null)
_buildInfoRow(context, "Width", "${asset.width}px"),
if (asset.width != null) _buildInfoRow(context, "Width", "${asset.width}px"),
if (asset.height != null)
_buildInfoRow(
context,

View file

@ -97,9 +97,7 @@ class FailedBackupStatusPage extends HookConsumerWidget {
),
style: TextStyle(
fontWeight: FontWeight.w600,
color: context.isDarkTheme
? Colors.white70
: Colors.grey[800],
color: context.isDarkTheme ? Colors.white70 : Colors.grey[800],
),
),
Icon(
@ -125,9 +123,7 @@ class FailedBackupStatusPage extends HookConsumerWidget {
errorAsset.errorMessage,
style: TextStyle(
fontWeight: FontWeight.w500,
color: context.isDarkTheme
? Colors.white70
: Colors.grey[800],
color: context.isDarkTheme ? Colors.white70 : Colors.grey[800],
),
),
],