Skip to content

Commit ce79d54

Browse files
author
MritunjayTiwari14
committed
poll: Display UI feedback on poll delay.
In this commit, we added Material, InkWell and Ink Widget to account for the Ink Splash effect for UI feedback. Fixes: #1808
1 parent 3730c90 commit ce79d54

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

lib/widgets/poll.dart

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,28 @@ class _PollWidgetState extends State<PollWidget> {
8787
crossAxisAlignment: CrossAxisAlignment.baseline,
8888
textBaseline: localizedTextBaseline(context),
8989
children: [
90-
GestureDetector(
91-
// TODO: Implement feedback when the user taps the button
92-
onTap: () => _toggleVote(option),
93-
behavior: HitTestBehavior.translucent,
94-
child: ConstrainedBox(
95-
constraints: const BoxConstraints(minWidth: 44, minHeight: 44),
96-
child: Padding(
97-
// For accessibility, the touch target is padded to be larger
98-
// than the vote count box. Still, we avoid padding at the
99-
// start because we want to align all the poll options to the
100-
// surrounding messages.
101-
padding: const EdgeInsetsDirectional.only(
102-
end: 5, top: verticalPadding, bottom: verticalPadding),
103-
child: Container(
104-
// Inner padding preserves whitespace even when the text's
105-
// width approaches the button's min-width (e.g. because
106-
// there are more than three digits).
107-
padding: const EdgeInsets.symmetric(horizontal: 4),
108-
decoration: BoxDecoration(
109-
color: theme.colorPollVoteCountBackground,
110-
border: Border.all(color: theme.colorPollVoteCountBorder),
111-
borderRadius: BorderRadius.circular(3)),
112-
child: Center(
113-
child: Text(option.voters.length.toString(),
114-
style: textStyleBold.copyWith(
115-
color: theme.colorPollVoteCountText, fontSize: 20))))))),
90+
ConstrainedBox(
91+
constraints: const BoxConstraints(minWidth: 44, minHeight: 44),
92+
child: Padding(
93+
padding: const EdgeInsetsDirectional.only(
94+
end: 5, top: verticalPadding, bottom: verticalPadding),
95+
child: Material(
96+
color: Colors.transparent,
97+
child: InkWell(
98+
onTap: () => _toggleVote(option),
99+
child: Ink(
100+
// Inner padding preserves whitespace even when the text's
101+
// width approaches the button's min-width (e.g. because
102+
// there are more than three digits).
103+
padding: const EdgeInsets.symmetric(horizontal: 4),
104+
decoration: BoxDecoration(
105+
color: theme.colorPollVoteCountBackground,
106+
border: Border.all(color: theme.colorPollVoteCountBorder),
107+
borderRadius: BorderRadius.circular(3)),
108+
child: Center(
109+
child: Text(option.voters.length.toString(),
110+
style: textStyleBold.copyWith(
111+
color: theme.colorPollVoteCountText, fontSize: 20)))))))),
116112
Expanded(
117113
child: Padding(
118114
// This and the padding on the vote count box both extend the row

0 commit comments

Comments
 (0)