Skip to content

armgit / ente

Public Imported from GitHub
0

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

Simplify search section header sizing

ashilknb842c6e7feae
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/file_type_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/file_type_section.dart
index 7ece8e64ed..0a4345ed58 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/file_type_section.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/file_type_section.dart
@@ -200,7 +200,7 @@ class _FileTypeCard extends StatelessWidget {
static double _heightFor(BuildContext context) {
return (_labelTop +
- searchTabSingleLineTextHeight(context, _labelStyle(Colors.black)) +
+ _singleLineTextHeight(context, _labelStyle(Colors.black)) +
_labelBottomPadding)
.clamp(_height, double.infinity)
.toDouble();
@@ -257,6 +257,15 @@ class _FileTypeCard extends StatelessWidget {
}
}
+double _singleLineTextHeight(BuildContext context, TextStyle style) {
+ final textPainter = TextPainter(
+ text: TextSpan(text: "Ag", style: style),
+ textDirection: Directionality.of(context),
+ textScaler: MediaQuery.textScalerOf(context),
+ )..layout();
+ return textPainter.height;
+}
+
class _FileExtensionPill extends StatelessWidget {
final _FileTypeTile tile;
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab_horizontal_scroll.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab_horizontal_scroll.dart
index b6450c54e6..b4681e6b72 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab_horizontal_scroll.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab_horizontal_scroll.dart
@@ -2,15 +2,6 @@ import "package:flutter/material.dart";
const searchTabHorizontalPadding = 15.0;
-double searchTabSingleLineTextHeight(BuildContext context, TextStyle style) {
- final textPainter = TextPainter(
- text: TextSpan(text: "Ag", style: style),
- textDirection: Directionality.of(context),
- textScaler: MediaQuery.textScalerOf(context),
- )..layout();
- return textPainter.height;
-}
-
class SearchTabHorizontalRow extends StatelessWidget {
const SearchTabHorizontalRow({
required this.children,
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/section_header.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/section_header.dart
index a9525477ad..50e7848567 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/section_header.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/section_header.dart
@@ -6,7 +6,6 @@ import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/viewer/search/result/people_section_all_page.dart";
import "package:photos/ui/viewer/search/result/search_section_all_page.dart";
-import "package:photos/ui/viewer/search_tab/search_tab_horizontal_scroll.dart";
class SectionHeader extends StatelessWidget {
final SectionType sectionType;
@@ -22,15 +21,14 @@ class SectionHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
- final headerHeight = _sectionHeaderHeightFor(context);
return GestureDetector(
onTap: () {
if (hasMore) {
routeToPage(context, _sectionAllPage());
}
},
- child: SizedBox(
- height: headerHeight,
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: 38),
child: Row(
children: [
Expanded(
@@ -86,10 +84,3 @@ class SectionHeader extends StatelessWidget {
);
}
}
-
-double _sectionHeaderHeightFor(BuildContext context) {
- return searchTabSingleLineTextHeight(
- context,
- TextStyles.display3,
- ).clamp(38.0, double.infinity).toDouble();
-}