Skip to content

armgit / ente

Public Imported from GitHub
0

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

Simplify search tab horizontal padding

ashilkn4c0766ead024
diff --git a/mobile/apps/photos/lib/ui/rituals/rituals_banner.dart b/mobile/apps/photos/lib/ui/rituals/rituals_banner.dart
index b8d261895b..10b4183876 100644
--- a/mobile/apps/photos/lib/ui/rituals/rituals_banner.dart
+++ b/mobile/apps/photos/lib/ui/rituals/rituals_banner.dart
@@ -40,16 +40,23 @@ class RitualsBanner extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- _RitualsHeader(
- showChevron: rituals.isNotEmpty,
- onTap: rituals.isNotEmpty
- ? () => routeToPage(context, const AllRitualsScreen())
- : null,
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: searchTabSectionHorizontalPadding,
+ ),
+ child: _RitualsHeader(
+ showChevron: rituals.isNotEmpty,
+ onTap: rituals.isNotEmpty
+ ? () => routeToPage(context, const AllRitualsScreen())
+ : null,
+ ),
),
const SizedBox(height: 4),
if (rituals.isEmpty)
Padding(
- padding: EdgeInsets.zero,
+ padding: const EdgeInsets.symmetric(
+ horizontal: searchTabSectionHorizontalPadding,
+ ),
child: StartNewRitualCard(
variant: StartNewRitualCardVariant.wide,
onTap: () async {
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/contacts_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/contacts_section.dart
index 7406561efc..d40abbd4e4 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/contacts_section.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/contacts_section.dart
@@ -124,7 +124,11 @@ class _ContactsSectionState extends State<ContactsSection> {
if (_contactSearchResults.isEmpty) {
final colors = context.componentColors;
return Padding(
- padding: const EdgeInsets.only(left: 12, right: 8, bottom: 24),
+ padding: const EdgeInsets.only(
+ left: searchTabSectionHorizontalPadding + 12,
+ right: searchTabSectionHorizontalPadding + 8,
+ bottom: 24,
+ ),
child: Row(
children: [
Expanded(
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 0a4345ed58..1996162cb2 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
@@ -29,7 +29,11 @@ class FileTypeSection extends StatelessWidget {
if (!hasAnySearchableFiles) {
final textTheme = getEnteTextTheme(context);
return Padding(
- padding: const EdgeInsets.only(left: 12, right: 8, bottom: 24),
+ padding: const EdgeInsets.only(
+ left: searchTabSectionHorizontalPadding + 12,
+ right: searchTabSectionHorizontalPadding + 8,
+ bottom: 24,
+ ),
child: Row(
children: [
Expanded(
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart
index 970b5fbf1c..36b234bcd0 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart
@@ -73,7 +73,11 @@ class _LocationsSectionState extends State<LocationsSection> {
if (_locationsSearchResults.isEmpty) {
final colors = context.componentColors;
return Padding(
- padding: const EdgeInsets.only(left: 12, right: 8, bottom: 24),
+ padding: const EdgeInsets.only(
+ left: searchTabSectionHorizontalPadding + 12,
+ right: searchTabSectionHorizontalPadding + 8,
+ bottom: 24,
+ ),
child: Row(
children: [
Expanded(
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart
index ec8515be3d..7510a20e96 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart
@@ -105,7 +105,10 @@ class _PeopleSectionState extends State<PeopleSection> {
routeToPage(context, const MachineLearningSettingsPage());
},
child: Padding(
- padding: const EdgeInsets.only(left: 16, right: 8),
+ padding: const EdgeInsets.only(
+ left: searchTabSectionHorizontalPadding + 16,
+ right: searchTabSectionHorizontalPadding + 8,
+ ),
child: Row(
children: [
Expanded(
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
index c30fba9f4b..b28bdc3a3d 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
@@ -258,19 +258,19 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
if (!wrappedService.shouldShowDiscoveryEntry) {
return const SizedBox.shrink();
}
- return WrappedDiscoverySection(state: state);
+ return Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: searchTabSectionHorizontalPadding,
+ ),
+ child: WrappedDiscoverySection(state: state),
+ );
},
),
const ContactsSectionLoader(),
FileTypeSection(hasAnySearchableFiles: hasAnySearchableFiles),
];
return ListView.builder(
- padding: const EdgeInsets.fromLTRB(
- searchTabHorizontalPadding,
- 0,
- searchTabHorizontalPadding,
- bottomPadding,
- ),
+ padding: const EdgeInsets.only(bottom: bottomPadding),
physics: const BouncingScrollPhysics(),
keyboardDismissBehavior:
ScrollViewKeyboardDismissBehavior.onDrag,
@@ -283,7 +283,12 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
if (hasSurfacedOfflineFaces) {
return const SizedBox.shrink();
}
- return const MLProgressBanner();
+ return const Padding(
+ padding: EdgeInsets.symmetric(
+ horizontal: searchTabSectionHorizontalPadding,
+ ),
+ child: MLProgressBanner(),
+ );
}
return sectionWidgets[index - 1];
},
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 b4681e6b72..6b5dfd9a82 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
@@ -1,6 +1,6 @@
import "package:flutter/material.dart";
-const searchTabHorizontalPadding = 15.0;
+const searchTabSectionHorizontalPadding = 15.0;
class SearchTabHorizontalRow extends StatelessWidget {
const SearchTabHorizontalRow({
@@ -14,18 +14,16 @@ class SearchTabHorizontalRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return _SearchTabHorizontalViewport(
- child: SingleChildScrollView(
- padding: const EdgeInsets.symmetric(
- horizontal: searchTabHorizontalPadding,
- ),
- physics: const BouncingScrollPhysics(),
- keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
- scrollDirection: Axis.horizontal,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: _spacedChildren(),
- ),
+ return SingleChildScrollView(
+ padding: const EdgeInsets.symmetric(
+ horizontal: searchTabSectionHorizontalPadding,
+ ),
+ physics: const BouncingScrollPhysics(),
+ keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
+ scrollDirection: Axis.horizontal,
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: _spacedChildren(),
),
);
}
@@ -54,35 +52,15 @@ class SearchTabHorizontalScrollView extends StatelessWidget {
Widget build(BuildContext context) {
return SizedBox(
height: height,
- child: _SearchTabHorizontalViewport(
- child: SingleChildScrollView(
- padding: const EdgeInsets.symmetric(
- horizontal: searchTabHorizontalPadding,
- ),
- physics: const BouncingScrollPhysics(),
- keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
- scrollDirection: Axis.horizontal,
- child: child,
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.symmetric(
+ horizontal: searchTabSectionHorizontalPadding,
),
+ physics: const BouncingScrollPhysics(),
+ keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
+ scrollDirection: Axis.horizontal,
+ child: child,
),
);
}
}
-
-class _SearchTabHorizontalViewport extends StatelessWidget {
- const _SearchTabHorizontalViewport({required this.child});
-
- final Widget child;
-
- @override
- Widget build(BuildContext context) {
- return LayoutBuilder(
- builder: (context, constraints) {
- final widthFactor =
- (constraints.maxWidth + (searchTabHorizontalPadding * 2)) /
- constraints.maxWidth;
- return FractionallySizedBox(widthFactor: widthFactor, child: child);
- },
- );
- }
-}
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 50e7848567..5e83fc82bd 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,6 +6,7 @@ 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;
@@ -21,54 +22,59 @@ class SectionHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
- return GestureDetector(
- onTap: () {
- if (hasMore) {
- routeToPage(context, _sectionAllPage());
- }
- },
- child: ConstrainedBox(
- constraints: const BoxConstraints(minHeight: 38),
- child: Row(
- children: [
- Expanded(
- child: Text(
- sectionType.sectionTitle(context),
- style: TextStyles.display3.copyWith(
- color: colorScheme.textBase,
+ return Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: searchTabSectionHorizontalPadding,
+ ),
+ child: GestureDetector(
+ onTap: () {
+ if (hasMore) {
+ routeToPage(context, _sectionAllPage());
+ }
+ },
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: 38),
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ sectionType.sectionTitle(context),
+ style: TextStyles.display3.copyWith(
+ color: colorScheme.textBase,
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
),
- ),
- hasMore
- ? Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- if (showSearch)
- IconButtonWidget(
- icon: Icons.search,
- iconButtonType: IconButtonType.secondary,
- iconColor: colorScheme.blurStrokePressed,
- onTap: () {
- routeToPage(
- context,
- _sectionAllPage(startInSearchMode: true),
- );
- },
- ),
- SizedBox(
- width: 38,
- height: 38,
- child: Icon(
- Icons.chevron_right_outlined,
- color: colorScheme.blurStrokePressed,
+ hasMore
+ ? Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (showSearch)
+ IconButtonWidget(
+ icon: Icons.search,
+ iconButtonType: IconButtonType.secondary,
+ iconColor: colorScheme.blurStrokePressed,
+ onTap: () {
+ routeToPage(
+ context,
+ _sectionAllPage(startInSearchMode: true),
+ );
+ },
+ ),
+ SizedBox(
+ width: 38,
+ height: 38,
+ child: Icon(
+ Icons.chevron_right_outlined,
+ color: colorScheme.blurStrokePressed,
+ ),
),
- ),
- ],
- )
- : const SizedBox.shrink(),
- ],
+ ],
+ )
+ : const SizedBox.shrink(),
+ ],
+ ),
),
),
);