Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove legacy album sharing pages

AmanRajSinghMourya0a67e52cbb86
diff --git a/mobile/apps/photos/lib/ui/sharing/add_participant_page.dart b/mobile/apps/photos/lib/ui/sharing/add_participant_page.dart
deleted file mode 100644
index 10e14e8f1d..0000000000
--- a/mobile/apps/photos/lib/ui/sharing/add_participant_page.dart
+++ /dev/null
@@ -1,505 +0,0 @@
-import 'package:email_validator/email_validator.dart';
-import 'package:ente_components/ente_components.dart';
-import "package:ente_strings/ente_strings.dart";
-import 'package:flutter/material.dart';
-import 'package:hugeicons/hugeicons.dart';
-import "package:photos/models/api/collection/user.dart";
-import 'package:photos/models/collection/collection.dart';
-import "package:photos/services/account/user_service.dart";
-import 'package:photos/services/collections_service.dart';
-import "package:photos/services/contacts/contact_identity_resolver.dart";
-import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
-import "package:photos/ui/notification/toast.dart";
-import 'package:photos/ui/sharing/share_components.dart';
-import 'package:photos/ui/sharing/user_avator_widget.dart';
-import "package:photos/ui/sharing/verify_identity_dialog.dart";
-
-enum ActionTypesToShow { addViewer, addCollaborator, addAdmin }
-
-class AddParticipantPage extends StatefulWidget {
- final List<ActionTypesToShow> actionTypesToShow;
- final List<Collection> collections;
-
- AddParticipantPage(this.collections, this.actionTypesToShow, {super.key})
- : assert(actionTypesToShow.isNotEmpty, 'actionTypesToShow cannot be empty');
-
- @override
- State<StatefulWidget> createState() => _AddParticipantPage();
-}
-
-class _AddParticipantPage extends State<AddParticipantPage> {
- final _selectedEmails = <String>{};
- String _newEmail = '';
- bool _emailIsValid = false;
- bool isKeypadOpen = false;
- late CollectionActions collectionActions;
- late List<UserSuggestion> _suggestedUsers;
-
- final textFieldFocusNode = FocusNode();
- final _textController = TextEditingController();
-
- @override
- void initState() {
- super.initState();
- collectionActions = CollectionActions(CollectionsService.instance);
- _suggestedUsers = _getSuggestedUser();
- }
-
- @override
- void dispose() {
- _textController.dispose();
- textFieldFocusNode.dispose();
- super.dispose();
- }
-
- @override
- Widget build(BuildContext context) {
- final filterSuggestedUsers = _suggestedUsers
- .where(
- (element) => matchesResolvedSuggestionQuery(
- element,
- _textController.text.trim().toLowerCase(),
- ),
- )
- .toList();
- isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;
-
- return ShareScaffold(
- title: _getTitle(),
- subtitle: _getSubtitle(),
- resizeToAvoidBottomInset: isKeypadOpen,
- footer: _bottomActionBar(),
- slivers: _slivers(filterSuggestedUsers),
- );
- }
-
- List<Widget> _slivers(List<UserSuggestion> filterSuggestedUsers) {
- final footerDescriptions = [
- if (filterSuggestedUsers.isNotEmpty)
- ShareSectionDescription(
- context.strings.longPressAnEmailToVerifyEndToEndEncryption,
- ),
- ..._roleDescriptionWidgets(),
- ];
-
- return [
- SliverSafeArea(
- top: false,
- bottom: false,
- sliver: SliverPadding(
- padding: const EdgeInsets.symmetric(horizontal: Spacing.lg),
- sliver: SliverList.list(
- children: [
- ShareSectionTitle(context.strings.addANewEmail),
- _enterEmailField(),
- if (filterSuggestedUsers.isNotEmpty) ...[
- const SizedBox(height: Spacing.xxl),
- ShareSectionTitle(context.strings.orPickAnExistingOne),
- ],
- ],
- ),
- ),
- ),
- if (filterSuggestedUsers.isNotEmpty)
- SliverPadding(
- padding: const EdgeInsets.symmetric(horizontal: Spacing.lg),
- sliver: SliverList.builder(
- itemCount: filterSuggestedUsers.length,
- itemBuilder: (context, index) {
- return Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- _suggestedUserItem(filterSuggestedUsers, index),
- if (index < filterSuggestedUsers.length - 1)
- _suggestedUserSeparator(),
- ],
- );
- },
- ),
- ),
- if (footerDescriptions.isNotEmpty)
- SliverSafeArea(
- top: false,
- bottom: false,
- sliver: SliverPadding(
- padding: const EdgeInsets.fromLTRB(
- Spacing.lg,
- 0,
- Spacing.lg,
- Spacing.sm,
- ),
- sliver: SliverList.list(children: footerDescriptions),
- ),
- ),
- ];
- }
-
- Widget _bottomActionBar() {
- final actionButtons = _actionButtons();
- final bottomPadding = isKeypadOpen ? Spacing.sm : Spacing.xl;
- return SafeArea(
- top: false,
- bottom: !isKeypadOpen,
- child: Padding(
- padding: EdgeInsets.fromLTRB(
- Spacing.lg,
- Spacing.sm,
- Spacing.lg,
- bottomPadding,
- ),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- for (var index = 0; index < actionButtons.length; index++) ...[
- actionButtons[index],
- if (index < actionButtons.length - 1)
- const SizedBox(height: Spacing.sm),
- ],
- ],
- ),
- ),
- );
- }
-
- List<Widget> _roleDescriptionWidgets() {
- if (widget.actionTypesToShow.length == 1) {
- return const [];
- }
-
- return [
- if (widget.actionTypesToShow.contains(ActionTypesToShow.addCollaborator))
- ShareSectionDescription(
- context.strings.collaboratorsCanAddPhotosAndVideosToTheSharedAlbum,
- ),
- if (widget.actionTypesToShow.contains(ActionTypesToShow.addAdmin))
- ShareSectionDescription(
- context.strings.adminsCanManagePhotosAndParticipants,
- ),
- ];
- }
-
- Widget _suggestedUserItem(List<UserSuggestion> users, int index) {
- final currentUser = users[index];
- final borderRadius = MenuGroupComponent.itemBorderRadius(
- index: index,
- itemCount: users.length,
- borderRadius: BorderRadius.circular(Radii.button),
- );
- return ClipRRect(
- borderRadius: borderRadius,
- child: DecoratedBox(
- decoration: BoxDecoration(
- color: context.componentColors.fillLight,
- borderRadius: borderRadius,
- ),
- child: ShareMenuItem(
- key: ValueKey(
- '${currentUser.email}-${resolveSuggestionDisplayName(currentUser)}',
- ),
- title: resolveSuggestionDisplayName(currentUser),
- titleColor: context.componentColors.textLight,
- leading: UserAvatarWidget.suggestion(
- currentUser,
- type: AvatarType.medium,
- ),
- trailing: _selectedEmails.contains(currentUser.email)
- ? shareCheck(context)
- : null,
- onTap: () async {
- textFieldFocusNode.unfocus();
- if (_selectedEmails.contains(currentUser.email)) {
- _selectedEmails.remove(currentUser.email);
- } else {
- _selectedEmails.add(currentUser.email);
- }
- setState(() => {});
- },
- onLongPress: () async {
- await showVerifyIdentitySheet(
- context,
- self: false,
- email: currentUser.email,
- );
- },
- ),
- ),
- );
- }
-
- Widget _suggestedUserSeparator() {
- return ColoredBox(
- color: context.componentColors.fillLight,
- child: const DividerComponent(),
- );
- }
-
- List<Widget> _actionButtons() {
- final widgets = <Widget>[];
- if (widget.actionTypesToShow.contains(ActionTypesToShow.addCollaborator)) {
- widgets.add(
- ButtonComponent(
- variant:
- widget.actionTypesToShow.contains(ActionTypesToShow.addViewer)
- ? ButtonComponentVariant.neutral
- : ButtonComponentVariant.primary,
- size: ButtonComponentSize.large,
- label: context.strings.addCollaborators(
- count: _selectedEmails.length,
- ),
- isDisabled: _selectedEmails.isEmpty,
- onTap: () async {
- final results = <bool>[];
- final collections = widget.collections;
-
- for (String email in _selectedEmails) {
- bool result = false;
- for (Collection collection in collections) {
- result = await collectionActions.addEmailToCollection(
- context,
- collection,
- email,
- CollectionParticipantRole.collaborator,
- );
- }
- results.add(result);
- }
-
- final noOfSuccessfullAdds = results.where((e) => e).length;
- if (!mounted) return;
- showToast(
- context,
- context.strings.collaboratorsSuccessfullyAdded(
- count: noOfSuccessfullAdds,
- ),
- );
-
- if (!results.any((e) => e == false) && mounted) {
- Navigator.of(context).pop(true);
- }
- },
- ),
- );
- }
- if (widget.actionTypesToShow.contains(ActionTypesToShow.addViewer)) {
- widgets.add(
- ButtonComponent(
- variant: ButtonComponentVariant.primary,
- size: ButtonComponentSize.large,
- label: context.strings.addViewers(count: _selectedEmails.length),
- isDisabled: _selectedEmails.isEmpty,
- onTap: () async {
- final results = <bool>[];
- final collections = widget.collections;
-
- for (final email in _selectedEmails) {
- bool result = false;
- for (final collection in collections) {
- result = await collectionActions.addEmailToCollection(
- context,
- collection,
- email,
- CollectionParticipantRole.viewer,
- );
- }
- results.add(result);
- }
-
- final noOfSuccessfullAdds = results.where((e) => e).length;
- if (!mounted) return;
- showToast(
- context,
- context.strings.viewersSuccessfullyAdded(
- count: noOfSuccessfullAdds,
- ),
- );
-
- if (!results.any((e) => e == false) && mounted) {
- Navigator.of(context).pop(true);
- }
- },
- ),
- );
- }
- if (widget.actionTypesToShow.contains(ActionTypesToShow.addAdmin)) {
- widgets.add(
- ButtonComponent(
- variant: widget.actionTypesToShow.length == 1
- ? ButtonComponentVariant.primary
- : ButtonComponentVariant.neutral,
- size: ButtonComponentSize.large,
- label: context.strings.addAdmins(count: _selectedEmails.length),
- isDisabled: _selectedEmails.isEmpty,
- onTap: () async {
- final results = <bool>[];
- final collections = widget.collections;
-
- for (final email in _selectedEmails) {
- bool result = false;
- for (final collection in collections) {
- result = await collectionActions.addEmailToCollection(
- context,
- collection,
- email,
- CollectionParticipantRole.admin,
- );
- }
- results.add(result);
- }
-
- final successful = results.where((e) => e).length;
- if (!mounted) return;
- showToast(
- context,
- context.strings.adminsSuccessfullyAdded(count: successful),
- );
-
- if (!results.any((e) => e == false) && mounted) {
- Navigator.of(context).pop(true);
- }
- },
- ),
- );
- }
- return widgets;
- }
-
- void clearFocus() {
- _clearEmailField();
- textFieldFocusNode.unfocus();
- setState(() => {});
- }
-
- void _clearEmailField() {
- _textController.clear();
- _newEmail = _textController.text;
- _emailIsValid = false;
- }
-
- Widget _enterEmailField() {
- return Row(
- children: [
- Expanded(
- child: TextInputComponent(
- controller: _textController,
- focusNode: textFieldFocusNode,
- hintText: context.strings.enterAnEmailAddress,
- isClearable: true,
- shouldUnfocusOnClearOrSubmit: true,
- autofillHints: const [AutofillHints.email],
- autocorrect: false,
- keyboardType: TextInputType.emailAddress,
- onChanged: (value) {
- _newEmail = value.trim();
- _emailIsValid = EmailValidator.validate(_newEmail);
- setState(() {});
- },
- ),
- ),
- const SizedBox(width: Spacing.sm),
- IconButtonComponent(
- variant: IconButtonComponentVariant.green,
- tooltip: context.strings.add,
- icon: const HugeIcon(icon: HugeIcons.strokeRoundedMailAdd01),
- onTap: _emailIsValid ? _addNewEmail : null,
- ),
- ],
- );
- }
-
- Future<void> _addNewEmail() async {
- if (!_emailIsValid) {
- return;
- }
- final result = await collectionActions.doesEmailHaveAccount(
- context,
- _newEmail,
- );
- if (result && mounted) {
- setState(() {
- for (var suggestedUser in _suggestedUsers) {
- if (suggestedUser.email == _newEmail) {
- _selectedEmails.add(suggestedUser.email);
- _clearEmailField();
- textFieldFocusNode.unfocus();
-
- return;
- }
- }
- _suggestedUsers.insert(0, UserSuggestion(_newEmail));
- _selectedEmails.add(_newEmail);
- _clearEmailField();
- textFieldFocusNode.unfocus();
- });
- }
- }
-
- List<UserSuggestion> _getSuggestedUser() {
- final Set<String> existingEmails = {};
- final collections = widget.collections;
- if (collections.isEmpty) {
- return [];
- }
- final Set<String> ownerEmails = {};
-
- for (final Collection collection in collections) {
- for (final User u in collection.sharees) {
- if (u.email.isNotEmpty) {
- existingEmails.add(u.email);
- }
- }
- final ownerEmail = collection.owner.email;
- if (ownerEmail.isNotEmpty) {
- ownerEmails.add(ownerEmail);
- existingEmails.add(ownerEmail);
- }
- }
-
- final suggestedUsers = UserService.instance.getRelevantContacts()
- ..removeWhere((element) => existingEmails.contains(element.email));
-
- if (_textController.text.trim().isNotEmpty) {
- suggestedUsers.removeWhere(
- (element) => !matchesResolvedSuggestionQuery(
- element,
- _textController.text.trim().toLowerCase(),
- ),
- );
- }
- suggestedUsers.removeWhere(
- (element) => ownerEmails.contains(element.email),
- );
- suggestedUsers.sort((a, b) => a.email.compareTo(b.email));
-
- return suggestedUsers;
- }
-
- String _getTitle() {
- if (widget.actionTypesToShow.length > 1) {
- return context.strings.addParticipants;
- }
- switch (widget.actionTypesToShow.first) {
- case ActionTypesToShow.addViewer:
- return context.strings.addViewer;
- case ActionTypesToShow.addCollaborator:
- return context.strings.addCollaborator;
- case ActionTypesToShow.addAdmin:
- return context.strings.addAdmin;
- }
- }
-
- String? _getSubtitle() {
- if (widget.actionTypesToShow.length != 1) {
- return null;
- }
- switch (widget.actionTypesToShow.first) {
- case ActionTypesToShow.addCollaborator:
- return context
- .strings
- .collaboratorsCanAddPhotosAndVideosToTheSharedAlbum;
- case ActionTypesToShow.addAdmin:
- return context.strings.adminsCanManagePhotosAndParticipants;
- case ActionTypesToShow.addViewer:
- return null;
- }
- }
-}
diff --git a/mobile/apps/photos/lib/ui/sharing/manage_album_participant.dart b/mobile/apps/photos/lib/ui/sharing/manage_album_participant.dart
deleted file mode 100644
index 6d2dafa207..0000000000
--- a/mobile/apps/photos/lib/ui/sharing/manage_album_participant.dart
+++ /dev/null
@@ -1,144 +0,0 @@
-import 'package:ente_components/ente_components.dart';
-import "package:ente_strings/ente_strings.dart";
-import 'package:flutter/material.dart';
-import 'package:hugeicons/hugeicons.dart';
-import "package:photos/models/api/collection/user.dart";
-import 'package:photos/models/collection/collection.dart';
-import 'package:photos/services/collections_service.dart';
-import "package:photos/services/contacts/contact_identity_resolver.dart";
-import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
-import 'package:photos/ui/components/buttons/button_widget.dart';
-import 'package:photos/ui/sharing/share_components.dart';
-import 'package:photos/utils/dialog_util.dart';
-
-class ManageIndividualParticipant extends StatefulWidget {
- final Collection collection;
- final User user;
-
- const ManageIndividualParticipant({
- super.key,
- required this.collection,
- required this.user,
- });
-
- @override
- State<StatefulWidget> createState() => _ManageIndividualParticipantState();
-}
-
-class _ManageIndividualParticipantState
- extends State<ManageIndividualParticipant> {
- final CollectionActions collectionActions = CollectionActions(
- CollectionsService.instance,
- );
- late CollectionParticipantRole _role;
-
- @override
- void initState() {
- super.initState();
- _role = CollectionParticipantRoleExtn.fromString(widget.user.role);
- }
-
- Future<void> _changeRole(CollectionParticipantRole role) async {
- final changed = await collectionActions.addEmailToCollection(
- context,
- widget.collection,
- widget.user.email,
- role,
- );
- if (changed && mounted) setState(() => _role = role);
- }
-
- @override
- Widget build(BuildContext context) {
- final isAdmin = _role == CollectionParticipantRole.admin;
- final isCollaborator = _role == CollectionParticipantRole.collaborator;
- final isViewer = _role == CollectionParticipantRole.viewer;
- final resolvedName = resolveDisplayName(widget.user);
- return ShareScaffold(
- title: context.strings.manage,
- subtitle: resolvedName,
- children: [
- ShareSectionTitle(context.strings.addedAs),
- ShareMenuGroup(
- items: [
- ShareMenuItem(
- title: context.strings.admin,
- icon: HugeIcons.strokeRoundedCrown,
- trailing: isAdmin ? shareCheck(context) : null,
- onTap: isAdmin
- ? null
- : () => _changeRole(CollectionParticipantRole.admin),
- ),
- ShareMenuItem(
- title: context.strings.collaborator,
- icon: HugeIcons.strokeRoundedUserGroup,
- trailing: isCollaborator ? shareCheck(context) : null,
- onTap: isCollaborator
- ? null
- : () => _changeRole(CollectionParticipantRole.collaborator),
- ),
- ShareMenuItem(
- title: context.strings.viewer,
- icon: HugeIcons.strokeRoundedView,
- trailing: isViewer ? shareCheck(context) : null,
- showOnlyLoadingState: true,
- onTap: isViewer
- ? null
- : () async {
- final actionResult = await showChoiceActionSheet(
- context,
- title: context.strings.changePermissionsQuestion,
- firstButtonLabel: context.strings.yesConvertToViewer,
- body: context.strings
- .cannotAddMorePhotosAfterBecomingViewer(
- user: resolvedName,
- ),
- isCritical: true,
- );
- if (actionResult?.action != ButtonAction.first ||
- !context.mounted) {
- return;
- }
- try {
- await _changeRole(CollectionParticipantRole.viewer);
- } catch (e) {
- if (!context.mounted) return;
- await showGenericErrorDialog(
- context: context,
- error: e,
- );
- }
- },
- ),
- ],
- ),
- ShareSectionDescription(
- context.strings.adminsAndCollaboratorsCanAddPhotosDescription,
- ),
- const SizedBox(height: Spacing.xxl),
- ShareSectionTitle(context.strings.removeParticipant),
- ShareMenuGroup(
- items: [
- ShareMenuItem(
- title: context.strings.remove,
- leading: const Icon(Icons.not_interested_outlined),
- isDestructive: true,
- onTap: () async {
- final result = await collectionActions.removeParticipant(
- context,
- widget.collection,
- widget.user,
- );
-
- if ((result) && mounted) {
- if (!context.mounted) return;
- Navigator.of(context).pop(true);
- }
- },
- ),
- ],
- ),
- ],
- );
- }
-}
diff --git a/mobile/apps/photos/lib/ui/sharing/show_images_prevew.dart b/mobile/apps/photos/lib/ui/sharing/show_images_prevew.dart
deleted file mode 100644
index 5eb239b01c..0000000000
--- a/mobile/apps/photos/lib/ui/sharing/show_images_prevew.dart
+++ /dev/null
@@ -1,391 +0,0 @@
-import 'dart:math' as math;
-import "dart:ui";
-
-import "package:figma_squircle/figma_squircle.dart";
-import "package:flutter/material.dart";
-import "package:photos/core/constants.dart";
-import "package:photos/models/file/file.dart";
-import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/viewer/file/thumbnail_widget.dart";
-
-class LinkPlaceholder extends StatelessWidget {
- const LinkPlaceholder({required this.files, super.key});
-
- final List<EnteFile> files;
-
- @override
- Widget build(BuildContext context) {
- final int length = files.length;
- Widget placeholderWidget = const SizedBox(height: 300, width: 300);
-
- if (length == 1) {
- placeholderWidget = _BackDrop(
- backDropImage: files[0],
- children: [
- LayoutBuilder(
- builder: (context, constraints) {
- final imageHeight = constraints.maxHeight * 0.9;
- return Center(
- child: _CustomImage(
- width: imageHeight,
- height: imageHeight,
- file: files[0],
- zIndex: 0,
- ),
- );
- },
- ),
- ],
- );
- } else if (length == 2) {
- placeholderWidget = _BackDrop(
- backDropImage: files[0],
- children: [
- LayoutBuilder(
- builder: ((context, constraints) {
- final imageHeight = constraints.maxHeight * 0.52;
- return Stack(
- children: [
- Positioned(
- top: 145,
- left: 180,
- child: _CustomImage(
- height: imageHeight,
- width: imageHeight,
- file: files[1],
- zIndex: 10 * math.pi / 180,
- ),
- ),
- Positioned(
- top: 45,
- left: 3.2,
- child: _CustomImage(
- height: imageHeight,
- width: imageHeight,
- file: files[0],
- zIndex: -(10 * math.pi / 180),
- imageShadow: const [
- BoxShadow(
- offset: Offset(0, 0),
- blurRadius: 0.84,
- color: Color.fromRGBO(0, 0, 0, 0.11),
- ),
- BoxShadow(
- offset: Offset(0.84, 0.84),
- blurRadius: 1.68,
- color: Color.fromRGBO(0, 0, 0, 0.09),
- ),
- BoxShadow(
- offset: Offset(2.53, 2.53),
- blurRadius: 2.53,
- color: Color.fromRGBO(0, 0, 0, 0.05),
- ),
- BoxShadow(
- offset: Offset(5.05, 4.21),
- blurRadius: 2.53,
- color: Color.fromRGBO(0, 0, 0, 0.02),
- ),
- BoxShadow(
- offset: Offset(7.58, 6.74),
- blurRadius: 2.53,
- color: Color.fromRGBO(0, 0, 0, 0.0),
- ),
- ],
- ),
- ),
- ],
- );
- }),
- ),
- ],
- );
- } else if (length == 3) {
- placeholderWidget = _BackDrop(
- backDropImage: files[0],
- children: [
- LayoutBuilder(
- builder: (context, constraint) {
- final imageHeightSmall = constraint.maxHeight * 0.43;
- final imageHeightLarge = constraint.maxHeight * 0.50;
- return Stack(
- children: [
- Positioned(
- top: 55,
- child: _CustomImage(
- height: imageHeightSmall,
- width: imageHeightSmall,
- file: files[1],
- zIndex: -(20 * math.pi / 180),
- ),
- ),
- Positioned(
- bottom: 50,
- right: -10,
- child: _CustomImage(
- height: imageHeightSmall,
- width: imageHeightSmall,
- file: files[2],
- zIndex: 20 * math.pi / 180,
- ),
- ),
- Center(
- child: _CustomImage(
- height: imageHeightLarge,
- width: imageHeightLarge,
- file: files[0],
- zIndex: 0.0,
- imageShadow: const [
- BoxShadow(
- offset: Offset(0, 1.02),
- blurRadius: 2.04,
- color: Color.fromRGBO(0, 0, 0, 0.23),
- ),
- BoxShadow(
- offset: Offset(0, 3.06),
- blurRadius: 3.06,
- color: Color.fromRGBO(0, 0, 0, 0.2),
- ),
- BoxShadow(
- offset: Offset(0, 6.12),
- blurRadius: 4.08,
- color: Color.fromRGBO(0, 0, 0, 0.12),
- ),
- BoxShadow(
- offset: Offset(0, 11.22),
- blurRadius: 5.1,
- color: Color.fromRGBO(0, 0, 0, 0.04),
- ),
- BoxShadow(
- offset: Offset(0, 18.36),
- blurRadius: 5.1,
- color: Color.fromRGBO(0, 0, 0, 0.0),
- ),
- ],
- ),
- ),
- ],
- );
- },
- ),
- ],
- );
- } else if (length > 3) {
- placeholderWidget = _BackDrop(
- backDropImage: files[0],
- children: [
- LayoutBuilder(
- builder: (context, constraint) {
- final imageHeightSmall = constraint.maxHeight * 0.43;
- final imageHeightLarge = constraint.maxHeight * 0.50;
- final boxHeight = constraint.maxHeight * 0.15;
- return Stack(
- children: [
- Positioned(
- top: 30,
- left: 25,
- child: _CustomImage(
- height: imageHeightSmall,
- width: imageHeightSmall,
- file: files[1],
- zIndex: 0.0,
- ),
- ),
- Positioned(
- top: 202,
- left: 50,
- child: _CustomImage(
- height: imageHeightSmall,
- width: imageHeightSmall,
- file: files[2],
- zIndex: 0.0,
- ),
- ),
- Positioned(
- top: 75,
- right: 25,
- child: _CustomImage(
- height: imageHeightLarge,
- width: imageHeightLarge,
- file: files[0],
- zIndex: 0.0,
- imageShadow: const [
- BoxShadow(
- offset: Offset(0, 1.02),
- blurRadius: 2.04,
- color: Color.fromRGBO(0, 0, 0, 0.23),
- ),
- BoxShadow(
- offset: Offset(0, 3.06),
- blurRadius: 3.06,
- color: Color.fromRGBO(0, 0, 0, 0.2),
- ),
- BoxShadow(
- offset: Offset(0, 6.12),
- blurRadius: 4.08,
- color: Color.fromRGBO(0, 0, 0, 0.12),
- ),
- BoxShadow(
- offset: Offset(0, 11.22),
- blurRadius: 5.1,
- color: Color.fromRGBO(0, 0, 0, 0.04),
- ),
- BoxShadow(
- offset: Offset(0, 18.36),
- blurRadius: 5.1,
- color: Color.fromRGBO(0, 0, 0, 0.0),
- ),
- ],
- ),
- ),
- Positioned(
- top: 290,
- left: 270,
- child: Stack(
- children: [
- Center(
- child: Container(
- height: boxHeight + 1,
- width: boxHeight + 1,
- decoration: ShapeDecoration(
- color: const Color.fromRGBO(129, 129, 129, 0.1),
- shape: SmoothRectangleBorder(
- borderRadius: SmoothBorderRadius(
- cornerRadius: 12.5,
- cornerSmoothing: 1.0,
- ),
- ),
- ),
- ),
- ),
- Center(
- child: ClipSmoothRect(
- radius: SmoothBorderRadius(
- cornerRadius: 12,
- cornerSmoothing: 1.0,
- ),
- child: Container(
- height: boxHeight,
- width: boxHeight,
- color: const Color.fromRGBO(255, 255, 255, 1),
- padding: const EdgeInsets.all(4),
- child: Center(
- child: FittedBox(
- child: Text(
- "+"
- "${length - 3}",
- style: getEnteTextTheme(context).h3Bold,
- ),
- ),
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- ],
- );
- },
- ),
- ],
- );
- }
-
- return placeholderWidget;
- }
-}
-
-class _BackDrop extends StatelessWidget {
- const _BackDrop({required this.backDropImage, required this.children});
-
- final List<Widget> children;
- final EnteFile backDropImage;
-
- @override
- Widget build(BuildContext context) {
- return AspectRatio(
- aspectRatio: 1,
- child: Stack(
- children: [
- ThumbnailWidget(
- backDropImage,
- shouldShowSyncStatus: false,
- shouldShowFavoriteIcon: false,
- thumbnailSize: thumbnailLargeSize,
- ),
- BackdropFilter(
- filter: ImageFilter.blur(sigmaX: 12, sigmaY: 12),
- child: Container(color: Colors.transparent),
- ),
- ...children,
- ],
- ),
- );
- }
-}
-
-class _CustomImage extends StatelessWidget {
- const _CustomImage({
- required this.width,
- required this.height,
- required this.file,
- required this.zIndex,
- this.imageShadow,
- });
- final List<BoxShadow>? imageShadow;
- final EnteFile file;
- final double zIndex;
- final double height;
- final double width;
-
- @override
- Widget build(BuildContext context) {
- return Container(
- transform: Matrix4.rotationZ(zIndex),
- height: height,
- width: width,
- child: Stack(
- children: [
- Center(
- child: Container(
- height: height,
- width: width,
- decoration: ShapeDecoration(
- color: const Color.fromRGBO(129, 129, 129, 0.1),
- shadows: imageShadow,
- shape: SmoothRectangleBorder(
- borderRadius: SmoothBorderRadius(
- cornerRadius: 21.0,
- cornerSmoothing: 1.0,
- ),
- ),
- ),
- ),
- ),
- Center(
- child: SizedBox(
- height: height - 2,
- width: width - 2,
- child: ClipSmoothRect(
- radius: SmoothBorderRadius(
- cornerRadius: 20.0,
- cornerSmoothing: 1,
- ),
- clipBehavior: Clip.antiAliasWithSaveLayer,
- child: Container(
- decoration: BoxDecoration(boxShadow: imageShadow),
- child: ThumbnailWidget(
- file,
- shouldShowSyncStatus: false,
- shouldShowFavoriteIcon: false,
- thumbnailSize: thumbnailLargeSize,
- ),
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
-}