Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor: Rename showShareLinkDialog to showShareLinkSheet for consistency and update usages

AmanRajSinghMouryaf7d9f47a13eb
diff --git a/mobile/apps/locker/lib/ui/components/share_link_dialog.dart b/mobile/apps/locker/lib/ui/components/share_link_dialog.dart
index d224cd41d6..df8ca48897 100644
--- a/mobile/apps/locker/lib/ui/components/share_link_dialog.dart
+++ b/mobile/apps/locker/lib/ui/components/share_link_dialog.dart
@@ -2,7 +2,6 @@ import "package:ente_ui/components/alert_bottom_sheet.dart";
import "package:ente_ui/components/buttons/button_widget.dart";
import "package:ente_ui/components/buttons/models/button_result.dart";
import "package:ente_ui/components/close_icon_button.dart";
-import "package:ente_ui/components/title_bar_title_widget.dart";
import "package:ente_ui/theme/ente_theme.dart";
import "package:ente_ui/utils/dialog_util.dart";
import "package:ente_ui/utils/toast_util.dart";
@@ -15,20 +14,20 @@ import "package:locker/services/files/links/links_service.dart";
import "package:locker/services/files/sync/models/file.dart";
import "package:locker/ui/components/gradient_button.dart";
-Future<void> showShareLinkDialog(
+Future<void> showShareLinkSheet(
BuildContext context,
String url,
String linkID,
EnteFile file,
) async {
- // Capture the root context (with Scaffold) before showing dialog
final rootContext = context;
- await showDialog<void>(
+ await showModalBottomSheet<void>(
context: context,
- barrierDismissible: false,
- builder: (BuildContext dialogContext) {
- return ShareLinkDialog(
+ isScrollControlled: true,
+ backgroundColor: Colors.transparent,
+ builder: (BuildContext sheetContext) {
+ return ShareLinkSheet(
url: url,
file: file,
rootContext: rootContext,
@@ -37,12 +36,12 @@ Future<void> showShareLinkDialog(
);
}
-class ShareLinkDialog extends StatefulWidget {
+class ShareLinkSheet extends StatefulWidget {
final String url;
final EnteFile file;
final BuildContext rootContext;
- const ShareLinkDialog({
+ const ShareLinkSheet({
super.key,
required this.url,
required this.file,
@@ -50,118 +49,128 @@ class ShareLinkDialog extends StatefulWidget {
});
@override
- State<ShareLinkDialog> createState() => _ShareLinkDialogState();
+ State<ShareLinkSheet> createState() => _ShareLinkSheetState();
}
-class _ShareLinkDialogState extends State<ShareLinkDialog> {
+class _ShareLinkSheetState extends State<ShareLinkSheet> {
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
final l10n = context.l10n;
- return Dialog(
- backgroundColor: colorScheme.backgroundElevated2,
- insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(24),
+ return Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated2,
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(24),
+ topRight: Radius.circular(24),
+ ),
),
- child: Container(
- constraints: const BoxConstraints(maxWidth: 400),
- padding: const EdgeInsets.all(24),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- TitleBarTitleWidget(
- title: l10n.share,
- ),
- const CloseIconButton(),
- ],
- ),
- const SizedBox(height: 16),
- Text(
- l10n.shareThisLink,
- style: textTheme.body.copyWith(
- color: colorScheme.textMuted,
+ child: SafeArea(
+ top: false,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l10n.share,
+ style: textTheme.largeBold,
+ ),
+ const CloseIconButton(),
+ ],
),
- ),
- const SizedBox(height: 24),
- Container(
- decoration: BoxDecoration(
- color: colorScheme.backgroundElevated,
- borderRadius: BorderRadius.circular(12),
+ const SizedBox(height: 16),
+ Text(
+ l10n.shareThisLink,
+ style: textTheme.body.copyWith(
+ color: colorScheme.textMuted,
+ ),
),
- child: Stack(
- children: [
- Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 12,
- vertical: 16,
- ),
- child: Row(
- children: [
- Expanded(
- child: SelectableText(
- widget.url,
- style: textTheme.small.copyWith(
- color: colorScheme.textBase,
- fontFamily: 'monospace',
+ const SizedBox(height: 24),
+ Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Stack(
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ vertical: 16,
+ ),
+ child: Row(
+ children: [
+ Expanded(
+ child: SelectableText(
+ widget.url,
+ style: textTheme.small.copyWith(
+ color: colorScheme.textBase,
+ fontFamily: 'monospace',
+ ),
),
),
- ),
- ],
+ ],
+ ),
),
- ),
- Positioned(
- right: 0,
- top: 0,
- child: Center(
- child: IconButton(
- onPressed: () => _copyToClipboard(),
- visualDensity: VisualDensity.compact,
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedCopy01,
- color: colorScheme.textBase,
- size: 18,
+ Positioned(
+ right: 0,
+ top: 0,
+ child: Center(
+ child: IconButton(
+ onPressed: () => _copyToClipboard(),
+ visualDensity: VisualDensity.compact,
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedCopy01,
+ color: colorScheme.textBase,
+ size: 18,
+ ),
+ tooltip: 'Copy link',
),
- tooltip: 'Copy link',
),
),
- ),
- ],
+ ],
+ ),
),
- ),
- const SizedBox(height: 24),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- onTap: () async {
- Navigator.of(context).pop();
- await shareText(
- widget.url,
- context: widget.rootContext,
- );
- },
- text: l10n.shareLink,
+ const SizedBox(height: 24),
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ onTap: () async {
+ Navigator.of(context).pop();
+ await shareText(
+ widget.url,
+ context: widget.rootContext,
+ );
+ },
+ text: l10n.shareLink,
+ ),
),
- ),
- const SizedBox(height: 12),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- onTap: () async {
- Navigator.of(context).pop();
- await _deleteShareLink(widget.rootContext);
- },
- backgroundColor: colorScheme.warning400,
- text: l10n.deleteLink,
+ const SizedBox(height: 16),
+ Center(
+ child: GestureDetector(
+ onTap: () async {
+ Navigator.of(context).pop();
+ await _deleteShareLink(widget.rootContext);
+ },
+ child: Text(
+ l10n.deleteLink,
+ style: textTheme.bodyBold.copyWith(
+ color: colorScheme.warning500,
+ decoration: TextDecoration.underline,
+ decorationColor: colorScheme.warning500,
+ ),
+ ),
+ ),
),
- ),
- ],
+ ],
+ ),
),
),
);
diff --git a/mobile/apps/locker/lib/utils/file_actions.dart b/mobile/apps/locker/lib/utils/file_actions.dart
index fc9148b3ef..fdb2e70b96 100644
--- a/mobile/apps/locker/lib/utils/file_actions.dart
+++ b/mobile/apps/locker/lib/utils/file_actions.dart
@@ -258,7 +258,7 @@ class FileActions {
await dialog.hide();
if (context.mounted) {
- await showShareLinkDialog(
+ await showShareLinkSheet(
context,
shareableLink.fullURL!,
shareableLink.linkID,