From 428eb78f0d4990f91eb4e1d63dec788bef339d30 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Tue, 6 Dec 2022 11:45:23 +0530 Subject: [PATCH 1/4] restrict width of content inside BottomActionBar --- .../bottom_action_bar/bottom_action_bar_widget.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart index b0730640c..746c5f14f 100644 --- a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart +++ b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart @@ -27,12 +27,13 @@ class BottomActionBarWidget extends StatelessWidget { final ExpandableController _expandableController = ExpandableController(initialExpanded: false); - @override @override Widget build(BuildContext context) { + final widthOfScreen = MediaQuery.of(context).size.width; final colorScheme = getEnteColorScheme(context); final textTheme = getEnteTextTheme(context); - //todo : restrict width of column + final double leftRightPadding = + widthOfScreen > 430 ? (widthOfScreen - 430) / 2 : 0; return ClipRRect( child: BackdropFilter( filter: ImageFilter.blur(sigmaX: blurBase, sigmaY: blurBase), @@ -41,6 +42,8 @@ class BottomActionBarWidget extends StatelessWidget { padding: EdgeInsets.only( top: 4, bottom: (selectedFiles?.files.isNotEmpty) ?? false ? 24 : 36, + right: leftRightPadding, + left: leftRightPadding, ), child: Column( mainAxisSize: MainAxisSize.min, @@ -66,8 +69,6 @@ class BottomActionBarWidget extends StatelessWidget { ), GestureDetector( onTap: () { - //unselect all files here - //or collapse the expansion panel onCancel?.call(); _expandableController.value = false; }, From 00fdde0bf359d946302b7bf47ee2fcfdaf72b917 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Tue, 6 Dec 2022 11:50:23 +0530 Subject: [PATCH 2/4] add option to sepecify smaller or larger bottom padding for BottomActionBar --- .../bottom_action_bar/bottom_action_bar_widget.dart | 4 +++- lib/ui/viewer/gallery/collection_page.dart | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart index 746c5f14f..25cbd506b 100644 --- a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart +++ b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart @@ -14,9 +14,11 @@ class BottomActionBarWidget extends StatelessWidget { final Widget expandedMenu; final SelectedFiles? selectedFiles; final VoidCallback? onCancel; + final bool hasSmallerBottomPadding; BottomActionBarWidget({ required this.expandedMenu, + required this.hasSmallerBottomPadding, this.selectedFiles, this.text, this.iconButtons, @@ -41,7 +43,7 @@ class BottomActionBarWidget extends StatelessWidget { color: colorScheme.backdropBase, padding: EdgeInsets.only( top: 4, - bottom: (selectedFiles?.files.isNotEmpty) ?? false ? 24 : 36, + bottom: hasSmallerBottomPadding ? 24 : 36, right: leftRightPadding, left: leftRightPadding, ), diff --git a/lib/ui/viewer/gallery/collection_page.dart b/lib/ui/viewer/gallery/collection_page.dart index bafcad341..fb73ca736 100644 --- a/lib/ui/viewer/gallery/collection_page.dart +++ b/lib/ui/viewer/gallery/collection_page.dart @@ -126,6 +126,7 @@ class _CollectionPageState extends State { duration: const Duration(milliseconds: 400), child: BottomActionBarWidget( selectedFiles: _selectedFiles, + hasSmallerBottomPadding: true, expandedMenu: ExpandedMenuWidget( items: [ [ From 8085c9d571e22615763980232e2fecf14673f142 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Tue, 6 Dec 2022 13:30:01 +0530 Subject: [PATCH 3/4] add crossFade for expandedMenu --- .../components/bottom_action_bar/bottom_action_bar_widget.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart index 25cbd506b..62de3755a 100644 --- a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart +++ b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart @@ -113,6 +113,7 @@ class BottomActionBarWidget extends StatelessWidget { tapBodyToExpand: false, tapHeaderToExpand: false, animationDuration: Duration(milliseconds: 400), + crossFadePoint: 0.5, ); } } From 86a61e935a2ab3025c57b1ca168466200fdb1020 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Tue, 6 Dec 2022 13:41:37 +0530 Subject: [PATCH 4/4] use constant for max width --- lib/core/constants.dart | 3 +++ .../bottom_action_bar/bottom_action_bar_widget.dart | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/core/constants.dart b/lib/core/constants.dart index 1a6d1cc48..c74ea9251 100644 --- a/lib/core/constants.dart +++ b/lib/core/constants.dart @@ -46,3 +46,6 @@ class FFDefault { const kDefaultProductionEndpoint = 'https://api.ente.io'; const int intMaxValue = 9223372036854775807; + +//Screen width of iPhone 14 pro max in points is taken as maximum +const double restrictedMaxWidth = 430; diff --git a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart index 62de3755a..d9985332c 100644 --- a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart +++ b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; +import 'package:photos/core/constants.dart'; import 'package:photos/models/selected_files.dart'; import 'package:photos/theme/effects.dart'; import 'package:photos/theme/ente_theme.dart'; @@ -34,8 +35,9 @@ class BottomActionBarWidget extends StatelessWidget { final widthOfScreen = MediaQuery.of(context).size.width; final colorScheme = getEnteColorScheme(context); final textTheme = getEnteTextTheme(context); - final double leftRightPadding = - widthOfScreen > 430 ? (widthOfScreen - 430) / 2 : 0; + final double leftRightPadding = widthOfScreen > restrictedMaxWidth + ? (widthOfScreen - restrictedMaxWidth) / 2 + : 0; return ClipRRect( child: BackdropFilter( filter: ImageFilter.blur(sigmaX: blurBase, sigmaY: blurBase),