Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Update album empty states and add photos UI (#11042)

Aman Raj999b459798de
diff --git a/mobile/apps/photos/assets/2.0x/new_empty_album.png b/mobile/apps/photos/assets/2.0x/new_empty_album.png
deleted file mode 100644
index cbd3834a06..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/new_empty_album.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/2.0x/new_empty_album_dark.png b/mobile/apps/photos/assets/2.0x/new_empty_album_dark.png
deleted file mode 100644
index 6c8e189182..0000000000
Binary files a/mobile/apps/photos/assets/2.0x/new_empty_album_dark.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/new_empty_album.png b/mobile/apps/photos/assets/3.0x/new_empty_album.png
deleted file mode 100644
index a1be6b14a7..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/new_empty_album.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/3.0x/new_empty_album_dark.png b/mobile/apps/photos/assets/3.0x/new_empty_album_dark.png
deleted file mode 100644
index 1cf4a4de33..0000000000
Binary files a/mobile/apps/photos/assets/3.0x/new_empty_album_dark.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/new_empty_album.png b/mobile/apps/photos/assets/new_empty_album.png
deleted file mode 100644
index 495c2bb553..0000000000
Binary files a/mobile/apps/photos/assets/new_empty_album.png and /dev/null differ
diff --git a/mobile/apps/photos/assets/new_empty_album_dark.png b/mobile/apps/photos/assets/new_empty_album_dark.png
deleted file mode 100644
index 10249439dd..0000000000
Binary files a/mobile/apps/photos/assets/new_empty_album_dark.png and /dev/null differ
diff --git a/mobile/apps/photos/changes/album-empty-state-components.md b/mobile/apps/photos/changes/album-empty-state-components.md
new file mode 100644
index 0000000000..f3d21883b6
--- /dev/null
+++ b/mobile/apps/photos/changes/album-empty-state-components.md
@@ -0,0 +1 @@
+- Updated album empty states and add photos flows to use the new UI components.
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 77b3edbeb0..14523ffcbc 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -2559,6 +2559,7 @@
"addSomePhotosDesc1": "Add some photos or pick ",
"addSomePhotosDesc2": "familiar faces",
"addSomePhotosDesc3": "\nto begin with",
+ "startWithAddingPhotosOrFamiliarFaces": "Start with adding\nphotos or familiar faces",
"ignorePerson": "Ignore person",
"mixedGrouping": "Mixed grouping?",
"analysis": "Analysis",
diff --git a/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart b/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
index 497ce8756a..e094f30934 100644
--- a/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
@@ -1,5 +1,6 @@
import "dart:async";
+import "package:ente_components/ente_components.dart";
import "package:flutter/foundation.dart";
import 'package:flutter/material.dart';
import "package:logging/logging.dart";
@@ -15,8 +16,6 @@ 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/title_bar_title_widget.dart';
-import 'package:photos/ui/components/title_bar_widget.dart';
import "package:photos/ui/viewer/search/result/people_section_all_page.dart"
show PeopleSectionAllWidget;
import "package:photos/utils/dialog_util.dart";
@@ -54,7 +53,9 @@ class _SmartAlbumPeopleState extends State<SmartAlbumPeople> {
@override
Widget build(BuildContext context) {
+ final colors = context.componentColors;
return Scaffold(
+ backgroundColor: colors.backgroundBase,
bottomNavigationBar: Padding(
padding: EdgeInsets.fromLTRB(
16,
@@ -71,10 +72,9 @@ class _SmartAlbumPeopleState extends State<SmartAlbumPeople> {
currentConfig!.personIDs,
)
: _selectedPeople.personIds.isNotEmpty;
- return ButtonWidget(
- buttonType: ButtonType.primary,
- buttonSize: ButtonSize.large,
- labelText: AppLocalizations.of(context).save,
+ return ButtonComponent(
+ variant: ButtonComponentVariant.primary,
+ label: AppLocalizations.of(context).save,
shouldSurfaceExecutionStates: false,
isDisabled: !areIdsChanged,
onTap: areIdsChanged
@@ -187,19 +187,11 @@ class _SmartAlbumPeopleState extends State<SmartAlbumPeople> {
},
),
),
- body: CustomScrollView(
- primary: false,
+ body: AppBarComponent(
+ title: AppLocalizations.of(context).people,
+ subtitle: AppLocalizations.of(context).peopleAutoAddDesc,
+ physics: const BouncingScrollPhysics(),
slivers: <Widget>[
- TitleBarWidget(
- flexibleSpaceTitle: TitleBarTitleWidget(
- title: AppLocalizations.of(context).people,
- ),
- expandedHeight: MediaQuery.textScalerOf(context).scale(120),
- flexibleSpaceCaption: AppLocalizations.of(
- context,
- ).peopleAutoAddDesc,
- actionIcons: const [],
- ),
SliverFillRemaining(
child: PeopleSectionAllWidget(
selectedPeople: _selectedPeople,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart
deleted file mode 100644
index 0eda6c8ffe..0000000000
--- a/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_bottom_buttons.dart
+++ /dev/null
@@ -1,150 +0,0 @@
-import "package:flutter/material.dart";
-import "package:photos/generated/l10n.dart";
-import "package:photos/models/collection/collection.dart";
-import "package:photos/models/selected_files.dart";
-import "package:photos/services/collections_service.dart";
-import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/actions/collection/collection_sharing_actions.dart";
-import "package:photos/ui/components/buttons/button_widget.dart";
-import "package:photos/ui/components/models/button_type.dart";
-import "package:photos/ui/viewer/gallery/hooks/add_photos_sheet.dart";
-import "package:photos/utils/dialog_util.dart";
-import "package:photos/utils/share_util.dart";
-
-class CollectPhotosBottomButtons extends StatefulWidget {
- final Collection c;
- final SelectedFiles? selectedFiles;
- const CollectPhotosBottomButtons(this.c, {super.key, this.selectedFiles});
-
- @override
- State<CollectPhotosBottomButtons> createState() => _EmptyAlbumStateNewState();
-}
-
-class _EmptyAlbumStateNewState extends State<CollectPhotosBottomButtons> {
- final ValueNotifier<bool> _hasSelectedFilesNotifier = ValueNotifier(false);
- final GlobalKey shareLinkAlbumButtonKey = GlobalKey();
- late CollectionActions collectionActions;
-
- @override
- void initState() {
- super.initState();
- collectionActions = CollectionActions(CollectionsService.instance);
- widget.selectedFiles?.addListener(_selectedFilesListener);
- }
-
- @override
- void dispose() {
- _hasSelectedFilesNotifier.dispose();
- widget.selectedFiles!.removeListener(_selectedFilesListener);
- super.dispose();
- }
-
- Future<void> _shareAlbumUrl() async {
- final String url = CollectionsService.instance.getPublicUrl(widget.c);
- await shareAlbumLink(context, url, shareLinkAlbumButtonKey);
- }
-
- Future<void> _generateAlbumUrl() async {
- final dialog = createProgressDialog(
- context,
- AppLocalizations.of(context).creatingLink,
- isDismissible: true,
- );
- await dialog.show();
- final bool hasUrl = widget.c.hasLink;
- if (hasUrl) {
- await _shareAlbumUrl();
- } else {
- final bool result = await collectionActions.enableUrl(
- context,
- widget.c,
- enableCollect: true,
- );
- if (result) {
- await _shareAlbumUrl();
- } else {
- await showGenericErrorDialog(context: context, error: result);
- }
- }
- await dialog.hide();
- }
-
- @override
- Widget build(BuildContext context) {
- return SafeArea(
- child: ValueListenableBuilder(
- valueListenable: _hasSelectedFilesNotifier,
- builder: (context, value, child) {
- return AnimatedCrossFade(
- firstCurve: Curves.easeInOutExpo,
- secondCurve: Curves.easeInOutExpo,
- sizeCurve: Curves.easeInOutExpo,
- duration: const Duration(milliseconds: 300),
- crossFadeState: !_hasSelectedFilesNotifier.value
- ? CrossFadeState.showFirst
- : CrossFadeState.showSecond,
- firstChild: Container(
- decoration: BoxDecoration(
- border: Border(
- top: BorderSide(
- color: getEnteColorScheme(context).strokeFaint,
- ),
- ),
- color: getEnteColorScheme(context).backgroundElevated,
- ),
- child: Padding(
- padding: const EdgeInsets.fromLTRB(16, 15, 16, 18),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Container(
- decoration: BoxDecoration(
- color: getEnteColorScheme(context).backgroundElevated2,
- borderRadius: const BorderRadius.all(
- Radius.circular(4),
- ),
- ),
- child: ButtonWidget(
- buttonType: ButtonType.secondary,
- buttonSize: ButtonSize.large,
- labelText: AppLocalizations.of(context).addPhotos,
- icon: Icons.add_photo_alternate_outlined,
- shouldSurfaceExecutionStates: false,
- onTap: () async {
- try {
- await showAddPhotosSheet(context, widget.c);
- } catch (e) {
- await showGenericErrorDialog(
- context: context,
- error: e,
- );
- }
- },
- ),
- ),
- const SizedBox(height: 8),
- ButtonWidget(
- buttonType: ButtonType.primary,
- buttonSize: ButtonSize.large,
- labelText: AppLocalizations.of(context).share,
- icon: Icons.adaptive.share,
- shouldSurfaceExecutionStates: false,
- onTap: () async {
- await _generateAlbumUrl();
- },
- ),
- ],
- ),
- ),
- ),
- secondChild: const SizedBox.shrink(),
- );
- },
- ),
- );
- }
-
- void _selectedFilesListener() {
- _hasSelectedFilesNotifier.value = widget.selectedFiles!.files.isNotEmpty;
- }
-}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
index 305fd44501..109b2ff564 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
@@ -15,7 +15,6 @@ import 'package:photos/models/selected_files.dart';
import 'package:photos/services/ignored_files_service.dart';
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import "package:photos/ui/viewer/actions/smart_albums_status_widget.dart";
-import "package:photos/ui/viewer/gallery/collect_photos_bottom_buttons.dart";
import "package:photos/ui/viewer/gallery/empty_album_state.dart";
import 'package:photos/ui/viewer/gallery/empty_state.dart';
import 'package:photos/ui/viewer/gallery/gallery.dart';
@@ -31,14 +30,12 @@ class CollectionPage extends StatelessWidget {
final CollectionWithThumbnail c;
final String tagPrefix;
final bool? hasVerifiedLock;
- final bool isFromCollectPhotos;
final EnteFile? fileToJumpTo;
CollectionPage(
this.c, {
this.tagPrefix = "collection",
this.hasVerifiedLock = false,
- this.isFromCollectPhotos = false,
this.fileToJumpTo,
super.key,
});
@@ -63,7 +60,6 @@ class CollectionPage extends StatelessWidget {
c.collection.displayName,
_selectedFiles,
collection: c.collection,
- isFromCollectPhotos: isFromCollectPhotos,
);
final gallery = Gallery(
appBar: appBar,
@@ -111,7 +107,6 @@ class CollectionPage extends StatelessWidget {
emptyState: galleryType == GalleryType.ownedCollection
? EmptyAlbumState(
c.collection,
- isFromCollectPhotos: isFromCollectPhotos,
onAddPhotos: () {
Bus.instance.fire(
CollectionMetaEvent(
@@ -122,9 +117,7 @@ class CollectionPage extends StatelessWidget {
},
)
: const EmptyState(),
- footer: isFromCollectPhotos
- ? const SizedBox(height: 20)
- : const SizedBox(height: 212),
+ footer: const SizedBox(height: 212),
fileToJumpTo: fileToJumpTo,
);
@@ -139,12 +132,6 @@ class CollectionPage extends StatelessWidget {
),
child: GalleryBoundariesProvider(
child: Scaffold(
- bottomNavigationBar: isFromCollectPhotos
- ? CollectPhotosBottomButtons(
- c.collection,
- selectedFiles: _selectedFiles,
- )
- : null,
body: SelectionState(
selectedFiles: _selectedFiles,
child: Stack(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/empty_album_state.dart b/mobile/apps/photos/lib/ui/viewer/gallery/empty_album_state.dart
index effce9c51f..a2b249e5b1 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/empty_album_state.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/empty_album_state.dart
@@ -1,124 +1,76 @@
+import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
import "package:photos/generated/l10n.dart";
-import 'package:photos/models/collection/collection.dart';
-import "package:photos/theme/ente_theme.dart";
+import "package:photos/models/collection/collection.dart";
import "package:photos/ui/collections/album/smart_album_people.dart";
-import "package:photos/ui/components/buttons/button_widget.dart";
-import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/viewer/gallery/hooks/add_photos_sheet.dart";
import "package:photos/utils/dialog_util.dart";
class EmptyAlbumState extends StatelessWidget {
final Collection c;
- final bool isFromCollectPhotos;
final VoidCallback? onAddPhotos;
- const EmptyAlbumState(
- this.c, {
- super.key,
- this.isFromCollectPhotos = false,
- this.onAddPhotos,
- });
+ const EmptyAlbumState(this.c, {super.key, this.onAddPhotos});
@override
Widget build(BuildContext context) {
- final isLightMode = Theme.of(context).brightness == Brightness.light;
- return isFromCollectPhotos
- ? Stack(
+ final colors = context.componentColors;
+ return Stack(
+ children: [
+ SizedBox(
+ width: double.infinity,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
- Center(
- child: Opacity(
- opacity: 0.5,
- child: isLightMode
- ? Image.asset('assets/new_empty_album.png')
- : Image.asset('assets/new_empty_album_dark.png'),
- ),
+ Image.asset("assets/albums-widget-static.png", height: 160),
+ const SizedBox(height: 16),
+ Text(
+ AppLocalizations.of(
+ context,
+ ).startWithAddingPhotosOrFamiliarFaces,
+ style: TextStyles.display2.copyWith(color: colors.textBase),
+ textAlign: TextAlign.center,
),
+ const SizedBox(height: 200),
],
- )
- : Stack(
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.end,
children: [
- SizedBox(
- width: double.infinity,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Image.asset("assets/albums-widget-static.png", height: 160),
- const SizedBox(height: 16),
- Text.rich(
- TextSpan(
- text: AppLocalizations.of(context).addSomePhotosDesc1,
- children: [
- TextSpan(
- text: AppLocalizations.of(
- context,
- ).addSomePhotosDesc2,
- style: TextStyle(
- color: getEnteColorScheme(context).primary500,
- ),
- ),
- TextSpan(
- text: AppLocalizations.of(
- context,
- ).addSomePhotosDesc3,
- ),
- ],
- ),
- style: getEnteTextTheme(context).smallMuted,
- textAlign: TextAlign.center,
- ),
- const SizedBox(height: 140),
- ],
- ),
+ ButtonComponent(
+ variant: ButtonComponentVariant.primary,
+ label: AppLocalizations.of(context).addPhotos,
+ shouldSurfaceExecutionStates: false,
+ onTap: () async {
+ try {
+ await showAddPhotosSheet(context, c);
+ } catch (e) {
+ await showGenericErrorDialog(context: context, error: e);
+ }
+ },
),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 24),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- ButtonWidget(
- buttonType: ButtonType.primary,
- buttonSize: ButtonSize.large,
- labelText: AppLocalizations.of(context).addPhotos,
- icon: Icons.add_photo_alternate_outlined,
- shouldSurfaceExecutionStates: false,
- onTap: () async {
- try {
- await showAddPhotosSheet(context, c);
- } catch (e) {
- await showGenericErrorDialog(
- context: context,
- error: e,
- );
- }
- },
- ),
- const SizedBox(height: 12),
- ButtonWidget(
- buttonType: ButtonType.neutral,
- buttonSize: ButtonSize.large,
- iconWidget: Image.asset(
- 'assets/auto-add-people.png',
- width: 24,
- height: 24,
- color: isLightMode ? Colors.white : Colors.black,
- ),
- labelText: AppLocalizations.of(context).autoAddPeople,
- shouldSurfaceExecutionStates: false,
- onTap: () async {
- await routeToPage(
- context,
- SmartAlbumPeople(collectionId: c.id),
- );
- onAddPhotos?.call();
- },
- ),
- const SizedBox(height: 48),
- ],
- ),
+ const SizedBox(height: 12),
+ ButtonComponent(
+ variant: ButtonComponentVariant.neutral,
+ label: AppLocalizations.of(context).autoAddPeople,
+ shouldSurfaceExecutionStates: false,
+ onTap: () async {
+ await routeToPage(
+ context,
+ SmartAlbumPeople(collectionId: c.id),
+ );
+ onAddPhotos?.call();
+ },
),
+ const SizedBox(height: 48),
],
- );
+ ),
+ ),
+ ],
+ );
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index e02983811a..94d4d2926f 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -76,7 +76,6 @@ class GalleryAppBarWidget extends StatefulWidget {
SelectedFiles selectedFiles, {
DeviceCollection? deviceCollection,
Collection? collection,
- bool isFromCollectPhotos = false,
List<EnteFile>? files,
}) {
return GalleryAppBarConfig(
@@ -86,7 +85,6 @@ class GalleryAppBarWidget extends StatefulWidget {
selectedFiles,
deviceCollection: deviceCollection,
collection: collection,
- isFromCollectPhotos: isFromCollectPhotos,
files: files,
),
geometryBuilder: _resolveSliverGeometry,
@@ -117,7 +115,6 @@ class GalleryAppBarWidget extends StatefulWidget {
final SelectedFiles selectedFiles;
final DeviceCollection? deviceCollection;
final Collection? collection;
- final bool isFromCollectPhotos;
final List<EnteFile>? files;
const GalleryAppBarWidget._(
@@ -126,7 +123,6 @@ class GalleryAppBarWidget extends StatefulWidget {
this.selectedFiles, {
this.deviceCollection,
this.collection,
- this.isFromCollectPhotos = false,
this.files,
});
@@ -489,7 +485,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
);
}
- if (galleryType.isSharable() && !widget.isFromCollectPhotos) {
+ if (galleryType.isSharable()) {
actions.add(
IconButtonComponent(
tooltip: strings.share,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
index 1baeda406e..a2070ab98a 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
@@ -1,28 +1,23 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:flutter_animate/flutter_animate.dart";
-import "package:modal_bottom_sheet/modal_bottom_sheet.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:photos/core/configuration.dart";
import "package:photos/core/constants.dart";
import "package:photos/db/files_db.dart";
-import "package:photos/generated/l10n.dart";
import "package:photos/l10n/l10n.dart";
import 'package:photos/models/collection/collection.dart';
import "package:photos/models/selected_files.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/services/filter/db_filters.dart";
-import "package:photos/theme/colors.dart";
-import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/actions/collection/collection_file_actions.dart";
import "package:photos/ui/actions/collection/collection_sharing_actions.dart";
import "package:photos/ui/common/loading_widget.dart";
-import "package:photos/ui/components/bottom_of_title_bar_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/title_bar_title_widget.dart";
import "package:photos/ui/viewer/gallery/gallery.dart";
import "package:photos/ui/viewer/gallery/state/boundary_reporter_mixin.dart";
+import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/utils/dialog_util.dart";
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
@@ -31,22 +26,23 @@ Future<dynamic> showAddPhotosSheet(
BuildContext context,
Collection collection,
) async {
- return await showBarModalBottomSheet(
+ return await showBottomSheetComponent<dynamic>(
context: context,
builder: (context) {
- return AddPhotosPhotoWidget(collection);
+ return FractionallySizedBox(
+ heightFactor: _sheetHeightFactor,
+ alignment: Alignment.bottomCenter,
+ child: GalleryBoundariesProvider(
+ child: AddPhotosPhotoWidget(collection),
+ ),
+ );
},
- shape: const RoundedRectangleBorder(
- side: BorderSide(width: 0),
- borderRadius: BorderRadius.vertical(top: Radius.circular(5)),
- ),
- topControl: const SizedBox.shrink(),
- backgroundColor: getEnteColorScheme(context).backgroundElevated,
- barrierColor: backdropFaintDark,
enableDrag: false,
);
}
+const double _sheetHeightFactor = 0.86;
+
class AddPhotosPhotoWidget extends StatelessWidget {
final Collection collection;
@@ -64,96 +60,113 @@ class AddPhotosPhotoWidget extends StatelessWidget {
// Hide the current collection files from suggestions
hiddenCollectionIDs.add(collection.id);
- return Padding(
- padding: const EdgeInsets.fromLTRB(0, 32, 0, 8),
- child: SizedBox(
- width: double.infinity,
+ return Container(
+ clipBehavior: Clip.antiAlias,
+ decoration: BoxDecoration(
+ color: context.componentColors.backgroundBase,
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(Radii.bottomSheet),
+ topRight: Radius.circular(Radii.bottomSheet),
+ ),
+ ),
+ child: SafeArea(
+ top: false,
child: Column(
mainAxisSize: MainAxisSize.max,
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Expanded(
- child: Column(
- children: [
- _AppBarWithBoundary(
- child: BottomOfTitleBarWidget(
- title: TitleBarTitleWidget(
- title: AppLocalizations.of(context).addMore,
+ _AppBarWithBoundary(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(
+ Spacing.xl,
+ Spacing.xl,
+ Spacing.xl,
+ 0,
+ ),
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ context.l10n.addMore,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyles.h2.copyWith(
+ color: context.componentColors.textBase,
+ ),
),
- caption: AppLocalizations.of(context).selectItemsToAdd,
- showCloseButton: true,
),
- ),
- Expanded(
- child: DelayedGallery(
- hiddenCollectionIDs: hiddenCollectionIDs,
- selectedFiles: selectedFiles,
+ const SizedBox(width: Spacing.md),
+ IconButtonComponent(
+ tooltip: context.l10n.close,
+ variant: IconButtonComponentVariant.circular,
+ shouldSurfaceExecutionStates: false,
+ icon: const HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ size: IconSizes.small,
+ ),
+ onTap: () => Navigator.of(context).pop(),
),
- ),
- ],
+ ],
+ ),
),
),
- SafeArea(
- child: Container(
- decoration: BoxDecoration(
- border: Border(
- top: BorderSide(
- color: getEnteColorScheme(context).strokeFaint,
- ),
+ const SizedBox(height: Spacing.lg),
+ Expanded(
+ child: DelayedGallery(
+ hiddenCollectionIDs: hiddenCollectionIDs,
+ selectedFiles: selectedFiles,
+ ),
+ ),
+ Center(
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 428),
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(
+ Spacing.xl,
+ Spacing.lg,
+ Spacing.xl,
+ Spacing.sm,
),
- ),
- child: Center(
- child: ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 428),
- child: Padding(
- //inner stroke of 1pt + 15 pts of top padding = 16 pts
- padding: const EdgeInsets.fromLTRB(16, 15, 16, 8),
- child: Column(
- children: [
- ValueListenableBuilder(
- valueListenable: isFileSelected,
- builder: (context, bool value, _) {
- return AnimatedSwitcher(
- duration: const Duration(milliseconds: 300),
- switchInCurve: Curves.easeInOutExpo,
- switchOutCurve: Curves.easeInOutExpo,
- child: ButtonWidget(
- key: ValueKey(value),
- // isDisabled: !value,
- buttonType: ButtonType.primary,
- labelText: AppLocalizations.of(
- context,
- ).addSelected,
- onTap: () async {
- final selectedFile = selectedFiles.files;
- final ca = CollectionActions(
- CollectionsService.instance,
- );
- await ca.addToCollection(
- context,
- collection.id,
- false,
- selectedFiles: selectedFile.toList(),
- );
- Navigator.pop(context, selectedFile);
- },
- ),
- );
- },
- ),
- const SizedBox(height: 8),
- ButtonWidget(
- buttonType: ButtonType.secondary,
- buttonAction: ButtonAction.second,
- labelText: AppLocalizations.of(
- context,
- ).addFromDevice,
- onTap: () async {
- await _onPickFromDeviceClicked(context);
- },
- ),
- ],
+ child: Column(
+ children: [
+ ValueListenableBuilder(
+ valueListenable: isFileSelected,
+ builder: (context, bool value, _) {
+ return AnimatedSwitcher(
+ duration: const Duration(milliseconds: 300),
+ switchInCurve: Curves.easeInOutExpo,
+ switchOutCurve: Curves.easeInOutExpo,
+ child: ButtonComponent(
+ key: ValueKey(value),
+ variant: ButtonComponentVariant.primary,
+ isDisabled: !value,
+ label: context.l10n.addSelected,
+ onTap: () async {
+ final selectedFile = selectedFiles.files;
+ final ca = CollectionActions(
+ CollectionsService.instance,
+ );
+ await ca.addToCollection(
+ context,
+ collection.id,
+ false,
+ selectedFiles: selectedFile.toList(),
+ );
+ Navigator.pop(context, selectedFile);
+ },
+ ),
+ );
+ },
),
- ),
+ const SizedBox(height: Spacing.md),
+ ButtonComponent(
+ variant: ButtonComponentVariant.secondary,
+ label: context.l10n.addFromDevice,
+ onTap: () async {
+ await _onPickFromDeviceClicked(context);
+ },
+ ),
+ ],
),
),
),