[mob][photos] Dart format (#7101)

## Description

- Formats the flutter code in `/photos`
- Adds format instructions to claude.md
This commit is contained in:
Neeraj
2025-09-08 11:38:42 +05:30
committed by GitHub
16 changed files with 63 additions and 41 deletions

View File

@@ -31,7 +31,10 @@ The Photos app uses two types of packages:
**CRITICAL: CI will fail if ANY of these checks fail. Run ALL commands and ensure they ALL pass.**
```bash
# 1. Analyze flutter code for errors and warnings
# 1. Format Dart code
dart format .
# 2. Analyze flutter code for errors and warnings
flutter analyze
```
@@ -164,11 +167,12 @@ lib/
## Critical Coding Requirements
### 1. Code Quality - MANDATORY
**Every code change MUST pass `flutter analyze` with zero issues**
**Every code change MUST pass `dart format .` and `flutter analyze` with zero issues**
- Run `dart format .` first to format all Dart code
- Run `flutter analyze` after EVERY code modification
- Resolve ALL issues (info, warning, error) - no exceptions
- The codebase has zero issues by default, so any issue is from your changes
- DO NOT commit or consider work complete until `flutter analyze` passes cleanly
- DO NOT commit or consider work complete until both commands pass cleanly
### 2. Component Reuse - MANDATORY
**Always try to reuse existing components**

View File

@@ -228,7 +228,7 @@ extension CustomColorScheme on ColorScheme {
Color get videoPlayerPrimaryColor => brightness == Brightness.light
? const Color.fromRGBO(0, 179, 60, 1)
: const Color.fromRGBO(1, 222, 77, 1);
Color get videoPlayerBorderColor => brightness == Brightness.light
? const Color(0xFF424242)
: const Color(0xFFFFFFFF);

View File

@@ -5,4 +5,4 @@ class CreateNewAlbumEvent extends Event {
final Collection collection;
CreateNewAlbumEvent(this.collection);
}
}

View File

@@ -110,7 +110,7 @@ class DateParseService {
result = _parseStructuredFormats(lowerInput);
if (!result.isEmpty) return result;
final normalized = _normalizeDateString(lowerInput);
result = _parseTokenizedDate(normalized);
@@ -203,7 +203,7 @@ class DateParseService {
}
return PartialDate.empty;
}
match = _standardFormatRegex.firstMatch(cleanInput);
if (match != null) {
final p1 = int.parse(match.group(1)!);

View File

@@ -344,7 +344,8 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
child: Text(
AppLocalizations.of(context).passwordStrength(
passwordStrengthValue: passwordStrengthText,),
passwordStrengthValue: passwordStrengthText,
),
style: TextStyle(
color: passwordStrengthColor,
),

View File

@@ -14,7 +14,8 @@ class DeveloperSettingsWidget extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 20),
child: Text(
AppLocalizations.of(context).customEndpoint(
endpoint: "${endpointURI.host}:${endpointURI.port}",),
endpoint: "${endpointURI.host}:${endpointURI.port}",
),
style: Theme.of(context).textTheme.bodySmall,
),
);

View File

@@ -283,7 +283,9 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
: const SizedBox.shrink(),
Text(
AppLocalizations.of(context).availableStorageSpace(
freeAmount: freeSpace, storageUnit: freeSpaceUnit,),
freeAmount: freeSpace,
storageUnit: freeSpaceUnit,
),
style: getEnteTextTheme(context)
.mini
.copyWith(color: textFaintDark),

View File

@@ -180,7 +180,8 @@ class _VerifyIdentifyDialogState extends State<VerifyIdentifyDialog> {
.shareMyVerificationID(verificationID: verificationID)
: AppLocalizations.of(context)
.shareTextConfirmOthersVerificationID(
verificationID: verificationID,),
verificationID: verificationID,
),
);
},
child: Container(

View File

@@ -366,7 +366,8 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
margin: const EdgeInsets.only(bottom: 24),
decoration: BoxDecoration(
color: isHovered
? colorScheme.warning400.withValues(alpha: 0.8)
? colorScheme.warning400
.withValues(alpha: 0.8)
: Colors.white,
shape: BoxShape.circle,
),

View File

@@ -54,7 +54,9 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
? AppLocalizations.of(context)
.filesBackedUpInAlbum(count: count, formattedNumber: formattedCount)
: AppLocalizations.of(context).filesBackedUpFromDevice(
count: count, formattedNumber: formattedCount,);
count: count,
formattedNumber: formattedCount,
);
final informationTextStyle = TextStyle(
fontSize: 14,
height: 1.3,
@@ -121,7 +123,9 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
Expanded(
child: Text(
AppLocalizations.of(context).freeUpSpaceSaving(
count: count, formattedSize: formatBytes(status.size),),
count: count,
formattedSize: formatBytes(status.size),
),
style: informationTextStyle,
),
),

