From 3094f686072e44c5ded2d8df50bd749dc5e804de Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Sun, 22 Feb 2026 18:55:47 +0100 Subject: [PATCH] dart format --- app/lib/core/filesystem.dart | 21 ++++---------- app/lib/core/routing/routes.tor.dart | 5 +--- app/lib/domain/entities/profile.dart | 12 ++------ app/lib/domain/services/generic_website.dart | 28 +++++++++---------- .../widgets/browser_modules/browser_fab.dart | 4 +-- .../widgets/browser_modules/browser_view.dart | 3 +- .../presentation/widgets/sheets/view_tab.dart | 3 +- .../pwa/domain/pwa_installability.dart | 20 ++++++------- .../search/presentation/screens/search.dart | 3 +- .../presentation/widgets/container_chips.dart | 3 +- .../entities/sync_repository_state.dart | 16 ++++++----- .../user/domain/services/user_backup.dart | 8 ++---- .../widgets/authors_horizontal_list.dart | 3 +- .../widgets/tags_horizontal_list.dart | 3 +- .../presentation/widgets/safe_raw_image.dart | 7 +---- 15 files changed, 55 insertions(+), 84 deletions(-) diff --git a/app/lib/core/filesystem.dart b/app/lib/core/filesystem.dart index 1ce4ffbf..73908b28 100644 --- a/app/lib/core/filesystem.dart +++ b/app/lib/core/filesystem.dart @@ -80,9 +80,7 @@ class _Filesystem { /// Returns `true` if a migration was performed. static Future _migrateMozillaDirToFiles(Directory profileDir) async { final oldDir = Directory(p.join(profileDir.path, 'mozilla')); - final newDir = Directory( - p.join(profileDir.path, 'files', 'mozilla'), - ); + final newDir = Directory(p.join(profileDir.path, 'files', 'mozilla')); final oldType = await FileSystemEntity.type( oldDir.path, @@ -90,9 +88,7 @@ class _Filesystem { ); if (oldType == FileSystemEntityType.directory && !await newDir.exists()) { - await Directory( - p.join(profileDir.path, 'files'), - ).create(recursive: true); + await Directory(p.join(profileDir.path, 'files')).create(recursive: true); await oldDir.rename(newDir.path); return true; } @@ -105,9 +101,7 @@ class _Filesystem { for (final profileId in profileIds) { final oldCache = Directory(p.join(globalCacheDir.path, profileId)); - final newCache = Directory( - p.join(profileDir.path, 'cache', profileId), - ); + final newCache = Directory(p.join(profileDir.path, 'cache', profileId)); if (await oldCache.exists() && !await newCache.exists()) { try { @@ -132,9 +126,7 @@ class _Filesystem { Directory filesDir, Directory profileDir, ) async { - final mozillaDir = Directory( - p.join(profileDir.path, 'files', 'mozilla'), - ); + final mozillaDir = Directory(p.join(profileDir.path, 'files', 'mozilla')); await mozillaDir.create(recursive: true); final mozillaPath = p.join(filesDir.path, 'mozilla'); @@ -279,10 +271,7 @@ class _Filesystem { } if (changed) { - await extensionsFile.writeAsString( - jsonEncode(json), - flush: true, - ); + await extensionsFile.writeAsString(jsonEncode(json), flush: true); logger.i('Migrated extension paths in $profileId/extensions.json'); migrated = true; } diff --git a/app/lib/core/routing/routes.tor.dart b/app/lib/core/routing/routes.tor.dart index 1f60e432..d62def1b 100644 --- a/app/lib/core/routing/routes.tor.dart +++ b/app/lib/core/routing/routes.tor.dart @@ -46,9 +46,6 @@ class TorCountryPickerRoute extends GoRouteData with $TorCountryPickerRoute { @override Widget build(BuildContext context, GoRouterState state) { - return CountryPickerScreen( - title: title, - selectedCountryCode: $extra, - ); + return CountryPickerScreen(title: title, selectedCountryCode: $extra); } } diff --git a/app/lib/domain/entities/profile.dart b/app/lib/domain/entities/profile.dart index 8f2fdaac..24b66798 100644 --- a/app/lib/domain/entities/profile.dart +++ b/app/lib/domain/entities/profile.dart @@ -38,16 +38,10 @@ class Profile with FastEquatable { static String getNewProfileId() => uuid.v7(); - Profile({ - required this.id, - required this.name, - AuthSettings? authSettings, - }) : authSettings = authSettings ?? AuthSettings.withDefaults(); + Profile({required this.id, required this.name, AuthSettings? authSettings}) + : authSettings = authSettings ?? AuthSettings.withDefaults(); - factory Profile.create({ - required String name, - AuthSettings? authSettings, - }) { + factory Profile.create({required String name, AuthSettings? authSettings}) { return Profile( id: getNewProfileId(), name: name, diff --git a/app/lib/domain/services/generic_website.dart b/app/lib/domain/services/generic_website.dart index 264fb88e..e50a7a17 100644 --- a/app/lib/domain/services/generic_website.dart +++ b/app/lib/domain/services/generic_website.dart @@ -358,21 +358,19 @@ class GenericWebsiteService extends _$GenericWebsiteService { } late final Future> inFlightFetch; - inFlightFetch = fetchPageInfo( - url: url, - isImageRequest: true, - proxyPort: null, - ).timeout( - const Duration(seconds: 20), - onTimeout: () => Result.failure( - const ErrorMessage(source: 'icon', message: 'Icon fetch timeout'), - ), - ).whenComplete(() { - // Only clear this entry if it is still the active in-flight request. - if (identical(_inFlightFetches[url]?.future, inFlightFetch)) { - _inFlightFetches.remove(url); - } - }); + inFlightFetch = fetchPageInfo(url: url, isImageRequest: true, proxyPort: null) + .timeout( + const Duration(seconds: 20), + onTimeout: () => Result.failure( + const ErrorMessage(source: 'icon', message: 'Icon fetch timeout'), + ), + ) + .whenComplete(() { + // Only clear this entry if it is still the active in-flight request. + if (identical(_inFlightFetches[url]?.future, inFlightFetch)) { + _inFlightFetches.remove(url); + } + }); _inFlightFetches[url] = _InFlightFetch(inFlightFetch); return inFlightFetch; diff --git a/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_fab.dart b/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_fab.dart index fdd8c067..4e926c97 100644 --- a/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_fab.dart +++ b/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_fab.dart @@ -64,9 +64,7 @@ class BrowserFab extends HookConsumerWidget { heroTag: 'dock_fab', onPressed: () { ref - .read( - toolbarVisibilityControllerProvider(selectedTabId).notifier, - ) + .read(toolbarVisibilityControllerProvider(selectedTabId).notifier) .forceShow(); }, child: const Icon(MdiIcons.dockBottom), diff --git a/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart b/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart index c54f2cb0..aa4b8112 100644 --- a/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart +++ b/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart @@ -68,7 +68,8 @@ class BrowserView extends StatefulHookConsumerWidget { final Future Function()? postInitializationStep; final StreamSink? pointerMoveEventSink; - const BrowserView({super.key, + const BrowserView({ + super.key, this.screenshotPeriod = const Duration(seconds: 10), this.suggestionTimeout = const Duration(seconds: 30), this.postInitializationStep, diff --git a/app/lib/features/geckoview/features/browser/presentation/widgets/sheets/view_tab.dart b/app/lib/features/geckoview/features/browser/presentation/widgets/sheets/view_tab.dart index 0326be3e..a28d70de 100644 --- a/app/lib/features/geckoview/features/browser/presentation/widgets/sheets/view_tab.dart +++ b/app/lib/features/geckoview/features/browser/presentation/widgets/sheets/view_tab.dart @@ -52,7 +52,8 @@ class ViewTabSheetWidget extends HookConsumerWidget { final double bottomAppBarHeight; final ValueChanged? onClearSiteDataExpandedChanged; - const ViewTabSheetWidget({super.key, + const ViewTabSheetWidget({ + super.key, required this.initialTabState, required this.sheetScrollController, required this.draggableScrollableController, diff --git a/app/lib/features/geckoview/features/pwa/domain/pwa_installability.dart b/app/lib/features/geckoview/features/pwa/domain/pwa_installability.dart index dcdd9ec2..bb107152 100644 --- a/app/lib/features/geckoview/features/pwa/domain/pwa_installability.dart +++ b/app/lib/features/geckoview/features/pwa/domain/pwa_installability.dart @@ -70,15 +70,9 @@ bool isManifestInstallable(PwaManifest manifest) { _validDisplayModes.contains(manifest.display!.toLowerCase()); // Check that start_url is within scope - final isInScope = _isStartUrlInScope( - manifest.startUrl, - manifest.scope, - ); + final isInScope = _isStartUrlInScope(manifest.startUrl, manifest.scope); - return hasValidName && - hasValidStartUrl && - hasValidDisplay && - isInScope; + return hasValidName && hasValidStartUrl && hasValidDisplay && isInScope; } /// Returns true if two URLs share the same origin (scheme + host + port). @@ -120,10 +114,12 @@ bool _isStartUrlInScope(String startUrl, String? scope) { // Path containment: scope path must be a prefix of start_url path // on a `/` boundary to avoid "/app" matching "/application" - final scopePath = - scopeUri.path.endsWith('/') ? scopeUri.path : '${scopeUri.path}/'; - final startPath = - startUri.path.endsWith('/') ? startUri.path : '${startUri.path}/'; + final scopePath = scopeUri.path.endsWith('/') + ? scopeUri.path + : '${scopeUri.path}/'; + final startPath = startUri.path.endsWith('/') + ? startUri.path + : '${startUri.path}/'; return startPath.startsWith(scopePath) || startUri.path == scopeUri.path; } catch (e) { diff --git a/app/lib/features/geckoview/features/search/presentation/screens/search.dart b/app/lib/features/geckoview/features/search/presentation/screens/search.dart index d5c11715..dff4484b 100644 --- a/app/lib/features/geckoview/features/search/presentation/screens/search.dart +++ b/app/lib/features/geckoview/features/search/presentation/screens/search.dart @@ -59,7 +59,8 @@ class SearchScreen extends HookConsumerWidget { /// When null, a new tab will be created. final String? tabId; - const SearchScreen({super.key, + const SearchScreen({ + super.key, required this.initialSearchText, required this.tabType, this.launchedFromIntent = false, diff --git a/app/lib/features/geckoview/features/tabs/presentation/widgets/container_chips.dart b/app/lib/features/geckoview/features/tabs/presentation/widgets/container_chips.dart index 623a6cdd..19d23427 100644 --- a/app/lib/features/geckoview/features/tabs/presentation/widgets/container_chips.dart +++ b/app/lib/features/geckoview/features/tabs/presentation/widgets/container_chips.dart @@ -178,7 +178,8 @@ class ContainerChips extends HookConsumerWidget { final ValueListenable? searchTextListenable; - const ContainerChips({super.key, + const ContainerChips({ + super.key, required this.selectedContainer, required this.onSelected, required this.onDeleted, diff --git a/app/lib/features/sync/domain/entities/sync_repository_state.dart b/app/lib/features/sync/domain/entities/sync_repository_state.dart index 7f86b17c..8be5c2ca 100644 --- a/app/lib/features/sync/domain/entities/sync_repository_state.dart +++ b/app/lib/features/sync/domain/entities/sync_repository_state.dart @@ -4,11 +4,7 @@ import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; part 'sync_repository_state.g.dart'; -enum SyncEvent { - started, - completed, - error; -} +enum SyncEvent { started, completed, error } @CopyWith() class SyncRepositoryState with FastEquatable { @@ -29,6 +25,12 @@ class SyncRepositoryState with FastEquatable { }); @override - List get hashParameters => - [account, remoteTabs, devices, deviceName, lastSyncEvent, lastSyncError]; + List get hashParameters => [ + account, + remoteTabs, + devices, + deviceName, + lastSyncEvent, + lastSyncError, + ]; } diff --git a/app/lib/features/user/domain/services/user_backup.dart b/app/lib/features/user/domain/services/user_backup.dart index 3e8f3eb3..b2f7f50d 100644 --- a/app/lib/features/user/domain/services/user_backup.dart +++ b/app/lib/features/user/domain/services/user_backup.dart @@ -148,9 +148,7 @@ class UserBackupService extends _$UserBackupService { outputDirectory, ); if (existingProfile == null) { - throw Exception( - 'Backup does not contain valid profile metadata', - ); + throw Exception('Backup does not contain valid profile metadata'); } if (existingProfile.uuidValue == filesystem.selectedProfile) { @@ -159,9 +157,7 @@ class UserBackupService extends _$UserBackupService { ); } - final profileDir = filesystem.getProfileDir( - existingProfile.uuidValue, - ); + final profileDir = filesystem.getProfileDir(existingProfile.uuidValue); if (await profileDir.exists()) { final result = await confirmOverrideCallback(); diff --git a/app/lib/features/web_feed/presentation/widgets/authors_horizontal_list.dart b/app/lib/features/web_feed/presentation/widgets/authors_horizontal_list.dart index b98f41d9..b06d5d6b 100644 --- a/app/lib/features/web_feed/presentation/widgets/authors_horizontal_list.dart +++ b/app/lib/features/web_feed/presentation/widgets/authors_horizontal_list.dart @@ -25,7 +25,8 @@ import 'package:weblibre/features/web_feed/data/models/feed_author.dart'; class AuthorsHorizontalList extends StatelessWidget { late final List _authors; - AuthorsHorizontalList({super.key, + AuthorsHorizontalList({ + super.key, required List authors, Set selectedTags = const {}, void Function(String tagId, bool value)? onTagSelected, diff --git a/app/lib/features/web_feed/presentation/widgets/tags_horizontal_list.dart b/app/lib/features/web_feed/presentation/widgets/tags_horizontal_list.dart index 33016cb5..bfd1a92a 100644 --- a/app/lib/features/web_feed/presentation/widgets/tags_horizontal_list.dart +++ b/app/lib/features/web_feed/presentation/widgets/tags_horizontal_list.dart @@ -25,7 +25,8 @@ import 'package:weblibre/features/web_feed/data/models/feed_category.dart'; class TagsHorizontalList extends StatelessWidget { late final List _tags; - TagsHorizontalList({super.key, + TagsHorizontalList({ + super.key, required List tags, Set selectedTags = const {}, void Function(String tagId, bool value)? onTagSelected, diff --git a/app/lib/presentation/widgets/safe_raw_image.dart b/app/lib/presentation/widgets/safe_raw_image.dart index f3e2b2eb..e26bff00 100644 --- a/app/lib/presentation/widgets/safe_raw_image.dart +++ b/app/lib/presentation/widgets/safe_raw_image.dart @@ -49,11 +49,6 @@ class SafeRawImage extends StatelessWidget { return fallback ?? SizedBox(width: width, height: height); } - return RawImage( - image: uiImage, - width: width, - height: height, - fit: fit, - ); + return RawImage(image: uiImage, width: width, height: height, fit: fit); } }