Skip to content

armgit / ente

Public Imported from GitHub
0

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

revert file details

AmanRajSinghMouryade4e08ec8607
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 366f4f718a..199d2d6410 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -2462,7 +2462,6 @@
"joinAlbumConfirmationDialogBody": "Joining an album will make your email visible to its participants.",
"pleaseWaitThisWillTakeAWhile": "Please wait, this will take a while.",
"editTime": "Edit time",
- "editDateAndTime": "Edit date and time",
"selectTime": "Select time",
"selectDate": "Select date",
"previous": "Previous",
diff --git a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
index de71036672..a3c66efdaa 100644
--- a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
+++ b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
@@ -11,6 +11,7 @@ import 'package:photos/models/file/file.dart';
import 'package:photos/module/metadata/panorama.dart';
import "package:photos/service_locator.dart";
import "package:photos/services/media_store_service.dart";
+import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/notification/toast.dart";
import 'package:photos/ui/viewer/file/file_details_widget.dart';
import "package:photos/utils/delete_file_util.dart";
@@ -111,9 +112,11 @@ Future<void> showDetailsSheet(BuildContext context, EnteFile file) async {
opened: true,
),
);
- await showBottomSheetComponent(
+ await showModalBottomSheet(
context: context,
- builder: (_) => FileDetailsWidget(file),
+ isScrollControlled: true,
+ backgroundColor: Colors.transparent,
+ builder: (_) => _DraggableDetailsSheet(file: file),
);
Bus.instance.fire(
DetailsSheetEvent(
@@ -123,3 +126,63 @@ Future<void> showDetailsSheet(BuildContext context, EnteFile file) async {
),
);
}
+
+class _DraggableDetailsSheet extends StatefulWidget {
+ final EnteFile file;
+ const _DraggableDetailsSheet({required this.file});
+
+ @override
+ State<_DraggableDetailsSheet> createState() => _DraggableDetailsSheetState();
+}
+
+class _DraggableDetailsSheetState extends State<_DraggableDetailsSheet> {
+ final _sheetController = DraggableScrollableController();
+ bool _isExpanded = false;
+
+ @override
+ void initState() {
+ super.initState();
+ _sheetController.addListener(_onSheetSizeChanged);
+ }
+
+ @override
+ void dispose() {
+ _sheetController.removeListener(_onSheetSizeChanged);
+ _sheetController.dispose();
+ super.dispose();
+ }
+
+ void _onSheetSizeChanged() {
+ final isNowExpanded = _sheetController.size >= 0.75;
+ if (isNowExpanded != _isExpanded) {
+ setState(() {
+ _isExpanded = isNowExpanded;
+ });
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final isKeyboardOpen = MediaQuery.of(context).viewInsets.bottom > 60;
+ final disableSnap = isKeyboardOpen || _isExpanded;
+ return DraggableScrollableSheet(
+ controller: _sheetController,
+ initialChildSize: disableSnap ? 0.95 : 0.75,
+ minChildSize: disableSnap ? 0.75 : 0.5,
+ maxChildSize: 0.95,
+ snap: !disableSnap,
+ snapSizes: disableSnap ? null : const [0.75],
+ expand: false,
+ builder: (context, scrollController) => Container(
+ decoration: BoxDecoration(
+ color: getEnteColorScheme(context).backgroundElevated,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(12)),
+ ),
+ child: FileDetailsWidget(
+ widget.file,
+ scrollController: scrollController,
+ ),
+ ),
+ );
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/components/buttons/chip_button_widget.dart b/mobile/apps/photos/lib/ui/components/buttons/chip_button_widget.dart
new file mode 100644
index 0000000000..f00d5d4083
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/components/buttons/chip_button_widget.dart
@@ -0,0 +1,56 @@
+import "package:flutter/material.dart";
+import "package:photos/theme/ente_theme.dart";
+
+///https://www.figma.com/file/SYtMyLBs5SAOkTbfMMzhqt/ente-Visual-Design?node-id=8119%3A59513&t=gQa1to5jY89Qk1k7-4
+class ChipButtonWidget extends StatelessWidget {
+ final String? label;
+ final IconData? leadingIcon;
+ final double iconSize;
+ final VoidCallback? onTap;
+ final bool noChips;
+
+ const ChipButtonWidget(
+ this.label, {
+ this.leadingIcon,
+ this.onTap,
+ this.iconSize = 16,
+ this.noChips = false,
+ super.key,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: onTap?.call,
+ child: Container(
+ width: noChips ? double.infinity : null,
+ decoration: BoxDecoration(
+ color: getEnteColorScheme(context).fillFaint,
+ borderRadius: const BorderRadius.all(Radius.circular(4)),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ leadingIcon != null
+ ? Icon(leadingIcon, size: iconSize)
+ : const SizedBox.shrink(),
+ if (label != null && leadingIcon != null)
+ const SizedBox(width: 4),
+ if (label != null)
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 4),
+ child: Text(
+ label!,
+ style: getEnteTextTheme(context).miniBold,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/components/info_item_widget.dart b/mobile/apps/photos/lib/ui/components/info_item_widget.dart
new file mode 100644
index 0000000000..a821833673
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/components/info_item_widget.dart
@@ -0,0 +1,123 @@
+import "package:flutter/material.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';
+
+///https://www.figma.com/file/SYtMyLBs5SAOkTbfMMzhqt/ente-Visual-Design?node-id=8113-59605&t=OMX5f5KdDJYWSQQN-4
+class InfoItemWidget extends StatelessWidget {
+ final IconData? leadingIcon;
+ final Widget? leadingIconWidget;
+ final VoidCallback? editOnTap;
+ final String? title;
+ final Widget? endSection;
+ final Future<List<Widget>> subtitleSection;
+ final bool hasChipButtons;
+ final bool biggerSpinner;
+ final VoidCallback? onTap;
+ const InfoItemWidget({
+ this.leadingIcon,
+ this.leadingIconWidget,
+ this.editOnTap,
+ this.title,
+ this.endSection,
+ required this.subtitleSection,
+ this.hasChipButtons = false,
+ this.biggerSpinner = false,
+ this.onTap,
+ super.key,
+ }) : assert(leadingIcon != null || leadingIconWidget != null);
+
+ @override
+ Widget build(BuildContext context) {
+ final children = <Widget>[];
+ if (title != null) {
+ children.addAll([
+ Text(
+ title!,
+ style: hasChipButtons
+ ? getEnteTextTheme(context).miniMuted
+ : getEnteTextTheme(context).small,
+ ),
+ SizedBox(height: hasChipButtons ? 8 : 4),
+ ]);
+ }
+
+ children.addAll([
+ Flexible(
+ child: FutureBuilder(
+ future: subtitleSection,
+ builder: (context, snapshot) {
+ Widget child;
+ if (snapshot.hasData) {
+ final subtitle = snapshot.data as List<Widget>;
+ if (subtitle.isNotEmpty) {
+ child = Wrap(runSpacing: 8, spacing: 8, children: subtitle);
+ } else {
+ child = const SizedBox.shrink();
+ }
+ } else {
+ child = EnteLoadingWidget(
+ padding: biggerSpinner ? 6 : 3,
+ size: biggerSpinner ? 20 : 11,
+ color: getEnteColorScheme(context).strokeMuted,
+ alignment: biggerSpinner
+ ? Alignment.center
+ : Alignment.centerLeft,
+ );
+ }
+ return AnimatedSwitcher(
+ duration: const Duration(milliseconds: 200),
+ switchInCurve: Curves.easeInOutExpo,
+ child: child,
+ );
+ },
+ ),
+ ),
+ ]);
+
+ endSection != null ? children.add(endSection!) : null;
+
+ return Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Flexible(
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ IconButtonWidget(
+ icon: leadingIcon,
+ iconWidget: leadingIconWidget,
+ iconButtonType: IconButtonType.secondary,
+ ),
+ Flexible(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(12, 3.5, 16, 3.5),
+ child: GestureDetector(
+ behavior: HitTestBehavior.translucent,
+ onTap: onTap,
+ child: SizedBox(
+ width: double.infinity,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: children,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ editOnTap != null
+ ? IconButtonWidget(
+ icon: Icons.edit,
+ iconButtonType: IconButtonType.secondary,
+ onTap: editOnTap,
+ )
+ : const SizedBox.shrink(),
+ ],
+ );
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/viewer/date/date_time_picker.dart b/mobile/apps/photos/lib/ui/viewer/date/date_time_picker.dart
index 34177daeed..fbba29346b 100644
--- a/mobile/apps/photos/lib/ui/viewer/date/date_time_picker.dart
+++ b/mobile/apps/photos/lib/ui/viewer/date/date_time_picker.dart
@@ -1,7 +1,7 @@
-import "package:ente_components/ente_components.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";
import "package:photos/generated/l10n.dart";
+import "package:photos/theme/ente_theme.dart";
Future<DateTime?> showDatePickerSheet(
BuildContext context, {
@@ -9,32 +9,37 @@ Future<DateTime?> showDatePickerSheet(
DateTime? maxDate,
DateTime? minDate,
bool startWithTime = false,
-}) {
- bool showTimePicker = startWithTime;
- return showBottomSheetComponent<DateTime?>(
+}) async {
+ final colorScheme = getEnteColorScheme(context);
+ final sheet = Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated,
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(12),
+ topRight: Radius.circular(12),
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: DateTimePickerWidget(
+ (DateTime dateTime) {
+ Navigator.of(context).pop(dateTime);
+ },
+ () {
+ Navigator.of(context).pop(null);
+ },
+ initialDate,
+ minDateTime: minDate,
+ maxDateTime: maxDate,
+ ),
+ ),
+ );
+ final newDate = await showModalBottomSheet<DateTime?>(
context: context,
- builder: (context) {
- final l10n = AppLocalizations.of(context);
- return StatefulBuilder(
- builder: (context, setState) => BottomSheetComponent(
- title: showTimePicker ? l10n.selectTime : l10n.selectDate,
- showCloseButton: true,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- content: DateTimePickerWidget(
- (dateTime) => Navigator.of(context).pop(dateTime),
- () => Navigator.of(context).pop(null),
- initialDate,
- minDateTime: minDate,
- maxDateTime: maxDate,
- startWithTime: startWithTime,
- showTitle: false,
- onShowTimePickerChanged: (value) =>
- setState(() => showTimePicker = value),
- ),
- ),
- );
- },
+ isScrollControlled: true,
+ builder: (context) => sheet,
);
+ return newDate;
}
class DateTimePickerWidget extends StatefulWidget {
@@ -44,8 +49,6 @@ class DateTimePickerWidget extends StatefulWidget {
final DateTime? maxDateTime;
final DateTime? minDateTime;
final bool startWithTime;
- final bool showTitle;
- final ValueChanged<bool>? onShowTimePickerChanged;
const DateTimePickerWidget(
this.onDateTimeSelected,
@@ -54,8 +57,6 @@ class DateTimePickerWidget extends StatefulWidget {
this.maxDateTime,
this.minDateTime,
this.startWithTime = false,
- this.showTitle = true,
- this.onShowTimePickerChanged,
super.key,
});
@@ -76,14 +77,14 @@ class _DateTimePickerWidgetState extends State<DateTimePickerWidget> {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
- return Container(
- color: colors.backgroundBase,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- // Header
- if (widget.showTitle)
+ final colorScheme = getEnteColorScheme(context);
+ return SafeArea(
+ child: Container(
+ color: colorScheme.backgroundElevated,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ // Header
Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Align(
@@ -92,132 +93,136 @@ class _DateTimePickerWidgetState extends State<DateTimePickerWidget> {
_showTimePicker
? AppLocalizations.of(context).selectTime
: AppLocalizations.of(context).selectDate,
- style: TextStyle(color: colors.textBase, fontSize: 16),
+ style: TextStyle(color: colorScheme.textBase, fontSize: 16),
),
),
),
- // Date/Time Picker
- Container(
- height: 220,
- decoration: BoxDecoration(
- color: colors.fillLight,
- borderRadius: BorderRadius.circular(Radii.lg),
- ),
- child: CupertinoTheme(
- data: CupertinoThemeData(
- brightness: Theme.of(context).brightness,
- textTheme: CupertinoTextThemeData(
- dateTimePickerTextStyle: TextStyle(
- color: colors.textBase,
- fontSize: 22,
+ // Date/Time Picker
+ Container(
+ height: 220,
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated2,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: CupertinoTheme(
+ data: CupertinoThemeData(
+ brightness: Brightness.dark,
+ textTheme: CupertinoTextThemeData(
+ dateTimePickerTextStyle: TextStyle(
+ color: colorScheme.textBase,
+ fontSize: 22,
+ ),
),
),
- ),
- child: CupertinoDatePicker(
- key: ValueKey(_showTimePicker),
- mode: _showTimePicker
- ? CupertinoDatePickerMode.time
- : CupertinoDatePickerMode.date,
- initialDateTime: _selectedDateTime,
- minimumDate: widget.minDateTime ?? DateTime(1800),
- maximumDate: widget.maxDateTime ?? DateTime(2200),
- use24hFormat: MediaQuery.of(context).alwaysUse24HourFormat,
- showDayOfWeek: !_showTimePicker,
- onDateTimeChanged: (DateTime newDateTime) {
- setState(() {
- if (_showTimePicker) {
- // Keep the date but update the time
- _selectedDateTime = DateTime(
- _selectedDateTime.year,
- _selectedDateTime.month,
- _selectedDateTime.day,
- newDateTime.hour,
- newDateTime.minute,
- );
- } else {
- // Keep the time but update the date
- _selectedDateTime = DateTime(
- newDateTime.year,
- newDateTime.month,
- newDateTime.day,
- _selectedDateTime.hour,
- _selectedDateTime.minute,
- );
- }
+ child: CupertinoDatePicker(
+ key: ValueKey(_showTimePicker),
+ mode: _showTimePicker
+ ? CupertinoDatePickerMode.time
+ : CupertinoDatePickerMode.date,
+ initialDateTime: _selectedDateTime,
+ minimumDate: widget.minDateTime ?? DateTime(1800),
+ maximumDate: widget.maxDateTime ?? DateTime(2200),
+ use24hFormat: MediaQuery.of(context).alwaysUse24HourFormat,
+ showDayOfWeek: !_showTimePicker,
+ onDateTimeChanged: (DateTime newDateTime) {
+ setState(() {
+ if (_showTimePicker) {
+ // Keep the date but update the time
+ _selectedDateTime = DateTime(
+ _selectedDateTime.year,
+ _selectedDateTime.month,
+ _selectedDateTime.day,
+ newDateTime.hour,
+ newDateTime.minute,
+ );
+ } else {
+ // Keep the time but update the date
+ _selectedDateTime = DateTime(
+ newDateTime.year,
+ newDateTime.month,
+ newDateTime.day,
+ _selectedDateTime.hour,
+ _selectedDateTime.minute,
+ );
+ }
- // Ensure the selected date doesn't exceed maxDateTime or minDateTime
- if (widget.minDateTime != null &&
- _selectedDateTime.isBefore(widget.minDateTime!)) {
- _selectedDateTime = widget.minDateTime!;
- }
- if (widget.maxDateTime != null &&
- _selectedDateTime.isAfter(widget.maxDateTime!)) {
- _selectedDateTime = widget.maxDateTime!;
- }
- });
- },
+ // Ensure the selected date doesn't exceed maxDateTime or minDateTime
+ if (widget.minDateTime != null &&
+ _selectedDateTime.isBefore(widget.minDateTime!)) {
+ _selectedDateTime = widget.minDateTime!;
+ }
+ if (widget.maxDateTime != null &&
+ _selectedDateTime.isAfter(widget.maxDateTime!)) {
+ _selectedDateTime = widget.maxDateTime!;
+ }
+ });
+ },
+ ),
),
),
- ),
- // Buttons
- SafeArea(
- top: false,
- child: Padding(
+ // Buttons
+ Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- TextButton(
- style: TextButton.styleFrom(
- foregroundColor: colors.textBase,
- textStyle: TextStyles.body,
+ // Cancel Button
+ CupertinoButton(
+ padding: EdgeInsets.zero,
+ child: Text(
+ _showTimePicker
+ ? AppLocalizations.of(context).previous
+ : AppLocalizations.of(context).cancel,
+ style: TextStyle(
+ color: colorScheme.textBase,
+ fontSize: 14,
+ ),
),
onPressed: () {
if (_showTimePicker) {
- _setShowTimePicker(false);
+ // Go back to date picker
+ setState(() {
+ _showTimePicker = false;
+ });
} else {
widget.onCancel();
}
},
+ ),
+
+ // Next/Done Button
+ CupertinoButton(
+ padding: EdgeInsets.zero,
child: Text(
_showTimePicker
- ? AppLocalizations.of(context).previous
- : AppLocalizations.of(context).cancel,
- ),
- ),
- TextButton(
- style: TextButton.styleFrom(
- foregroundColor: colors.primary,
- textStyle: TextStyles.bodyBold,
+ ? AppLocalizations.of(context).done
+ : AppLocalizations.of(context).next,
+ style: TextStyle(
+ color: colorScheme.primary700,
+ fontSize: 14,
+ fontWeight: FontWeight.bold,
+ ),
),
onPressed: () {
if (_showTimePicker) {
+ // We're done, call the callback
widget.onDateTimeSelected(_selectedDateTime);
} else {
- _setShowTimePicker(true);
+ // Move to time picker
+ setState(() {
+ _showTimePicker = true;
+ });
}
},
- child: Text(
- _showTimePicker
- ? AppLocalizations.of(context).done
- : AppLocalizations.of(context).next,
- ),
),
],
),
),
- ),
- ],
+ ],
+ ),
),
);
}
-
- void _setShowTimePicker(bool showTimePicker) {
- setState(() {
- _showTimePicker = showTimePicker;
- });
- widget.onShowTimePickerChanged?.call(showTimePicker);
- }
}
diff --git a/mobile/apps/photos/lib/ui/viewer/date/edit_date_sheet.dart b/mobile/apps/photos/lib/ui/viewer/date/edit_date_sheet.dart
index 27eab2321c..13a2d299ac 100644
--- a/mobile/apps/photos/lib/ui/viewer/date/edit_date_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/date/edit_date_sheet.dart
@@ -1,9 +1,10 @@
-import "package:ente_components/ente_components.dart";
import 'package:flutter/material.dart';
-import "package:hugeicons/hugeicons.dart";
import 'package:intl/intl.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/button_widget.dart";
+import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/viewer/date/date_time_picker.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
import "package:photos/utils/magic_util.dart";
@@ -13,8 +14,9 @@ Future<DateTime?> showEditDateSheet(
Iterable<EnteFile> enteFiles, {
bool showHeader = true,
}) async {
- final newDate = await showBottomSheetComponent<DateTime?>(
+ final newDate = await showModalBottomSheet<DateTime?>(
context: context,
+ isScrollControlled: true,
builder: (context) =>
EditDateSheet(enteFiles: enteFiles, showHeader: showHeader),
);
@@ -82,115 +84,120 @@ class _EditDateSheetState extends State<EditDateSheet> {
return const SizedBox.shrink();
}
+ final colorScheme = getEnteColorScheme(context);
DateTime maxDate = DateTime.now();
if (!selectSingleDate) {
final maxForward = DateTime.now().difference(endDate);
maxDate = startDate.add(maxForward);
}
- final l10n = AppLocalizations.of(context);
- final String sheetTitle;
- if (selectingTime) {
- sheetTitle = l10n.selectTime;
- } else if (selectingDate) {
- sheetTitle = l10n.selectDate;
- } else {
- sheetTitle = l10n.editDateAndTime;
- }
- return BottomSheetComponent(
- title: sheetTitle,
- showCloseButton: true,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- content: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- // Photo count and date range section
- if (widget.showHeader)
- PhotoDateHeaderWidget(
- enteFiles: widget.enteFiles,
- startDate: startDate,
- endDate: endDate,
- ),
- if (widget.showHeader) const SizedBox(height: Spacing.lg),
- if (showSingleOrShiftChoice)
- SelectDateOrShiftWidget(
- onSelectOneDate: () {
- showSingleOrShiftChoice = false;
- selectSingleDate = true;
- setState(() {});
- },
- onShiftDates: () {
- showSingleOrShiftChoice = false;
- selectSingleDate = false;
- setState(() {});
- },
- ),
- if (!showSingleOrShiftChoice && !selectingDate && !selectingTime)
- DateAndTimeWidget(
- key: ValueKey(selectedDate.toString()),
- dateTime: selectedDate,
- selectDate: selectSingleDate,
- singleFile: photoCount == 1,
- newRangeEnd: (selectedDate != startDate && !selectSingleDate)
- ? endDate.add(selectedDate.difference(startDate))
- : null,
- onPressedDate: () {
- selectingDate = true;
- selectingTime = false;
- setState(() {});
- },
- onPressedTime: () {
- selectingDate = false;
- selectingTime = true;
- setState(() {});
- },
- ),
- if (selectingDate || selectingTime)
- DateTimePickerWidget(
- (DateTime dateTime) {
- selectedDate = dateTime;
- selectingDate = false;
- selectingTime = false;
- setState(() {});
- },
- () {
- selectingDate = false;
- selectingTime = false;
- setState(() {});
- },
- selectedDate,
- maxDateTime: maxDate,
- startWithTime: selectingTime,
- showTitle: false,
- onShowTimePickerChanged: (showTimePicker) {
- selectingDate = !showTimePicker;
- selectingTime = showTimePicker;
- setState(() {});
- },
- ),
- if (!showSingleOrShiftChoice &&
- !selectingDate &&
- !selectingTime &&
- selectedDate != startDate)
- Padding(
- padding: const EdgeInsets.only(top: Spacing.lg),
- child: ButtonComponent(
- variant: ButtonComponentVariant.primary,
- size: ButtonComponentSize.large,
- label: AppLocalizations.of(context).confirm,
- onTap: () async {
- final newDate = await _editDates(
- context,
- widget.enteFiles,
- selectedDate,
- selectSingleDate ? null : startDate,
- );
- if (!context.mounted) return;
- Navigator.of(context).pop(newDate);
+ return Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated,
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(12),
+ topRight: Radius.circular(12),
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ // Photo count and date range section
+ if (widget.showHeader)
+ PhotoDateHeaderWidget(
+ enteFiles: widget.enteFiles,
+ startDate: startDate,
+ endDate: endDate,
+ ),
+ if (showSingleOrShiftChoice)
+ SelectDateOrShiftWidget(
+ onSelectOneDate: () {
+ showSingleOrShiftChoice = false;
+ selectSingleDate = true;
+ setState(() {});
+ },
+ onShiftDates: () {
+ showSingleOrShiftChoice = false;
+ selectSingleDate = false;
+ setState(() {});
},
),
- ),
- ],
+ if (!showSingleOrShiftChoice && !selectingDate && !selectingTime)
+ DateAndTimeWidget(
+ key: ValueKey(selectedDate.toString()),
+ dateTime: selectedDate,
+ selectDate: selectSingleDate,
+ singleFile: photoCount == 1,
+ newRangeEnd: (selectedDate != startDate && !selectSingleDate)
+ ? endDate.add(selectedDate.difference(startDate))
+ : null,
+ onPressedDate: () {
+ selectingDate = true;
+ selectingTime = false;
+ setState(() {});
+ },
+ onPressedTime: () {
+ selectingDate = false;
+ selectingTime = true;
+ setState(() {});
+ },
+ ),
+ if (selectingDate || selectingTime)
+ DateTimePickerWidget(
+ (DateTime dateTime) {
+ selectedDate = dateTime;
+ selectingDate = false;
+ selectingTime = false;
+ setState(() {});
+ },
+ () {
+ selectingDate = false;
+ selectingTime = false;
+ setState(() {});
+ },
+ selectedDate,
+ maxDateTime: maxDate,
+ startWithTime: selectingTime,
+ ),
+ if (!showSingleOrShiftChoice &&
+ !selectingDate &&
+ !selectingTime &&
+ selectedDate != startDate)
+ Column(
+ children: [
+ const SizedBox(height: 16),
+ ButtonWidget(
+ buttonType: ButtonType.primary,
+ labelText: AppLocalizations.of(context).confirm,
+ buttonSize: ButtonSize.large,
+ onTap: () async {
+ final newDate = await _editDates(
+ context,
+ widget.enteFiles,
+ selectedDate,
+ selectSingleDate ? null : startDate,
+ );
+ if (!context.mounted) return;
+ Navigator.of(context).pop(newDate);
+ },
+ ),
+ const SizedBox(height: 8),
+ ButtonWidget(
+ buttonType: ButtonType.neutral,
+ labelText: AppLocalizations.of(context).cancel,
+ buttonSize: ButtonSize.large,
+ onTap: () async {
+ Navigator.of(context).pop(null);
+ },
+ ),
+ ],
+ ),
+ // Bottom indicator line
+ const SizedBox(height: 20),
+ ],
+ ),
),
);
}
@@ -248,7 +255,7 @@ class DateAndTimeWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
+ final colorScheme = getEnteColorScheme(context);
final locale = Localizations.localeOf(context);
final String date = DateFormat.yMMMd(locale.toString()).format(dateTime);
final String time = DateFormat(
@@ -265,7 +272,7 @@ class DateAndTimeWidget extends StatelessWidget {
selectDate
? AppLocalizations.of(context).selectOneDateAndTimeForAll
: AppLocalizations.of(context).selectStartOfRange,
- style: TextStyle(color: colors.textBase, fontSize: 16),
+ style: TextStyle(color: colorScheme.textBase, fontSize: 16),
),
),
if (!singleFile) const SizedBox(height: 8),
@@ -280,41 +287,57 @@ class DateAndTimeWidget extends StatelessWidget {
: AppLocalizations.of(
context,
).allWillShiftRangeBasedOnFirst,
- style: TextStyle(color: colors.textLight, fontSize: 12),
+ style: TextStyle(color: colorScheme.textFaint, fontSize: 12),
),
),
if (!singleFile) const SizedBox(height: 16),
- MenuGroupComponent(
- items: [
- MenuComponent(
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedCalendar04,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- title: date,
- trailing: Icon(
- Icons.chevron_right_outlined,
- color: colors.textLight,
- size: IconSizes.medium,
+ Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated2,
+ border: Border.all(color: colorScheme.strokeFaint, width: 0.5),
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ ListTile(
+ leading: Icon(
+ Icons.calendar_today_outlined,
+ color: colorScheme.textBase,
+ ),
+ title: Text(
+ date,
+ style: TextStyle(color: colorScheme.textBase, fontSize: 16),
+ ),
+ trailing: Icon(
+ Icons.chevron_right,
+ color: colorScheme.strokeMuted,
+ ),
+ onTap: () => onPressedDate(),
),
- onTap: () => onPressedDate(),
- ),
- MenuComponent(
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedClock01,
- size: IconSizes.small,
- color: colors.textLight,
+ Divider(
+ color: colorScheme.blurStrokeFaint,
+ indent: 16,
+ endIndent: 16,
+ height: 0.5,
),
- title: time,
- trailing: Icon(
- Icons.chevron_right_outlined,
- color: colors.textLight,
- size: IconSizes.medium,
+ ListTile(
+ leading: Icon(
+ Icons.access_time_outlined,
+ color: colorScheme.textBase,
+ ),
+ title: Text(
+ time,
+ style: TextStyle(color: colorScheme.textBase, fontSize: 16),
+ ),
+ trailing: Icon(
+ Icons.chevron_right,
+ color: colorScheme.strokeMuted,
+ ),
+ onTap: () => onPressedTime(),
),
- onTap: () => onPressedTime(),
- ),
- ],
+ ],
+ ),
),
if (newRangeEnd != null) const SizedBox(height: 16),
if (newRangeEnd != null)
@@ -322,15 +345,15 @@ class DateAndTimeWidget extends StatelessWidget {
alignment: Alignment.centerLeft,
child: Text(
AppLocalizations.of(context).newRange,
- style: TextStyle(color: colors.textBase, fontSize: 12),
+ style: TextStyle(color: colorScheme.textBase, fontSize: 12),
),
),
if (newRangeEnd != null) const SizedBox(height: 8),
if (newRangeEnd != null)
Container(
decoration: BoxDecoration(
- color: colors.fillLight,
- border: Border.all(color: colors.strokeFaint, width: 0.5),
+ color: colorScheme.backgroundElevated2,
+ border: Border.all(color: colorScheme.strokeFaint, width: 0.5),
borderRadius: BorderRadius.circular(8),
),
child: Padding(
@@ -342,7 +365,7 @@ class DateAndTimeWidget extends StatelessWidget {
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.calendar_today_outlined,
- color: colors.textBase,
+ color: colorScheme.textBase,
),
),
Expanded(
@@ -352,7 +375,7 @@ class DateAndTimeWidget extends StatelessWidget {
Text(
_formatDate(dateTime, locale, context),
style: TextStyle(
- color: colors.textLight,
+ color: colorScheme.textFaint,
fontSize: 12,
),
),
@@ -361,7 +384,7 @@ class DateAndTimeWidget extends StatelessWidget {
child: Text(
"-",
style: TextStyle(
- color: colors.textLight,
+ color: colorScheme.textFaint,
fontSize: 12,
),
),
@@ -369,7 +392,7 @@ class DateAndTimeWidget extends StatelessWidget {
Text(
_formatDate(newRangeEnd!, locale, context),
style: TextStyle(
- color: colors.textLight,
+ color: colorScheme.textFaint,
fontSize: 12,
),
),
@@ -399,44 +422,66 @@ class SelectDateOrShiftWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
+ final colorScheme = getEnteColorScheme(context);
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
- child: MenuGroupComponent(
- items: [
- MenuComponent(
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedCalendar04,
- size: IconSizes.small,
- color: colors.textLight,
+ child: Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated2,
+ border: Border.all(color: colorScheme.strokeFaint, width: 0.5),
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ // Select one date option
+ ListTile(
+ leading: Icon(
+ Icons.calendar_today_outlined,
+ color: colorScheme.textBase,
+ ),
+ title: Text(
+ AppLocalizations.of(context).selectOneDateAndTime,
+ style: TextStyle(color: colorScheme.textBase, fontSize: 16),
+ ),
+ subtitle: Text(
+ AppLocalizations.of(context).moveSelectedPhotosToOneDate,
+ style: TextStyle(color: colorScheme.textFaint, fontSize: 12),
+ ),
+ trailing: Icon(
+ Icons.chevron_right,
+ color: colorScheme.strokeMuted,
+ ),
+ onTap: () => onSelectOneDate(),
),
- title: AppLocalizations.of(context).selectOneDateAndTime,
- subtitle: AppLocalizations.of(context).moveSelectedPhotosToOneDate,
- trailing: Icon(
- Icons.chevron_right_outlined,
- color: colors.textLight,
- size: IconSizes.medium,
+ Divider(
+ color: colorScheme.blurStrokeFaint,
+ indent: 16,
+ endIndent: 16,
+ height: 0.5,
),
- onTap: () => onSelectOneDate(),
- ),
- MenuComponent(
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedCalendar03,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- title: AppLocalizations.of(context).shiftDatesAndTime,
- subtitle: AppLocalizations.of(
- context,
- ).photosKeepRelativeTimeDifference,
- trailing: Icon(
- Icons.chevron_right_outlined,
- color: colors.textLight,
- size: IconSizes.medium,
+ // Shift dates option
+ ListTile(
+ leading: Icon(
+ Icons.calendar_month_outlined,
+ color: colorScheme.textBase,
+ ),
+ title: Text(
+ AppLocalizations.of(context).shiftDatesAndTime,
+ style: TextStyle(color: colorScheme.textBase, fontSize: 16),
+ ),
+ subtitle: Text(
+ AppLocalizations.of(context).photosKeepRelativeTimeDifference,
+ style: TextStyle(color: colorScheme.textFaint, fontSize: 12),
+ ),
+ trailing: Icon(
+ Icons.chevron_right,
+ color: colorScheme.strokeMuted,
+ ),
+ onTap: () => onShiftDates(),
),
- onTap: () => onShiftDates(),
- ),
- ],
+ ],
+ ),
),
);
}
@@ -457,73 +502,106 @@ class PhotoDateHeaderWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final photoCount = enteFiles.length;
- final colors = context.componentColors;
+ final colorScheme = getEnteColorScheme(context);
final locale = Localizations.localeOf(context);
- final bool multipleFiles = photoCount != 1;
- final dateTextStyle = TextStyles.mini.copyWith(color: colors.textLight);
- return Row(
- children: [
- ClipRRect(
- borderRadius: BorderRadius.circular(Radii.sm),
- child: SizedBox(
- width: 56,
- height: 56,
- child: ThumbnailWidget(enteFiles.first),
+ bool multipleFiles = true;
+ if (photoCount == 1) {
+ multipleFiles = false;
+ }
+ return Container(
+ padding: const EdgeInsets.symmetric(vertical: 4),
+ child: Row(
+ children: [
+ // Thumbnail
+ ClipRRect(
+ borderRadius: BorderRadius.circular(8),
+ child: SizedBox(
+ width: 56,
+ height: 56,
+ child: ThumbnailWidget(enteFiles.first),
+ ),
),
- ),
- const SizedBox(width: Spacing.md),
- multipleFiles
- ? Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- AppLocalizations.of(
- context,
- ).photosCount(count: photoCount),
- style: TextStyles.h2,
- ),
- const SizedBox(height: Spacing.xs),
- Row(
- children: [
- Text(
- _formatDate(startDate, locale, context),
- style: dateTextStyle,
+ const SizedBox(width: 16),
+ // Photo count and date info
+ multipleFiles
+ ? Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ AppLocalizations.of(
+ context,
+ ).photosCount(count: photoCount),
+ style: TextStyle(
+ color: colorScheme.textBase,
+ fontSize: 18,
+ fontWeight: FontWeight.bold,
),
- Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: Spacing.sm,
+ ),
+ const SizedBox(height: 4),
+ Row(
+ children: [
+ Text(
+ _formatDate(startDate, locale, context),
+ style: TextStyle(
+ color: colorScheme.textMuted,
+ fontSize: 12,
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8),
+ child: Text(
+ "-",
+ style: TextStyle(
+ color: colorScheme.textMuted,
+ fontSize: 12,
+ ),
+ ),
+ ),
+ Text(
+ _formatDate(endDate, locale, context),
+ style: TextStyle(
+ color: colorScheme.textMuted,
+ fontSize: 12,
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ )
+ : Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(right: 40),
+ child: FittedBox(
+ fit: BoxFit.scaleDown,
+ alignment: Alignment.centerLeft,
+ child: Text(
+ enteFiles.first.displayName,
+ style: TextStyle(
+ color: colorScheme.textBase,
+ fontSize: 24,
+ fontWeight: FontWeight.bold,
+ ),
),
- child: Text("-", style: dateTextStyle),
),
- Text(
- _formatDate(endDate, locale, context),
- style: dateTextStyle,
+ ),
+ const SizedBox(height: 4),
+ Text(
+ "${DateFormat.yMEd(locale.toString()).format(startDate)} Β· ${DateFormat(MediaQuery.of(context).alwaysUse24HourFormat ? 'HH:mm' : 'h:mm a').format(startDate)}",
+ style: TextStyle(
+ color: colorScheme.textMuted,
+ fontSize: 12,
),
- ],
- ),
- ],
- ),
- )
- : Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- enteFiles.first.displayName,
- style: TextStyles.h2,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- ),
- const SizedBox(height: Spacing.xs),
- Text(
- "${DateFormat.yMEd(locale.toString()).format(startDate)} Β· ${DateFormat(MediaQuery.of(context).alwaysUse24HourFormat ? 'HH:mm' : 'h:mm a').format(startDate)}",
- style: dateTextStyle,
- ),
- ],
+ ),
+ ],
+ ),
),
- ),
- ],
+ ],
+ ),
);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file/exif_info_dialog.dart b/mobile/apps/photos/lib/ui/viewer/file/exif_info_dialog.dart
index b0acff54e3..c6e4bc4909 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/exif_info_dialog.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/exif_info_dialog.dart
@@ -1,8 +1,8 @@
-import "package:ente_components/ente_components.dart";
import 'package:flutter/material.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/file/file.dart';
import 'package:photos/module/metadata/exif.dart';
+import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/common/loading_widget.dart';
class ExifInfoDialog extends StatelessWidget {
@@ -11,30 +11,34 @@ class ExifInfoDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
- return BottomSheetComponent(
- title: AppLocalizations.of(context).exif,
- isScrollable: true,
- snap: true,
- initialChildSize: 0.75,
- snapSizes: const [0.5, 0.75, 0.95],
- content: Column(
+ final textTheme = getEnteTextTheme(context);
+ return AlertDialog(
+ title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
children: [
- Text(
- file.title!,
- style: TextStyles.body.copyWith(color: colors.textLight),
- ),
- const SizedBox(height: Spacing.lg),
- _getInfo(context),
+ Text(AppLocalizations.of(context).exif, style: textTheme.h3Bold),
+ Text(file.title!, style: textTheme.smallMuted),
],
),
+ content: Scrollbar(
+ thumbVisibility: true,
+ child: SingleChildScrollView(child: _getInfo()),
+ ),
+ actions: [
+ TextButton(
+ child: Text(
+ AppLocalizations.of(context).close,
+ style: textTheme.body,
+ ),
+ onPressed: () {
+ Navigator.of(context).pop('dialog');
+ },
+ ),
+ ],
);
}
- Widget _getInfo(BuildContext context) {
- final colors = context.componentColors;
+ Widget _getInfo() {
return FutureBuilder(
future: getExif(file),
builder: (BuildContext context, AsyncSnapshot snapshot) {
@@ -44,11 +48,27 @@ class ExifInfoDialog extends StatelessWidget {
.map((entry) => "${entry.key}: ${entry.value}")
.join("\n");
if (data.isEmpty) {
- data = AppLocalizations.of(context).noExifData;
+ data = "no exif data found";
}
- return Text(
- data,
- style: TextStyles.body.copyWith(color: colors.textLight),
+ return Container(
+ padding: const EdgeInsets.all(2),
+ color: Colors.white.withValues(alpha: 0.05),
+ child: Center(
+ child: Padding(
+ padding: const EdgeInsets.all(4),
+ child: Text(
+ data,
+ style: TextStyle(
+ fontSize: 14,
+ fontFeatures: const [FontFeature.tabularFigures()],
+ height: 1.4,
+ color: Theme.of(
+ context,
+ ).colorScheme.onSurface.withValues(alpha: 0.7),
+ ),
+ ),
+ ),
+ ),
);
} else {
return const EnteLoadingWidget();
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_caption_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/file_caption_widget.dart
index 7860cf7d3a..19f18eae04 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_caption_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_caption_widget.dart
@@ -1,10 +1,11 @@
-import "package:ente_components/ente_components.dart";
import 'package:flutter/material.dart';
-import "package:hugeicons/hugeicons.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/file_caption_updated_event.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/keyboard/keyboard_oveylay.dart';
+import 'package:photos/ui/components/keyboard/keyboard_top_button.dart';
import "package:photos/ui/notification/toast.dart";
import 'package:photos/utils/magic_util.dart';
@@ -15,9 +16,31 @@ class FileCaptionReadyOnly extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return Text(
- caption,
- style: TextStyles.body.copyWith(color: context.componentColors.textLight),
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ return Padding(
+ padding: const EdgeInsets.all(4.0),
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(
+ minHeight: 32.0,
+ minWidth: double.infinity,
+ maxHeight: 200.0,
+ maxWidth: double.infinity,
+ ),
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ color: colorScheme.fillFaint,
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: SingleChildScrollView(
+ scrollDirection: Axis.vertical,
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
+ child: Text(caption, style: textTheme.small),
+ ),
+ ),
+ ),
+ ),
);
}
}
@@ -34,25 +57,33 @@ class FileCaptionWidget extends StatefulWidget {
class _FileCaptionWidgetState extends State<FileCaptionWidget> {
static const int maxLength = 5000;
+ // counterThreshold represents the nun of char after which
+ // currentLength/maxLength will show up
+ static const int counterThreshold = 1000;
+ int currentLength = 0;
+
final _textController = TextEditingController();
final _focusNode = FocusNode();
String? editedCaption;
late String defaultHintText = AppLocalizations.of(
context,
).fileInfoAddDescHint;
+ String hintText = '';
+ Widget? keyboardTopButtons;
@override
void initState() {
super.initState();
+ _focusNode.addListener(_focusNodeListener);
editedCaption = widget.file.caption;
if (editedCaption != null && editedCaption!.isNotEmpty) {
- _textController.text = editedCaption!;
+ hintText = editedCaption!;
}
}
@override
void dispose() {
- if (_hasPendingCaptionEdit) {
+ if (editedCaption != null) {
editFileCaption(
null,
widget.file,
@@ -60,64 +91,105 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
).then((isSuccess) => _onEditFileFinish(isSuccess));
}
_textController.dispose();
- _focusNode.dispose();
+ _focusNode.removeListener(_focusNodeListener);
super.dispose();
}
@override
Widget build(BuildContext context) {
- return Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Expanded(
- child: TextInputComponent(
- controller: _textController,
- focusNode: _focusNode,
- hintText: defaultHintText,
- maxLength: maxLength,
- minLines: 1,
- maxLines: 10,
- textCapitalization: TextCapitalization.sentences,
- keyboardType: TextInputType.multiline,
- onSubmit: (value) => _onDoneClick(context),
- onChanged: (value) {
- setState(() {
- editedCaption = value;
- });
- },
- ),
+ if (hintText.isEmpty) {
+ hintText = defaultHintText;
+ }
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ return TextField(
+ onSubmitted: (value) async {
+ await _onDoneClick(context);
+ },
+ controller: _textController,
+ focusNode: _focusNode,
+ decoration: InputDecoration(
+ counterStyle: textTheme.mini.copyWith(color: colorScheme.textMuted),
+ counterText: currentLength >= counterThreshold
+ ? currentLength.toString() + " / " + maxLength.toString()
+ : "",
+ contentPadding: const EdgeInsets.all(16),
+ border: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(2),
+ borderSide: const BorderSide(width: 0, style: BorderStyle.none),
),
- const SizedBox(width: Spacing.sm),
- IconButtonComponent(
- variant: IconButtonComponentVariant.green,
- tooltip: AppLocalizations.of(context).done,
- icon: const HugeIcon(icon: HugeIcons.strokeRoundedTick02),
- onTap: _hasPendingCaptionEdit ? onDoneTap : null,
+ focusedBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(2),
+ borderSide: const BorderSide(width: 0, style: BorderStyle.none),
),
- ],
+ filled: true,
+ fillColor: colorScheme.fillFaint,
+ hintText: hintText,
+ hintStyle: hintText == defaultHintText
+ ? textTheme.miniMuted
+ : textTheme.mini,
+ ),
+ style: textTheme.mini,
+ cursorWidth: 1.5,
+ maxLength: maxLength,
+ minLines: 1,
+ maxLines: 10,
+ textCapitalization: TextCapitalization.sentences,
+ keyboardType: TextInputType.multiline,
+ onChanged: (value) {
+ setState(() {
+ hintText = defaultHintText;
+ currentLength = value.length;
+ editedCaption = value;
+ });
+ },
);
}
Future<void> _onDoneClick(BuildContext context) async {
- if (_hasPendingCaptionEdit) {
+ if (editedCaption != null) {
final isSuccesful = await editFileCaption(
context,
widget.file,
editedCaption!,
).then((isSuccess) => _onEditFileFinish(isSuccess));
- if (isSuccesful && mounted) {
- setState(() {});
+ if (isSuccesful) {
+ if (mounted) {
+ if (!context.mounted) return;
+ Navigator.pop(context);
+ }
}
}
}
+ void onCancelTap() {
+ _textController.text = widget.file.caption ?? '';
+ _focusNode.unfocus();
+ editedCaption = null;
+ }
+
void onDoneTap() {
_focusNode.unfocus();
_onDoneClick(context);
}
- bool get _hasPendingCaptionEdit =>
- editedCaption != null && editedCaption != (widget.file.caption ?? '');
+ void _focusNodeListener() {
+ final caption = widget.file.caption;
+ if (_focusNode.hasFocus && caption != null) {
+ _textController.text = caption;
+ editedCaption = caption;
+ }
+ final bool hasFocus = _focusNode.hasFocus;
+ keyboardTopButtons ??= KeyboardTopButton(
+ onDoneTap: onDoneTap,
+ onCancelTap: onCancelTap,
+ );
+ if (hasFocus) {
+ KeyboardOverlay.showOverlay(context, keyboardTopButtons!);
+ } else {
+ KeyboardOverlay.removeOverlay();
+ }
+ }
bool _onEditFileFinish(bool isSuccess) {
if (!mounted) {
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
index 18725076c7..4791f234d8 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
@@ -2,7 +2,6 @@ import "dart:async";
import "dart:developer";
import "dart:io";
-import "package:ente_components/ente_components.dart";
import "package:exif_reader/exif_reader.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
@@ -23,9 +22,14 @@ import "package:photos/module/metadata/exif.dart";
import "package:photos/module/metadata/video.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/file_magic_service.dart";
+import 'package:photos/theme/ente_theme.dart';
+import 'package:photos/ui/components/buttons/icon_button_widget.dart';
+import "package:photos/ui/components/divider_widget.dart";
+import 'package:photos/ui/components/title_bar_widget.dart';
import 'package:photos/ui/viewer/file/file_caption_widget.dart';
import "package:photos/ui/viewer/file_details/added_by_widget.dart";
import "package:photos/ui/viewer/file_details/albums_item_widget.dart";
+import 'package:photos/ui/viewer/file_details/backed_up_time_item_widget.dart';
import "package:photos/ui/viewer/file_details/creation_time_item_widget.dart";
import 'package:photos/ui/viewer/file_details/exif_item_widgets.dart';
import "package:photos/ui/viewer/file_details/file_info_faces_item_widget.dart";
@@ -37,8 +41,9 @@ import "package:photos/ui/viewer/file_details/video_exif_item.dart";
class FileDetailsWidget extends StatefulWidget {
final EnteFile file;
+ final ScrollController? scrollController;
- const FileDetailsWidget(this.file, {super.key});
+ const FileDetailsWidget(this.file, {this.scrollController, super.key});
@override
State<FileDetailsWidget> createState() => _FileDetailsWidgetState();
@@ -147,135 +152,210 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
@override
Widget build(BuildContext context) {
final file = widget.file;
- final l10n = AppLocalizations.of(context);
final bool isFileOwner =
file.ownerID == null || file.ownerID == _currentUserID;
- final bool canEditCaption = isFileOwner && !file.isTrash;
- final bool showCaption =
- file.isUploaded &&
- !(!canEditCaption && (file.caption?.isEmpty ?? true));
- final bool hasPreview =
- file.uploadedFileID != null &&
- fileDataService.previewIds.containsKey(file.uploadedFileID);
-
- final sections = <Widget>[];
- sections.add(
- _sectionPadding(
+ //Make sure the bottom most tile is always the same one, that is it should
+ //not be rendered only if a condition is met.
+ final fileDetailsTiles = <Widget>[];
+ final bool canEditCaption = isFileOwner && !file.isTrash;
+ fileDetailsTiles.add(
+ !widget.file.isUploaded ||
+ (!canEditCaption && (widget.file.caption?.isEmpty ?? true))
+ ? const SizedBox(height: 16)
+ : Padding(
+ padding: const EdgeInsets.only(top: 8, bottom: 24),
+ child: canEditCaption
+ ? FileCaptionWidget(file: widget.file)
+ : FileCaptionReadyOnly(caption: widget.file.caption!),
+ ),
+ );
+ fileDetailsTiles.addAll([
+ CreationTimeItem(file, _currentUserID),
+ const FileDetailsDivider(),
+ ValueListenableBuilder(
+ valueListenable: _exifNotifier,
+ builder: (context, _, _) =>
+ FilePropertiesItemWidget(file, _isImage, _exifData, _currentUserID),
+ ),
+ const FileDetailsDivider(),
+ if (widget.file.uploadedFileID != null &&
+ (fileDataService.previewIds.containsKey(
+ widget.file.uploadedFileID,
+ ))) ...[
ValueListenableBuilder(
valueListenable: _exifNotifier,
- builder: (context, _, _) => Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- AddedByWidget(file),
- if (showCaption)
- Padding(
- padding: const EdgeInsets.only(bottom: Spacing.lg),
- child: canEditCaption
- ? FileCaptionWidget(file: file)
- : FileCaptionReadyOnly(caption: file.caption!),
- ),
- MenuGroupComponent(
- items: [
- FilePropertiesItemWidget(
- file,
- _isImage,
- _exifData,
- _currentUserID,
- ),
- CreationTimeItem(file, _currentUserID),
- if (showExifListTile) BasicExifItemWidget(_exifData),
- ],
- ),
- ],
+ builder: (context, _, _) => PreviewPropertiesItemWidget(
+ file,
+ _isImage,
+ _exifData,
+ _currentUserID,
),
),
+ const FileDetailsDivider(),
+ ],
+ ]);
+ fileDetailsTiles.add(
+ ValueListenableBuilder(
+ valueListenable: _exifNotifier,
+ builder: (context, value, _) {
+ return showExifListTile
+ ? Column(
+ children: [
+ BasicExifItemWidget(_exifData),
+ const FileDetailsDivider(),
+ ],
+ )
+ : const SizedBox.shrink();
+ },
),
);
- if (hasGrantedMLConsent) {
- sections.add(_sectionPadding(FacesItemWidget(file)));
- if (flagService.petEnabled && localSettings.petRecognitionEnabled) {
- sections.add(PetsItemWidget(file));
- }
- }
-
- sections.add(
- ValueListenableBuilder<bool>(
+ fileDetailsTiles.addAll([
+ ValueListenableBuilder(
valueListenable: hasLocationData,
- builder: (context, hasLocation, _) => hasLocation
- ? _sectionPadding(LocationTagsWidget(file))
- : const SizedBox.shrink(),
+ builder: (context, bool value, _) {
+ return value
+ ? Column(
+ children: [
+ LocationTagsWidget(widget.file),
+ const FileDetailsDivider(),
+ ],
+ )
+ : const SizedBox.shrink();
+
+ ///To be used when state issues are fixed when location is updated.
+ //
+ // file.fileType != FileType.video &&
+ // file.ownerID == _currentUserID
+ // ? Column(
+ // children: [
+ // InfoItemWidget(
+ // leadingIcon: Icons.pin_drop_outlined,
+ // title: "No location data",
+ // subtitleSection: Future.value(
+ // [
+ // Text(
+ // "Add location data",
+ // style: getEnteTextTheme(context).miniBoldMuted,
+ // ),
+ // ],
+ // ),
+ // hasChipButtons: false,
+ // onTap: () async {
+ // await showBarModalBottomSheet(
+ // shape: const RoundedRectangleBorder(
+ // borderRadius: BorderRadius.vertical(
+ // top: Radius.circular(5),
+ // ),
+ // ),
+ // backgroundColor: getEnteColorScheme(context)
+ // .backgroundElevated,
+ // barrierColor: backdropFaintDark,
+ // context: context,
+ // builder: (context) {
+ // return UpdateLocationDataWidget([file]);
+ // },
+ // );
+ // },
+ // ),
+ // const FileDetailsDivider(),
+ // ],
+ // )
+ // : const SizedBox.shrink();
+ },
),
- );
-
- if (!file.isTrash) {
- sections.add(_sectionPadding(AlbumsItemWidget(file, _currentUserID)));
- }
-
+ ]);
if (_isImage) {
- sections.add(
+ fileDetailsTiles.addAll([
ValueListenableBuilder(
valueListenable: _exifNotifier,
- builder: (context, _, _) => MenuGroupComponent(
- items: [
- if (hasPreview)
- PreviewPropertiesItemWidget(
- file,
- _isImage,
- _exifData,
- _currentUserID,
- ),
- AllExifItemWidget(file, _exifNotifier.value),
- ],
- ),
+ builder: (context, value, _) {
+ return Column(
+ children: [
+ AllExifItemWidget(file, _exifNotifier.value),
+ const FileDetailsDivider(),
+ ],
+ );
+ },
),
- );
- } else if (file.isVideo) {
- sections.add(
+ ]);
+ } else if (widget.file.isVideo) {
+ fileDetailsTiles.addAll([
ValueListenableBuilder(
valueListenable: _videoMetadataNotifier,
builder: (context, value, _) {
- final items = <Widget>[
- if (hasPreview)
- PreviewPropertiesItemWidget(
- file,
- _isImage,
- _exifData,
- _currentUserID,
- ),
- if (flagService.internalUser) VideoExifRowItem(file, value),
- ];
- if (items.isEmpty) {
- return const SizedBox.shrink();
- }
- return MenuGroupComponent(items: items);
+ return Column(
+ children: [
+ VideoExifRowItem(file, value),
+ const FileDetailsDivider(),
+ ],
+ );
},
),
- );
+ ]);
+ }
+
+ if (hasGrantedMLConsent) {
+ fileDetailsTiles.addAll([
+ FacesItemWidget(file),
+ const FileDetailsDivider(),
+ ]);
+ if (flagService.petEnabled && localSettings.petRecognitionEnabled) {
+ fileDetailsTiles.addAll([
+ PetsItemWidget(file),
+ const FileDetailsDivider(),
+ ]);
+ }
}
- return BottomSheetComponent(
- title: l10n.details,
- isKeyboardAware: true,
- isScrollable: true,
- snap: true,
- initialChildSize: 0.75,
- snapSizes: const [0.5, 0.75, 0.95],
- content: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: sections,
+ if (file.uploadedFileID != null && file.updationTime != null) {
+ fileDetailsTiles.addAll([
+ BackedUpTimeItemWidget(file),
+ const FileDetailsDivider(),
+ ]);
+ }
+ if (!file.isTrash) {
+ fileDetailsTiles.add(AlbumsItemWidget(file, _currentUserID));
+ }
+
+ return SafeArea(
+ top: false,
+ child: Scrollbar(
+ thickness: 4,
+ radius: const Radius.circular(2),
+ thumbVisibility: true,
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: CustomScrollView(
+ controller: widget.scrollController,
+ physics: const ClampingScrollPhysics(),
+ shrinkWrap: true,
+ slivers: <Widget>[
+ TitleBarWidget(
+ isFlexibleSpaceDisabled: true,
+ title: AppLocalizations.of(context).details,
+ isOnTopOfScreen: false,
+ backgroundColor: getEnteColorScheme(context).backgroundElevated,
+ leading: IconButtonWidget(
+ icon: Icons.expand_more_outlined,
+ iconButtonType: IconButtonType.primary,
+ onTap: () => Navigator.pop(context),
+ ),
+ ),
+ SliverToBoxAdapter(child: AddedByWidget(widget.file)),
+ SliverList(
+ delegate: SliverChildBuilderDelegate((context, index) {
+ return fileDetailsTiles[index];
+ }, childCount: fileDetailsTiles.length),
+ ),
+ ],
+ ),
+ ),
),
);
}
- Widget _sectionPadding(Widget child) => Padding(
- padding: const EdgeInsets.only(bottom: Spacing.xxl),
- child: child,
- );
-
//This code is for updating the location of files in which location data is
//missing and the EXIF has location data. This is only happens for a
//certain specific minority of devices.
@@ -402,3 +482,17 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
return null;
}
}
+
+class FileDetailsDivider extends StatelessWidget {
+ const FileDetailsDivider({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ const dividerPadding = EdgeInsets.symmetric(vertical: 9.5);
+ return const DividerWidget(
+ dividerType: DividerType.menu,
+ divColorHasBlur: false,
+ padding: dividerPadding,
+ );
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/albums_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/albums_item_widget.dart
index 7a2d610563..e1752039bf 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/albums_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/albums_item_widget.dart
@@ -1,83 +1,64 @@
-import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
import "package:logging/logging.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/db/files_db.dart";
import "package:photos/events/pause_video_event.dart";
import "package:photos/generated/l10n.dart";
+import 'package:photos/models/collection/collection.dart';
import 'package:photos/models/collection/collection_items.dart';
import 'package:photos/models/file/file.dart';
import "package:photos/models/selected_files.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/ui/collections/collection_action_sheet.dart";
+import "package:photos/ui/components/buttons/chip_button_widget.dart";
+import "package:photos/ui/components/info_item_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
-class AlbumsItemWidget extends StatefulWidget {
+class AlbumsItemWidget extends StatelessWidget {
final EnteFile file;
final int currentUserID;
const AlbumsItemWidget(this.file, this.currentUserID, {super.key});
- @override
- State<AlbumsItemWidget> createState() => _AlbumsItemWidgetState();
-}
-
-class _AlbumsItemWidgetState extends State<AlbumsItemWidget> {
- Future<List<Widget>>? _chipsFuture;
-
@override
Widget build(BuildContext context) {
- _chipsFuture ??= _buildChips(context);
- return Column(
- key: const ValueKey("Albums"),
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(AppLocalizations.of(context).albums, style: TextStyles.h2),
- const SizedBox(height: Spacing.lg),
- FutureBuilder<List<Widget>>(
- future: _chipsFuture,
- builder: (context, snapshot) {
- final chips = snapshot.data ?? const <Widget>[];
- return Wrap(
- spacing: Spacing.sm,
- runSpacing: Spacing.sm,
- children: chips,
- );
- },
- ),
- ],
+ final fileIsBackedup = file.uploadedFileID == null ? false : true;
+ late Future<Set<int>> allCollectionIDsOfFile;
+ //Typing this as Future<Set<T>> as it would be easier to implement showing multiple device folders for a file in the future
+ final Future<Set<String>> allDeviceFoldersOfFile = Future.sync(
+ () => {file.deviceFolder ?? ''},
);
- }
-
- Future<List<Widget>> _buildChips(BuildContext context) {
- final file = widget.file;
- if (file.uploadedFileID != null) {
- return _collectionsListOfFile(
- context,
- FilesDB.instance.getAllCollectionIDsOfFile(file.uploadedFileID!),
- widget.currentUserID,
+ if (fileIsBackedup) {
+ allCollectionIDsOfFile = FilesDB.instance.getAllCollectionIDsOfFile(
+ file.uploadedFileID!,
);
}
- return _deviceFoldersListOfFile(
- context,
- Future.sync(() => {file.deviceFolder ?? ''}),
+ return InfoItemWidget(
+ key: const ValueKey("Albums"),
+ leadingIcon: Icons.folder_outlined,
+ title: AppLocalizations.of(context).albums,
+ subtitleSection: fileIsBackedup
+ ? _collectionsListOfFile(
+ context,
+ allCollectionIDsOfFile,
+ currentUserID,
+ )
+ : _deviceFoldersListOfFile(allDeviceFoldersOfFile),
+ hasChipButtons: true,
);
}
- Future<List<Widget>> _deviceFoldersListOfFile(
- BuildContext context,
+ Future<List<ChipButtonWidget>> _deviceFoldersListOfFile(
Future<Set<String>> allDeviceFoldersOfFile,
) async {
try {
- final chips = <Widget>[];
+ final chipButtons = <ChipButtonWidget>[];
final List<String> deviceFolders = (await allDeviceFoldersOfFile)
.toList();
for (var deviceFolder in deviceFolders) {
- chips.add(FilterChipComponent(label: deviceFolder, onChanged: (_) {}));
+ chipButtons.add(ChipButtonWidget(deviceFolder));
}
- return chips;
+ return chipButtons;
} catch (e, s) {
Logger(
"AlbumsItemWidget",
@@ -86,51 +67,49 @@ class _AlbumsItemWidgetState extends State<AlbumsItemWidget> {
}
}
- Future<List<Widget>> _collectionsListOfFile(
+ Future<List<ChipButtonWidget>> _collectionsListOfFile(
BuildContext context,
Future<Set<int>> allCollectionIDsOfFile,
int currentUserID,
) async {
try {
- final colors = context.componentColors;
- final chips = <Widget>[];
+ final chipButtons = <ChipButtonWidget>[];
final Set<int> collectionIDs = await allCollectionIDsOfFile;
- if (!context.mounted) return const [];
+ final collections = <Collection>[];
for (var collectionID in collectionIDs) {
- final c = CollectionsService.instance.getCollectionByID(collectionID)!;
- chips.add(
- FilterChipComponent(
- label: c.isHidden()
- ? AppLocalizations.of(context).hidden
- : c.displayName,
- onChanged: (_) {
+ final c = CollectionsService.instance.getCollectionByID(collectionID);
+ collections.add(c!);
+ if (!context.mounted) return const [];
+ chipButtons.add(
+ ChipButtonWidget(
+ c.isHidden() ? AppLocalizations.of(context).hidden : c.displayName,
+ onTap: () {
if (c.isHidden()) {
return;
}
+ // stop playing video when navigating to collection page
Bus.instance.fire(PauseVideoEvent());
routeToPage(
context,
CollectionPage(
CollectionWithThumbnail(c, null),
- fileToJumpTo: widget.file,
+ fileToJumpTo: file,
),
);
},
),
);
}
- chips.add(
- IconButtonComponent(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedPlusSign,
- size: IconSizes.small,
- color: colors.textBase,
- ),
- variant: IconButtonComponentVariant.circular,
- shouldSurfaceExecutionStates: false,
+
+ // Add the '+' button if feature flag is enabled
+ chipButtons.add(
+ ChipButtonWidget(
+ null,
+ leadingIcon: Icons.add,
+ iconSize: 15,
onTap: () {
final selectedFiles = SelectedFiles();
- selectedFiles.files.add(widget.file);
+ selectedFiles.files.add(file);
showCollectionActionSheet(
context,
selectedFiles: selectedFiles,
@@ -139,7 +118,8 @@ class _AlbumsItemWidgetState extends State<AlbumsItemWidget> {
},
),
);
- return chips;
+
+ return chipButtons;
} catch (e, s) {
Logger(
"AlbumsItemWidget",
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/backed_up_time_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/backed_up_time_item_widget.dart
new file mode 100644
index 0000000000..dba3104806
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/backed_up_time_item_widget.dart
@@ -0,0 +1,33 @@
+import "package:ente_pure_utils/ente_pure_utils.dart";
+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/components/info_item_widget.dart";
+
+class BackedUpTimeItemWidget extends StatelessWidget {
+ final EnteFile file;
+ const BackedUpTimeItemWidget(this.file, {super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final dateTimeForUpdationTime = DateTime.fromMicrosecondsSinceEpoch(
+ file.updationTime!,
+ );
+ return InfoItemWidget(
+ key: const ValueKey("Backedup date"),
+ leadingIcon: Icons.backup_outlined,
+ title: DateFormat.yMMMEd(
+ Localizations.localeOf(context).languageCode,
+ ).format(dateTimeForUpdationTime),
+ subtitleSection: Future.value([
+ Text(
+ getTimeIn12hrFormat(dateTimeForUpdationTime) +
+ " " +
+ dateTimeForUpdationTime.timeZoneName,
+ style: getEnteTextTheme(context).miniMuted,
+ ),
+ ]),
+ );
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/creation_time_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/creation_time_item_widget.dart
index 94fd7aa711..2b155979e0 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/creation_time_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/creation_time_item_widget.dart
@@ -1,12 +1,12 @@
-import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
import "package:intl/intl.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/pause_video_event.dart";
import "package:photos/models/file/extensions/file_props.dart";
import 'package:photos/models/file/file.dart';
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/info_item_widget.dart";
import "package:photos/ui/viewer/date/edit_date_sheet.dart";
import "package:photos/ui/viewer/gallery/jump_to_date_gallery.dart";
@@ -22,40 +22,35 @@ class CreationTimeItem extends StatefulWidget {
class _CreationTimeItemState extends State<CreationTimeItem> {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
final dateTime = _dateTimeForDisplay(widget.file);
- final canEdit =
- (widget.file.ownerID == null ||
- widget.file.ownerID == widget.currentUserID) &&
- widget.file.uploadedFileID != null &&
- !widget.file.isTrash;
- return MenuComponent(
- key: const ValueKey("Creation time"),
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedCalendar04,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- title: DateFormat.yMMMEd(
- Localizations.localeOf(context).languageCode,
- ).format(dateTime),
- subtitle: getTimeIn12hrFormat(dateTime),
+ return GestureDetector(
+ behavior: HitTestBehavior.translucent,
onTap: () {
Bus.instance.fire(PauseVideoEvent());
routeToPage(context, JumpToDateGallery(fileToJumpTo: widget.file));
},
- trailing: canEdit
- ? IconButtonComponent(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedEdit03,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- variant: IconButtonComponentVariant.secondary,
- shouldSurfaceExecutionStates: false,
- onTap: () => _showDateTimePicker(widget.file),
- )
- : null,
+ child: InfoItemWidget(
+ key: const ValueKey("Creation time"),
+ leadingIcon: Icons.calendar_today_outlined,
+ title: DateFormat.yMMMEd(
+ Localizations.localeOf(context).languageCode,
+ ).format(dateTime),
+ subtitleSection: Future.value([
+ Text(
+ getTimeIn12hrFormat(dateTime),
+ style: getEnteTextTheme(context).miniMuted,
+ ),
+ ]),
+ editOnTap:
+ ((widget.file.ownerID == null ||
+ widget.file.ownerID == widget.currentUserID) &&
+ widget.file.uploadedFileID != null &&
+ !widget.file.isTrash)
+ ? () {
+ _showDateTimePicker(widget.file);
+ }
+ : null,
+ ),
);
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart b/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart
index 701da6d0f2..3cae984df4 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart
@@ -1,9 +1,11 @@
-import "package:ente_components/ente_components.dart";
import "package:exif_reader/exif_reader.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:photos/generated/l10n.dart";
import 'package:photos/models/file/file.dart';
+import "package:photos/theme/colors.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/info_item_widget.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/viewer/file/exif_info_dialog.dart";
@@ -13,67 +15,87 @@ class BasicExifItemWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
- final parts = <String>[];
- if (exifData["fNumber"] != null) {
- parts.add('Ζ’/${exifData["fNumber"]}');
- }
- if (exifData["exposureTime"] != null) {
- parts.add(exifData["exposureTime"].toString());
- }
- if (exifData["focalLength"] != null) {
- parts.add('${exifData["focalLength"]}mm');
- }
- if (exifData["ISO"] != null) {
- parts.add('ISO${exifData["ISO"]}');
- }
- return MenuComponent(
+ final subtitleTextTheme = getEnteTextTheme(context).miniMuted;
+ return InfoItemWidget(
key: const ValueKey("Basic EXIF"),
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedCamera01,
- size: IconSizes.small,
- color: colors.textLight,
- ),
+ leadingIconWidget: const HugeIcon(icon: HugeIcons.strokeRoundedLicense),
title: exifData["takenOnDevice"] ?? "--",
- subtitle: parts.isEmpty ? null : parts.join(" "),
+ subtitleSection: Future.value([
+ if (exifData["fNumber"] != null)
+ Text('Ζ’/' + exifData["fNumber"].toString(), style: subtitleTextTheme),
+ if (exifData["exposureTime"] != null)
+ Text(exifData["exposureTime"], style: subtitleTextTheme),
+ if (exifData["focalLength"] != null)
+ Text(
+ exifData["focalLength"].toString() + "mm",
+ style: subtitleTextTheme,
+ ),
+ if (exifData["ISO"] != null)
+ Text("ISO" + exifData["ISO"].toString(), style: subtitleTextTheme),
+ ]),
);
}
}
-class AllExifItemWidget extends StatelessWidget {
+class AllExifItemWidget extends StatefulWidget {
final EnteFile file;
final Map<String, IfdTag>? exif;
const AllExifItemWidget(this.file, this.exif, {super.key});
+ @override
+ State<AllExifItemWidget> createState() => _AllExifItemWidgetState();
+}
+
+class _AllExifItemWidgetState extends State<AllExifItemWidget> {
+ VoidCallback? _onTap;
+
+ @override
+ void initState() {
+ super.initState();
+ }
+
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
- final l10n = AppLocalizations.of(context);
- final String subtitle;
- final VoidCallback? onTap;
+ return InfoItemWidget(
+ leadingIconWidget: const HugeIcon(icon: HugeIcons.strokeRoundedLicense),
+ title: AppLocalizations.of(context).exif,
+ subtitleSection: _exifButton(context, widget.file, widget.exif),
+ onTap: _onTap,
+ );
+ }
+
+ Future<List<Widget>> _exifButton(
+ BuildContext context,
+ EnteFile file,
+ Map<String, IfdTag>? exif,
+ ) async {
+ late final String label;
+ late final VoidCallback? onTap;
if (exif == null) {
- subtitle = l10n.loadingExifData;
+ label = AppLocalizations.of(context).loadingExifData;
onTap = null;
- } else if (exif!.isNotEmpty) {
- subtitle = l10n.viewAllExifData;
- onTap = () => showBottomSheetComponent(
+ } else if (exif.isNotEmpty) {
+ label = AppLocalizations.of(context).viewAllExifData;
+ onTap = () => showDialog(
+ useRootNavigator: false,
context: context,
- builder: (context) => ExifInfoDialog(file),
+ builder: (BuildContext context) {
+ return ExifInfoDialog(file);
+ },
+ barrierColor: backdropFaintDark,
);
} else {
- subtitle = l10n.noExifData;
- onTap = () => showShortToast(context, l10n.thisImageHasNoExifData);
+ label = AppLocalizations.of(context).noExifData;
+ onTap = () => showShortToast(
+ context,
+ AppLocalizations.of(context).thisImageHasNoExifData,
+ );
}
- return MenuComponent(
- key: const ValueKey("All EXIF"),
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedCameraLens,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- title: l10n.exif,
- subtitle: subtitle,
- onTap: onTap,
- );
+ setState(() {
+ _onTap = onTap;
+ });
+ return Future.value([
+ Text(label, style: getEnteTextTheme(context).miniBoldMuted),
+ ]);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_face_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_face_widget.dart
index e3c47d3b0a..dd5736d46c 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_face_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_face_widget.dart
@@ -1,7 +1,6 @@
import "dart:async";
import "dart:typed_data";
-import "package:ente_components/ente_components.dart";
import "package:flutter/foundation.dart" show kDebugMode;
import "package:flutter/material.dart";
import "package:logging/logging.dart";
@@ -23,6 +22,7 @@ import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/viewer/people/cluster_page.dart";
+import "package:photos/ui/viewer/people/face_thumbnail_squircle.dart";
import "package:photos/ui/viewer/people/file_face_widget.dart";
import "package:photos/ui/viewer/people/people_page.dart";
import "package:photos/ui/viewer/people/save_or_edit_person.dart";
@@ -93,19 +93,20 @@ class _FileInfoFaceWidgetState extends State<FileInfoFaceWidget> {
child: Container(
height: thumbnailWidth,
width: thumbnailWidth,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(Radii.button),
- border: widget.highlight || widget.isSelected
- ? Border.all(
- color: widget.isSelected
- ? getEnteColorScheme(context).primary500
- : getEnteColorScheme(context).primary700,
- width: 1.0,
- )
- : null,
+ decoration: ShapeDecoration(
+ shape: faceThumbnailSquircleBorder(
+ side: thumbnailWidth,
+ borderSide: widget.highlight || widget.isSelected
+ ? BorderSide(
+ color: widget.isSelected
+ ? getEnteColorScheme(context).primary500
+ : getEnteColorScheme(context).primary700,
+ width: 1.0,
+ )
+ : BorderSide.none,
+ ),
),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(Radii.button),
+ child: FaceThumbnailSquircleClip(
child: Stack(
fit: StackFit.expand,
children: [
@@ -163,7 +164,7 @@ class _FileInfoFaceWidgetState extends State<FileInfoFaceWidget> {
widget.person!.data.isIgnored
? '(' + AppLocalizations.of(context).ignored + ')'
: widget.person!.data.name.trim(),
- style: TextStyles.body,
+ style: Theme.of(context).textTheme.bodySmall,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_faces_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_faces_item_widget.dart
index 875296d6bd..37fa652959 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_faces_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_faces_item_widget.dart
@@ -1,9 +1,8 @@
import "dart:async";
import "dart:typed_data";
-import "package:ente_components/ente_components.dart";
+import "package:dotted_border/dotted_border.dart";
import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
import "package:logging/logging.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/db/ml/db.dart";
@@ -23,9 +22,12 @@ import "package:photos/services/machine_learning/face_ml/person/person_service.d
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/common/loading_widget.dart";
import "package:photos/ui/components/buttons/button_widget.dart";
+import "package:photos/ui/components/buttons/chip_button_widget.dart";
+import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/viewer/file_details/file_info_face_widget.dart";
import "package:photos/ui/viewer/people/add_files_to_person_page.dart";
+import "package:photos/ui/viewer/people/face_thumbnail_squircle.dart";
import "package:photos/ui/viewer/people/people_page.dart";
import "package:photos/ui/viewer/people/person_face_widget.dart";
import "package:photos/utils/dialog_util.dart";
@@ -43,8 +45,7 @@ class FacesItemWidget extends StatefulWidget {
}
class _FacesItemWidgetState extends State<FacesItemWidget> {
- static const double _kHeaderActionHeight = 36;
- static const double _kFaceThumbnailSize = 60;
+ static const double _kHeaderActionHeight = 48;
bool _isEditMode = false;
bool _showRemainingFaces = false;
bool _isLoading = true;
@@ -111,18 +112,30 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
@override
Widget build(BuildContext context) {
- return _buildContent();
+ return Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const IconButtonWidget(
+ icon: Icons.face_retouching_natural_outlined,
+ iconButtonType: IconButtonType.secondary,
+ ),
+ const SizedBox(width: 12),
+ _buildContent(),
+ ],
+ );
}
Widget _buildContent() {
if (_isLoading) {
- return const Padding(
- padding: EdgeInsets.only(top: 8),
- child: Center(
- child: EnteLoadingWidget(
- padding: 6,
- size: 20,
- alignment: Alignment.center,
+ return const Expanded(
+ child: Padding(
+ padding: EdgeInsets.only(top: 8, right: 12),
+ child: Center(
+ child: EnteLoadingWidget(
+ padding: 6,
+ size: 20,
+ alignment: Alignment.center,
+ ),
),
),
);
@@ -134,27 +147,32 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
return _buildNoFacesWidget();
}
- const double thumbnailWidth = _kFaceThumbnailSize;
+ final screenWidth = MediaQuery.of(context).size.width;
+ final thumbnailWidth = screenWidth * 0.16;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(AppLocalizations.of(context).people, style: TextStyles.h2),
- _editStateButton(),
+ return Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Text(
+ AppLocalizations.of(context).people,
+ style: getEnteTextTheme(context).small,
+ ),
+ _editStateButton(),
+ ],
+ ),
+ const SizedBox(height: 10),
+ _buildPeopleGrid(thumbnailWidth),
+ if (_remainingFaces.isNotEmpty) ...[
+ const SizedBox(height: 16),
+ _buildRemainingFacesSection(thumbnailWidth),
],
- ),
- const SizedBox(height: Spacing.lg),
- _buildPeopleGrid(thumbnailWidth),
- if (_remainingFaces.isNotEmpty) ...[
- const SizedBox(height: Spacing.lg),
- _buildRemainingFacesSection(thumbnailWidth),
],
- ],
+ ),
);
}
@@ -199,7 +217,7 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
if (!isLocalGalleryMode &&
flagService.manualTagFileToPerson &&
widget.file.uploadedFileID != null) {
- children.add(_buildAddFaceThumbnail(onTap: _openAddFilesToPersonPage));
+ children.add(_buildAddPersonButton(thumbnailWidth));
}
return Padding(
@@ -208,6 +226,35 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
);
}
+ Widget _buildAddPersonButton(double thumbnailWidth) {
+ final colorScheme = getEnteColorScheme(context);
+ const strokeWidth = 1.0;
+ final innerSize = thumbnailWidth - strokeWidth * 2;
+ return GestureDetector(
+ onTap: _openAddFilesToPersonPage,
+ child: DottedBorder(
+ options: CustomPathDottedBorderOptions(
+ customPath: faceThumbnailSquircleOuterPath,
+ color: colorScheme.strokeMuted,
+ strokeWidth: strokeWidth,
+ dashPattern: const [4, 4],
+ padding: EdgeInsets.zero,
+ ),
+ child: SizedBox(
+ height: innerSize,
+ width: innerSize,
+ child: Center(
+ child: Icon(
+ Icons.person_add_alt_1_outlined,
+ color: colorScheme.strokeMuted,
+ size: 24,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
Future<List<_FaceInfo>> _buildFaceInfoList(
List<Face> faces,
Map<String, String?> faceIdsToClusterIds,
@@ -303,43 +350,16 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
!isLocalGalleryMode &&
flagService.manualTagFileToPerson &&
reason == NoFacesReason.noFacesFound;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(AppLocalizations.of(context).people, style: TextStyles.h2),
- const SizedBox(height: Spacing.lg),
- if (showManualTagOption)
- _buildAddFaceThumbnail(onTap: _openAddFilesToPersonPage)
- else
- Text(
- getNoFaceReasonText(context, reason),
- style: TextStyles.body.copyWith(
- color: context.componentColors.textLighter,
- ),
- ),
- ],
- );
- }
-
- Widget _buildAddFaceThumbnail({VoidCallback? onTap}) {
- final colors = context.componentColors;
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: Container(
- width: _kFaceThumbnailSize,
- height: _kFaceThumbnailSize,
- decoration: BoxDecoration(
- color: colors.fillLight,
- borderRadius: BorderRadius.circular(Radii.button),
- ),
- child: Center(
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedUserAdd01,
- size: IconSizes.medium,
- color: colors.textLight,
- ),
+ final label = showManualTagOption
+ ? AppLocalizations.of(context).noFacesDetectedTapToAdd
+ : getNoFaceReasonText(context, reason);
+ return Expanded(
+ child: Padding(
+ padding: const EdgeInsets.only(right: 12, top: 8),
+ child: ChipButtonWidget(
+ label,
+ noChips: true,
+ onTap: showManualTagOption ? _openAddFilesToPersonPage : null,
),
),
);
@@ -387,7 +407,7 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
children: [
Text(
AppLocalizations.of(context).otherDetectedFaces,
- style: TextStyles.bodyBold,
+ style: getEnteTextTheme(context).miniMuted,
),
const Spacer(),
Padding(
@@ -416,49 +436,56 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
if (isLocalGalleryMode) {
return const SizedBox.shrink();
}
- final Widget action;
if (_isEditMode) {
final hasSelection = _selectedFaceInfos().isNotEmpty;
- action = Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- if (hasSelection) ...[
- IconButtonComponent(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedUserBlock01,
- size: IconSizes.small,
- color: context.componentColors.textLight,
+ return Padding(
+ padding: const EdgeInsets.only(right: 12.0),
+ child: SizedBox(
+ height: _kHeaderActionHeight,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (hasSelection)
+ IconButtonWidget(
+ icon: Icons.person_off_outlined,
+ iconButtonType: IconButtonType.secondary,
+ onTap: _onIgnoreSelectedFaces,
+ ),
+ if (hasSelection) const SizedBox(width: 8),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: _toggleEditMode,
+ child: Center(
+ child: Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 8,
+ vertical: 4,
+ ),
+ decoration: BoxDecoration(
+ border: Border.all(
+ color: getEnteColorScheme(context).primary500,
+ width: 1,
+ ),
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Text(
+ AppLocalizations.of(context).done,
+ style: getEnteTextTheme(context).small.copyWith(
+ color: getEnteColorScheme(context).primary500,
+ ),
+ ),
+ ),
+ ),
),
- variant: IconButtonComponentVariant.secondary,
- shouldSurfaceExecutionStates: false,
- onTap: _onIgnoreSelectedFaces,
- ),
- const SizedBox(width: 8),
- ],
- ButtonComponent(
- label: AppLocalizations.of(context).done,
- variant: ButtonComponentVariant.link,
- size: ButtonComponentSize.small,
- shouldSurfaceExecutionStates: false,
- onTap: _toggleEditMode,
+ ],
),
- ],
- );
- } else {
- action = IconButtonComponent(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedEdit03,
- size: IconSizes.small,
- color: context.componentColors.textLight,
),
- variant: IconButtonComponentVariant.secondary,
- shouldSurfaceExecutionStates: false,
- onTap: _toggleEditMode,
);
}
- return SizedBox(
- height: _kHeaderActionHeight,
- child: Align(alignment: Alignment.centerRight, child: action),
+ return IconButtonWidget(
+ icon: Icons.edit,
+ iconButtonType: IconButtonType.secondary,
+ onTap: _toggleEditMode,
);
}
@@ -881,11 +908,10 @@ class _ManualPersonTag extends StatelessWidget {
Container(
height: thumbnailWidth,
width: thumbnailWidth,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(Radii.button),
+ decoration: ShapeDecoration(
+ shape: faceThumbnailSquircleBorder(side: thumbnailWidth),
),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(Radii.button),
+ child: FaceThumbnailSquircleClip(
child: PersonFaceWidget(
personId: person.remoteID,
keepAlive: true,
@@ -922,7 +948,7 @@ class _ManualPersonTag extends StatelessWidget {
child: Center(
child: Text(
displayName,
- style: TextStyles.body,
+ style: Theme.of(context).textTheme.bodySmall,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_pets_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_pets_item_widget.dart
index 79aa3472a3..981cfa7435 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_pets_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_pets_item_widget.dart
@@ -1,7 +1,6 @@
import "dart:convert";
import "dart:typed_data";
-import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
import "package:logging/logging.dart";
import "package:photos/db/ml/db.dart";
@@ -12,7 +11,10 @@ import "package:photos/models/ml/face/box.dart";
import "package:photos/models/ml/face/detection.dart";
import "package:photos/models/ml/face/face.dart";
import "package:photos/service_locator.dart" show isLocalGalleryMode;
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/theme/text_style.dart";
import "package:photos/ui/common/loading_widget.dart";
+import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/viewer/people/face_thumbnail_squircle.dart";
import "package:photos/ui/viewer/people/file_face_widget.dart";
import "package:photos/utils/face/face_thumbnail_cache.dart";
@@ -138,21 +140,31 @@ class _PetsItemWidgetState extends State<PetsItemWidget> {
if (!_isLoading && _petFaces.isEmpty) {
return const SizedBox.shrink();
}
- return Padding(
- padding: const EdgeInsets.only(bottom: Spacing.xxl),
- child: _buildContent(context),
+
+ return Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const IconButtonWidget(
+ icon: Icons.pets,
+ iconButtonType: IconButtonType.secondary,
+ ),
+ const SizedBox(width: 12),
+ _buildContent(context),
+ ],
);
}
Widget _buildContent(BuildContext context) {
if (_isLoading) {
- return const Padding(
- padding: EdgeInsets.only(top: 8),
- child: Center(
- child: EnteLoadingWidget(
- padding: 6,
- size: 20,
- alignment: Alignment.center,
+ return const Expanded(
+ child: Padding(
+ padding: EdgeInsets.only(top: 8, right: 12),
+ child: Center(
+ child: EnteLoadingWidget(
+ padding: 6,
+ size: 20,
+ alignment: Alignment.center,
+ ),
),
),
);
@@ -160,25 +172,40 @@ class _PetsItemWidgetState extends State<PetsItemWidget> {
final screenWidth = MediaQuery.of(context).size.width;
final thumbnailWidth = screenWidth * 0.16;
+ final textTheme = getEnteTextTheme(context);
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(AppLocalizations.of(context).discover_pets, style: TextStyles.h2),
- const SizedBox(height: Spacing.lg),
- Wrap(
- runSpacing: 8,
- spacing: 12,
- children: _petFaces
- .map((info) => _buildPetThumbnail(info, thumbnailWidth))
- .toList(),
- ),
- ],
+ return Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ AppLocalizations.of(context).discover_pets,
+ style: textTheme.small,
+ ),
+ const SizedBox(height: 10),
+ Padding(
+ padding: const EdgeInsets.only(right: 12.0),
+ child: Wrap(
+ runSpacing: 8,
+ spacing: 12,
+ children: _petFaces
+ .map(
+ (info) =>
+ _buildPetThumbnail(info, thumbnailWidth, textTheme),
+ )
+ .toList(),
+ ),
+ ),
+ ],
+ ),
);
}
- Widget _buildPetThumbnail(_PetFaceInfo info, double thumbnailWidth) {
+ Widget _buildPetThumbnail(
+ _PetFaceInfo info,
+ double thumbnailWidth,
+ EnteTextTheme textTheme,
+ ) {
final l10n = AppLocalizations.of(context);
final speciesLabel = info.species == 0 ? l10n.dog : l10n.cat;
@@ -196,7 +223,7 @@ class _PetsItemWidgetState extends State<PetsItemWidget> {
const SizedBox(height: 4),
Text(
speciesLabel,
- style: TextStyles.mini,
+ style: textTheme.mini,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dart
index a64cd543b5..14e785d002 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dart
@@ -1,4 +1,3 @@
-import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
@@ -7,6 +6,8 @@ import "package:photos/models/file/extensions/file_props.dart";
import 'package:photos/models/file/file.dart';
import 'package:photos/models/file/file_type.dart';
import "package:photos/module/download/file.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/info_item_widget.dart";
import "package:photos/utils/image_util.dart";
import "package:photos/utils/magic_util.dart";
@@ -30,50 +31,31 @@ class FilePropertiesItemWidget extends StatefulWidget {
class _FilePropertiesItemWidgetState extends State<FilePropertiesItemWidget> {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
- final canEdit =
- !(widget.file.uploadedFileID == null ||
- widget.file.ownerID != widget.currentUserID ||
- widget.file.isTrash);
- final title =
- path.basenameWithoutExtension(widget.file.displayName) +
- path.extension(widget.file.displayName).toUpperCase();
- return FutureBuilder<String>(
- future: _subtitle(),
- builder: (context, snapshot) {
- return MenuComponent(
- key: const ValueKey("File properties"),
- leading: HugeIcon(
- icon: widget.isImage
- ? HugeIcons.strokeRoundedImage01
- : HugeIcons.strokeRoundedVideo02,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- title: title,
- subtitle: snapshot.data,
- trailing: canEdit
- ? IconButtonComponent(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedEdit03,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- variant: IconButtonComponentVariant.secondary,
- shouldSurfaceExecutionStates: false,
- onTap: () async {
- await editFilename(context, widget.file);
- setState(() {});
- },
- )
- : null,
- );
- },
+ return InfoItemWidget(
+ key: const ValueKey("File properties"),
+ leadingIconWidget: HugeIcon(
+ icon: widget.isImage
+ ? HugeIcons.strokeRoundedImage01
+ : HugeIcons.strokeRoundedVideo02,
+ ),
+ title:
+ path.basenameWithoutExtension(widget.file.displayName) +
+ path.extension(widget.file.displayName).toUpperCase(),
+ subtitleSection: _subTitleSection(),
+ editOnTap:
+ widget.file.uploadedFileID == null ||
+ widget.file.ownerID != widget.currentUserID ||
+ widget.file.isTrash
+ ? null
+ : () async {
+ await editFilename(context, widget.file);
+ setState(() {});
+ },
);
}
- Future<String> _subtitle() async {
- final parts = <String>[];
+ Future<List<Widget>> _subTitleSection() async {
+ final textStyle = getEnteTextTheme(context).miniMuted;
final StringBuffer dimString = StringBuffer();
int? width;
int? height;
@@ -106,9 +88,10 @@ class _FilePropertiesItemWidgetState extends State<FilePropertiesItemWidget> {
dimString.write('${widget.exifData["megaPixels"]}MP ');
dimString.write('${widget.exifData["resolution"]}');
}
+ final subSectionWidgets = <Widget>[];
if (dimString.isNotEmpty) {
- parts.add(dimString.toString());
+ subSectionWidgets.add(Text(dimString.toString(), style: textStyle));
}
int fileSize;
@@ -117,21 +100,25 @@ class _FilePropertiesItemWidgetState extends State<FilePropertiesItemWidget> {
} else {
fileSize = await getFile(widget.file).then((f) => f!.length());
}
- parts.add(formatBytes(fileSize));
+ subSectionWidgets.add(Text(formatBytes(fileSize), style: textStyle));
if ((widget.file.fileType == FileType.video) &&
(widget.file.localID != null || widget.file.duration != 0)) {
if (widget.file.duration != 0) {
- parts.add(secondsToHHMMSS(widget.file.duration!));
+ subSectionWidgets.add(
+ Text(secondsToHHMMSS(widget.file.duration!), style: textStyle),
+ );
} else {
final asset = await widget.file.getAsset;
- final duration = asset?.videoDuration.toString().split(".")[0] ?? "";
- if (duration.isNotEmpty) {
- parts.add(duration);
- }
+ subSectionWidgets.add(
+ Text(
+ asset?.videoDuration.toString().split(".")[0] ?? "",
+ style: textStyle,
+ ),
+ );
}
}
- return parts.join(" ");
+ return Future.value(subSectionWidgets);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart
index fa1c2e4693..1314ddac96 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart
@@ -1,7 +1,6 @@
import "dart:async";
import "dart:ui";
-import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
import "package:flutter_animate/flutter_animate.dart";
@@ -16,6 +15,8 @@ import "package:photos/service_locator.dart";
import "package:photos/services/search_service.dart";
import "package:photos/states/location_screen_state.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/buttons/chip_button_widget.dart";
+import "package:photos/ui/components/info_item_widget.dart";
import "package:photos/ui/map/image_marker.dart";
import "package:photos/ui/map/map_screen.dart";
import "package:photos/ui/map/map_view.dart";
@@ -34,19 +35,24 @@ class LocationTagsWidget extends StatefulWidget {
}
class _LocationTagsWidgetState extends State<LocationTagsWidget> {
+ String? title;
late Future<List<Widget>> locationTagChips;
late StreamSubscription<LocationTagUpdatedEvent> _locTagUpdateListener;
+ VoidCallback? onTap;
+ bool _loadedLocationTags = false;
@override
void initState() {
- locationTagChips = _getLocationTags();
+ locationTagChips = _getLocationTags().then((value) {
+ _loadedLocationTags = true;
+ return value;
+ });
_locTagUpdateListener = Bus.instance.on<LocationTagUpdatedEvent>().listen((
event,
) {
- setState(() {
- locationTagChips = _getLocationTags();
- });
+ locationTagChips = _getLocationTags();
});
+
super.initState();
}
@@ -58,60 +64,97 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(AppLocalizations.of(context).location, style: TextStyles.h2),
- const SizedBox(height: Spacing.lg),
- FutureBuilder<List<Widget>>(
- future: locationTagChips,
- builder: (context, snapshot) {
- final placeChips = snapshot.data ?? const <Widget>[];
- return Wrap(
- spacing: Spacing.sm,
- runSpacing: Spacing.sm,
- children: [
- ...placeChips,
- IconButtonComponent(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedPlusSign,
- size: IconSizes.small,
- color: colors.textBase,
- ),
- variant: IconButtonComponentVariant.circular,
- shouldSurfaceExecutionStates: false,
- onTap: () =>
- showAddLocationSheet(context, widget.file.location!),
- ),
- ],
- );
- },
+ return AnimatedSwitcher(
+ duration: const Duration(milliseconds: 500),
+ switchInCurve: Curves.easeInOutExpo,
+ switchOutCurve: Curves.easeInOutExpo,
+ child: InfoItemWidget(
+ key: ValueKey(title),
+ leadingIconWidget: const HugeIcon(
+ icon: HugeIcons.strokeRoundedLocation01,
),
- InfoMap(widget.file),
- ],
+ title: title,
+ subtitleSection: locationTagChips,
+ onTap: onTap,
+ endSection: _loadedLocationTags
+ ? InfoMap(widget.file)
+ : const SizedBox.shrink(),
+
+ /// to be used when state issues are fixed when location is updated
+ // editOnTap: widget.file.ownerID == Configuration.instance.getUserID()!
+ // ? () {
+ // showBarModalBottomSheet(
+ // shape: const RoundedRectangleBorder(
+ // borderRadius: BorderRadius.vertical(
+ // top: Radius.circular(5),
+ // ),
+ // ),
+ // backgroundColor:
+ // getEnteColorScheme(context).backgroundElevated,
+ // barrierColor: backdropFaintDark,
+ // context: context,
+ // builder: (context) {
+ // return UpdateLocationDataWidget([widget.file]);
+ // },
+ // );
+ // }
+ // : null,
+ ),
);
}
Future<List<Widget>> _getLocationTags() async {
+ // await Future.delayed(const Duration(seconds: 1));
final locationTags = await locationService.enclosingLocationTags(
widget.file.location!,
);
- return locationTags
- .map(
- (locationTagEntity) => FilterChipComponent(
- label: locationTagEntity.item.name,
- onChanged: (_) => routeToPage(
- context,
- LocationScreenStateProvider(
- locationTagEntity,
- const LocationScreen(),
- ),
+ if (locationTags.isEmpty) {
+ if (mounted) {
+ setState(() {
+ title = AppLocalizations.of(context).location;
+ onTap = null;
+ });
+ }
+ if (!mounted) return const [];
+ return [
+ ChipButtonWidget(
+ AppLocalizations.of(context).addLocation,
+ onTap: () => showAddLocationSheet(context, widget.file.location!),
+ ),
+ ];
+ } else {
+ if (mounted) {
+ setState(() {
+ title = AppLocalizations.of(context).location;
+ onTap = null;
+ });
+ }
+ final result = locationTags
+ .map(
+ (locationTagEntity) => ChipButtonWidget(
+ locationTagEntity.item.name,
+ onTap: () {
+ routeToPage(
+ context,
+ LocationScreenStateProvider(
+ locationTagEntity,
+ const LocationScreen(),
+ ),
+ );
+ },
),
- ),
- )
- .toList();
+ )
+ .toList();
+ result.add(
+ ChipButtonWidget(
+ null,
+ leadingIcon: Icons.add,
+ iconSize: 15,
+ onTap: () => showAddLocationSheet(context, widget.file.location!),
+ ),
+ );
+ return result;
+ }
}
}
@@ -158,7 +201,7 @@ class _InfoMapState extends State<InfoMap> {
padding: const EdgeInsets.only(top: 8),
child: ClipRRect(
clipBehavior: Clip.antiAliasWithSaveLayer,
- borderRadius: const BorderRadius.all(Radius.circular(Radii.button)),
+ borderRadius: const BorderRadius.all(Radius.circular(8)),
child: SizedBox(
height: 124,
child: _hasEnabledMap
@@ -194,7 +237,7 @@ class _InfoMapState extends State<InfoMap> {
IgnorePointer(
child: Container(
decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(Radii.button),
+ borderRadius: BorderRadius.circular(8),
border: Border.all(
color: getEnteColorScheme(context).strokeFaint,
),
@@ -240,9 +283,7 @@ class _InfoMapState extends State<InfoMap> {
),
Container(
decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(
- Radii.button,
- ),
+ borderRadius: BorderRadius.circular(8),
border: Border.all(
color: getEnteColorScheme(
context,
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart
index 4a2ded9c35..0a5e105648 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart
@@ -1,12 +1,12 @@
-import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/ffmpeg/ffprobe_props.dart";
import 'package:photos/models/file/file.dart';
import "package:photos/models/file/file_type.dart";
import "package:photos/services/video_preview_service.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/info_item_widget.dart";
class PreviewPropertiesItemWidget extends StatefulWidget {
final EnteFile file;
@@ -27,7 +27,7 @@ class PreviewPropertiesItemWidget extends StatefulWidget {
class _PreviewPropertiesItemWidgetState
extends State<PreviewPropertiesItemWidget> {
- String? _subtitle;
+ Widget? child;
@override
void initState() {
@@ -37,57 +37,54 @@ class _PreviewPropertiesItemWidgetState
@override
Widget build(BuildContext context) {
- if (_subtitle == null) return const SizedBox();
- final colors = context.componentColors;
- return MenuComponent(
- key: const ValueKey("Stream properties"),
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedPlay,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- title: AppLocalizations.of(context).streamDetails,
- subtitle: _subtitle,
- );
+ return child ?? const SizedBox();
}
Future<void> _getSection() async {
if (!mounted) return;
-
- final parts = <String>[];
+ final textStyle = getEnteTextTheme(context).miniMuted;
+ final subSectionWidgets = <Widget>[];
final data = await VideoPreviewService.instance
.getPlaylist(widget.file)
.onError((error, stackTrace) {
+ if (!mounted) return;
return null;
});
- if (data == null) return;
- if (!mounted) return;
+ if (!mounted || data == null) return;
if (data.width != null && data.height != null) {
- parts.add("${data.width!}x${data.height!}");
+ subSectionWidgets.add(
+ Text("${data.width}x${data.height}", style: textStyle),
+ );
}
if (data.size != null) {
- parts.add(formatBytes(data.size!));
+ subSectionWidgets.add(Text(formatBytes(data.size!), style: textStyle));
}
if ((widget.file.fileType == FileType.video) &&
(widget.file.localID != null || widget.file.duration != 0) &&
data.size != null) {
+ // show bitrate, i.e. size * 8 / duration formatted
final result = FFProbeProps.formatBitrate(
data.size! * 8 / widget.file.duration!,
"b/s",
);
if (result != null) {
- parts.add(result);
+ subSectionWidgets.add(Text(result, style: textStyle));
}
}
- if (parts.isEmpty) return;
+ if (subSectionWidgets.isEmpty) return;
- _subtitle = parts.join(" ");
+ child = InfoItemWidget(
+ key: const ValueKey("Stream properties"),
+ leadingIcon: Icons.play_circle_outline,
+ title: AppLocalizations.of(context).streamDetails,
+ subtitleSection: Future.value(subSectionWidgets),
+ );
if (mounted) {
setState(() {});
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/video_exif_item.dart b/mobile/apps/photos/lib/ui/viewer/file_details/video_exif_item.dart
index 6491f43759..58f1b7334b 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/video_exif_item.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/video_exif_item.dart
@@ -1,4 +1,3 @@
-import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:modal_bottom_sheet/modal_bottom_sheet.dart";
@@ -7,26 +6,49 @@ import "package:photos/models/ffmpeg/ffprobe_props.dart";
import 'package:photos/models/file/file.dart';
import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/info_item_widget.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/viewer/file/video_exif_dialog.dart";
-class VideoExifRowItem extends StatelessWidget {
+class VideoExifRowItem extends StatefulWidget {
final EnteFile file;
final FFProbeProps? props;
const VideoExifRowItem(this.file, this.props, {super.key});
+ @override
+ State<VideoExifRowItem> createState() => _VideoProbeInfoState();
+}
+
+class _VideoProbeInfoState extends State<VideoExifRowItem> {
+ VoidCallback? _onTap;
+
+ @override
+ void initState() {
+ super.initState();
+ }
+
@override
Widget build(BuildContext context) {
- final colors = context.componentColors;
- final l10n = AppLocalizations.of(context);
- final props = this.props;
- final String? subtitle;
- final VoidCallback? onTap;
- if (props == null || props.propData == null) {
- subtitle = l10n.loadingExifData;
+ return InfoItemWidget(
+ leadingIconWidget: const HugeIcon(icon: HugeIcons.strokeRoundedLicense),
+ title: AppLocalizations.of(context).videoInfo,
+ subtitleSection: _exifButton(context, widget.file, widget.props),
+ onTap: _onTap,
+ );
+ }
+
+ Future<List<Widget>> _exifButton(
+ BuildContext context,
+ EnteFile file,
+ FFProbeProps? props,
+ ) async {
+ late final String label;
+ late final VoidCallback? onTap;
+ if (props?.propData == null) {
+ label = AppLocalizations.of(context).loadingExifData;
onTap = null;
- } else if (props.propData!.isNotEmpty) {
- subtitle = props.bitrate;
+ } else if (props!.propData!.isNotEmpty) {
+ label = "${widget.props?.videoInfo ?? ''} ..";
onTap = () => showBarModalBottomSheet(
context: context,
builder: (BuildContext context) {
@@ -42,19 +64,17 @@ class VideoExifRowItem extends StatelessWidget {
enableDrag: true,
);
} else {
- subtitle = l10n.noExifData;
- onTap = () => showShortToast(context, l10n.thisImageHasNoExifData);
+ label = AppLocalizations.of(context).noExifData;
+ onTap = () => showShortToast(
+ context,
+ AppLocalizations.of(context).thisImageHasNoExifData,
+ );
}
- return MenuComponent(
- key: const ValueKey("Video info"),
- leading: HugeIcon(
- icon: HugeIcons.strokeRoundedVideo02,
- size: IconSizes.small,
- color: colors.textLight,
- ),
- title: l10n.videoInfo,
- subtitle: subtitle,
- onTap: onTap,
- );
+ setState(() {
+ _onTap = onTap;
+ });
+ return Future.value([
+ Text(label, style: getEnteTextTheme(context).miniBoldMuted),
+ ]);
}
}