Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add copy buttons to Report an issue text fields

ashilkn311687a10d2c
diff --git a/mobile/apps/photos/changes/report-issue-copy-fields.md b/mobile/apps/photos/changes/report-issue-copy-fields.md
new file mode 100644
index 0000000000..698a50726d
--- /dev/null
+++ b/mobile/apps/photos/changes/report-issue-copy-fields.md
@@ -0,0 +1 @@
+- Add a copy button to the Subject and Description fields on the Report an issue screen.
diff --git a/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
index 158d2248fe..409a5e876f 100644
--- a/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
@@ -1,5 +1,7 @@
import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
+import "package:flutter/services.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:logging/logging.dart";
import "package:photos/core/constants.dart";
import "package:photos/generated/l10n.dart";
@@ -32,6 +34,16 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);
+ final colors = context.componentColors;
+ final subjectHasText = _subjectController.text.isNotEmpty;
+ final descriptionHasText = _descriptionController.text.isNotEmpty;
+
+ Widget copyIcon() => HugeIcon(
+ icon: HugeIcons.strokeRoundedCopy01,
+ size: IconSizes.small,
+ color: colors.textLighter,
+ strokeWidth: 1.6,
+ );
return SettingsPageScaffold(
title: l10n.reportAnIssue,
@@ -52,8 +64,12 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
hintText: l10n.oneLineAboutTheIssue,
controller: _subjectController,
textCapitalization: TextCapitalization.sentences,
- isClearable: true,
maxLines: 1,
+ onChanged: (_) => setState(() {}),
+ suffix: subjectHasText ? copyIcon() : null,
+ onSuffixTap: subjectHasText
+ ? () => _copyToClipboard(_subjectController.text)
+ : null,
),
const SizedBox(height: 16),
TextInputComponent(
@@ -63,6 +79,11 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
textCapitalization: TextCapitalization.sentences,
maxLines: 6,
minLines: 6,
+ onChanged: (_) => setState(() {}),
+ suffix: descriptionHasText ? copyIcon() : null,
+ onSuffixTap: descriptionHasText
+ ? () => _copyToClipboard(_descriptionController.text)
+ : null,
),
const SizedBox(height: 16),
MenuComponent(
@@ -83,6 +104,13 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
);
}
+ Future<void> _copyToClipboard(String text) async {
+ await Clipboard.setData(ClipboardData(text: text));
+ if (mounted) {
+ showShortToast(context, AppLocalizations.of(context).copied);
+ }
+ }
+
Future<void> _onSend() async {
if (_isSending) {
return;