π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] First bottom sheet
laurenspriemd8fd5add2608
diff --git a/mobile/lib/ui/components/bulk_edit_widget.dart b/mobile/lib/ui/components/bulk_edit_widget.dartnew file mode 100644index 0000000000..26c37376fd--- /dev/null+++ b/mobile/lib/ui/components/bulk_edit_widget.dart@@ -0,0 +1,193 @@+import 'package:flutter/material.dart';+import 'package:intl/intl.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 PhotoDateSelectionBottomSheet extends StatelessWidget {+ final Iterable<EnteFile> enteFiles;+ final Function(bool) onSelectOneDate;+ final Function(bool) onShiftDates;++ const PhotoDateSelectionBottomSheet({+ super.key,+ required this.enteFiles,+ required this.onSelectOneDate,+ required this.onShiftDates,+ });++ @override+ Widget build(BuildContext context) {+ final photoCount = enteFiles.length;+ if (photoCount == 0) {+ return const SizedBox.shrink();+ }+ final firstFileTime =+ DateTime.fromMicrosecondsSinceEpoch(enteFiles.first.creationTime!);+ DateTime startDate = firstFileTime;+ DateTime endDate = firstFileTime;+ for (final file in enteFiles) {+ if (file.creationTime == null) {+ continue;+ }+ final fileTime = DateTime.fromMicrosecondsSinceEpoch(file.creationTime!);+ if (fileTime.isBefore(startDate)) {+ startDate = fileTime;+ }+ if (fileTime.isAfter(endDate)) {+ endDate = fileTime;+ }+ }+ return Container(+ decoration: BoxDecoration(+ color: getEnteColorScheme(context).backgroundElevated2,+ borderRadius: const BorderRadius.only(+ topLeft: Radius.circular(12),+ topRight: Radius.circular(12),+ ),+ ),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ // Photo count and date range section+ Container(+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),+ child: Row(+ children: [+ // Thumbnail+ ClipRRect(+ borderRadius: BorderRadius.circular(8),+ child: SizedBox(+ width: 56,+ height: 56,+ child: ThumbnailWidget(enteFiles.first),+ ),+ ),+ const SizedBox(width: 16),+ // Photo count and date info+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ "$photoCount photos",+ style: const TextStyle(+ color: Colors.white,+ fontSize: 18,+ fontWeight: FontWeight.bold,+ ),+ ),+ const SizedBox(height: 4),+ Row(+ children: [+ Text(+ _formatDate(startDate),+ style: TextStyle(+ color: Colors.grey[400],+ fontSize: 12,+ ),+ ),+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: 8),+ child: Text(+ "-",+ style: TextStyle(+ color: Colors.grey[400],+ fontSize: 12,+ ),+ ),+ ),+ Text(+ _formatDate(endDate),+ style: TextStyle(+ color: Colors.grey[400],+ fontSize: 12,+ ),+ ),+ ],+ ),+ ],+ ),+ ),+ ],+ ),+ ),+ Divider(+ color: Colors.grey[800],+ height: 1,+ ),++ // Select one date option+ ListTile(+ leading: const Icon(+ Icons.calendar_today,+ color: Colors.white,+ ),+ title: const Text(+ "Select one date and time",+ style: TextStyle(+ color: Colors.white,+ fontSize: 16,+ ),+ ),+ subtitle: Text(+ "Move selected photos to one date",+ style: TextStyle(+ color: Colors.grey[400],+ fontSize: 12,+ ),+ ),+ trailing: const Icon(+ Icons.chevron_right,+ color: Colors.white,+ ),+ onTap: () => onSelectOneDate(true),+ ),++ // Shift dates option+ ListTile(+ leading: const Icon(+ Icons.calendar_month,+ color: Colors.white,+ ),+ title: const Text(+ "Shift dates and time",+ style: TextStyle(+ color: Colors.white,+ fontSize: 16,+ ),+ ),+ subtitle: Text(+ "Photos keep relative time difference",+ style: TextStyle(+ color: Colors.grey[400],+ fontSize: 12,+ ),+ ),+ trailing: const Icon(+ Icons.chevron_right,+ color: Colors.white,+ ),+ onTap: () => onShiftDates(true),+ ),++ // Bottom indicator line+ const SizedBox(height: 16),+ Container(+ width: 40,+ height: 4,+ margin: const EdgeInsets.only(bottom: 16),+ decoration: BoxDecoration(+ color: Colors.grey[600],+ borderRadius: BorderRadius.circular(2),+ ),+ ),+ ],+ ),+ );+ }++ String _formatDate(DateTime date) {+ return "Sat, ${DateFormat('dd MMM yyyy').format(date)}\n${DateFormat('h:mm a').format(date)}";+ }+}diff --git a/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dartindex cc1b71eb2e..8c44ff23fa 100644--- a/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart+++ b/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart@@ -36,6 +36,7 @@ import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';import 'package:photos/ui/collections/collection_action_sheet.dart';import 'package:photos/ui/components/action_sheet_widget.dart';import "package:photos/ui/components/bottom_action_bar/selection_action_button_widget.dart";+import "package:photos/ui/components/bulk_edit_widget.dart";import 'package:photos/ui/components/buttons/button_widget.dart';import 'package:photos/ui/components/models/button_type.dart';import "package:photos/ui/sharing/show_images_prevew.dart";@@ -379,6 +380,34 @@ class _FileSelectionActionsWidgetState);}+ // test bulk edit ui widget TODO: lau: merge with bulk edit date later on+ items.add(+ SelectionActionButton(+ shouldShow: widget.selectedFiles.files.every(+ (element) => (element.ownerID == currentUserID),+ ),+ labelText: "test edit date",+ icon: Icons.edit_calendar_outlined,+ onTap: () async {+ await showModalBottomSheet(+ context: context,+ isScrollControlled: true,+ builder: (context) => PhotoDateSelectionBottomSheet(+ enteFiles: widget.selectedFiles.files,+ onSelectOneDate: (selected) {+ Navigator.pop(context);+ // Handle select one date action+ },+ onShiftDates: (selected) {+ Navigator.pop(context);+ // Handle shift dates action+ },+ ),+ );+ },+ ),+ );+if (widget.type.showEditLocation()) {items.add(SelectionActionButton(