Skip to content

armgit / ente

Public Imported from GitHub
0

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

Share settings link across mobile apps

Neeraj Gupta407d1c0345ea
diff --git a/mobile/apps/locker/lib/ui/settings/pages/support_page.dart b/mobile/apps/locker/lib/ui/settings/pages/support_page.dart
index 2359df7f6a..a4fad34691 100644
--- a/mobile/apps/locker/lib/ui/settings/pages/support_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/pages/support_page.dart
@@ -62,7 +62,7 @@ class SupportPage extends StatelessWidget {
onTap: () => _viewLogs(context),
),
],
- _SupportLink(
+ SettingsLink(
label: context.strings.exportLogs,
onTap: () => _exportLogs(context),
),
@@ -115,7 +115,7 @@ class SupportPage extends StatelessWidget {
icon: HugeIcons.strokeRoundedWrench01,
faqUrl: _troubleshootingFaqUrl,
),
- _SupportLink(
+ SettingsLink(
label: l10n.viewAllHelpTopics,
onTap: () => _openHelpPage(context, title: l10n.helpAndSupport),
),
@@ -202,38 +202,3 @@ class SupportPage extends StatelessWidget {
}
}
}
-
-class _SupportLink extends StatelessWidget {
- final String label;
- final Future<void> Function() onTap;
-
- const _SupportLink({required this.label, required this.onTap});
-
- @override
- Widget build(BuildContext context) {
- final colors = context.componentColors;
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- label,
- style: TextStyles.bodyBold.copyWith(color: colors.primary),
- ),
- const SizedBox(width: 4),
- HugeIcon(
- icon: HugeIcons.strokeRoundedArrowRight01,
- color: colors.primary,
- size: 16,
- strokeWidth: 1.6,
- ),
- ],
- ),
- ),
- );
- }
-}
diff --git a/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart b/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
index a7bb944f20..7fbd31bcc9 100644
--- a/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
@@ -78,12 +78,7 @@ class HelpSupportPage extends StatelessWidget {
},
),
],
- _SupportLink(
- label: l10n.exportLogs,
- onTap: () async {
- await _exportLogs(context);
- },
- ),
+ SettingsLink(label: l10n.exportLogs, onTap: () => _exportLogs(context)),
const SizedBox(height: 24),
_sectionTitle(context, l10n.browseHelpPages),
_buildHelpTopicItem(
@@ -125,11 +120,9 @@ class HelpSupportPage extends StatelessWidget {
icon: HugeIcons.strokeRoundedWrench01,
faqUrl: _troubleshootingFaqUrl,
),
- _SupportLink(
+ SettingsLink(
label: l10n.viewAllHelpTopics,
- onTap: () async {
- await _openHelpPage(context, title: l10n.helpAndSupport);
- },
+ onTap: () => _openHelpPage(context, title: l10n.helpAndSupport),
),
const SizedBox(height: 24),
],
@@ -204,38 +197,3 @@ class HelpSupportPage extends StatelessWidget {
}
}
}
-
-class _SupportLink extends StatelessWidget {
- final String label;
- final Future<void> Function() onTap;
-
- const _SupportLink({required this.label, required this.onTap});
-
- @override
- Widget build(BuildContext context) {
- final colors = context.componentColors;
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- label,
- style: TextStyles.bodyBold.copyWith(color: colors.primary),
- ),
- const SizedBox(width: 4),
- HugeIcon(
- icon: HugeIcons.strokeRoundedArrowRight01,
- color: colors.primary,
- size: 16,
- strokeWidth: 1.6,
- ),
- ],
- ),
- ),
- );
- }
-}
diff --git a/mobile/packages/ente_components/lib/components/settings_link.dart b/mobile/packages/ente_components/lib/components/settings_link.dart
new file mode 100644
index 0000000000..255df9dd96
--- /dev/null
+++ b/mobile/packages/ente_components/lib/components/settings_link.dart
@@ -0,0 +1,44 @@
+import 'package:ente_components/theme/spacing.dart';
+import 'package:ente_components/theme/text_styles.dart';
+import 'package:ente_components/theme/theme.dart';
+import 'package:flutter/material.dart';
+import 'package:hugeicons/hugeicons.dart';
+
+class SettingsLink extends StatelessWidget {
+ const SettingsLink({super.key, required this.label, required this.onTap});
+
+ final String label;
+ final VoidCallback onTap;
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: onTap,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: Spacing.sm,
+ vertical: Spacing.md,
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ label,
+ style: TextStyles.bodyBold.copyWith(color: colors.primary),
+ ),
+ const SizedBox(width: Spacing.xs),
+ HugeIcon(
+ icon: HugeIcons.strokeRoundedArrowRight01,
+ color: colors.primary,
+ size: 16,
+ strokeWidth: 1.6,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/mobile/packages/ente_components/lib/ente_components.dart b/mobile/packages/ente_components/lib/ente_components.dart
index 1ff3674486..c5586ac723 100644
--- a/mobile/packages/ente_components/lib/ente_components.dart
+++ b/mobile/packages/ente_components/lib/ente_components.dart
@@ -19,6 +19,7 @@ export 'components/selection_controls/radio_component.dart';
export 'components/selection_controls/toggle_switch_component.dart';
export 'components/selection_summary_chip_component.dart';
export 'components/settings_item.dart';
+export 'components/settings_link.dart';
export 'components/settings_page_scaffold.dart';
export 'components/slider_component.dart';
export 'components/stepper_component.dart';