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

@ -31,8 +31,7 @@ final _features = [
return Future.value();
}
final assets =
await ref.read(remoteAssetRepositoryProvider).getSome(user.id);
final assets = await ref.read(remoteAssetRepositoryProvider).getSome(user.id);
final selectedAssets = await ctx.pushRoute<Set<BaseAsset>>(
DriftAssetSelectionTimelineRoute(
@ -75,9 +74,7 @@ final _features = [
_Feature(
name: 'WAL Checkpoint',
icon: Icons.save_rounded,
onTap: (_, ref) => ref
.read(driftProvider)
.customStatement("pragma wal_checkpoint(truncate)"),
onTap: (_, ref) => ref.read(driftProvider).customStatement("pragma wal_checkpoint(truncate)"),
),
_Feature(
name: '',

View file

@ -117,9 +117,8 @@ class LocalMediaSummaryPage extends StatelessWidget {
return SliverList.builder(
itemBuilder: (_, index) {
final album = albums[index];
final countFuture = db.managers.localAlbumAssetEntity
.filter((f) => f.albumId.id.equals(album.id))
.count();
final countFuture =
db.managers.localAlbumAssetEntity.filter((f) => f.albumId.id.equals(album.id)).count();
return _Summary(
leading: const Icon(Icons.photo_album_rounded),
name: album.name,
@ -226,9 +225,8 @@ class RemoteMediaSummaryPage extends StatelessWidget {
return SliverList.builder(
itemBuilder: (_, index) {
final album = albums[index];
final countFuture = db.managers.remoteAlbumAssetEntity
.filter((f) => f.albumId.id.equals(album.id))
.count();
final countFuture =
db.managers.remoteAlbumAssetEntity.filter((f) => f.albumId.id.equals(album.id)).count();
return _Summary(
leading: const Icon(Icons.photo_album_rounded),
name: album.name,

View file

@ -50,9 +50,7 @@ class _DriftAlbumsPageState extends ConsumerState<DriftAlbumsPage> {
void onSearch(String searchTerm, QuickFilterMode sortMode) {
final userId = ref.watch(currentUserProvider)?.id;
ref
.read(remoteAlbumProvider.notifier)
.searchAlbums(searchTerm, userId, sortMode);
ref.read(remoteAlbumProvider.notifier).searchAlbums(searchTerm, userId, sortMode);
}
Future<void> onRefresh() async {
@ -88,8 +86,7 @@ class _DriftAlbumsPageState extends ConsumerState<DriftAlbumsPage> {
@override
Widget build(BuildContext context) {
final albums =
ref.watch(remoteAlbumProvider.select((s) => s.filteredAlbums));
final albums = ref.watch(remoteAlbumProvider.select((s) => s.filteredAlbums));
final userId = ref.watch(currentUserProvider)?.id;
@ -221,9 +218,7 @@ class _SortButtonState extends ConsumerState<_SortButton> {
const EdgeInsets.fromLTRB(16, 16, 32, 16),
),
backgroundColor: WidgetStateProperty.all(
albumSortOption == sortMode
? context.colorScheme.primary
: Colors.transparent,
albumSortOption == sortMode ? context.colorScheme.primary : Colors.transparent,
),
shape: WidgetStateProperty.all(
const RoundedRectangleBorder(
@ -436,9 +431,7 @@ class _QuickFilterButton extends StatelessWidget {
child: Text(
label,
style: TextStyle(
color: isSelected
? context.colorScheme.onPrimary
: context.colorScheme.onSurface,
color: isSelected ? context.colorScheme.onPrimary : context.colorScheme.onSurface,
fontSize: 14,
),
),
@ -564,8 +557,7 @@ class _AlbumList extends ConsumerWidget {
child: Container(
decoration: BoxDecoration(
color: context.colorScheme.surfaceContainer,
borderRadius:
const BorderRadius.all(Radius.circular(16)),
borderRadius: const BorderRadius.all(Radius.circular(16)),
border: Border.all(
color: context.colorScheme.outline.withAlpha(50),
width: 1,

View file

@ -23,8 +23,7 @@ class DriftArchivePage extends StatelessWidget {
throw Exception('User must be logged in to access archive');
}
final timelineService =
ref.watch(timelineFactoryProvider).archive(user.id);
final timelineService = ref.watch(timelineFactoryProvider).archive(user.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -37,8 +37,7 @@ class DriftAssetSelectionTimelinePage extends ConsumerWidget {
);
}
final timelineService =
ref.watch(timelineFactoryProvider).remoteAssets(user.id);
final timelineService = ref.watch(timelineFactoryProvider).remoteAssets(user.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -15,8 +15,7 @@ class DriftCreateAlbumPage extends ConsumerStatefulWidget {
const DriftCreateAlbumPage({super.key});
@override
ConsumerState<DriftCreateAlbumPage> createState() =>
_DriftCreateAlbumPageState();
ConsumerState<DriftCreateAlbumPage> createState() => _DriftCreateAlbumPageState();
}
class _DriftCreateAlbumPageState extends ConsumerState<DriftCreateAlbumPage> {
@ -285,9 +284,7 @@ class _DriftCreateAlbumPageState extends ConsumerState<DriftCreateAlbumPage> {
'create'.t(),
style: TextStyle(
fontWeight: FontWeight.bold,
color: _canCreateAlbum
? context.primaryColor
: context.themeData.disabledColor,
color: _canCreateAlbum ? context.primaryColor : context.themeData.disabledColor,
),
),
),
@ -351,8 +348,7 @@ class _AlbumTitleTextFieldState extends State<_AlbumTitleTextField> {
),
controller: widget.textController,
onTap: () {
if (widget.textController.text ==
'create_album_page_untitled'.t(context: context)) {
if (widget.textController.text == 'create_album_page_untitled'.t(context: context)) {
widget.textController.clear();
}
},
@ -411,12 +407,10 @@ class _AlbumViewerEditableDescription extends StatefulWidget {
final FocusNode focusNode;
@override
State<_AlbumViewerEditableDescription> createState() =>
_AlbumViewerEditableDescriptionState();
State<_AlbumViewerEditableDescription> createState() => _AlbumViewerEditableDescriptionState();
}
class _AlbumViewerEditableDescriptionState
extends State<_AlbumViewerEditableDescription> {
class _AlbumViewerEditableDescriptionState extends State<_AlbumViewerEditableDescription> {
@override
void initState() {
super.initState();
@ -458,19 +452,18 @@ class _AlbumViewerEditableDescriptionState
horizontal: 12.0,
vertical: 16.0,
),
suffixIcon:
widget.focusNode.hasFocus && widget.textController.text.isNotEmpty
? IconButton(
onPressed: () {
widget.textController.clear();
},
icon: Icon(
Icons.cancel_rounded,
color: context.primaryColor,
),
splashRadius: 10.0,
)
: null,
suffixIcon: widget.focusNode.hasFocus && widget.textController.text.isNotEmpty
? IconButton(
onPressed: () {
widget.textController.clear();
},
icon: Icon(
Icons.cancel_rounded,
color: context.primaryColor,
),
splashRadius: 10.0,
)
: null,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: context.colorScheme.outline.withValues(alpha: 0.3),

View file

@ -23,8 +23,7 @@ class DriftFavoritePage extends StatelessWidget {
throw Exception('User must be logged in to access favorite');
}
final timelineService =
ref.watch(timelineFactoryProvider).favorite(user.id);
final timelineService = ref.watch(timelineFactoryProvider).favorite(user.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -79,9 +79,7 @@ class _ActionButtonGrid extends ConsumerWidget {
onTap: () => context.pushRoute(const SharedLinkRoute()),
label: 'shared_links'.t(context: context),
),
isTrashEnable
? const SizedBox(width: 8)
: const SizedBox.shrink(),
isTrashEnable ? const SizedBox(width: 8) : const SizedBox.shrink(),
isTrashEnable
? _ActionButton(
icon: Icons.delete_outline_rounded,
@ -267,8 +265,7 @@ class _PlacesCollectionCard extends StatelessWidget {
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(20)),
color:
context.colorScheme.secondaryContainer.withAlpha(100),
color: context.colorScheme.secondaryContainer.withAlpha(100),
),
child: IgnorePointer(
child: MapThumbnail(
@ -278,9 +275,7 @@ class _PlacesCollectionCard extends StatelessWidget {
-157.91959,
),
showAttribution: false,
themeMode: context.isDarkTheme
? ThemeMode.dark
: ThemeMode.light,
themeMode: context.isDarkTheme ? ThemeMode.dark : ThemeMode.light,
),
),
),

View file

@ -102,8 +102,7 @@ class _AlbumList extends ConsumerWidget {
color: context.colorScheme.onSurfaceSecondary,
),
),
onTap: () =>
context.pushRoute(LocalTimelineRoute(album: album)),
onTap: () => context.pushRoute(LocalTimelineRoute(album: album)),
),
);
},

View file

@ -14,12 +14,10 @@ class DriftLockedFolderPage extends ConsumerStatefulWidget {
const DriftLockedFolderPage({super.key});
@override
ConsumerState<DriftLockedFolderPage> createState() =>
_DriftLockedFolderPageState();
ConsumerState<DriftLockedFolderPage> createState() => _DriftLockedFolderPageState();
}
class _DriftLockedFolderPageState extends ConsumerState<DriftLockedFolderPage>
with WidgetsBindingObserver {
class _DriftLockedFolderPageState extends ConsumerState<DriftLockedFolderPage> with WidgetsBindingObserver {
bool _showOverlay = false;
@override
@ -54,8 +52,7 @@ class _DriftLockedFolderPageState extends ConsumerState<DriftLockedFolderPage>
throw Exception('User must be logged in to access locked folder');
}
final timelineService =
ref.watch(timelineFactoryProvider).lockedFolder(user.id);
final timelineService = ref.watch(timelineFactoryProvider).lockedFolder(user.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},
@ -64,8 +61,7 @@ class _DriftLockedFolderPageState extends ConsumerState<DriftLockedFolderPage>
child: _showOverlay
? const SizedBox()
: PopScope(
onPopInvokedWithResult: (didPop, _) =>
didPop ? ref.read(authProvider.notifier).lockPinCode() : null,
onPopInvokedWithResult: (didPop, _) => didPop ? ref.read(authProvider.notifier).lockPinCode() : null,
child: Timeline(
appBar: MesmerizingSliverAppBar(
title: 'locked_folder'.t(context: context),

View file

@ -40,8 +40,7 @@ class DriftMemoryPage extends HookConsumerWidget {
final currentAsset = useState<RemoteAsset?>(null);
/// The list of all of the asset page controllers
final memoryAssetPageControllers =
List.generate(memories.length, (i) => usePageController());
final memoryAssetPageControllers = List.generate(memories.length, (i) => usePageController());
/// The main vertically scrolling page controller with each list of memories
final memoryPageController = usePageController(initialPage: memoryIndex);
@ -73,19 +72,16 @@ class DriftMemoryPage extends HookConsumerWidget {
// Wait for the next frame to ensure the page is built
SchedulerBinding.instance.addPostFrameCallback((_) {
final previousIndex = currentMemoryIndex.value - 1;
final previousMemoryController =
memoryAssetPageControllers[previousIndex];
final previousMemoryController = memoryAssetPageControllers[previousIndex];
// Ensure the controller is attached
if (previousMemoryController.hasClients) {
previousMemoryController
.jumpToPage(memories[previousIndex].assets.length - 1);
previousMemoryController.jumpToPage(memories[previousIndex].assets.length - 1);
} else {
// Wait for the next frame until it is attached
SchedulerBinding.instance.addPostFrameCallback((_) {
if (previousMemoryController.hasClients) {
previousMemoryController
.jumpToPage(memories[previousIndex].assets.length - 1);
previousMemoryController.jumpToPage(memories[previousIndex].assets.length - 1);
}
});
}
@ -96,8 +92,7 @@ class DriftMemoryPage extends HookConsumerWidget {
toNextAsset(int currentAssetIndex) {
if (currentAssetIndex + 1 < currentMemory.value.assets.length) {
// Go to the next asset
PageController controller =
memoryAssetPageControllers[currentMemoryIndex.value];
PageController controller = memoryAssetPageControllers[currentMemoryIndex.value];
controller.nextPage(
curve: Curves.easeInOut,
@ -112,8 +107,7 @@ class DriftMemoryPage extends HookConsumerWidget {
toPreviousAsset(int currentAssetIndex) {
if (currentAssetIndex > 0) {
// Go to the previous asset
PageController controller =
memoryAssetPageControllers[currentMemoryIndex.value];
PageController controller = memoryAssetPageControllers[currentMemoryIndex.value];
controller.previousPage(
curve: Curves.easeInOut,
@ -126,8 +120,7 @@ class DriftMemoryPage extends HookConsumerWidget {
}
updateProgressText() {
assetProgress.value =
"${currentAssetPage.value + 1}|${currentMemory.value.assets.length}";
assetProgress.value = "${currentAssetPage.value + 1}|${currentMemory.value.assets.length}";
}
/// Downloads and caches the image for the asset at this [currentMemory]'s index
@ -179,8 +172,7 @@ class DriftMemoryPage extends HookConsumerWidget {
// Precache the next page right away if we are on the first page
if (currentAssetPage.value == 0) {
Future.delayed(const Duration(milliseconds: 200))
.then((_) => precacheAsset(1));
Future.delayed(const Duration(milliseconds: 200)).then((_) => precacheAsset(1));
}
Future<void> onAssetChanged(int otherIndex) async {
@ -212,12 +204,10 @@ class DriftMemoryPage extends HookConsumerWidget {
// maxScrollExtend contains the sum of horizontal pixels of all assets for depth = 1
// or sum of vertical pixels of all memories for depth = 0
if (notification is ScrollUpdateNotification) {
final isEpiloguePage =
(memoryPageController.page?.floor() ?? 0) >= memories.length;
final isEpiloguePage = (memoryPageController.page?.floor() ?? 0) >= memories.length;
final offset = notification.metrics.pixels;
if (isEpiloguePage &&
(offset > notification.metrics.maxScrollExtent + 150)) {
if (isEpiloguePage && (offset > notification.metrics.maxScrollExtent + 150)) {
context.maybePop();
return true;
}
@ -366,8 +356,7 @@ class DriftMemoryPage extends HookConsumerWidget {
),
),
),
if (currentAsset.value != null &&
currentAsset.value!.isVideo)
if (currentAsset.value != null && currentAsset.value!.isVideo)
Positioned(
bottom: 24,
right: 32,

View file

@ -26,8 +26,7 @@ class DriftPartnerDetailPage extends StatelessWidget {
overrides: [
timelineServiceProvider.overrideWith(
(ref) {
final timelineService =
ref.watch(timelineFactoryProvider).remoteAssets(partner.id);
final timelineService = ref.watch(timelineFactoryProvider).remoteAssets(partner.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -91,8 +91,7 @@ class _Map extends StatelessWidget {
width: context.width,
// TODO: migrate to DriftMapRoute after merging #19898
child: MapThumbnail(
onTap: (_, __) => context
.pushRoute(MapRoute(initialLocation: currentLocation)),
onTap: (_, __) => context.pushRoute(MapRoute(initialLocation: currentLocation)),
zoom: 8,
centre: currentLocation ??
const LatLng(
@ -100,8 +99,7 @@ class _Map extends StatelessWidget {
-157.91959,
),
showAttribution: false,
themeMode:
context.isDarkTheme ? ThemeMode.dark : ThemeMode.light,
themeMode: context.isDarkTheme ? ThemeMode.dark : ThemeMode.light,
),
),
),

View file

@ -20,8 +20,7 @@ class DriftPlaceDetailPage extends StatelessWidget {
overrides: [
timelineServiceProvider.overrideWith(
(ref) {
final timelineService =
ref.watch(timelineFactoryProvider).place(place);
final timelineService = ref.watch(timelineFactoryProvider).place(place);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -24,8 +24,7 @@ class DriftRecentlyTakenPage extends StatelessWidget {
);
}
final timelineService =
ref.watch(timelineFactoryProvider).remoteAssets(user.id);
final timelineService = ref.watch(timelineFactoryProvider).remoteAssets(user.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -37,8 +37,7 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
}
Future<void> addAssets(BuildContext context) async {
final albumAssets =
await ref.read(remoteAlbumProvider.notifier).getAssets(widget.album.id);
final albumAssets = await ref.read(remoteAlbumProvider.notifier).getAssets(widget.album.id);
final newAssets = await context.pushRoute<Set<BaseAsset>>(
DriftAssetSelectionTimelineRoute(
@ -82,9 +81,7 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
}
try {
await ref
.read(remoteAlbumProvider.notifier)
.addUsers(widget.album.id, newUsers);
await ref.read(remoteAlbumProvider.notifier).addUsers(widget.album.id, newUsers);
if (newUsers.isNotEmpty) {
ImmichToast.show(
@ -157,9 +154,7 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
if (confirmed == true) {
try {
await ref
.read(remoteAlbumProvider.notifier)
.deleteAlbum(widget.album.id);
await ref.read(remoteAlbumProvider.notifier).deleteAlbum(widget.album.id);
ImmichToast.show(
context: context,
@ -237,9 +232,7 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
overrides: [
timelineServiceProvider.overrideWith(
(ref) {
final timelineService = ref
.watch(timelineFactoryProvider)
.remoteAlbum(albumId: widget.album.id);
final timelineService = ref.watch(timelineFactoryProvider).remoteAlbum(albumId: widget.album.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -23,8 +23,7 @@ class DriftTrashPage extends StatelessWidget {
throw Exception('User must be logged in to access trash');
}
final timelineService =
ref.watch(timelineFactoryProvider).trash(user.id);
final timelineService = ref.watch(timelineFactoryProvider).trash(user.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -14,8 +14,7 @@ import 'package:immich_mobile/providers/user.provider.dart';
import 'package:immich_mobile/widgets/common/user_circle_avatar.dart';
// TODO: Refactor this provider when we have user provider/service/repository pattern in place
final driftUsersProvider =
FutureProvider.autoDispose<List<UserDto>>((ref) async {
final driftUsersProvider = FutureProvider.autoDispose<List<UserDto>>((ref) async {
final drift = ref.watch(driftProvider);
final currentUser = ref.watch(currentUserProvider);
@ -57,8 +56,7 @@ class DriftUserSelectionPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final AsyncValue<List<UserDto>> suggestedShareUsers =
ref.watch(driftUsersProvider);
final AsyncValue<List<UserDto>> suggestedShareUsers = ref.watch(driftUsersProvider);
final sharedUsersList = useState<Set<UserDto>>({});
addNewUsersHandler() {
@ -174,8 +172,7 @@ class DriftUserSelectionPage extends HookConsumerWidget {
),
actions: [
TextButton(
onPressed:
sharedUsersList.value.isEmpty ? null : addNewUsersHandler,
onPressed: sharedUsersList.value.isEmpty ? null : addNewUsersHandler,
child: const Text(
"add",
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
@ -186,16 +183,13 @@ class DriftUserSelectionPage extends HookConsumerWidget {
body: suggestedShareUsers.widgetWhen(
onData: (users) {
// Get shared users for this album from the database
final sharedUsers =
ref.watch(remoteAlbumSharedUsersProvider(album.id));
final sharedUsers = ref.watch(remoteAlbumSharedUsersProvider(album.id));
return sharedUsers.when(
data: (albumSharedUsers) {
// Filter out users that are already shared with this album and the owner
final filteredUsers = users.where((user) {
return !albumSharedUsers
.any((sharedUser) => sharedUser.id == user.id) &&
user.id != album.ownerId;
return !albumSharedUsers.any((sharedUser) => sharedUser.id == user.id) && user.id != album.ownerId;
}).toList();
return buildUserList(filteredUsers);
@ -203,8 +197,7 @@ class DriftUserSelectionPage extends HookConsumerWidget {
loading: () => const Center(child: CircularProgressIndicator()),
error: (error, stack) {
// If we can't load shared users, just filter out the owner
final filteredUsers =
users.where((user) => user.id != album.ownerId).toList();
final filteredUsers = users.where((user) => user.id != album.ownerId).toList();
return buildUserList(filteredUsers);
},
);

View file

@ -22,8 +22,7 @@ class DriftVideoPage extends StatelessWidget {
throw Exception('User must be logged in to video');
}
final timelineService =
ref.watch(timelineFactoryProvider).video(user.id);
final timelineService = ref.watch(timelineFactoryProvider).video(user.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -19,9 +19,7 @@ class LocalTimelinePage extends StatelessWidget {
overrides: [
timelineServiceProvider.overrideWith(
(ref) {
final timelineService = ref
.watch(timelineFactoryProvider)
.localAlbum(albumId: album.id);
final timelineService = ref.watch(timelineFactoryProvider).localAlbum(albumId: album.id);
ref.onDispose(timelineService.dispose);
return timelineService;
},

View file

@ -36,8 +36,7 @@ class DriftSearchPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final textSearchType = useState<TextSearchType>(TextSearchType.context);
final searchHintText =
useState<String>('sunrise_on_the_beach'.t(context: context));
final searchHintText = useState<String>('sunrise_on_the_beach'.t(context: context));
final textSearchController = useTextEditingController();
final filter = useState<SearchFilter>(
SearchFilter(
@ -52,8 +51,7 @@ class DriftSearchPage extends HookConsumerWidget {
isFavorite: false,
),
mediaType: preFilter?.mediaType ?? AssetType.other,
language:
"${context.locale.languageCode}-${context.locale.countryCode}",
language: "${context.locale.languageCode}-${context.locale.countryCode}",
),
);
@ -91,9 +89,7 @@ class DriftSearchPage extends HookConsumerWidget {
isSearching.value = true;
ref.watch(paginatedSearchProvider.notifier).clear();
final hasResult = await ref
.watch(paginatedSearchProvider.notifier)
.search(filter.value);
final hasResult = await ref.watch(paginatedSearchProvider.notifier).search(filter.value);
if (!hasResult) {
context.showSnackBar(
@ -107,9 +103,7 @@ class DriftSearchPage extends HookConsumerWidget {
loadMoreSearchResult() async {
isSearching.value = true;
final hasResult = await ref
.watch(paginatedSearchProvider.notifier)
.search(filter.value);
final hasResult = await ref.watch(paginatedSearchProvider.notifier).search(filter.value);
if (!hasResult) {
context.showSnackBar(
@ -157,9 +151,7 @@ class DriftSearchPage extends HookConsumerWidget {
);
peopleCurrentFilterWidget.value = Text(
value
.map((e) => e.name != '' ? e.name : 'no_name'.t(context: context))
.join(', '),
value.map((e) => e.name != '' ? e.name : 'no_name'.t(context: context)).join(', '),
style: context.textTheme.labelLarge,
);
}
@ -424,8 +416,7 @@ class DriftSearchPage extends HookConsumerWidget {
);
if (value) {
filterText.add(
'search_filter_display_option_not_in_album'
.t(context: context),
'search_filter_display_option_not_in_album'.t(context: context),
);
}
break;
@ -572,9 +563,7 @@ class DriftSearchPage extends HookConsumerWidget {
'search_by_context'.t(context: context),
style: context.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
color: textSearchType.value == TextSearchType.context
? context.colorScheme.primary
: null,
color: textSearchType.value == TextSearchType.context ? context.colorScheme.primary : null,
),
),
selectedColor: context.colorScheme.primary,
@ -582,8 +571,7 @@ class DriftSearchPage extends HookConsumerWidget {
),
onPressed: () {
textSearchType.value = TextSearchType.context;
searchHintText.value =
'sunrise_on_the_beach'.t(context: context);
searchHintText.value = 'sunrise_on_the_beach'.t(context: context);
},
),
MenuItemButton(
@ -593,9 +581,7 @@ class DriftSearchPage extends HookConsumerWidget {
'search_filter_filename'.t(context: context),
style: context.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
color: textSearchType.value == TextSearchType.filename
? context.colorScheme.primary
: null,
color: textSearchType.value == TextSearchType.filename ? context.colorScheme.primary : null,
),
),
selectedColor: context.colorScheme.primary,
@ -603,8 +589,7 @@ class DriftSearchPage extends HookConsumerWidget {
),
onPressed: () {
textSearchType.value = TextSearchType.filename;
searchHintText.value =
'file_name_or_extension'.t(context: context);
searchHintText.value = 'file_name_or_extension'.t(context: context);
},
),
MenuItemButton(
@ -614,20 +599,15 @@ class DriftSearchPage extends HookConsumerWidget {
'search_by_description'.t(context: context),
style: context.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
color:
textSearchType.value == TextSearchType.description
? context.colorScheme.primary
: null,
color: textSearchType.value == TextSearchType.description ? context.colorScheme.primary : null,
),
),
selectedColor: context.colorScheme.primary,
selected:
textSearchType.value == TextSearchType.description,
selected: textSearchType.value == TextSearchType.description,
),
onPressed: () {
textSearchType.value = TextSearchType.description;
searchHintText.value =
'search_by_description_example'.t(context: context);
searchHintText.value = 'search_by_description_example'.t(context: context);
},
),
],
@ -657,9 +637,7 @@ class DriftSearchPage extends HookConsumerWidget {
hintText: searchHintText.value,
key: const Key('search_text_field'),
controller: textSearchController,
contentPadding: preFilter != null
? const EdgeInsets.only(left: 24)
: const EdgeInsets.all(8),
contentPadding: preFilter != null ? const EdgeInsets.only(left: 24) : const EdgeInsets.all(8),
prefixIcon: preFilter != null
? null
: Icon(
@ -718,8 +696,7 @@ class DriftSearchPage extends HookConsumerWidget {
SearchFilterChip(
icon: Icons.display_settings_outlined,
onTap: showDisplayOptionPicker,
label:
'search_filter_display_options'.t(context: context),
label: 'search_filter_display_options'.t(context: context),
currentFilter: displayOptionCurrentFilterWidget.value,
),
],
@ -755,16 +732,13 @@ class _SearchResultGrid extends ConsumerWidget {
return NotificationListener<ScrollEndNotification>(
onNotification: (notification) {
final isBottomSheetNotification = notification.context
?.findAncestorWidgetOfExactType<DraggableScrollableSheet>() !=
null;
final isBottomSheetNotification =
notification.context?.findAncestorWidgetOfExactType<DraggableScrollableSheet>() != null;
final metrics = notification.metrics;
final isVerticalScroll = metrics.axis == Axis.vertical;
if (metrics.pixels >= metrics.maxScrollExtent &&
isVerticalScroll &&
!isBottomSheetNotification) {
if (metrics.pixels >= metrics.maxScrollExtent && isVerticalScroll && !isBottomSheetNotification) {
onScrollEnd();
}
@ -775,9 +749,7 @@ class _SearchResultGrid extends ConsumerWidget {
overrides: [
timelineServiceProvider.overrideWith(
(ref) {
final timelineService = ref
.watch(timelineFactoryProvider)
.fromAssets(searchResult.assets);
final timelineService = ref.watch(timelineFactoryProvider).fromAssets(searchResult.assets);
ref.onDispose(timelineService.dispose);
return timelineService;
},
@ -806,9 +778,7 @@ class _SearchEmptyContent extends StatelessWidget {
const SizedBox(height: 40),
Center(
child: Image.asset(
context.isDarkTheme
? 'assets/polaroid-dark.png'
: 'assets/polaroid-light.png',
context.isDarkTheme ? 'assets/polaroid-dark.png' : 'assets/polaroid-light.png',
height: 125,
),
),

View file

@ -4,16 +4,14 @@ import 'package:immich_mobile/domain/services/search.service.dart';
import 'package:immich_mobile/models/search/search_filter.model.dart';
import 'package:immich_mobile/providers/infrastructure/search.provider.dart';
final paginatedSearchProvider =
StateNotifierProvider<PaginatedSearchNotifier, SearchResult>(
final paginatedSearchProvider = StateNotifierProvider<PaginatedSearchNotifier, SearchResult>(
(ref) => PaginatedSearchNotifier(ref.watch(searchServiceProvider)),
);
class PaginatedSearchNotifier extends StateNotifier<SearchResult> {
final SearchService _searchService;
PaginatedSearchNotifier(this._searchService)
: super(const SearchResult(assets: [], nextPage: 1));
PaginatedSearchNotifier(this._searchService) : super(const SearchResult(assets: [], nextPage: 1));
Future<bool> search(SearchFilter filter) async {
if (state.nextPage == null) {