Skip to content

Commit 165c221

Browse files
committed
Add tooltip for idea copy action and update interaction method in IdeasListWidget
1 parent fc3fffe commit 165c221

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

lib/common/strings.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const String inspirationHeader = 'Running out of ideas? Try counting these:';
5050
String noInspirationTitle(String name) => 'No inspiration ideas yet for $name.';
5151
const String noInspirationSubtitle = 'Use this counter for anything you\'d like!';
5252
const String ideaCopied = 'Idea copied to clipboard!';
53+
const String ideaCopyTooltip = 'Tap to copy idea';
5354

5455
// -----------------------------------------------------------------------------
5556
// Settings Screen

lib/screens/inspiration_screen.dart

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ class _IdeasListWidget extends StatelessWidget {
130130
}
131131

132132
/// Widget that displays a single idea list item with a colored dot.
133+
///
134+
/// Easter egg: Tap the colored dot to copy the idea text to clipboard.
133135
class _IdeaListItem extends StatelessWidget {
134136
const _IdeaListItem({
135137
required this.idea,
@@ -142,23 +144,29 @@ class _IdeaListItem extends StatelessWidget {
142144
/// The color of the leading dot.
143145
final Color dotColor;
144146

145-
/// Handles long press to copy the idea to clipboard.
146-
void _onLongPress(BuildContext context) {
147+
/// Handles tap on the dot to copy the idea to clipboard.
148+
void _onDotPress(BuildContext context) {
147149
Clipboard.setData(ClipboardData(text: idea));
148150
utils.showSnackBar(context, strings.ideaCopied);
149151
}
150152

151153
@override
152154
Widget build(BuildContext context) {
153155
return ListTile(
156+
contentPadding: const .symmetric(horizontal: 8.0),
157+
horizontalTitleGap: 8.0,
158+
minLeadingWidth: 0.0,
154159
visualDensity: .comfortable,
155-
minLeadingWidth: 20.0,
156-
leading: Icon(Icons.circle, size: 12.0, color: dotColor),
160+
leading: IconButton(
161+
visualDensity: .compact,
162+
tooltip: strings.ideaCopyTooltip,
163+
onPressed: () => _onDotPress(context),
164+
icon: Icon(Icons.circle, size: 12.0, color: dotColor),
165+
),
157166
title: Text(
158167
idea,
159168
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 15.0),
160169
),
161-
onLongPress: () => _onLongPress(context),
162170
);
163171
}
164172
}

0 commit comments

Comments
 (0)