feat: add search filter to collection selection dialog

close #784
This commit is contained in:
edde746
2026-04-02 16:38:37 +02:00
parent da95901d39
commit 533472299a
32 changed files with 128 additions and 39 deletions
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "Fjern \"${title}\" fra denne samling?",
"removedFromCollection": "Fjernet fra samling",
"removeFromCollectionFailed": "Kunne ikke fjerne fra samling",
"removeFromCollectionError": "Fejl ved fjernelse fra samling: ${error}"
"removeFromCollectionError": "Fejl ved fjernelse fra samling: ${error}",
"searchCollections": "Søg i samlinger..."
},
"playlists": {
"title": "Playlister",
+2 -1
View File
@@ -677,7 +677,8 @@
"removeFromCollectionConfirm": "\"${title}\" aus dieser Sammlung entfernen?",
"removedFromCollection": "Aus Sammlung entfernt",
"removeFromCollectionFailed": "Entfernen aus Sammlung fehlgeschlagen",
"removeFromCollectionError": "Fehler beim Entfernen aus der Sammlung: ${error}"
"removeFromCollectionError": "Fehler beim Entfernen aus der Sammlung: ${error}",
"searchCollections": "Sammlungen durchsuchen..."
},
"watchTogether": {
"title": "Gemeinsam Schauen",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "Remove \"${title}\" from this collection?",
"removedFromCollection": "Removed from collection",
"removeFromCollectionFailed": "Failed to remove from collection",
"removeFromCollectionError": "Error removing from collection: ${error}"
"removeFromCollectionError": "Error removing from collection: ${error}",
"searchCollections": "Search collections..."
},
"playlists": {
"title": "Playlists",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "¿Eliminar \"${title}\" de esta colección?",
"removedFromCollection": "Eliminado de la colección",
"removeFromCollectionFailed": "Error al eliminar de la colección",
"removeFromCollectionError": "Error al eliminar de la colección: ${error}"
"removeFromCollectionError": "Error al eliminar de la colección: ${error}",
"searchCollections": "Buscar colecciones..."
},
"playlists": {
"title": "Listas de reproducción",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "Retirer \"${title}\" de cette collection ?",
"removedFromCollection": "Retiré de la collection",
"removeFromCollectionFailed": "Impossible de supprimer de la collection",
"removeFromCollectionError": "Erreur lors de la suppression de la collection: ${error}"
"removeFromCollectionError": "Erreur lors de la suppression de la collection: ${error}",
"searchCollections": "Rechercher des collections..."
},
"playlists": {
"title": "Playlists",
+2 -1
View File
@@ -677,7 +677,8 @@
"removeFromCollectionConfirm": "Rimuovere \"${title}\" da questa raccolta?",
"removedFromCollection": "Rimosso dalla raccolta",
"removeFromCollectionFailed": "Impossibile rimuovere dalla raccolta",
"removeFromCollectionError": "Errore durante la rimozione dalla raccolta: ${error}"
"removeFromCollectionError": "Errore durante la rimozione dalla raccolta: ${error}",
"searchCollections": "Cerca raccolte..."
},
"watchTogether": {
"title": "Guarda Insieme",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "\"${title}\"をこのコレクションから削除しますか?",
"removedFromCollection": "コレクションから削除しました",
"removeFromCollectionFailed": "コレクションからの削除に失敗しました",
"removeFromCollectionError": "コレクションからの削除エラー: ${error}"
"removeFromCollectionError": "コレクションからの削除エラー: ${error}",
"searchCollections": "コレクションを検索..."
},
"playlists": {
"title": "プレイリスト",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "${title}을/를 이 컬렉션에서 제거 하시겠습니까?",
"removedFromCollection": "컬렉션에서 제거됨",
"removeFromCollectionFailed": "컬렉션에서 제거 실패",
"removeFromCollectionError": "컬렉션에서 제거 중 오류 발생: ${error}"
"removeFromCollectionError": "컬렉션에서 제거 중 오류 발생: ${error}",
"searchCollections": "컬렉션 검색..."
},
"playlists": {
"title": "플레이리스트",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "Fjerne \"${title}\" fra denne samlingen?",
"removedFromCollection": "Fjernet fra samling",
"removeFromCollectionFailed": "Kunne ikke fjerne fra samling",
"removeFromCollectionError": "Feil ved fjerning fra samling: ${error}"
"removeFromCollectionError": "Feil ved fjerning fra samling: ${error}",
"searchCollections": "Søk i samlinger..."
},
"playlists": {
"title": "Spillelister",
+2 -1
View File
@@ -677,7 +677,8 @@
"removeFromCollectionConfirm": "\"${title}\" uit deze collectie verwijderen?",
"removedFromCollection": "Uit collectie verwijderd",
"removeFromCollectionFailed": "Verwijderen uit collectie mislukt",
"removeFromCollectionError": "Fout bij verwijderen uit collectie: ${error}"
"removeFromCollectionError": "Fout bij verwijderen uit collectie: ${error}",
"searchCollections": "Collecties zoeken..."
},
"watchTogether": {
"title": "Samen Kijken",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "Usunąć \"${title}\" z tej kolekcji?",
"removedFromCollection": "Usunięto z kolekcji",
"removeFromCollectionFailed": "Nie udało się usunąć z kolekcji",
"removeFromCollectionError": "Błąd usuwania z kolekcji: ${error}"
"removeFromCollectionError": "Błąd usuwania z kolekcji: ${error}",
"searchCollections": "Szukaj kolekcji..."
},
"playlists": {
"title": "Playlisty",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "Remover \"${title}\" desta coleção?",
"removedFromCollection": "Removido da coleção",
"removeFromCollectionFailed": "Falha ao remover da coleção",
"removeFromCollectionError": "Erro ao remover da coleção: ${error}"
"removeFromCollectionError": "Erro ao remover da coleção: ${error}",
"searchCollections": "Pesquisar coleções..."
},
"playlists": {
"title": "Playlists",
+2 -1
View File
@@ -629,7 +629,8 @@
"removeFromCollectionConfirm": "Удалить \"${title}\" из этой коллекции?",
"removedFromCollection": "Удалено из коллекции",
"removeFromCollectionFailed": "Не удалось удалить из коллекции",
"removeFromCollectionError": "Ошибка удаления из коллекции: ${error}"
"removeFromCollectionError": "Ошибка удаления из коллекции: ${error}",
"searchCollections": "Поиск коллекций..."
},
"playlists": {
"title": "Плейлисты",
+2 -2
View File
@@ -4,9 +4,9 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 15
/// Strings: 12675 (845 per locale)
/// Strings: 12690 (846 per locale)
///
/// Built on 2026-04-02 at 10:38 UTC
/// Built on 2026-04-02 at 13:51 UTC
// coverage:ignore-file
// ignore_for_file: type=lint, unused_import
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsDa implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Fjernet fra samling';
@override String get removeFromCollectionFailed => 'Kunne ikke fjerne fra samling';
@override String removeFromCollectionError({required Object error}) => 'Fejl ved fjernelse fra samling: ${error}';
@override String get searchCollections => 'Søg i samlinger...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsDa {
'collections.removedFromCollection' => 'Fjernet fra samling',
'collections.removeFromCollectionFailed' => 'Kunne ikke fjerne fra samling',
'collections.removeFromCollectionError' => ({required Object error}) => 'Fejl ved fjernelse fra samling: ${error}',
'collections.searchCollections' => 'Søg i samlinger...',
'playlists.title' => 'Playlister',
'playlists.playlist' => 'Playliste',
'playlists.noPlaylists' => 'Ingen playlister fundet',
+2
View File
@@ -931,6 +931,7 @@ class _TranslationsCollectionsDe implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Aus Sammlung entfernt';
@override String get removeFromCollectionFailed => 'Entfernen aus Sammlung fehlgeschlagen';
@override String removeFromCollectionError({required Object error}) => 'Fehler beim Entfernen aus der Sammlung: ${error}';
@override String get searchCollections => 'Sammlungen durchsuchen...';
}
// Path: watchTogether
@@ -1954,6 +1955,7 @@ extension on TranslationsDe {
'collections.removedFromCollection' => 'Aus Sammlung entfernt',
'collections.removeFromCollectionFailed' => 'Entfernen aus Sammlung fehlgeschlagen',
'collections.removeFromCollectionError' => ({required Object error}) => 'Fehler beim Entfernen aus der Sammlung: ${error}',
'collections.searchCollections' => 'Sammlungen durchsuchen...',
'watchTogether.title' => 'Gemeinsam Schauen',
'watchTogether.description' => 'Inhalte synchron mit Freunden und Familie schauen',
'watchTogether.createSession' => 'Sitzung Erstellen',
+4
View File
@@ -1933,6 +1933,9 @@ class TranslationsCollectionsEn {
/// en: 'Error removing from collection: ${error}'
String removeFromCollectionError({required Object error}) => 'Error removing from collection: ${error}';
/// en: 'Search collections...'
String get searchCollections => 'Search collections...';
}
// Path: playlists
@@ -3607,6 +3610,7 @@ extension on Translations {
'collections.removedFromCollection' => 'Removed from collection',
'collections.removeFromCollectionFailed' => 'Failed to remove from collection',
'collections.removeFromCollectionError' => ({required Object error}) => 'Error removing from collection: ${error}',
'collections.searchCollections' => 'Search collections...',
'playlists.title' => 'Playlists',
'playlists.playlist' => 'Playlist',
'playlists.noPlaylists' => 'No playlists found',
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsEs implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Eliminado de la colección';
@override String get removeFromCollectionFailed => 'Error al eliminar de la colección';
@override String removeFromCollectionError({required Object error}) => 'Error al eliminar de la colección: ${error}';
@override String get searchCollections => 'Buscar colecciones...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsEs {
'collections.removedFromCollection' => 'Eliminado de la colección',
'collections.removeFromCollectionFailed' => 'Error al eliminar de la colección',
'collections.removeFromCollectionError' => ({required Object error}) => 'Error al eliminar de la colección: ${error}',
'collections.searchCollections' => 'Buscar colecciones...',
'playlists.title' => 'Listas de reproducción',
'playlists.playlist' => 'Lista de reproducción',
'playlists.noPlaylists' => 'No se encontraron listas de reproducción',
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsFr implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Retiré de la collection';
@override String get removeFromCollectionFailed => 'Impossible de supprimer de la collection';
@override String removeFromCollectionError({required Object error}) => 'Erreur lors de la suppression de la collection: ${error}';
@override String get searchCollections => 'Rechercher des collections...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsFr {
'collections.removedFromCollection' => 'Retiré de la collection',
'collections.removeFromCollectionFailed' => 'Impossible de supprimer de la collection',
'collections.removeFromCollectionError' => ({required Object error}) => 'Erreur lors de la suppression de la collection: ${error}',
'collections.searchCollections' => 'Rechercher des collections...',
'playlists.title' => 'Playlists',
'playlists.playlist' => 'Playlist',
'playlists.noPlaylists' => 'Aucune playlist trouvée',
+2
View File
@@ -931,6 +931,7 @@ class _TranslationsCollectionsIt implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Rimosso dalla raccolta';
@override String get removeFromCollectionFailed => 'Impossibile rimuovere dalla raccolta';
@override String removeFromCollectionError({required Object error}) => 'Errore durante la rimozione dalla raccolta: ${error}';
@override String get searchCollections => 'Cerca raccolte...';
}
// Path: watchTogether
@@ -1954,6 +1955,7 @@ extension on TranslationsIt {
'collections.removedFromCollection' => 'Rimosso dalla raccolta',
'collections.removeFromCollectionFailed' => 'Impossibile rimuovere dalla raccolta',
'collections.removeFromCollectionError' => ({required Object error}) => 'Errore durante la rimozione dalla raccolta: ${error}',
'collections.searchCollections' => 'Cerca raccolte...',
'watchTogether.title' => 'Guarda Insieme',
'watchTogether.description' => 'Guarda contenuti in sincronia con amici e familiari',
'watchTogether.createSession' => 'Crea Sessione',
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsJa implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'コレクションから削除しました';
@override String get removeFromCollectionFailed => 'コレクションからの削除に失敗しました';
@override String removeFromCollectionError({required Object error}) => 'コレクションからの削除エラー: ${error}';
@override String get searchCollections => 'コレクションを検索...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsJa {
'collections.removedFromCollection' => 'コレクションから削除しました',
'collections.removeFromCollectionFailed' => 'コレクションからの削除に失敗しました',
'collections.removeFromCollectionError' => ({required Object error}) => 'コレクションからの削除エラー: ${error}',
'collections.searchCollections' => 'コレクションを検索...',
'playlists.title' => 'プレイリスト',
'playlists.playlist' => 'プレイリスト',
'playlists.noPlaylists' => 'プレイリストが見つかりません',
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsKo implements TranslationsCollectionsEn {
@override String get removedFromCollection => '컬렉션에서 제거됨';
@override String get removeFromCollectionFailed => '컬렉션에서 제거 실패';
@override String removeFromCollectionError({required Object error}) => '컬렉션에서 제거 중 오류 발생: ${error}';
@override String get searchCollections => '컬렉션 검색...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsKo {
'collections.removedFromCollection' => '컬렉션에서 제거됨',
'collections.removeFromCollectionFailed' => '컬렉션에서 제거 실패',
'collections.removeFromCollectionError' => ({required Object error}) => '컬렉션에서 제거 중 오류 발생: ${error}',
'collections.searchCollections' => '컬렉션 검색...',
'playlists.title' => '플레이리스트',
'playlists.playlist' => '재생 목록',
'playlists.noPlaylists' => '재생 목록을 찾을 수 없습니다',
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsNb implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Fjernet fra samling';
@override String get removeFromCollectionFailed => 'Kunne ikke fjerne fra samling';
@override String removeFromCollectionError({required Object error}) => 'Feil ved fjerning fra samling: ${error}';
@override String get searchCollections => 'Søk i samlinger...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsNb {
'collections.removedFromCollection' => 'Fjernet fra samling',
'collections.removeFromCollectionFailed' => 'Kunne ikke fjerne fra samling',
'collections.removeFromCollectionError' => ({required Object error}) => 'Feil ved fjerning fra samling: ${error}',
'collections.searchCollections' => 'Søk i samlinger...',
'playlists.title' => 'Spillelister',
'playlists.playlist' => 'Spilleliste',
'playlists.noPlaylists' => 'Ingen spillelister funnet',
+2
View File
@@ -931,6 +931,7 @@ class _TranslationsCollectionsNl implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Uit collectie verwijderd';
@override String get removeFromCollectionFailed => 'Verwijderen uit collectie mislukt';
@override String removeFromCollectionError({required Object error}) => 'Fout bij verwijderen uit collectie: ${error}';
@override String get searchCollections => 'Collecties zoeken...';
}
// Path: watchTogether
@@ -1954,6 +1955,7 @@ extension on TranslationsNl {
'collections.removedFromCollection' => 'Uit collectie verwijderd',
'collections.removeFromCollectionFailed' => 'Verwijderen uit collectie mislukt',
'collections.removeFromCollectionError' => ({required Object error}) => 'Fout bij verwijderen uit collectie: ${error}',
'collections.searchCollections' => 'Collecties zoeken...',
'watchTogether.title' => 'Samen Kijken',
'watchTogether.description' => 'Kijk synchroon met vrienden en familie',
'watchTogether.createSession' => 'Sessie Maken',
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsPl implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Usunięto z kolekcji';
@override String get removeFromCollectionFailed => 'Nie udało się usunąć z kolekcji';
@override String removeFromCollectionError({required Object error}) => 'Błąd usuwania z kolekcji: ${error}';
@override String get searchCollections => 'Szukaj kolekcji...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsPl {
'collections.removedFromCollection' => 'Usunięto z kolekcji',
'collections.removeFromCollectionFailed' => 'Nie udało się usunąć z kolekcji',
'collections.removeFromCollectionError' => ({required Object error}) => 'Błąd usuwania z kolekcji: ${error}',
'collections.searchCollections' => 'Szukaj kolekcji...',
'playlists.title' => 'Playlisty',
'playlists.playlist' => 'Playlista',
'playlists.noPlaylists' => 'Nie znaleziono playlist',
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsPt implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Removido da coleção';
@override String get removeFromCollectionFailed => 'Falha ao remover da coleção';
@override String removeFromCollectionError({required Object error}) => 'Erro ao remover da coleção: ${error}';
@override String get searchCollections => 'Pesquisar coleções...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsPt {
'collections.removedFromCollection' => 'Removido da coleção',
'collections.removeFromCollectionFailed' => 'Falha ao remover da coleção',
'collections.removeFromCollectionError' => ({required Object error}) => 'Erro ao remover da coleção: ${error}',
'collections.searchCollections' => 'Pesquisar coleções...',
'playlists.title' => 'Playlists',
'playlists.playlist' => 'Playlist',
'playlists.noPlaylists' => 'Nenhuma playlist encontrada',
+2
View File
@@ -869,6 +869,7 @@ class _TranslationsCollectionsRu implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Удалено из коллекции';
@override String get removeFromCollectionFailed => 'Не удалось удалить из коллекции';
@override String removeFromCollectionError({required Object error}) => 'Ошибка удаления из коллекции: ${error}';
@override String get searchCollections => 'Поиск коллекций...';
}
// Path: playlists
@@ -1910,6 +1911,7 @@ extension on TranslationsRu {
'collections.removedFromCollection' => 'Удалено из коллекции',
'collections.removeFromCollectionFailed' => 'Не удалось удалить из коллекции',
'collections.removeFromCollectionError' => ({required Object error}) => 'Ошибка удаления из коллекции: ${error}',
'collections.searchCollections' => 'Поиск коллекций...',
'playlists.title' => 'Плейлисты',
'playlists.playlist' => 'Плейлист',
'playlists.noPlaylists' => 'Плейлисты не найдены',
+2
View File
@@ -931,6 +931,7 @@ class _TranslationsCollectionsSv implements TranslationsCollectionsEn {
@override String get removedFromCollection => 'Borttagen från samling';
@override String get removeFromCollectionFailed => 'Misslyckades med att ta bort från samling';
@override String removeFromCollectionError({required Object error}) => 'Fel vid borttagning från samling: ${error}';
@override String get searchCollections => 'Sök samlingar...';
}
// Path: watchTogether
@@ -1954,6 +1955,7 @@ extension on TranslationsSv {
'collections.removedFromCollection' => 'Borttagen från samling',
'collections.removeFromCollectionFailed' => 'Misslyckades med att ta bort från samling',
'collections.removeFromCollectionError' => ({required Object error}) => 'Fel vid borttagning från samling: ${error}',
'collections.searchCollections' => 'Sök samlingar...',
'watchTogether.title' => 'Titta Tillsammans',
'watchTogether.description' => 'Titta på innehåll synkroniserat med vänner och familj',
'watchTogether.createSession' => 'Skapa Session',
+2
View File
@@ -931,6 +931,7 @@ class _TranslationsCollectionsZh implements TranslationsCollectionsEn {
@override String get removedFromCollection => '已从合集移除';
@override String get removeFromCollectionFailed => '从合集移除失败';
@override String removeFromCollectionError({required Object error}) => '从合集移除时出错:${error}';
@override String get searchCollections => '搜索合集...';
}
// Path: watchTogether
@@ -1954,6 +1955,7 @@ extension on TranslationsZh {
'collections.removedFromCollection' => '已从合集移除',
'collections.removeFromCollectionFailed' => '从合集移除失败',
'collections.removeFromCollectionError' => ({required Object error}) => '从合集移除时出错:${error}',
'collections.searchCollections' => '搜索合集...',
'watchTogether.title' => '一起看',
'watchTogether.description' => '与朋友和家人同步观看内容',
'watchTogether.createSession' => '创建会话',
+2 -1
View File
@@ -677,7 +677,8 @@
"removeFromCollectionConfirm": "Ta bort \"${title}\" från denna samling?",
"removedFromCollection": "Borttagen från samling",
"removeFromCollectionFailed": "Misslyckades med att ta bort från samling",
"removeFromCollectionError": "Fel vid borttagning från samling: ${error}"
"removeFromCollectionError": "Fel vid borttagning från samling: ${error}",
"searchCollections": "Sök samlingar..."
},
"watchTogether": {
"title": "Titta Tillsammans",
+2 -1
View File
@@ -677,7 +677,8 @@
"removeFromCollectionConfirm": "将“${title}”从此合集移除?",
"removedFromCollection": "已从合集移除",
"removeFromCollectionFailed": "从合集移除失败",
"removeFromCollectionError": "从合集移除时出错:${error}"
"removeFromCollectionError": "从合集移除时出错:${error}",
"searchCollections": "搜索合集..."
},
"watchTogether": {
"title": "一起看",
+64 -22
View File
@@ -30,6 +30,7 @@ import '../utils/video_player_navigation.dart';
import '../utils/deletion_notifier.dart';
import '../theme/mono_tokens.dart';
import '../widgets/file_info_bottom_sheet.dart';
import 'pill_input_decoration.dart';
import '../widgets/focusable_list_tile.dart';
import '../widgets/overlay_sheet.dart';
import '../widgets/rating_bottom_sheet.dart';
@@ -1272,43 +1273,84 @@ class _PlaylistSelectionDialog extends StatelessWidget {
}
/// Dialog to select a collection or create a new one
class _CollectionSelectionDialog extends StatelessWidget {
class _CollectionSelectionDialog extends StatefulWidget {
final List<PlexMetadata> collections;
const _CollectionSelectionDialog({required this.collections});
@override
State<_CollectionSelectionDialog> createState() => _CollectionSelectionDialogState();
}
class _CollectionSelectionDialogState extends State<_CollectionSelectionDialog> {
final _filterController = TextEditingController();
late List<PlexMetadata> _filteredCollections = widget.collections;
@override
void dispose() {
_filterController.dispose();
super.dispose();
}
void _onFilterChanged(String query) {
final lower = query.toLowerCase();
setState(() {
_filteredCollections = lower.isEmpty
? widget.collections
: widget.collections.where((c) => (c.title ?? '').toLowerCase().contains(lower)).toList();
});
}
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text(t.collections.selectCollection),
content: SizedBox(
width: double.maxFinite,
child: ListView.builder(
shrinkWrap: true,
itemCount: collections.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
// Create new collection option (always shown first)
return ListTile(
leading: const AppIcon(Symbols.add_rounded, fill: 1),
title: Text(t.common.createNew),
onTap: () => Navigator.pop(context, '_create_new'),
);
}
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (widget.collections.length >= 10) ...[
TextField(
controller: _filterController,
autofocus: true,
decoration: pillInputDecoration(
context,
hintText: t.collections.searchCollections,
prefixIcon: const Icon(Symbols.search_rounded, size: 20),
),
onChanged: _onFilterChanged,
),
const SizedBox(height: 8),
],
Flexible(
child: ListView.builder(
shrinkWrap: true,
itemCount: _filteredCollections.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
return ListTile(
leading: const AppIcon(Symbols.add_rounded, fill: 1),
title: Text(t.common.createNew),
onTap: () => Navigator.pop(context, '_create_new'),
);
}
final collection = collections[index - 1];
return ListTile(
leading: const AppIcon(Symbols.collections_rounded, fill: 1),
title: Text(collection.title!),
subtitle: collection.childCount != null ? Text('${collection.childCount} items') : null,
onTap: () => Navigator.pop(context, collection.ratingKey),
);
},
final collection = _filteredCollections[index - 1];
return ListTile(
leading: const AppIcon(Symbols.collections_rounded, fill: 1),
title: Text(collection.title!),
subtitle: collection.childCount != null ? Text('${collection.childCount} items') : null,
onTap: () => Navigator.pop(context, collection.ratingKey),
);
},
),
),
],
),
),
actions: [
FocusableButton(
autofocus: true,
onPressed: () => Navigator.pop(context),
child: TextButton(onPressed: () => Navigator.pop(context), child: Text(t.common.cancel)),
),