View File

@@ -153,8 +153,9 @@ class _DeleteEmptyAlbumsState extends State<DeleteEmptyAlbums> {
.toString()
.padLeft(collections.length.toString().length, '0');
_deleteProgress.value = AppLocalizations.of(context).deleteProgress(
currentlyDeleting: currentlyDeleting,
totalCount: collections.length,);
currentlyDeleting: currentlyDeleting,
totalCount: collections.length,
);
try {
await CollectionsService.instance.trashEmptyCollection(
collections[i],

View File

@@ -47,15 +47,16 @@ class _VideoStreamChangeWidgetState extends State<VideoStreamChangeWidget> {
final status = event.status;
// Handle different states - will be false for different files or non-processing states
final newProcessingState = widget.file.uploadedFileID == fileId && switch (status) {
PreviewItemStatus.inQueue ||
PreviewItemStatus.retry ||
PreviewItemStatus.compressing ||
PreviewItemStatus.uploading =>
true,
_ => false,
};
final newProcessingState = widget.file.uploadedFileID == fileId &&
switch (status) {
PreviewItemStatus.inQueue ||
PreviewItemStatus.retry ||
PreviewItemStatus.compressing ||
PreviewItemStatus.uploading =>
true,
_ => false,
};
// Only update state if value changed
if (isCurrentlyProcessing != newProcessingState) {
isCurrentlyProcessing = newProcessingState;

View File

@@ -224,7 +224,8 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
context,
AppLocalizations.of(context)
.typeOfGallerGallerytypeIsNotSupportedForRename(
galleryType: "$galleryType",),
galleryType: "$galleryType",
),
);
return;

View File

@@ -104,7 +104,8 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
return Center(
child: Text(
AppLocalizations.of(context).noSuggestionsForPerson(
personName: widget.person.data.name,),
personName: widget.person.data.name,
),
style: getEnteTextTheme(context).largeMuted,
),
);

View File

@@ -156,7 +156,9 @@ class _LinkContactToPersonSelectionPageState
title: context.l10n.linkPersonToEmail(email: emailToLink),
icon: Icons.info_outline,
body: context.l10n.linkPersonToEmailConfirmation(
personName: personName, email: emailToLink,),
personName: personName,
email: emailToLink,
),
isDismissible: true,
buttons: [
ButtonWidget(

View File

@@ -42,7 +42,7 @@ class LocalSettings {
static const kCollectionViewType = "collection_view_type";
static const kCollectionSortDirection = "collection_sort_direction";
static const kShowLocalIDOverThumbnails = "show_local_id_over_thumbnails";
// Thumbnail queue configuration keys
static const kSmallQueueMaxConcurrent = "small_queue_max_concurrent";
static const kSmallQueueTimeout = "small_queue_timeout_seconds";
@@ -235,39 +235,41 @@ class LocalSettings {
}
// Thumbnail queue configuration - Small queue
int get smallQueueMaxConcurrent => _prefs.getInt(kSmallQueueMaxConcurrent) ?? 15;
int get smallQueueMaxConcurrent =>
_prefs.getInt(kSmallQueueMaxConcurrent) ?? 15;
int get smallQueueTimeoutSeconds => _prefs.getInt(kSmallQueueTimeout) ?? 60;
int get smallQueueMaxSize => _prefs.getInt(kSmallQueueMaxSize) ?? 200;
Future<void> setSmallQueueMaxConcurrent(int value) async {
await _prefs.setInt(kSmallQueueMaxConcurrent, value);
}
Future<void> setSmallQueueTimeout(int seconds) async {
await _prefs.setInt(kSmallQueueTimeout, seconds);
}
Future<void> setSmallQueueMaxSize(int value) async {
await _prefs.setInt(kSmallQueueMaxSize, value);
}
// Thumbnail queue configuration - Large queue
int get largeQueueMaxConcurrent => _prefs.getInt(kLargeQueueMaxConcurrent) ?? 5;
int get largeQueueMaxConcurrent =>
_prefs.getInt(kLargeQueueMaxConcurrent) ?? 5;
int get largeQueueTimeoutSeconds => _prefs.getInt(kLargeQueueTimeout) ?? 60;
int get largeQueueMaxSize => _prefs.getInt(kLargeQueueMaxSize) ?? 200;
Future<void> setLargeQueueMaxConcurrent(int value) async {
await _prefs.setInt(kLargeQueueMaxConcurrent, value);
}
Future<void> setLargeQueueTimeout(int seconds) async {
await _prefs.setInt(kLargeQueueTimeout, seconds);
}
Future<void> setLargeQueueMaxSize(int value) async {
await _prefs.setInt(kLargeQueueMaxSize, value);
}