π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix bottom sheet
AmanRajSinghMourya12c2250af305
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.dartindex 9fcd38d731..230e32028c 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,21 +7,12 @@ 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@@ -35,12 +26,7 @@ class SelectionActionButton extends StatelessWidget {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),- ),+ borderRadius: BorderRadius.circular(24.0),),padding: const EdgeInsets.symmetric(vertical: 18.0,diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dartindex 6ccadc50f2..6ff74e107c 100644--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart@@ -228,17 +228,15 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>),),backgroundColor: colorScheme.backgroundBase,- body: _buildBody(colorScheme, textTheme),- bottomNavigationBar: ListenableBuilder(- listenable: _selectedFiles,- builder: (context, _) {- return _selectedFiles.hasSelections- ? FileSelectionOverlayBar(- files: _displayedFiles,- selectedFiles: _selectedFiles,- )- : const SizedBox.shrink();- },+ body: Stack(+ alignment: Alignment.bottomCenter,+ children: [+ _buildBody(colorScheme, textTheme),+ FileSelectionOverlayBar(+ files: _displayedFiles,+ selectedFiles: _selectedFiles,+ ),+ ],),),);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.dartindex 97eec876e8..e0be79cd88 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@@ -14,6 +14,8 @@ import "package:locker/ui/components/share_link_dialog.dart";import "package:locker/utils/snack_bar_utils.dart";class FileSelectionOverlayBar extends StatefulWidget {+ static const double roughHeight = 300.0;+final SelectedFiles selectedFiles;final List<EnteFile> files;const FileSelectionOverlayBar({@@ -28,246 +30,332 @@ class FileSelectionOverlayBar extends StatefulWidget {}class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {+ @override+ void initState() {+ super.initState();+ widget.selectedFiles.addListener(_onSelectionChanged);+ }++ @override+ void dispose() {+ widget.selectedFiles.removeListener(_onSelectionChanged);+ super.dispose();+ }++ void _onSelectionChanged() {+ if (mounted) {+ setState(() {});+ }+ }+@overrideWidget build(BuildContext context) {final bottomPadding = MediaQuery.of(context).padding.bottom;final colorScheme = getEnteColorScheme(context);final textTheme = getEnteTextTheme(context);-- return ConstrainedBox(- constraints: BoxConstraints(- maxHeight: MediaQuery.of(context).size.height * 0.4,- ),- child: Column(- mainAxisSize: MainAxisSize.min,- mainAxisAlignment: MainAxisAlignment.end,- children: [- 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)),- ),- margin: EdgeInsets.zero,- child: Padding(- padding: EdgeInsets.fromLTRB(16, 16, 16, 28 + bottomPadding),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- Row(- children: [- ListenableBuilder(- listenable: widget.selectedFiles,- builder: (context, child) {- final isAllSelected =- widget.selectedFiles.count == widget.files.length;- final buttonText = isAllSelected- ? context.l10n.deselectAll- : context.l10n.selectAll;- final iconData = isAllSelected- ? Icons.remove_circle_outline- : Icons.check_circle_outline_outlined;-- return InkWell(- onTap: () {- if (isAllSelected) {- widget.selectedFiles.clearAll();- } else {- widget.selectedFiles- .selectAll(widget.files.toSet());- }- },- child: Container(- decoration: BoxDecoration(- color: colorScheme.backgroundElevated2,- borderRadius: BorderRadius.circular(50),- ),- padding: const EdgeInsets.symmetric(- horizontal: 16.0,- vertical: 14.0,- ),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- Text(- buttonText,- style: textTheme.body,- ),- const SizedBox(width: 6),- Icon(- iconData,- color: getEnteColorScheme(context).textBase,- size: 20,- ),- ],- ),- ),- );- },+ final hasSelection = widget.selectedFiles.files.isNotEmpty;++ return IgnorePointer(+ ignoring: !hasSelection,+ child: Align(+ alignment: Alignment.bottomCenter,+ child: AnimatedSlide(+ duration: const Duration(milliseconds: 300),+ curve: Curves.easeInOutCubic,+ offset: hasSelection ? Offset.zero : const Offset(0, 1),+ child: AnimatedOpacity(+ duration: const Duration(milliseconds: 250),+ opacity: hasSelection ? 1.0 : 0.0,+ curve: Curves.easeInOut,+ child: hasSelection+ ? GestureDetector(+ behavior: HitTestBehavior.opaque,+ onVerticalDragUpdate: (_) {},+ child: 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),+ ),),- const Spacer(),- ListenableBuilder(- listenable: widget.selectedFiles,- builder: (context, child) {- final count = widget.selectedFiles.count;- final countText =- count == 1 ? '1 selected' : '$count selected';-- return InkWell(- onTap: () {- widget.selectedFiles.clearAll();- },- child: Container(- decoration: BoxDecoration(- color: colorScheme.backgroundElevated2,- borderRadius: BorderRadius.circular(50),- ),- padding: const EdgeInsets.symmetric(- horizontal: 16.0,- vertical: 14.0,- ),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- Text(- countText,- style: textTheme.body,- ),- const SizedBox(width: 6),- Icon(- Icons.close,- color: getEnteColorScheme(context).textBase,- size: 20,- ),- ],- ),+ margin: EdgeInsets.zero,+ child: Padding(+ padding:+ EdgeInsets.fromLTRB(16, 16, 16, 28 + bottomPadding),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Row(+ children: [+ ListenableBuilder(+ listenable: widget.selectedFiles,+ builder: (context, child) {+ final isAllSelected =+ widget.selectedFiles.count ==+ widget.files.length;+ final buttonText = isAllSelected+ ? context.l10n.deselectAll+ : context.l10n.selectAll;+ final iconData = isAllSelected+ ? Icons.remove_circle_outline+ : Icons.check_circle_outline_outlined;++ return InkWell(+ onTap: () {+ if (isAllSelected) {+ widget.selectedFiles.clearAll();+ } else {+ widget.selectedFiles+ .selectAll(widget.files.toSet());+ }+ },+ child: Container(+ decoration: BoxDecoration(+ color:+ colorScheme.backgroundElevated2,+ borderRadius:+ BorderRadius.circular(50),+ ),+ padding: const EdgeInsets.symmetric(+ horizontal: 16.0,+ vertical: 14.0,+ ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ buttonText,+ style: textTheme.body,+ ),+ const SizedBox(width: 6),+ Icon(+ iconData,+ color: getEnteColorScheme(context)+ .textBase,+ size: 20,+ ),+ ],+ ),+ ),+ );+ },+ ),+ const Spacer(),+ ListenableBuilder(+ listenable: widget.selectedFiles,+ builder: (context, child) {+ final count = widget.selectedFiles.count;+ final countText = count == 1+ ? '1 selected'+ : '$count selected';++ return InkWell(+ onTap: () {+ widget.selectedFiles.clearAll();+ },+ child: Container(+ decoration: BoxDecoration(+ color:+ colorScheme.backgroundElevated2,+ borderRadius:+ BorderRadius.circular(50),+ ),+ padding: const EdgeInsets.symmetric(+ horizontal: 16.0,+ vertical: 14.0,+ ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ countText,+ style: textTheme.body,+ ),+ const SizedBox(width: 6),+ Icon(+ Icons.close,+ color: getEnteColorScheme(context)+ .textBase,+ size: 20,+ ),+ ],+ ),+ ),+ );+ },+ ),+ ],),- );- },+ const SizedBox(height: 24),+ _buildActionButtons(),+ ],+ ),),- ],- ),- const SizedBox(height: 24),- _buildActionButtons(),- ],- ),- ),+ ),+ )+ : const SizedBox.shrink(),),- ],+ ),),);}Widget _buildActionButtons() {- return ListenableBuilder(- listenable: widget.selectedFiles,- builder: (context, child) {- final selectedFiles = widget.selectedFiles.files;- if (selectedFiles.isEmpty) {- return const SizedBox.shrink();- }+ final selectedFiles = widget.selectedFiles.files;+ if (selectedFiles.isEmpty) {+ return const SizedBox.shrink();+ }- final actionRows = _getActionsForSelection(selectedFiles);+ final isSingleSelection = selectedFiles.length == 1;+ final file = isSingleSelection ? selectedFiles.first : null;- return AnimatedContainer(- duration: const Duration(milliseconds: 200),- curve: Curves.easeInOut,- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- for (int i = 0; i < actionRows.length; i++) ...[+ return AnimatedSwitcher(+ duration: const Duration(milliseconds: 300),+ switchInCurve: Curves.easeInOut,+ switchOutCurve: Curves.easeInOut,+ transitionBuilder: (Widget child, Animation<double> animation) {+ return FadeTransition(+ opacity: animation,+ child: SizeTransition(+ sizeFactor: animation,+ child: child,+ ),+ );+ },+ child: isSingleSelection+ ? Column(+ key: const ValueKey('single_selection'),+ mainAxisSize: MainAxisSize.min,+ children: [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),- ],+ Expanded(+ child: SelectionActionButton(+ icon: Icons.download_outlined,+ label: "Download",+ onTap: () => _downloadFile(context, file!),+ ),+ ),+ const SizedBox(width: 12),+ Expanded(+ child: SelectionActionButton(+ icon: Icons.share_outlined,+ label: context.l10n.share,+ onTap: () => _shareLink(context, file!),+ ),+ ),+ const SizedBox(width: 12),+ Expanded(+ child: SelectionActionButton(+ icon: Icons.delete_outline,+ label: context.l10n.delete,+ onTap: () => _deleteFile(context, file!),+ isDestructive: true,+ ),+ ),],),- if (i < actionRows.length - 1) const SizedBox(height: 12),+ const SizedBox(height: 12),+ _buildContinuousActionRow(file!),],- ],- ),- );- },+ )+ : Row(+ key: const ValueKey('multi_selection'),+ children: [+ Expanded(+ child: SelectionActionButton(+ icon: Icons.delete_outline,+ label: context.l10n.delete,+ onTap: () =>+ _deleteMultipleFile(context, selectedFiles.toList()),+ isDestructive: true,+ ),+ ),+ ],+ ),);}- List<List<Widget>> _getActionsForSelection(Set<EnteFile> selectedFiles) {- final isSingleSelection = selectedFiles.length == 1;- final file = isSingleSelection ? selectedFiles.first : null;+ Widget _buildContinuousActionRow(EnteFile file) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);- if (isSingleSelection) {- final firstRow = <Widget>[- SelectionActionButton(- icon: Icons.download_outlined,- label: "Download",- onTap: () {- _downloadFile(context, file!);- },- ),- SelectionActionButton(- icon: Icons.share_outlined,- label: context.l10n.share,- onTap: () {- _shareLink(context, file!);- },- ),- SelectionActionButton(- icon: Icons.delete_outline,- label: context.l10n.delete,- onTap: () {- _deleteFile(context, file!);- },- isDestructive: true,- ),- ];-- // Second row: Edit, Important- final secondRow = <Widget>[- SelectionActionButton(- icon: Icons.edit_outlined,- label: context.l10n.edit,- isTopLeftRounded: true,- isTopRightRounded: false,- isBottomLeftRounded: true,- isBottomRightRounded: false,- onTap: () {- _showEditDialog(context, file!);- },- ),- SelectionActionButton(- icon: Icons.star_outline,- label: "Important",- isTopLeftRounded: false,- isTopRightRounded: true,- isBottomLeftRounded: false,- isBottomRightRounded: true,- onTap: () {- _toggleImportant(context, file!);- },+ return Container(+ decoration: BoxDecoration(+ color: colorScheme.backgroundElevated2,+ borderRadius: BorderRadius.circular(24.0),+ ),+ child: IntrinsicHeight(+ child: Row(+ children: [+ Expanded(+ child: GestureDetector(+ onTap: () => _showEditDialog(context, file),+ child: Container(+ padding: const EdgeInsets.symmetric(+ vertical: 18.0,+ horizontal: 12.0,+ ),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ Icon(+ Icons.edit_outlined,+ color: colorScheme.textBase,+ size: 24,+ ),+ const SizedBox(height: 8),+ Text(+ context.l10n.edit,+ style: textTheme.body.copyWith(+ color: colorScheme.textBase,+ ),+ textAlign: TextAlign.center,+ ),+ ],+ ),+ ),+ ),+ ),+ Expanded(+ child: GestureDetector(+ onTap: () => _toggleImportant(context, file),+ child: Container(+ padding: const EdgeInsets.symmetric(+ vertical: 18.0,+ horizontal: 12.0,+ ),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ Icon(+ Icons.star_outline,+ color: colorScheme.textBase,+ size: 24,+ ),+ const SizedBox(height: 8),+ Text(+ "Important",+ style: textTheme.body.copyWith(+ color: colorScheme.textBase,+ ),+ textAlign: TextAlign.center,+ ),+ ],+ ),+ ),+ ),+ ),+ ],),- ];-- return [firstRow, secondRow];- } else {- return [- [- SelectionActionButton(- icon: Icons.delete_outline,- label: context.l10n.delete,- onTap: () {- _deleteMultipleFile(context, selectedFiles.toList());- },- isDestructive: true,- ),- ],- ];- }+ ),+ );}Future<void> _shareLink(BuildContext context, EnteFile file) async {