Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] scale trash tabs with system font size

Priyanshu Dangarefff16017d155
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 e9b1cb0cdc..f0d6f4e786 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
@@ -74,8 +74,7 @@ class GalleryAppBarWidget extends StatefulWidget {
Future<void> Function()? onDisableDeviceFolderBackup,
Collection? collection,
List<EnteFile>? files,
- Widget? bottom,
- double? bottomPreferredHeight,
+ PreferredSizeWidget? bottom,
}) {
return GalleryAppBarConfig(
sliverBuilder: (_) => GalleryAppBarWidget._(
@@ -89,20 +88,15 @@ class GalleryAppBarWidget extends StatefulWidget {
collection: collection,
files: files,
bottom: bottom,
- bottomPreferredHeight: bottomPreferredHeight,
- ),
- geometryBuilder: (context) => _resolveSliverGeometry(
- context,
- subtitle: subtitle,
- description: collection?.displayDescription,
),
+ geometryBuilder: (context) =>
+ _resolveSliverGeometry(context, subtitle: subtitle),
);
}
static HeaderAppBarGeometry _resolveSliverGeometry(
BuildContext context, {
String? subtitle,
- String? description,
}) {
final inheritedSearchFilterData = InheritedSearchFilterData.maybeOf(
context,
@@ -112,10 +106,6 @@ class GalleryAppBarWidget extends StatefulWidget {
final bottomHeight = isHierarchicalSearchable
? AppBarFilterChips.preferredHeight(context)
: 0.0;
- final collapsibleBottomHeight = AlbumDescriptionHeader.preferredHeight(
- context,
- description,
- );
return SliverAppBarComponent.resolveGeometry(
context,
subtitle: subtitle,
@@ -136,8 +126,7 @@ class GalleryAppBarWidget extends StatefulWidget {
final Future<void> Function()? onDisableDeviceFolderBackup;
final Collection? collection;
final List<EnteFile>? files;
- final Widget? bottom;
- final double? bottomPreferredHeight;
+ final PreferredSizeWidget? bottom;
const GalleryAppBarWidget._(
this.type,
@@ -150,7 +139,6 @@ class GalleryAppBarWidget extends StatefulWidget {
this.collection,
this.files,
this.bottom,
- this.bottomPreferredHeight,
});
@override
@@ -282,14 +270,11 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
title: _appBarTitle,
subtitle: widget.subtitle,
actions: _getDefaultActions(context),
- bottom: PreferredSize(
- preferredSize: Size.fromHeight(widget.bottomPreferredHeight!),
- child: widget.bottom!,
- ),
+ bottom: widget.bottom,
);
}
- if (!isHierarchicalSearchable && widget.bottom == null) {
+ if (!isHierarchicalSearchable) {
return _GallerySliverAppBar(
title: _appBarTitle,
subtitle: widget.subtitle,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
index ea6de10fb3..aa6c65abe3 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
@@ -67,6 +67,14 @@ class _TrashPageState extends State<TrashPage> {
],
),
);
+ final appBarBottom = header == null
+ ? null
+ : PreferredSize(
+ preferredSize: Size.fromHeight(
+ 2 * Spacing.sm + TagChipComponent.preferredHeight(context),
+ ),
+ child: header,
+ );
final gallery = AnimatedSwitcher(
duration: const Duration(milliseconds: 150),
child: Gallery(
@@ -78,8 +86,7 @@ class _TrashPageState extends State<TrashPage> {
_selectedFiles,
subtitle:
l10n.itemsShowTheNumberOfDaysRemainingBeforePermanentDeletion,
- bottom: header,
- bottomPreferredHeight: header == null ? null : 8 + 44 + 8,
+ bottom: appBarBottom,
),
asyncLoader: _asyncLoader,
reloadEvent: Bus.instance.on<FilesUpdatedEvent>().where(
diff --git a/mobile/packages/ente_components/lib/components/tag_chip_component.dart b/mobile/packages/ente_components/lib/components/tag_chip_component.dart
index 0481e60c8f..fe58f3cc95 100644
--- a/mobile/packages/ente_components/lib/components/tag_chip_component.dart
+++ b/mobile/packages/ente_components/lib/components/tag_chip_component.dart
@@ -1,3 +1,5 @@
+import 'dart:math' as math;
+
import 'package:ente_components/components/chip_surface.dart';
import 'package:ente_components/theme/radii.dart';
import 'package:ente_components/theme/spacing.dart';
@@ -26,6 +28,13 @@ class TagChipComponent extends StatelessWidget {
final VoidCallback? onTap;
final String? tooltip;
+ static double preferredHeight(BuildContext context) {
+ final textHeight =
+ MediaQuery.textScalerOf(context).scale(TextStyles.body.fontSize!) *
+ TextStyles.body.height!;
+ return math.max(44, textHeight + 2 * Spacing.md);
+ }
+
bool get _selected => state == TagChipComponentState.selected;
bool get _enabled => state != TagChipComponentState.disabled && onTap != null;