Skip to content

armgit / ente

Public Imported from GitHub
0

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

Align gallery app bar metrics

ashilkn23c3ff6debd3
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 633831fc85..f192a2e1a2 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
@@ -76,22 +76,38 @@ class GalleryAppBarWidget extends StatefulWidget {
BuildContext context, {
required bool isHierarchicalSearchable,
}) {
+ final bottomHeight = isHierarchicalSearchable
+ ? AppBarFilterChips.preferredHeight(context)
+ : 0.0;
+ final metrics = resolveHeaderAppBarMetrics(
+ context,
+ subtitle: null,
+ expandedHeight: _sliverExpandedHeight,
+ collapsedHeight: toolbarHeight,
+ titleBuilderHeight: null,
+ );
return MediaQuery.paddingOf(context).top +
- toolbarHeight +
- (isHierarchicalSearchable
- ? AppBarFilterChips.preferredHeight(context)
- : 0);
+ metrics.collapsedHeight +
+ bottomHeight;
}
static double sliverExpandedHeight(
BuildContext context, {
required bool isHierarchicalSearchable,
}) {
+ final bottomHeight = isHierarchicalSearchable
+ ? AppBarFilterChips.preferredHeight(context)
+ : 0.0;
+ final metrics = resolveHeaderAppBarMetrics(
+ context,
+ subtitle: null,
+ expandedHeight: _sliverExpandedHeight,
+ collapsedHeight: toolbarHeight,
+ titleBuilderHeight: null,
+ );
return MediaQuery.paddingOf(context).top +
- _sliverExpandedHeight +
- (isHierarchicalSearchable
- ? AppBarFilterChips.preferredHeight(context)
- : 0);
+ metrics.expandedHeight +
+ bottomHeight;
}
static GalleryAppBarConfig sliverConfig(
diff --git a/mobile/packages/ente_components/lib/components/app_bar_component.dart b/mobile/packages/ente_components/lib/components/app_bar_component.dart
index 233b8b902f..7a6ef8f475 100644
--- a/mobile/packages/ente_components/lib/components/app_bar_component.dart
+++ b/mobile/packages/ente_components/lib/components/app_bar_component.dart
@@ -209,7 +209,7 @@ class _AppBarComponentState extends State<AppBarComponent> {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final metrics = _resolveHeaderAppBarMetrics(
+ final metrics = resolveHeaderAppBarMetrics(
context,
subtitle: widget.subtitle,
expandedHeight: widget.expandedHeight,
@@ -328,7 +328,7 @@ class SliverAppBarComponent extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final metrics = _resolveHeaderAppBarMetrics(
+ final metrics = resolveHeaderAppBarMetrics(
context,
subtitle: subtitle,
expandedHeight: expandedHeight,
@@ -739,8 +739,8 @@ const _headerSnapTolerance = 1.0;
const _headerSnapDuration = Duration(milliseconds: 160);
const _titleTooltipShowDuration = Duration(seconds: 3);
-class _HeaderAppBarMetrics {
- const _HeaderAppBarMetrics({
+class HeaderAppBarMetrics {
+ const HeaderAppBarMetrics({
required this.expandedHeight,
required this.collapsedHeight,
required this.expandedTitleLineHeight,
@@ -757,7 +757,7 @@ class _HeaderAppBarMetrics {
double get collapseExtent => expandedHeight - collapsedHeight;
}
-_HeaderAppBarMetrics _resolveHeaderAppBarMetrics(
+HeaderAppBarMetrics resolveHeaderAppBarMetrics(
BuildContext context, {
required String? subtitle,
required double? expandedHeight,
@@ -794,7 +794,7 @@ _HeaderAppBarMetrics _resolveHeaderAppBarMetrics(
_expandedContentBottomGap,
);
- return _HeaderAppBarMetrics(
+ return HeaderAppBarMetrics(
expandedHeight: effectiveExpandedHeight,
collapsedHeight: effectiveCollapsedHeight,
expandedTitleLineHeight: expandedTitleLineHeight,