Skip to content

armgit / ente

Public Imported from GitHub
0

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

feat: Enhance GradientButton usage and update ShareLinkDialog with new design

AmanRajSinghMouryac3bf50198524
diff --git a/mobile/apps/locker/lib/ui/components/gradient_button.dart b/mobile/apps/locker/lib/ui/components/gradient_button.dart
index 09fe4bea2c..4579a26686 100644
--- a/mobile/apps/locker/lib/ui/components/gradient_button.dart
+++ b/mobile/apps/locker/lib/ui/components/gradient_button.dart
@@ -7,6 +7,7 @@ class GradientButton extends StatelessWidget {
final String text;
final HugeIcon? hugeIcon;
final double paddingValue;
+ final Color? backgroundColor;
const GradientButton({
super.key,
@@ -14,6 +15,7 @@ class GradientButton extends StatelessWidget {
this.text = '',
this.hugeIcon,
this.paddingValue = 6.0,
+ this.backgroundColor,
});
static const TextStyle _textStyle = TextStyle(
@@ -27,8 +29,8 @@ class GradientButton extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final bool isEnabled = onTap != null;
- final Color backgroundColor =
- isEnabled ? colorScheme.primary700 : colorScheme.fillFaint;
+ final Color effectiveBackgroundColor = backgroundColor ??
+ (isEnabled ? colorScheme.primary700 : colorScheme.fillFaint);
final TextStyle effectiveTextStyle = _textStyle.copyWith(
color: isEnabled ? Colors.white : colorScheme.textMuted,
);
@@ -51,7 +53,7 @@ class GradientButton extends StatelessWidget {
return ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Material(
- color: backgroundColor,
+ color: effectiveBackgroundColor,
child: InkWell(
onTap: onTap,
splashColor: isEnabled ? null : Colors.transparent,
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 c8ed7725f6..64771a20a7 100644
--- a/mobile/apps/locker/lib/ui/components/share_link_dialog.dart
+++ b/mobile/apps/locker/lib/ui/components/share_link_dialog.dart
@@ -4,6 +4,7 @@ import "package:ente_ui/utils/toast_util.dart";
import "package:ente_utils/share_utils.dart";
import "package:flutter/material.dart";
import "package:flutter/services.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:locker/l10n/l10n.dart";
import "package:locker/services/files/sync/models/file.dart";
import "package:locker/ui/components/delete_share_link_dialog.dart";
@@ -56,7 +57,7 @@ class _ShareLinkDialogState extends State<ShareLinkDialog> {
return Dialog(
backgroundColor: colorScheme.backgroundElevated2,
- insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 22),
+ insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
@@ -100,7 +101,7 @@ class _ShareLinkDialogState extends State<ShareLinkDialog> {
const SizedBox(height: 24),
Container(
decoration: BoxDecoration(
- color: colorScheme.primary700,
+ color: colorScheme.backgroundElevated,
borderRadius: BorderRadius.circular(12),
),
child: Stack(
@@ -116,7 +117,7 @@ class _ShareLinkDialogState extends State<ShareLinkDialog> {
child: SelectableText(
widget.url,
style: textTheme.small.copyWith(
- color: Colors.white,
+ color: colorScheme.textBase,
fontFamily: 'monospace',
),
),
@@ -131,10 +132,10 @@ class _ShareLinkDialogState extends State<ShareLinkDialog> {
child: IconButton(
onPressed: () => _copyToClipboard(),
visualDensity: VisualDensity.compact,
- icon: const Icon(
- Icons.copy_rounded,
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedCopy01,
+ color: colorScheme.textBase,
size: 18,
- color: Colors.white,
),
tooltip: 'Copy link',
),
@@ -160,28 +161,16 @@ class _ShareLinkDialogState extends State<ShareLinkDialog> {
const SizedBox(height: 12),
SizedBox(
width: double.infinity,
- height: 56,
- child: ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: colorScheme.warning500,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(20),
- ),
- elevation: 0,
- ),
- onPressed: () async {
+ child: GradientButton(
+ onTap: () async {
Navigator.of(context).pop();
await deleteShareLink(
widget.rootContext,
widget.file.uploadedFileID!,
);
},
- child: Text(
- l10n.deleteLink,
- style: textTheme.largeBold.copyWith(
- color: Colors.white,
- ),
- ),
+ backgroundColor: colorScheme.warning400,
+ text: l10n.deleteLink,
),
),
],
diff --git a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart b/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
index c1428e0c13..5690fc5c70 100644
--- a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
@@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
import 'package:locker/l10n/l10n.dart';
import 'package:locker/models/info/info_item.dart';
import 'package:locker/ui/components/collection_selection_widget.dart';
+import 'package:locker/ui/components/gradient_button.dart';
import 'package:locker/ui/pages/base_info_page.dart';
class PersonalNotePage extends BaseInfoPage<PersonalNoteData> {
@@ -487,20 +488,83 @@ class _PersonalNotePageState
Future<bool> _showDiscardChangesDialog() async {
final result = await showDialog<bool>(
context: context,
- builder: (context) {
- return AlertDialog(
- title: Text(context.l10n.unsavedNoteChangesTitle),
- content: Text(context.l10n.unsavedNoteChangesDescription),
- actions: [
- TextButton(
- onPressed: () => Navigator.of(context).pop(false),
- child: Text(context.l10n.keepEditing),
+ barrierDismissible: false,
+ builder: (dialogContext) {
+ final colorScheme = getEnteColorScheme(dialogContext);
+ final textTheme = getEnteTextTheme(dialogContext);
+
+ return Dialog(
+ backgroundColor: colorScheme.backgroundElevated2,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(24),
+ ),
+ insetPadding: const EdgeInsets.symmetric(
+ horizontal: 24,
+ vertical: 24,
+ ),
+ child: Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated2,
+ borderRadius: BorderRadius.circular(24),
+ boxShadow: [
+ BoxShadow(
+ color: Colors.black.withValues(alpha: 0.08),
+ blurRadius: 24,
+ offset: const Offset(0, 12),
+ ),
+ ],
),
- TextButton(
- onPressed: () => Navigator.of(context).pop(true),
- child: Text(context.l10n.discardChanges),
+ padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 22),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ context.l10n.unsavedNoteChangesTitle,
+ style: textTheme.h3Bold,
+ ),
+ ),
+ const SizedBox(width: 16),
+ GestureDetector(
+ onTap: () => Navigator.of(dialogContext).pop(false),
+ child: Container(
+ height: 36,
+ width: 36,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: colorScheme.backgroundElevated,
+ ),
+ child: const Icon(
+ Icons.close_rounded,
+ size: 20,
+ ),
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 16),
+ Text(
+ context.l10n.unsavedNoteChangesDescription,
+ style: textTheme.body.copyWith(
+ color: colorScheme.textMuted,
+ ),
+ ),
+ const SizedBox(height: 28),
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ text: context.l10n.discardChanges,
+ backgroundColor: colorScheme.warning400,
+ onTap: () => Navigator.of(dialogContext).pop(true),
+ ),
+ ),
+ ],
),
- ],
+ ),
);
},
);