Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix bottom sheet UI

AmanRajSinghMouryaea74f24d0249
diff --git a/mobile/apps/locker/lib/ui/components/selection_action_button_widget.dart b/mobile/apps/locker/lib/ui/components/selection_action_button_widget.dart
index 93d1495445..9fcd38d731 100644
--- a/mobile/apps/locker/lib/ui/components/selection_action_button_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/selection_action_button_widget.dart
@@ -7,36 +7,58 @@ class SelectionActionButton extends StatelessWidget {
final VoidCallback onTap;
final bool isDestructive;
+ final bool isTopLeftRounded;
+ final bool isTopRightRounded;
+ final bool isBottomLeftRounded;
+ final bool isBottomRightRounded;
+
const SelectionActionButton({
super.key,
required this.icon,
required this.label,
required this.onTap,
this.isDestructive = false,
+ this.isTopLeftRounded = true,
+ this.isTopRightRounded = true,
+ this.isBottomLeftRounded = true,
+ this.isBottomRightRounded = true,
});
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final color = isDestructive ? Colors.red : colorScheme.textBase;
+ final color = isDestructive ? colorScheme.warning500 : colorScheme.textBase;
return GestureDetector(
onTap: onTap,
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
+ child: Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated2,
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(isTopLeftRounded ? 24.0 : 0.0),
+ topRight: Radius.circular(isTopRightRounded ? 24.0 : 0.0),
+ bottomLeft: Radius.circular(isBottomLeftRounded ? 24.0 : 0.0),
+ bottomRight: Radius.circular(isBottomRightRounded ? 24.0 : 0.0),
+ ),
+ ),
+ padding: const EdgeInsets.symmetric(
+ vertical: 18.0,
+ horizontal: 12.0,
+ ),
child: Column(
mainAxisSize: MainAxisSize.min,
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
icon,
color: color,
- size: 22,
+ size: 24,
),
- const SizedBox(height: 6),
+ const SizedBox(height: 8),
Text(
label,
- style: textTheme.small.copyWith(
+ style: textTheme.body.copyWith(
color: color,
),
textAlign: TextAlign.center,
diff --git a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
index f97530d9a1..cfef9d7540 100644
--- a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
+++ b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
@@ -108,6 +108,7 @@ class _FileUploadScreenState extends State<FileUploadScreen> {
const SizedBox(height: 24),
Expanded(
child: SingleChildScrollView(
+ controller: ScrollController(),
physics: const BouncingScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -115,16 +116,14 @@ class _FileUploadScreenState extends State<FileUploadScreen> {
if (_files.isNotEmpty) ...[
Container(
decoration: BoxDecoration(
- color: colorScheme.fillFaint,
+ color: colorScheme.strokeFainter,
borderRadius: BorderRadius.circular(24),
),
padding: const EdgeInsets.all(12),
child: Container(
constraints: BoxConstraints(
- maxHeight: _files.length > 5
- ? 420 // Show exactly 5 items (84 * 5)
- : _files.length *
- 84.0, // Actual height for fewer items
+ maxHeight:
+ _files.length > 5 ? 360 : _files.length * 84.0,
),
child: ListView.separated(
shrinkWrap: true,
@@ -238,7 +237,7 @@ class _FileUploadScreenState extends State<FileUploadScreen> {
return Container(
decoration: BoxDecoration(
- color: colorScheme.backgroundBase,
+ color: colorScheme.backdropBase,
borderRadius: const BorderRadius.all(Radius.circular(16)),
),
child: Row(
@@ -260,8 +259,8 @@ class _FileUploadScreenState extends State<FileUploadScreen> {
padding: const EdgeInsets.only(right: 12),
child: Container(
decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(50),
- color: colorScheme.backdropBase,
+ shape: BoxShape.circle,
+ color: colorScheme.backgroundElevated,
),
padding: const EdgeInsets.all(8),
child: HugeIcon(
diff --git a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index da68d7610f..97eec876e8 100644
--- a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -42,17 +42,16 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
children: [
- Card(
- borderOnForeground: true,
- margin: EdgeInsets.zero,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.only(
+ Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backdropBase,
+ borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
+ border: Border(top: BorderSide(color: colorScheme.strokeFaint)),
),
- elevation: 4,
- surfaceTintColor: colorScheme.backdropBase,
+ margin: EdgeInsets.zero,
child: Padding(
padding: EdgeInsets.fromLTRB(16, 16, 16, 28 + bottomPadding),
child: Column(
@@ -83,25 +82,25 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
},
child: Container(
decoration: BoxDecoration(
- color: colorScheme.backgroundBase,
+ color: colorScheme.backgroundElevated2,
borderRadius: BorderRadius.circular(50),
),
padding: const EdgeInsets.symmetric(
- horizontal: 12.0,
- vertical: 8.0,
+ horizontal: 16.0,
+ vertical: 14.0,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
buttonText,
- style: textTheme.small,
+ style: textTheme.body,
),
const SizedBox(width: 6),
Icon(
iconData,
- color: Colors.grey,
- size: 16,
+ color: getEnteColorScheme(context).textBase,
+ size: 20,
),
],
),
@@ -123,25 +122,25 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
},
child: Container(
decoration: BoxDecoration(
- color: colorScheme.backgroundBase,
+ color: colorScheme.backgroundElevated2,
borderRadius: BorderRadius.circular(50),
),
padding: const EdgeInsets.symmetric(
- horizontal: 12.0,
- vertical: 8.0,
+ horizontal: 16.0,
+ vertical: 14.0,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
countText,
- style: textTheme.small,
+ style: textTheme.body,
),
const SizedBox(width: 6),
- const Icon(
+ Icon(
Icons.close,
- color: Colors.grey,
- size: 16,
+ color: getEnteColorScheme(context).textBase,
+ size: 20,
),
],
),
@@ -163,7 +162,6 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
}
Widget _buildActionButtons() {
- final colorScheme = getEnteColorScheme(context);
return ListenableBuilder(
listenable: widget.selectedFiles,
builder: (context, child) {
@@ -172,43 +170,51 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
return const SizedBox.shrink();
}
- final actions = _getActionsForSelection(selectedFiles);
+ final actionRows = _getActionsForSelection(selectedFiles);
return AnimatedContainer(
duration: const Duration(milliseconds: 200),
curve: Curves.easeInOut,
- decoration: BoxDecoration(
- color: colorScheme.backgroundBase,
- borderRadius: BorderRadius.circular(12),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: actions,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ for (int i = 0; i < actionRows.length; i++) ...[
+ Row(
+ children: [
+ for (int j = 0; j < actionRows[i].length; j++) ...[
+ Expanded(child: actionRows[i][j]),
+ if (i == 0 && j < actionRows[i].length - 1)
+ const SizedBox(width: 12),
+ ],
+ ],
+ ),
+ if (i < actionRows.length - 1) const SizedBox(height: 12),
+ ],
+ ],
),
);
},
);
}
- List<Widget> _getActionsForSelection(Set<EnteFile> selectedFiles) {
+ List<List<Widget>> _getActionsForSelection(Set<EnteFile> selectedFiles) {
final isSingleSelection = selectedFiles.length == 1;
final file = isSingleSelection ? selectedFiles.first : null;
- final actions = <Widget>[];
if (isSingleSelection) {
- actions.addAll([
+ final firstRow = <Widget>[
SelectionActionButton(
- icon: Icons.share_outlined,
- label: context.l10n.share,
+ icon: Icons.download_outlined,
+ label: "Download",
onTap: () {
- _shareLink(context, file!);
+ _downloadFile(context, file!);
},
),
SelectionActionButton(
- icon: Icons.edit_outlined,
- label: context.l10n.edit,
+ icon: Icons.share_outlined,
+ label: context.l10n.share,
onTap: () {
- _showEditDialog(context, file!);
+ _shareLink(context, file!);
},
),
SelectionActionButton(
@@ -219,20 +225,49 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
},
isDestructive: true,
),
- ]);
- } else {
- actions.addAll([
+ ];
+
+ // Second row: Edit, Important
+ final secondRow = <Widget>[
SelectionActionButton(
- icon: Icons.delete_outline,
- label: context.l10n.delete,
+ icon: Icons.edit_outlined,
+ label: context.l10n.edit,
+ isTopLeftRounded: true,
+ isTopRightRounded: false,
+ isBottomLeftRounded: true,
+ isBottomRightRounded: false,
onTap: () {
- _deleteMultipleFile(context, selectedFiles.toList());
+ _showEditDialog(context, file!);
+ },
+ ),
+ SelectionActionButton(
+ icon: Icons.star_outline,
+ label: "Important",
+ isTopLeftRounded: false,
+ isTopRightRounded: true,
+ isBottomLeftRounded: false,
+ isBottomRightRounded: true,
+ onTap: () {
+ _toggleImportant(context, file!);
},
- isDestructive: true,
),
- ]);
+ ];
+
+ return [firstRow, secondRow];
+ } else {
+ return [
+ [
+ SelectionActionButton(
+ icon: Icons.delete_outline,
+ label: context.l10n.delete,
+ onTap: () {
+ _deleteMultipleFile(context, selectedFiles.toList());
+ },
+ isDestructive: true,
+ ),
+ ],
+ ];
}
- return actions;
}
Future<void> _shareLink(BuildContext context, EnteFile file) async {
@@ -431,4 +466,20 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
);
}
}
+
+ Future<void> _downloadFile(BuildContext context, EnteFile file) async {
+ // TODO: Implemexnt file download functionality
+ SnackBarUtils.showInfoSnackBar(
+ context,
+ "Download functionality coming soon",
+ );
+ }
+
+ Future<void> _toggleImportant(BuildContext context, EnteFile file) async {
+ // TODO: Implement toggle important/star functionality
+ SnackBarUtils.showInfoSnackBar(
+ context,
+ "Mark as important functionality coming soon",
+ );
+ }
}