Skip to content

armgit / ente

Public Imported from GitHub
0

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

Refactor UI components to improve consistency and usability; update memory link and quick link items with new styles and functionality

AmanRajSinghMourya23c322a2cfc5
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 817ed35755..561d6d1ecf 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -1057,7 +1057,6 @@
"albumsSharedWithYouShowUpHere": "Albums shared with you show up here",
"inviteFamilyToSharePhotosPrivately": "Invite your family to share photos privately",
"shareStorageWithUpToFiveFamilyMembers": "Share storage with up to 5 family members",
- "privateSpaceForEveryMember": "Private space for every member",
"reactAndChatOnSharedMemories": "React and chat on shared memories",
"addFamily": "Add family",
"openSettings": "Open settings",
@@ -1154,6 +1153,7 @@
"deleteLinkQuestion": "Delete link?",
"deleteMemoryLinkMessage": "People you shared this link with will lose access once it is deleted.",
"linkDeletedSuccessfully": "Link deleted successfully",
+ "memoryLink": "Memory link",
"memoryLinks": "Memory links",
"openLink": "Open link",
"pay": "Pay",
diff --git a/mobile/apps/photos/lib/ui/collections/album/column_item.dart b/mobile/apps/photos/lib/ui/collections/album/column_item.dart
index 05a1ca59d3..6d78d3ff12 100644
--- a/mobile/apps/photos/lib/ui/collections/album/column_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/column_item.dart
@@ -149,8 +149,10 @@ class AlbumColumnItemWidget extends StatelessWidget {
switchInCurve: Curves.easeOut,
switchOutCurve: Curves.easeIn,
child: isSelected
- ? const CollectionSelectedBadge(
+ ? const Padding(
key: ValueKey("selected"),
+ padding: EdgeInsets.only(right: 8),
+ child: CollectionSelectedBadge(),
)
: null,
),
diff --git a/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart b/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart
index 6f19e2a073..e8afa3ff16 100644
--- a/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart
+++ b/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart
@@ -3,6 +3,7 @@ import 'dart:math';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import "package:logging/logging.dart";
import "package:photos/core/configuration.dart";
import "package:photos/core/event_bus.dart";
@@ -19,9 +20,8 @@ import 'package:photos/ui/collections/album/vertical_list.dart';
import 'package:photos/ui/common/loading_widget.dart';
import "package:photos/ui/common/progress_dialog.dart";
import "package:photos/ui/components/base_bottom_sheet.dart";
-import 'package:photos/ui/components/buttons/button_widget.dart';
-import 'package:photos/ui/components/models/button_type.dart';
-import "package:photos/ui/components/text_input_widget.dart";
+import 'package:photos/ui/components/buttons/button_widget_v2.dart';
+import "package:photos/ui/components/text_input_widget_v2.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/separators_util.dart";
@@ -178,6 +178,7 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
@override
Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
final bottomInset = MediaQuery.viewInsetsOf(context).bottom;
final isKeyboardUp = bottomInset > 100;
final double bottomPadding =
@@ -195,10 +196,14 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
Expanded(
child: Column(
children: [
- TextInputWidget(
+ TextInputWidgetV2(
hintText:
AppLocalizations.of(context).searchByAlbumNameHint,
- prefixIcon: Icons.search_rounded,
+ leadingWidget: HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ size: 18,
+ color: colorScheme.textMuted,
+ ),
onChange: (value) {
setState(() {
_searchQuery = value.trim();
@@ -214,15 +219,6 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
SafeArea(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 8),
- decoration: BoxDecoration(
- border: Border(
- top: BorderSide(
- color: _enableSelection
- ? getEnteColorScheme(context).strokeFaint
- : Colors.transparent,
- ),
- ),
- ),
child: Column(
children: [
..._actionButtons(),
@@ -241,9 +237,9 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
final List<Widget> widgets = [];
if (_enableSelection) {
widgets.add(
- ButtonWidget(
+ ButtonWidgetV2(
key: const ValueKey('add_button'),
- buttonType: ButtonType.primary,
+ buttonType: ButtonTypeV2.primary,
isInAlert: true,
labelText: AppLocalizations.of(context).add,
shouldSurfaceExecutionStates: false,
diff --git a/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart b/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart
index 887041cbee..ab24a7a544 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart
@@ -3,17 +3,21 @@ import "dart:async";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
import "package:flutter/services.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/api/memory_share/memory_share.dart";
+import "package:photos/models/button_result.dart";
import "package:photos/models/collection/collection.dart";
import "package:photos/models/collection/collection_items.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/services/memory_share_service.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/actions/collection/collection_sharing_actions.dart";
-import "package:photos/ui/components/action_sheet_widget.dart";
-import "package:photos/ui/components/buttons/button_widget.dart";
-import "package:photos/ui/components/models/button_type.dart";
+import "package:photos/ui/components/alert_bottom_sheet.dart";
+import "package:photos/ui/components/buttons/button_widget.dart"
+ show ButtonAction;
+import "package:photos/ui/components/buttons/button_widget_v2.dart";
+import "package:photos/ui/components/buttons/soft_icon_button.dart";
import "package:photos/ui/components/title_bar_title_widget.dart";
import "package:photos/ui/sharing/memory_link_details_sheet.dart";
import "package:photos/ui/tabs/shared/memory_link_item.dart";
@@ -41,8 +45,10 @@ class _AllLinksPageState extends State<AllLinksPage> {
static const _quickLinkHeroTagPrefix = "outgoing_collection";
final List<Collection> _selectedQuickLinks = [];
+ final Set<int> _selectedMemoryShareIDs = {};
- bool get _hasSelection => _selectedQuickLinks.isNotEmpty;
+ bool get _hasSelection =>
+ _selectedQuickLinks.isNotEmpty || _selectedMemoryShareIDs.isNotEmpty;
Future<void> _navigateToCollectionPage(Collection c) async {
final thumbnail = await CollectionsService.instance.getCover(c);
@@ -62,7 +68,7 @@ class _AllLinksPageState extends State<AllLinksPage> {
if (_selectedQuickLinks.contains(c)) {
_selectedQuickLinks.remove(c);
} else {
- if (_selectedQuickLinks.isEmpty) {
+ if (!_hasSelection) {
await HapticFeedback.mediumImpact();
}
_selectedQuickLinks.add(c);
@@ -70,48 +76,67 @@ class _AllLinksPageState extends State<AllLinksPage> {
setState(() {});
}
- Future<void> _removeSelectedQuickLinks() async {
- if (_selectedQuickLinks.isEmpty) {
+ Future<void> _toggleMemoryShareSelection(MemoryShare share) async {
+ if (_selectedMemoryShareIDs.contains(share.id)) {
+ _selectedMemoryShareIDs.remove(share.id);
+ } else {
+ if (!_hasSelection) {
+ await HapticFeedback.mediumImpact();
+ }
+ _selectedMemoryShareIDs.add(share.id);
+ }
+ setState(() {});
+ }
+
+ Future<void> _removeSelectedLinks() async {
+ if (!_hasSelection) {
await showErrorDialog(
context,
- AppLocalizations.of(context).noQuickLinksSelected,
+ AppLocalizations.of(context).deleteLinkQuestion,
AppLocalizations.of(context).pleaseSelectQuickLinksToRemove,
);
return;
}
- final result = await showActionSheet(
- context: context,
+ final result = await showAlertBottomSheet<ButtonResult>(
+ context,
+ title: AppLocalizations.of(context).removePublicLinks,
+ message: AppLocalizations.of(context).deleteMemoryLinkMessage,
+ assetPath: "assets/warning-grey.png",
buttons: [
- ButtonWidget(
- buttonType: ButtonType.critical,
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.critical,
+ labelText: AppLocalizations.of(context).remove,
isInAlert: true,
- shouldStickToDarkTheme: true,
buttonAction: ButtonAction.first,
- shouldSurfaceExecutionStates: true,
- labelText: AppLocalizations.of(context).yesRemove,
- onTap: () async {
- for (final link in List<Collection>.of(_selectedQuickLinks)) {
- await CollectionActions(CollectionsService.instance)
- .trashCollectionKeepingPhotos(link, context);
- widget.quickLinks.remove(link);
- }
- setState(_selectedQuickLinks.clear);
- },
- ),
- ButtonWidget(
- buttonType: ButtonType.secondary,
- buttonAction: ButtonAction.cancel,
- isInAlert: true,
- shouldStickToDarkTheme: true,
- labelText: AppLocalizations.of(context).cancel,
+ onTap: _deleteSelectedLinks,
),
],
- title: AppLocalizations.of(context).removePublicLinks,
- body: AppLocalizations.of(context)
- .thisWillRemovePublicLinksOfAllSelectedQuickLinks,
);
- if (result?.action == ButtonAction.error) {
- await showGenericErrorDialog(context: context, error: result!.exception);
+ if (result?.action == ButtonAction.error && context.mounted) {
+ await showGenericErrorBottomSheet(
+ context: context,
+ error: result?.exception,
+ );
+ }
+ }
+
+ Future<void> _deleteSelectedLinks() async {
+ for (final link in List<Collection>.of(_selectedQuickLinks)) {
+ await CollectionActions(CollectionsService.instance)
+ .trashCollectionKeepingPhotos(link, context);
+ if (!mounted) return;
+ setState(() {
+ widget.quickLinks.remove(link);
+ _selectedQuickLinks.remove(link);
+ });
+ }
+ for (final shareID in Set<int>.of(_selectedMemoryShareIDs)) {
+ await MemoryShareService.instance.deleteMemoryShare(shareID);
+ if (!mounted) return;
+ setState(() {
+ widget.memoryShares.removeWhere((share) => share.id == shareID);
+ _selectedMemoryShareIDs.remove(shareID);
+ });
}
}
@@ -131,9 +156,8 @@ class _AllLinksPageState extends State<AllLinksPage> {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final strings = AppLocalizations.of(context);
- final hasQuickLinks = widget.quickLinks.isNotEmpty;
- final hasMemoryLinks = widget.memoryShares.isNotEmpty;
+ final linkItems = <Object>[...widget.quickLinks, ...widget.memoryShares];
+ final hasLinks = linkItems.isNotEmpty;
return Scaffold(
appBar: AppBar(
@@ -145,11 +169,15 @@ class _AllLinksPageState extends State<AllLinksPage> {
),
actions: [
if (_hasSelection)
- IconButton(
- onPressed: _removeSelectedQuickLinks,
- icon: Icon(
- Icons.remove_circle_outline_outlined,
- color: colorScheme.blurStrokeBase,
+ Padding(
+ padding: const EdgeInsets.only(right: 16),
+ child: SoftIconButton(
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedDelete01,
+ size: 18,
+ color: colorScheme.warning500,
+ ),
+ onTap: _removeSelectedLinks,
),
),
],
@@ -164,7 +192,7 @@ class _AllLinksPageState extends State<AllLinksPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TitleBarTitleWidget(
- title: "Links",
+ title: AppLocalizations.of(context).links,
heroTag: widget.titleHeroTag,
),
Text(
@@ -176,72 +204,54 @@ class _AllLinksPageState extends State<AllLinksPage> {
),
),
const SliverToBoxAdapter(child: SizedBox(height: 20)),
- if (hasQuickLinks) ...[
- SliverPadding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- sliver: SliverToBoxAdapter(
- child: Text(strings.quickLinks, style: textTheme.largeBold),
- ),
- ),
- const SliverToBoxAdapter(child: SizedBox(height: 12)),
+ if (hasLinks) ...[
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16),
sliver: SliverList.separated(
- itemCount: widget.quickLinks.length,
+ itemCount: linkItems.length,
itemBuilder: (context, index) {
- final c = widget.quickLinks[index];
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
+ final item = linkItems[index];
+ if (item is Collection) {
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ if (_hasSelection) {
+ _toggleQuickLinkSelection(item);
+ } else {
+ _navigateToCollectionPage(item);
+ }
+ },
+ onLongPress: () {
+ if (_hasSelection) {
+ _navigateToCollectionPage(item);
+ } else {
+ _toggleQuickLinkSelection(item);
+ }
+ },
+ child: QuickLinkAlbumItem(
+ c: item,
+ selectedQuickLinks: _selectedQuickLinks,
+ ),
+ );
+ }
+
+ final share = item as MemoryShare;
+ final title =
+ MemoryShareService.instance.getMemoryShareTitle(share) ??
+ AppLocalizations.of(context).memoryLink;
+ return MemoryLinkAlbumItem(
+ title: title,
+ fileCount: share.fileCount,
+ previewUploadedFileID: share.previewUploadedFileID,
+ isSelected: _selectedMemoryShareIDs.contains(share.id),
onTap: () {
if (_hasSelection) {
- _toggleQuickLinkSelection(c);
- } else {
- _navigateToCollectionPage(c);
- }
- },
- onLongPress: () {
- if (_hasSelection) {
- _navigateToCollectionPage(c);
+ _toggleMemoryShareSelection(share);
} else {
- _toggleQuickLinkSelection(c);
+ _openMemoryLink(share);
}
},
- child: QuickLinkAlbumItem(
- c: c,
- selectedQuickLinks: _selectedQuickLinks,
- ),
- );
- },
- separatorBuilder: (_, __) => const SizedBox(height: 10),
- ),
- ),
- const SliverToBoxAdapter(child: SizedBox(height: 24)),
- ],
- if (hasMemoryLinks) ...[
- SliverPadding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- sliver: SliverToBoxAdapter(
- child: Text(strings.memoryLinks, style: textTheme.largeBold),
- ),
- ),
- const SliverToBoxAdapter(child: SizedBox(height: 12)),
- SliverPadding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- sliver: SliverList.separated(
- itemCount: widget.memoryShares.length,
- itemBuilder: (context, index) {
- final share = widget.memoryShares[index];
- final title = MemoryShareService.instance
- .getMemoryShareTitle(share) ??
- "Memory link";
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () => _openMemoryLink(share),
- child: MemoryLinkAlbumItem(
- title: title,
- fileCount: share.fileCount,
- previewUploadedFileID: share.previewUploadedFileID,
- ),
+ onLongPress: () => _toggleMemoryShareSelection(share),
);
},
separatorBuilder: (_, __) => const SizedBox(height: 10),
@@ -249,7 +259,7 @@ class _AllLinksPageState extends State<AllLinksPage> {
),
const SliverToBoxAdapter(child: SizedBox(height: 24)),
],
- if (!hasQuickLinks && !hasMemoryLinks)
+ if (!hasLinks)
SliverFillRemaining(
hasScrollBody: false,
child: Center(
diff --git a/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart b/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
index 1d95cf7f82..c1dc571766 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
@@ -1,22 +1,34 @@
import "package:flutter/material.dart";
import "package:photos/db/files_db.dart";
+import "package:photos/generated/l10n.dart";
import 'package:photos/models/file/file.dart';
import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/components/buttons/icon_button_widget.dart";
+import "package:photos/ui/components/collection_share_badge.dart";
import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
class MemoryLinkAlbumItem extends StatelessWidget {
+ static const _thumbSize = 52.0;
+ static const _cornerRadius = 12.0;
+ static const _rowHeight = 68.0;
+ static const _cardRadius = 20.0;
+
static const heroTagPrefix = "memory_link";
final String title;
final int? fileCount;
final int? previewUploadedFileID;
+ final bool isSelected;
+ final VoidCallback? onTap;
+ final VoidCallback? onLongPress;
const MemoryLinkAlbumItem({
super.key,
required this.title,
this.fileCount,
this.previewUploadedFileID,
+ this.isSelected = false,
+ this.onTap,
+ this.onLongPress,
});
Future<EnteFile?> _loadPreviewFile() async {
@@ -32,49 +44,63 @@ class MemoryLinkAlbumItem extends StatelessWidget {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- return Container(
- padding: const EdgeInsets.all(8),
- decoration: BoxDecoration(
- color: colorScheme.fill,
- border: Border.all(color: colorScheme.fill),
- borderRadius: const BorderRadius.all(Radius.circular(20)),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Flexible(
- flex: 6,
- child: Row(
- children: [
- SizedBox(
- width: 52,
- height: 52,
- child: FutureBuilder<EnteFile?>(
- future: _loadPreviewFile(),
- builder: (context, snapshot) {
- if (snapshot.hasData && snapshot.data != null) {
- final String heroTag =
- heroTagPrefix + snapshot.data!.tag;
- return Hero(
- tag: heroTag,
- child: ClipRRect(
- borderRadius: BorderRadius.circular(12),
- child: ThumbnailWidget(
- snapshot.data!,
- key: ValueKey(heroTag),
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: onTap,
+ onLongPress: onLongPress,
+ child: AnimatedContainer(
+ curve: Curves.easeOut,
+ duration: const Duration(milliseconds: 200),
+ height: _rowHeight,
+ padding: const EdgeInsets.all(8),
+ decoration: BoxDecoration(
+ color: colorScheme.fill,
+ border: Border.all(
+ color: isSelected ? colorScheme.greenStroke : colorScheme.fill,
+ ),
+ borderRadius: const BorderRadius.all(
+ Radius.circular(_cardRadius),
+ ),
+ ),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Flexible(
+ flex: 6,
+ child: Row(
+ children: [
+ SizedBox(
+ width: _thumbSize,
+ height: _thumbSize,
+ child: FutureBuilder<EnteFile?>(
+ future: _loadPreviewFile(),
+ builder: (context, snapshot) {
+ if (snapshot.hasData && snapshot.data != null) {
+ final String heroTag =
+ heroTagPrefix + snapshot.data!.tag;
+ return Hero(
+ tag: heroTag,
+ child: ClipRRect(
+ borderRadius:
+ BorderRadius.circular(_cornerRadius),
+ child: ThumbnailWidget(
+ snapshot.data!,
+ key: ValueKey(heroTag),
+ ),
),
- ),
+ );
+ }
+ return const NoThumbnailWidget(
+ addBorder: false,
+ borderRadius: _cornerRadius,
);
- }
- return const NoThumbnailWidget();
- },
+ },
+ ),
),
- ),
- const SizedBox(width: 12),
- Flexible(
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 4),
+ const SizedBox(width: 12),
+ Flexible(
child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
@@ -82,35 +108,35 @@ class MemoryLinkAlbumItem extends StatelessWidget {
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 4),
- Row(
- children: [
- Text(
- (fileCount ?? 0).toString() + " \u2022 ",
- style: textTheme.smallMuted,
- ),
- Icon(
- Icons.link_outlined,
- color: colorScheme.strokeMuted,
- size: 22,
- ),
- ],
+ Text(
+ AppLocalizations.of(context).itemCount(
+ count: fileCount ?? 0,
+ ),
+ style: textTheme.smallMuted,
),
],
),
),
- ),
- ],
+ ],
+ ),
),
- ),
- Flexible(
- flex: 1,
- child: IconButtonWidget(
- icon: Icons.chevron_right_outlined,
- iconButtonType: IconButtonType.secondary,
- iconColor: colorScheme.blurStrokePressed,
+ Flexible(
+ flex: 1,
+ child: AnimatedSwitcher(
+ duration: const Duration(milliseconds: 300),
+ switchInCurve: Curves.easeOut,
+ switchOutCurve: Curves.easeIn,
+ child: isSelected
+ ? const Padding(
+ key: ValueKey("selected"),
+ padding: EdgeInsets.only(right: 8),
+ child: CollectionSelectedBadge(),
+ )
+ : null,
+ ),
),
- ),
- ],
+ ],
+ ),
),
);
}
diff --git a/mobile/apps/photos/lib/ui/tabs/shared/quick_link_album_item.dart b/mobile/apps/photos/lib/ui/tabs/shared/quick_link_album_item.dart
index 5f177f1135..da227461e8 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared/quick_link_album_item.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared/quick_link_album_item.dart
@@ -4,12 +4,16 @@ import 'package:photos/models/collection/collection.dart';
import 'package:photos/models/file/file.dart';
import "package:photos/services/collections_service.dart";
import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/common/loading_widget.dart";
-import "package:photos/ui/components/buttons/icon_button_widget.dart";
+import "package:photos/ui/components/collection_share_badge.dart";
import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
class QuickLinkAlbumItem extends StatelessWidget {
+ static const _thumbSize = 52.0;
+ static const _cornerRadius = 12.0;
+ static const _rowHeight = 68.0;
+ static const _cardRadius = 20.0;
+
final Collection c;
static const heroTagPrefix = "outgoing_collection";
final List<Collection> selectedQuickLinks;
@@ -29,13 +33,14 @@ class QuickLinkAlbumItem extends StatelessWidget {
return AnimatedContainer(
curve: Curves.easeOut,
duration: const Duration(milliseconds: 200),
+ height: _rowHeight,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: colorScheme.fill,
border: Border.all(
- color: isSelected ? colorScheme.strokeMuted : colorScheme.fill,
+ color: isSelected ? colorScheme.greenStroke : colorScheme.fill,
),
- borderRadius: const BorderRadius.all(Radius.circular(20)),
+ borderRadius: const BorderRadius.all(Radius.circular(_cardRadius)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -45,8 +50,8 @@ class QuickLinkAlbumItem extends StatelessWidget {
child: Row(
children: [
SizedBox(
- width: 52,
- height: 52,
+ width: _thumbSize,
+ height: _thumbSize,
child: FutureBuilder<EnteFile?>(
future: CollectionsService.instance.getCover(c),
builder: (context, snapshot) {
@@ -56,7 +61,7 @@ class QuickLinkAlbumItem extends StatelessWidget {
return Hero(
tag: heroTag,
child: ClipRRect(
- borderRadius: BorderRadius.circular(12),
+ borderRadius: BorderRadius.circular(_cornerRadius),
child: ThumbnailWidget(
snapshot.data!,
key: ValueKey(heroTag),
@@ -64,71 +69,45 @@ class QuickLinkAlbumItem extends StatelessWidget {
),
);
} else {
- return const NoThumbnailWidget();
+ return const NoThumbnailWidget(
+ addBorder: false,
+ borderRadius: _cornerRadius,
+ );
}
},
),
),
const SizedBox(width: 12),
Flexible(
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 4),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- c.displayName,
- overflow: TextOverflow.ellipsis,
- ),
- const SizedBox(height: 4),
- FutureBuilder<int>(
- future: CollectionsService.instance.getFileCount(c),
- builder: (context, snapshot) {
- if (!snapshot.hasError) {
- if (!snapshot.hasData) {
- return Row(
- children: [
- EnteLoadingWidget(
- size: 10,
- color: colorScheme.strokeMuted,
- ),
- ],
- );
- }
- final noOfMemories = snapshot.data;
-
- return Row(
- children: [
- Text(
- noOfMemories.toString() + " \u2022 ",
- style: textTheme.smallMuted,
- ),
- c.hasLink
- ? (c.publicURLs.first.isExpired
- ? Icon(
- Icons.link_outlined,
- color: colorScheme.warning500,
- size: 22,
- )
- : Icon(
- Icons.link_outlined,
- color: colorScheme.strokeMuted,
- size: 22,
- ))
- : const SizedBox.shrink(),
- ],
- );
- } else if (snapshot.hasError) {
- return Text(
- AppLocalizations.of(context).somethingWentWrong,
- );
- } else {
- return const EnteLoadingWidget(size: 10);
- }
- },
- ),
- ],
- ),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ c.displayName,
+ overflow: TextOverflow.ellipsis,
+ ),
+ const SizedBox(height: 4),
+ FutureBuilder<int>(
+ future: CollectionsService.instance.getFileCount(c),
+ builder: (context, snapshot) {
+ if (snapshot.hasData) {
+ return Text(
+ AppLocalizations.of(context).itemCount(
+ count: snapshot.data!,
+ ),
+ style: textTheme.smallMuted,
+ );
+ }
+ return Text(
+ "",
+ style: textTheme.small.copyWith(
+ color: colorScheme.textMuted,
+ ),
+ );
+ },
+ ),
+ ],
),
),
],
@@ -137,22 +116,16 @@ class QuickLinkAlbumItem extends StatelessWidget {
Flexible(
flex: 1,
child: AnimatedSwitcher(
- duration: const Duration(milliseconds: 200),
+ duration: const Duration(milliseconds: 300),
switchInCurve: Curves.easeOut,
switchOutCurve: Curves.easeIn,
child: isSelected
- ? IconButtonWidget(
- key: const ValueKey("selected"),
- icon: Icons.check_circle_rounded,
- iconButtonType: IconButtonType.secondary,
- iconColor: colorScheme.blurStrokeBase,
+ ? const Padding(
+ key: ValueKey("selected"),
+ padding: EdgeInsets.only(right: 8),
+ child: CollectionSelectedBadge(),
)
- : IconButtonWidget(
- key: const ValueKey("unselected"),
- icon: Icons.chevron_right_outlined,
- iconButtonType: IconButtonType.secondary,
- iconColor: colorScheme.blurStrokePressed,
- ),
+ : null,
),
),
],