π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Refine shared list item styling
ashilknd6fdc54ef5f5
diff --git a/mobile/apps/photos/lib/ui/collections/album/list_item.dart b/mobile/apps/photos/lib/ui/collections/album/list_item.dartindex ac67a92672..c75f718a2f 100644--- a/mobile/apps/photos/lib/ui/collections/album/list_item.dart+++ b/mobile/apps/photos/lib/ui/collections/album/list_item.dart@@ -72,6 +72,7 @@ class AlbumListItemWidget extends StatelessWidget {final bool hasAnyStatus = isFavoriteAlbum || showPin || showArchive;return ThumbnailListItem(+ backgroundColor: thumbnailListItemBackgroundColor(context),isSelected: isSelected,onTap: onTapCallback == null ? null : () => onTapCallback!(collection),onLongPress: onLongPressCallback == nulldiff --git a/mobile/apps/photos/lib/ui/collections/album/new_list_item.dart b/mobile/apps/photos/lib/ui/collections/album/new_list_item.dartindex 8d381e96fa..9cb9278b8c 100644--- a/mobile/apps/photos/lib/ui/collections/album/new_list_item.dart+++ b/mobile/apps/photos/lib/ui/collections/album/new_list_item.dart@@ -15,7 +15,7 @@ class NewAlbumListItemWidget extends StatelessWidget {final textTheme = getEnteTextTheme(context);final colorScheme = getEnteColorScheme(context);return ThumbnailListItem(- borderStyle: ThumbnailListItemBorderStyle.dotted,+ backgroundColor: thumbnailListItemBackgroundColor(context),leading: ClipRRect(borderRadius: BorderRadius.circular(ThumbnailListItem.defaultLeadingRadius,diff --git a/mobile/apps/photos/lib/ui/components/thumbnail_list_item.dart b/mobile/apps/photos/lib/ui/components/thumbnail_list_item.dartindex df8ef5c460..10d8a38dcc 100644--- a/mobile/apps/photos/lib/ui/components/thumbnail_list_item.dart+++ b/mobile/apps/photos/lib/ui/components/thumbnail_list_item.dart@@ -1,11 +1,10 @@-import "package:dotted_border/dotted_border.dart";import "package:flutter/material.dart";import "package:photos/theme/colors.dart";import "package:photos/theme/ente_theme.dart";-enum ThumbnailListItemBorderStyle {- solid,- dotted,+Color thumbnailListItemBackgroundColor(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ return EnteTheme.isDark(context) ? colorScheme.fill : colorScheme.fillDark;}class ThumbnailListItem extends StatefulWidget {@@ -23,7 +22,6 @@ class ThumbnailListItem extends StatefulWidget {final VoidCallback? onTap;final VoidCallback? onLongPress;final bool isSelected;- final ThumbnailListItemBorderStyle borderStyle;final EdgeInsetsGeometry padding;final double leadingSize;final double borderRadius;@@ -31,7 +29,6 @@ class ThumbnailListItem extends StatefulWidget {final Color? backgroundColor;final Color? borderColor;final Color? selectedBorderColor;- final Color? dottedBorderColor;const ThumbnailListItem({super.key,@@ -42,7 +39,6 @@ class ThumbnailListItem extends StatefulWidget {this.onTap,this.onLongPress,this.isSelected = false,- this.borderStyle = ThumbnailListItemBorderStyle.solid,this.padding = defaultPadding,this.leadingSize = defaultLeadingSize,this.borderRadius = defaultBorderRadius,@@ -50,7 +46,6 @@ class ThumbnailListItem extends StatefulWidget {this.backgroundColor,this.borderColor,this.selectedBorderColor,- this.dottedBorderColor,});@override@@ -63,50 +58,45 @@ class _ThumbnailListItemState extends State<ThumbnailListItem> {@overrideWidget build(BuildContext context) {final colorScheme = getEnteColorScheme(context);- final child = _decorate(- context,- AnimatedContainer(- duration: ThumbnailListItem._stateTransitionDuration,- width: double.infinity,- padding: widget.padding,- decoration: BoxDecoration(- color: _backgroundColor(colorScheme),- borderRadius: BorderRadius.all(Radius.circular(widget.borderRadius)),- border: Border.all(- color: widget.borderStyle == ThumbnailListItemBorderStyle.solid- ? widget.isSelected- ? widget.selectedBorderColor ?? colorScheme.greenBase- : widget.borderColor ?? _backgroundColor(colorScheme)- : Colors.transparent,- ),+ final child = AnimatedContainer(+ duration: ThumbnailListItem._stateTransitionDuration,+ width: double.infinity,+ padding: widget.padding,+ decoration: BoxDecoration(+ color: _backgroundColor(colorScheme),+ borderRadius: BorderRadius.all(Radius.circular(widget.borderRadius)),+ border: Border.all(+ color: widget.isSelected+ ? widget.selectedBorderColor ?? colorScheme.greenBase+ : widget.borderColor ?? _backgroundColor(colorScheme),),- child: Row(- children: [- SizedBox.square(- dimension: widget.leadingSize,- child: widget.leading,- ),- SizedBox(width: widget.contentSpacing),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- mainAxisAlignment: MainAxisAlignment.center,- mainAxisSize: MainAxisSize.min,- children: [- widget.title,- if (widget.subtitle != null) ...[- const SizedBox(height: 4),- widget.subtitle!,- ],+ ),+ child: Row(+ children: [+ SizedBox.square(+ dimension: widget.leadingSize,+ child: widget.leading,+ ),+ SizedBox(width: widget.contentSpacing),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisAlignment: MainAxisAlignment.center,+ mainAxisSize: MainAxisSize.min,+ children: [+ widget.title,+ if (widget.subtitle != null) ...[+ const SizedBox(height: 4),+ widget.subtitle!,],- ),+ ],),- if (widget.trailing != null) ...[- SizedBox(width: widget.contentSpacing),- widget.trailing!,- ],+ ),+ if (widget.trailing != null) ...[+ SizedBox(width: widget.contentSpacing),+ widget.trailing!,],- ),+ ],),);@@ -129,22 +119,6 @@ class _ThumbnailListItemState extends State<ThumbnailListItem> {);}- Widget _decorate(BuildContext context, Widget child) {- if (widget.borderStyle != ThumbnailListItemBorderStyle.dotted) {- return child;- }- final colorScheme = getEnteColorScheme(context);- return DottedBorder(- dashPattern: const [4, 4],- color: widget.dottedBorderColor ?? colorScheme.strokeFaint,- strokeWidth: 1,- padding: EdgeInsets.zero,- borderType: BorderType.RRect,- radius: Radius.circular(widget.borderRadius),- child: child,- );- }-Color _backgroundColor(EnteColorScheme colorScheme) {if (_isPressed) {return colorScheme.fillDarker;diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_widget.dartindex 6d8033c980..7238e69de7 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_widget.dart@@ -37,6 +37,7 @@ class SearchResultWidget extends StatelessWidget {return SizedBox(key: ValueKey(searchResult.hashCode),child: ThumbnailListItem(+ backgroundColor: thumbnailListItemBackgroundColor(context),padding: padding,onTap: () {RecentSearches().add(searchResult.name());diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/searchable_item.dart b/mobile/apps/photos/lib/ui/viewer/search/result/searchable_item.dartindex 8cceb27643..0dad00874a 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/searchable_item.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/searchable_item.dart@@ -41,6 +41,7 @@ class SearchableItemWidget extends StatelessWidget {result.params.containsKey(kClusterParamId);return ThumbnailListItem(+ backgroundColor: thumbnailListItemBackgroundColor(context),onTap: () {RecentSearches().add(searchResult.name());if (onResultTap != null) {@@ -130,8 +131,7 @@ class SearchableItemPlaceholder extends StatelessWidget {final colorScheme = getEnteColorScheme(context);final textTheme = getEnteTextTheme(context);return ThumbnailListItem(- borderStyle: ThumbnailListItemBorderStyle.dotted,- dottedBorderColor: colorScheme.strokeFainter,+ backgroundColor: thumbnailListItemBackgroundColor(context),onTap: sectionType.ctaOnTap(context),leading: ClipRRect(borderRadius: BorderRadius.circular(