Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use shared filter chip components

ashilknc6cbdd4a6d23
diff --git a/mobile/apps/photos/lib/core/constants.dart b/mobile/apps/photos/lib/core/constants.dart
index cd4941f4d0..bc0921e9d1 100644
--- a/mobile/apps/photos/lib/core/constants.dart
+++ b/mobile/apps/photos/lib/core/constants.dart
@@ -108,7 +108,6 @@ final tempDirCleanUpInterval = kDebugMode
? const Duration(hours: 1).inMicroseconds
: const Duration(hours: 6).inMicroseconds;
-const kFilterChipHeight = 32.0;
const kMaxAppbarFilters = 14;
const kLivePhotoHashSeparator = ':';
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
index 9403e22d1e..5c9a63f9be 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
@@ -132,7 +132,9 @@ class CollectionPage extends StatelessWidget {
child: GalleryBoundariesProvider(
child: Scaffold(
appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
+ preferredSize: const Size.fromHeight(
+ GalleryAppBarWidget.hierarchicalPreferredHeight,
+ ),
child: GalleryAppBarWidget(
galleryType,
c.collection.displayName,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index 8a5e728d12..6780e7a188 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -63,6 +63,8 @@ import 'package:photos/utils/magic_util.dart';
import "package:uuid/uuid.dart";
class GalleryAppBarWidget extends StatefulWidget {
+ static const hierarchicalPreferredHeight = AppBarFilterChips.appBarHeight;
+
final GalleryType type;
final String? title;
final SelectedFiles selectedFiles;
@@ -197,8 +199,8 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
.searchFilterDataProvider!
.isSearchingNotifier,
child: const PreferredSize(
- preferredSize: Size.fromHeight(0),
- child: Flexible(child: AppBarFilterChips()),
+ preferredSize: Size.fromHeight(AppBarFilterChips.preferredHeight),
+ child: AppBarFilterChips(),
),
builder: (context, isSearching, child) {
return AppBar(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
index 242548d690..650a07d44a 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
@@ -92,7 +92,9 @@ class UnCategorizedPage extends StatelessWidget {
),
child: Scaffold(
appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
+ preferredSize: const Size.fromHeight(
+ GalleryAppBarWidget.hierarchicalPreferredHeight,
+ ),
child: GalleryAppBarWidget(
appBarType,
AppLocalizations.of(context).uncategorized,
diff --git a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart
index 20caf5ebeb..abd5abbce7 100644
--- a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart
+++ b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart
@@ -1,6 +1,7 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
import "package:modal_bottom_sheet/modal_bottom_sheet.dart";
-import "package:photos/core/constants.dart";
+import "package:photos/generated/l10n.dart";
import "package:photos/models/search/hierarchical/face_filter.dart";
import "package:photos/models/search/hierarchical/hierarchical_search_filter.dart";
import "package:photos/models/search/hierarchical/only_them_filter.dart";
@@ -16,16 +17,18 @@ import "package:photos/utils/hierarchical_search_util.dart";
class AppBarFilterChips extends StatefulWidget {
const AppBarFilterChips({super.key});
+ static const chipHeight = 40.0;
+ static const bottomPadding = 8.0;
+ static const preferredHeight = chipHeight + bottomPadding;
+ static const appBarHeight = kToolbarHeight + preferredHeight;
+
@override
State<AppBarFilterChips> createState() => _AppBarFilterChipsState();
}
class _AppBarFilterChipsState extends State<AppBarFilterChips> {
- final _scrollController = ScrollController();
- final _filterChipKeys = Expando<GlobalKey>();
- late SearchFilterDataProvider _searchFilterDataProvider;
- late List<HierarchicalSearchFilter> _appliedFilters;
- late List<HierarchicalSearchFilter> _recommendations;
+ final _filterChipKeys = <HierarchicalSearchFilter, GlobalKey>{};
+ SearchFilterDataProvider? _searchFilterDataProvider;
HierarchicalSearchFilter? _filterToRevealAfterApply;
@override
@@ -36,107 +39,73 @@ class _AppBarFilterChipsState extends State<AppBarFilterChips> {
inheritedSearchFilterData.isHierarchicalSearchable,
"Do not use this widget if gallery is not hierarchical searchable",
);
- _searchFilterDataProvider =
+ final searchFilterDataProvider =
inheritedSearchFilterData.searchFilterDataProvider!;
- _appliedFilters = _searchFilterDataProvider.appliedFilters;
- _recommendations = getRecommendedFiltersForAppBar(
- _searchFilterDataProvider,
- );
-
- _searchFilterDataProvider.removeListener(
+ if (_searchFilterDataProvider == searchFilterDataProvider) {
+ return;
+ }
+ _searchFilterDataProvider?.removeListener(
fromApplied: true,
- listener: onFiltersUpdate,
+ listener: _onFiltersUpdate,
);
- _searchFilterDataProvider.removeListener(
+ _searchFilterDataProvider?.removeListener(
fromRecommended: true,
- listener: onFiltersUpdate,
+ listener: _onFiltersUpdate,
);
- _searchFilterDataProvider.addListener(
+ _searchFilterDataProvider = searchFilterDataProvider;
+ searchFilterDataProvider.addListener(
toApplied: true,
- listener: onFiltersUpdate,
+ listener: _onFiltersUpdate,
);
- _searchFilterDataProvider.addListener(
+ searchFilterDataProvider.addListener(
toRecommended: true,
- listener: onFiltersUpdate,
+ listener: _onFiltersUpdate,
);
}
@override
void dispose() {
- _searchFilterDataProvider.removeListener(
+ _searchFilterDataProvider?.removeListener(
fromApplied: true,
- listener: onFiltersUpdate,
+ listener: _onFiltersUpdate,
);
- _searchFilterDataProvider.removeListener(
+ _searchFilterDataProvider?.removeListener(
fromRecommended: true,
- listener: onFiltersUpdate,
+ listener: _onFiltersUpdate,
);
- _scrollController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
- if (_appliedFilters.isEmpty && _recommendations.isEmpty) {
+ final searchFilterDataProvider = _searchFilterDataProvider!;
+ final appliedFilters = searchFilterDataProvider.appliedFilters;
+ final recommendations = getRecommendedFiltersForAppBar(
+ searchFilterDataProvider,
+ );
+ if (appliedFilters.isEmpty && recommendations.isEmpty) {
return const SizedBox.shrink();
}
return Padding(
- padding: const EdgeInsets.only(bottom: 8),
+ padding: const EdgeInsets.only(bottom: AppBarFilterChips.bottomPadding),
child: SizedBox(
- // +1 to account for the filter's outer stroke width
- height: kFilterChipHeight + 1,
+ height: AppBarFilterChips.chipHeight,
child: ListView.builder(
- controller: _scrollController,
itemBuilder: (context, index) {
if (index == 0) {
- return GestureDetector(
- onTap: () {
- showBarModalBottomSheet(
- context: context,
- builder: (context) {
- return SafeArea(
- child: FilterOptionsBottomSheet(
- _searchFilterDataProvider,
- ),
- );
- },
- backgroundColor: getEnteColorScheme(
- context,
- ).backgroundElevated2,
- );
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 4),
- child: Container(
- decoration: BoxDecoration(
- color: getEnteColorScheme(context).fillFaint,
- borderRadius: const BorderRadius.all(
- Radius.circular(kFilterChipHeight / 2),
- ),
- border: Border.all(
- color: getEnteColorScheme(context).strokeFaint,
- width: 0.5,
- ),
- ),
- child: const Padding(
- padding: EdgeInsets.all(8.0),
- child: Icon(Icons.filter_list_rounded, size: 20),
- ),
- ),
- ),
- );
+ return _buildAllFiltersButton(context, searchFilterDataProvider);
}
- if (index <= _appliedFilters.length) {
- final filter = _appliedFilters[index - 1];
+ if (index <= appliedFilters.length) {
+ final filter = appliedFilters[index - 1];
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: _buildFilterChip(filter),
);
}
- final filter = _recommendations[index - _appliedFilters.length - 1];
+ final filter = recommendations[index - appliedFilters.length - 1];
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: _buildFilterChip(filter),
@@ -144,13 +113,42 @@ class _AppBarFilterChipsState extends State<AppBarFilterChips> {
},
clipBehavior: Clip.none,
scrollDirection: Axis.horizontal,
- itemCount: _appliedFilters.length + _recommendations.length + 1,
+ itemCount: appliedFilters.length + recommendations.length + 1,
padding: const EdgeInsets.symmetric(horizontal: 4),
),
),
);
}
+ Widget _buildAllFiltersButton(
+ BuildContext context,
+ SearchFilterDataProvider searchFilterDataProvider,
+ ) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 4),
+ child: SizedBox(
+ height: AppBarFilterChips.chipHeight,
+ child: Center(
+ child: IconButtonComponent(
+ icon: const Icon(Icons.filter_list_rounded),
+ variant: IconButtonComponentVariant.primary,
+ shouldSurfaceExecutionStates: false,
+ tooltip: AppLocalizations.of(context).filter,
+ onTap: () => showBarModalBottomSheet(
+ context: context,
+ builder: (context) {
+ return SafeArea(
+ child: FilterOptionsBottomSheet(searchFilterDataProvider),
+ );
+ },
+ backgroundColor: getEnteColorScheme(context).backgroundElevated2,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
Widget _buildFilterChip(HierarchicalSearchFilter filter) {
final chipKey = _keyForFilter(filter);
return KeyedSubtree(
@@ -181,27 +179,20 @@ class _AppBarFilterChipsState extends State<AppBarFilterChips> {
}
GlobalKey _keyForFilter(HierarchicalSearchFilter filter) {
- return _filterChipKeys[filter] ??= GlobalKey(
- debugLabel: "app-bar-filter-${filter.filterTypeName}",
- );
+ return _filterChipKeys[filter] ??= GlobalKey();
}
void _applyFilter(HierarchicalSearchFilter filter) {
_filterToRevealAfterApply = filter;
- _searchFilterDataProvider.applyFilters([filter]);
+ _searchFilterDataProvider!.applyFilters([filter]);
}
void _removeFilter(HierarchicalSearchFilter filter) {
- _searchFilterDataProvider.removeAppliedFilters([filter]);
+ _searchFilterDataProvider!.removeAppliedFilters([filter]);
}
- void onFiltersUpdate() {
- setState(() {
- _appliedFilters = _searchFilterDataProvider.appliedFilters;
- _recommendations = getRecommendedFiltersForAppBar(
- _searchFilterDataProvider,
- );
- });
+ void _onFiltersUpdate() {
+ setState(() {});
_revealPendingAppliedFilter();
}
@@ -210,7 +201,9 @@ class _AppBarFilterChipsState extends State<AppBarFilterChips> {
if (filter == null) {
return;
}
- if (!_appliedFilters.any((applied) => applied.isSameFilter(filter))) {
+ if (!_searchFilterDataProvider!.appliedFilters.any(
+ (applied) => applied.isSameFilter(filter),
+ )) {
return;
}
diff --git a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/face_filter_chip.dart b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/face_filter_chip.dart
index a865ed47c1..4fce643b45 100644
--- a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/face_filter_chip.dart
+++ b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/face_filter_chip.dart
@@ -1,15 +1,13 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
-import "package:photos/core/constants.dart";
-import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/viewer/people/person_face_widget.dart";
-class FaceFilterChip extends StatefulWidget {
+class FaceFilterChip extends StatelessWidget {
final String? personId;
final String? clusterId;
final VoidCallback apply;
final VoidCallback remove;
final bool isApplied;
- final bool isInAllFiltersView;
const FaceFilterChip({
required this.personId,
@@ -17,104 +15,21 @@ class FaceFilterChip extends StatefulWidget {
required this.apply,
required this.remove,
required this.isApplied,
- this.isInAllFiltersView = false,
super.key,
});
- @override
- State<FaceFilterChip> createState() => _FaceFilterChipState();
-}
-
-class _FaceFilterChipState extends State<FaceFilterChip> {
- double scale = 1.0;
-
- @override
- void initState() {
- super.initState();
- if (widget.isInAllFiltersView) {
- scale = 1.75;
- }
- }
-
@override
Widget build(BuildContext context) {
- return Stack(
- clipBehavior: Clip.none,
- children: [
- GestureDetector(
- onTap: () {
- if (widget.isApplied) {
- widget.remove();
- } else {
- widget.apply();
- }
- },
- child: Container(
- decoration: BoxDecoration(
- color: getEnteColorScheme(context).fillFaint,
- borderRadius: BorderRadius.all(
- Radius.circular(kFilterChipHeight * scale / 2),
- ),
- border: Border.all(
- color: getEnteColorScheme(context).strokeFaint,
- width: widget.isInAllFiltersView ? 1 : 0.5,
- ),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- ClipOval(
- child: SizedBox(
- width: kFilterChipHeight * scale,
- height: kFilterChipHeight * scale,
- child: PersonFaceWidget(
- personId: widget.personId,
- clusterID: widget.clusterId,
- useFullFile: false,
- ),
- ),
- ),
- widget.isApplied && !widget.isInAllFiltersView
- ? const SizedBox(width: 4)
- : const SizedBox.shrink(),
- widget.isApplied && !widget.isInAllFiltersView
- ? Icon(
- Icons.close_rounded,
- size: 16,
- color: getEnteColorScheme(context).textMuted,
- )
- : const SizedBox.shrink(),
- widget.isApplied && !widget.isInAllFiltersView
- ? const SizedBox(width: 8)
- : const SizedBox.shrink(),
- ],
- ),
- ),
- ),
- widget.isApplied && widget.isInAllFiltersView
- ? Positioned(
- top: -4,
- right: -4,
- child: Container(
- padding: const EdgeInsets.all(1),
- decoration: BoxDecoration(
- color: getEnteColorScheme(context).backgroundElevated2,
- border: Border.all(
- color: getEnteColorScheme(context).strokeMuted,
- width: 0.5,
- ),
- borderRadius: BorderRadius.all(Radius.circular(8 * scale)),
- ),
- child: Icon(
- Icons.close_rounded,
- size: 14,
- color: getEnteColorScheme(context).textMuted,
- ),
- ),
- )
- : const SizedBox.shrink(),
- ],
+ return FilterChipComponent(
+ avatar: PersonFaceWidget(
+ personId: personId,
+ clusterID: clusterId,
+ useFullFile: false,
+ ),
+ state: isApplied
+ ? FilterChipComponentState.selected
+ : FilterChipComponentState.unselected,
+ onChanged: (_) => isApplied ? remove() : apply(),
);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/generic_filter_chip.dart b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/generic_filter_chip.dart
index 7cb1ab48f8..6cc684ed8e 100644
--- a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/generic_filter_chip.dart
+++ b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/generic_filter_chip.dart
@@ -1,14 +1,12 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
-import "package:photos/core/constants.dart";
-import "package:photos/theme/ente_theme.dart";
-class GenericFilterChip extends StatefulWidget {
+class GenericFilterChip extends StatelessWidget {
final String label;
final IconData? leadingIcon;
final VoidCallback apply;
final VoidCallback remove;
final bool isApplied;
- final bool isInAllFiltersView;
const GenericFilterChip({
required this.label,
@@ -16,70 +14,18 @@ class GenericFilterChip extends StatefulWidget {
required this.remove,
required this.isApplied,
this.leadingIcon,
- this.isInAllFiltersView = false,
super.key,
});
- @override
- State<GenericFilterChip> createState() => _GenericFilterChipState();
-}
-
-class _GenericFilterChipState extends State<GenericFilterChip> {
@override
Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- if (widget.isApplied) {
- widget.remove();
- } else {
- widget.apply();
- }
- },
- child: SizedBox(
- // +1 to account for the filter's outer stroke width
- height: kFilterChipHeight + 1,
- child: Container(
- decoration: BoxDecoration(
- color: getEnteColorScheme(context).fillFaint,
- borderRadius: const BorderRadius.all(
- Radius.circular(kFilterChipHeight / 2),
- ),
- border: Border.all(
- color: getEnteColorScheme(context).strokeFaint,
- width: 0.5,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- widget.leadingIcon != null
- ? Icon(widget.leadingIcon, size: 16)
- : const SizedBox.shrink(),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 4),
- child: Text(
- widget.label,
- style: getEnteTextTheme(context).miniBold,
- ),
- ),
- widget.isApplied
- ? const SizedBox(width: 2)
- : const SizedBox.shrink(),
- widget.isApplied
- ? Icon(
- Icons.close_rounded,
- size: 16,
- color: getEnteColorScheme(context).textMuted,
- )
- : const SizedBox.shrink(),
- ],
- ),
- ),
- ),
- ),
+ return FilterChipComponent(
+ label: label,
+ leading: leadingIcon == null ? null : Icon(leadingIcon),
+ state: isApplied
+ ? FilterChipComponentState.selected
+ : FilterChipComponentState.unselected,
+ onChanged: (_) => isApplied ? remove() : apply(),
);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/only_them_filter_chip.dart b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/only_them_filter_chip.dart
index cedec33e9d..e73bf0b2f1 100644
--- a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/only_them_filter_chip.dart
+++ b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/only_them_filter_chip.dart
@@ -1,8 +1,7 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
-import "package:photos/core/constants.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/search/hierarchical/face_filter.dart";
-import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/viewer/people/person_face_widget.dart";
class OnlyThemFilterChip extends StatelessWidget {
@@ -10,63 +9,23 @@ class OnlyThemFilterChip extends StatelessWidget {
final VoidCallback apply;
final VoidCallback remove;
final bool isApplied;
- final bool isInAllFiltersView;
const OnlyThemFilterChip({
required this.faceFilters,
required this.apply,
required this.remove,
required this.isApplied,
- this.isInAllFiltersView = false,
super.key,
});
@override
Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- if (isApplied) {
- remove();
- } else {
- apply();
- }
- },
- child: Container(
- decoration: BoxDecoration(
- color: getEnteColorScheme(context).fillFaint,
- borderRadius: const BorderRadius.all(
- Radius.circular(kFilterChipHeight / 2),
- ),
- border: Border.all(
- color: getEnteColorScheme(context).strokeFaint,
- width: 0.5,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.only(right: 8.0),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- _OnlyThemFilterThumbnail(faceFilters: faceFilters),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 4),
- child: Text(
- AppLocalizations.of(context).onlyThem,
- style: getEnteTextTheme(context).miniBold,
- ),
- ),
- isApplied ? const SizedBox(width: 2) : const SizedBox.shrink(),
- isApplied
- ? Icon(
- Icons.close_rounded,
- size: 16,
- color: getEnteColorScheme(context).textMuted,
- )
- : const SizedBox.shrink(),
- ],
- ),
- ),
- ),
+ return FilterChipComponent(
+ label: AppLocalizations.of(context).onlyThem,
+ avatar: _OnlyThemFilterThumbnail(faceFilters: faceFilters),
+ state: isApplied
+ ? FilterChipComponentState.selected
+ : FilterChipComponentState.unselected,
+ onChanged: (_) => isApplied ? remove() : apply(),
);
}
}
@@ -82,8 +41,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
if (numberOfFaces == 1) {
return ClipOval(
child: SizedBox(
- width: kFilterChipHeight,
- height: kFilterChipHeight,
+ width: _thumbnailSize,
+ height: _thumbnailSize,
child: PersonFaceWidget(
personId: faceFilters.first.personId,
clusterID: faceFilters.first.clusterId,
@@ -96,8 +55,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
child: Row(
children: [
SizedBox(
- width: kFilterChipHeight / 2,
- height: kFilterChipHeight,
+ width: _thumbnailSize / 2,
+ height: _thumbnailSize,
child: PersonFaceWidget(
personId: faceFilters.first.personId,
clusterID: faceFilters.first.clusterId,
@@ -106,8 +65,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
),
const SizedBox(width: 1),
SizedBox(
- width: kFilterChipHeight / 2,
- height: kFilterChipHeight,
+ width: _thumbnailSize / 2,
+ height: _thumbnailSize,
child: PersonFaceWidget(
personId: faceFilters.last.personId,
clusterID: faceFilters.last.clusterId,
@@ -123,8 +82,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
- height: kFilterChipHeight,
- width: kFilterChipHeight / 2 - 0.5,
+ height: _thumbnailSize,
+ width: _thumbnailSize / 2 - 0.5,
child: PersonFaceWidget(
personId: faceFilters[0].personId,
clusterID: faceFilters[0].clusterId,
@@ -136,8 +95,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
- width: kFilterChipHeight / 2 - 0.5,
- height: kFilterChipHeight / 2 - 0.5,
+ width: _thumbnailSize / 2 - 0.5,
+ height: _thumbnailSize / 2 - 0.5,
child: ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(1),
@@ -151,8 +110,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
),
const SizedBox(height: 1),
SizedBox(
- width: kFilterChipHeight / 2 - 0.5,
- height: kFilterChipHeight / 2 - 0.5,
+ width: _thumbnailSize / 2 - 0.5,
+ height: _thumbnailSize / 2 - 0.5,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(1),
@@ -178,8 +137,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
- width: kFilterChipHeight / 2 - 0.5,
- height: kFilterChipHeight / 2 - 0.5,
+ width: _thumbnailSize / 2 - 0.5,
+ height: _thumbnailSize / 2 - 0.5,
child: ClipRRect(
borderRadius: const BorderRadius.only(
bottomRight: Radius.circular(1),
@@ -193,8 +152,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
),
const SizedBox(width: 1),
SizedBox(
- width: kFilterChipHeight / 2 - 0.5,
- height: kFilterChipHeight / 2 - 0.5,
+ width: _thumbnailSize / 2 - 0.5,
+ height: _thumbnailSize / 2 - 0.5,
child: ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(1),
@@ -213,8 +172,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
- width: kFilterChipHeight / 2 - 0.5,
- height: kFilterChipHeight / 2 - 0.5,
+ width: _thumbnailSize / 2 - 0.5,
+ height: _thumbnailSize / 2 - 0.5,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(1),
@@ -228,8 +187,8 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
),
const SizedBox(width: 1),
SizedBox(
- width: kFilterChipHeight / 2 - 0.5,
- height: kFilterChipHeight / 2 - 0.5,
+ width: _thumbnailSize / 2 - 0.5,
+ height: _thumbnailSize / 2 - 0.5,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(1),
@@ -249,3 +208,5 @@ class _OnlyThemFilterThumbnail extends StatelessWidget {
}
}
}
+
+const _thumbnailSize = 32.0;
diff --git a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/filter_options_bottom_sheet.dart b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/filter_options_bottom_sheet.dart
index 761e6628bb..1c208f0494 100644
--- a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/filter_options_bottom_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/filter_options_bottom_sheet.dart
@@ -54,7 +54,6 @@ class _FilterOptionsBottomSheetState extends State<FilterOptionsBottomSheet> {
FaceFilterChip(
personId: filter.personId,
clusterId: filter.clusterId,
- isInAllFiltersView: true,
apply: () {
widget.searchFilterDataProvider.applyFilters([
filter,
@@ -83,7 +82,6 @@ class _FilterOptionsBottomSheetState extends State<FilterOptionsBottomSheet> {
Navigator.of(context).pop();
},
isApplied: filter.isApplied,
- isInAllFiltersView: true,
)
else
GenericFilterChip(
@@ -101,7 +99,6 @@ class _FilterOptionsBottomSheetState extends State<FilterOptionsBottomSheet> {
Navigator.of(context).pop();
},
isApplied: filter.isApplied,
- isInAllFiltersView: true,
),
],
),
diff --git a/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart b/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart
index ba4a03b3ad..fbcc96a6d6 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart
@@ -43,7 +43,7 @@ class _LocationScreenState extends State<LocationScreen> {
@override
Widget build(BuildContext context) {
final heightOfStatusBar = MediaQuery.of(context).viewPadding.top;
- const heightOfAppBar = 90.0;
+ const heightOfAppBar = GalleryAppBarWidget.hierarchicalPreferredHeight;
final locationTag = InheritedLocationScreenState.of(
context,
).locationTagEntity.item;
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
index a487188990..12b36a0b04 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
@@ -30,6 +30,8 @@ const kShowUnnamedIgnoredPersonEventSource =
"_AppBarWidgetState._showPersonUnnamedDelete";
class PeopleAppBar extends StatefulWidget {
+ static const hierarchicalPreferredHeight = AppBarFilterChips.appBarHeight;
+
final GalleryType type;
final String? title;
final SelectedFiles selectedFiles;
@@ -172,8 +174,8 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
.searchFilterDataProvider!
.isSearchingNotifier,
child: const PreferredSize(
- preferredSize: Size.fromHeight(0),
- child: Flexible(child: AppBarFilterChips()),
+ preferredSize: Size.fromHeight(AppBarFilterChips.preferredHeight),
+ child: AppBarFilterChips(),
),
builder: (context, isSearching, child) {
return AppBar(
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
index 05a79e169d..a90bf9e6fc 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
@@ -250,7 +250,9 @@ class _PeoplePageState extends State<PeoplePage> {
child: Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(
- widget.searchResult != null ? 90.0 : 50.0,
+ widget.searchResult != null
+ ? PeopleAppBar.hierarchicalPreferredHeight
+ : 50.0,
),
child: PeopleAppBar(
GalleryType.peopleTag,
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
index 3af2aa6c38..a2f3037c69 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
@@ -4,7 +4,6 @@ import "package:email_validator/email_validator.dart";
import "package:ente_contacts/contacts.dart" as contacts;
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
-import "package:photos/core/constants.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/contacts_changed_event.dart";
import "package:photos/events/files_updated_event.dart";
@@ -576,7 +575,6 @@ class _UnsavedContactEmptyState extends StatelessWidget {
class _ContactResultAppBar extends StatelessWidget
implements PreferredSizeWidget {
static const _toolbarHeight = 56.0;
- static const _bottomPadding = 8.0;
final bool isHierarchicalSearchable;
@@ -584,7 +582,7 @@ class _ContactResultAppBar extends StatelessWidget
static double preferredHeight({required bool isHierarchicalSearchable}) {
return isHierarchicalSearchable
- ? _toolbarHeight + kFilterChipHeight + _bottomPadding + 1
+ ? AppBarFilterChips.appBarHeight
: _toolbarHeight;
}
@@ -613,7 +611,7 @@ class _ContactResultAppBar extends StatelessWidget
surfaceTintColor: Colors.transparent,
titleSpacing: 0,
bottom: const PreferredSize(
- preferredSize: Size.fromHeight(0),
+ preferredSize: Size.fromHeight(AppBarFilterChips.preferredHeight),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: AppBarFilterChips(),
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart b/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
index 7715164840..a086ba77d4 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
@@ -209,7 +209,9 @@ class _MagicResultScreenState extends State<MagicResultScreen> {
searchFilterDataProvider: _searchFilterDataProvider,
child: Scaffold(
appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
+ preferredSize: const Size.fromHeight(
+ GalleryAppBarWidget.hierarchicalPreferredHeight,
+ ),
child: _enableGrouping
? GalleryAppBarWidget(
MagicResultScreen.appBarType,
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart
index 32936425e1..59f790bc22 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart
@@ -108,7 +108,9 @@ class _SearchResultPageState extends State<SearchResultPage> {
searchFilterDataProvider: _searchFilterDataProvider,
child: Scaffold(
appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
+ preferredSize: const Size.fromHeight(
+ GalleryAppBarWidget.hierarchicalPreferredHeight,
+ ),
child: widget.enableGrouping
? GalleryAppBarWidget(
SearchResultPage.appBarType,