π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
search bar close button position
laurenspriemf03564712c32
diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_suffix_icon_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/search_suffix_icon_widget.dartindex df6c64be28..1501bec80a 100644--- a/mobile/apps/photos/lib/ui/viewer/search/search_suffix_icon_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/search_suffix_icon_widget.dart@@ -5,44 +5,67 @@ import "package:photos/theme/ente_theme.dart";class SearchSuffixIcon extends StatefulWidget {final bool shouldShowSpinner;- const SearchSuffixIcon(this.shouldShowSpinner, {super.key});+ final bool showClearButton;+ const SearchSuffixIcon(+ this.shouldShowSpinner, {+ required this.showClearButton,+ super.key,+ });@overrideState<SearchSuffixIcon> createState() => _SearchSuffixIconState();}class _SearchSuffixIconState extends State<SearchSuffixIcon> {+ static const double _suffixContainerSize = 44;+@overrideWidget build(BuildContext context) {final colorScheme = getEnteColorScheme(context);return AnimatedSwitcher(duration: const Duration(milliseconds: 175),child: widget.shouldShowSpinner- ? Padding(- padding: const EdgeInsets.all(12),- child: SizedBox(- height: 20,- width: 20,- child: Center(- child: CircularProgressIndicator(- strokeWidth: 2,- color: colorScheme.strokeMuted,+ ? SizedBox(+ width: _suffixContainerSize,+ height: _suffixContainerSize,+ child: Align(+ alignment: Alignment.centerRight,+ child: SizedBox(+ height: 20,+ width: 20,+ child: Center(+ child: CircularProgressIndicator(+ strokeWidth: 2,+ color: colorScheme.strokeMuted,+ ),),),),)- : IconButton(- splashRadius: 1,- visualDensity: const VisualDensity(horizontal: -1, vertical: -1),- onPressed: () {- Bus.instance.fire(ClearAndUnfocusSearchBar());- },- icon: Icon(- Icons.close,- color: colorScheme.strokeMuted,- size: 16,- ),- ),+ : widget.showClearButton+ ? IconButton(+ splashRadius: 1,+ padding: EdgeInsets.zero,+ constraints: const BoxConstraints.tightFor(+ width: _suffixContainerSize,+ height: _suffixContainerSize,+ ),+ alignment: Alignment.centerRight,+ visualDensity:+ const VisualDensity(horizontal: -1, vertical: -1),+ onPressed: () {+ Bus.instance.fire(ClearAndUnfocusSearchBar());+ },+ icon: Icon(+ Icons.close,+ color: colorScheme.strokeMuted,+ size: 16,+ ),+ )+ : const SizedBox(+ width: _suffixContainerSize,+ height: _suffixContainerSize,+ ),);}}diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dartindex 2ed75afc37..a3dbd808c1 100644--- a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart@@ -50,6 +50,11 @@ class SearchWidgetState extends State<SearchWidget> {void initState() {super.initState();focusNode = FocusNode();+ focusNode.addListener(() {+ if (mounted) {+ setState(() {});+ }+ });_tabChangedEvent = Bus.instance.on<TabChangedEvent>().listen((event) async {if (!mounted) {return;@@ -145,6 +150,8 @@ class SearchWidgetState extends State<SearchWidget> {final textTheme = getEnteTextTheme(context);final mutedTextColor =textTheme.smallMuted.color ?? colorScheme.strokeMuted;+ final shouldShowClearButton =+ focusNode.hasFocus || MediaQuery.viewInsetsOf(context).bottom > 0;return RepaintBoundary(key: widgetKey,child: Padding(@@ -198,6 +205,7 @@ class SearchWidgetState extends State<SearchWidget> {) {return SearchSuffixIcon(isSearching,+ showClearButton: shouldShowClearButton,);},),