From f45a04937f737bb62d5f866428c766f029bbf64b Mon Sep 17 00:00:00 2001 From: MritunjayTiwari14 Date: Sun, 21 Sep 2025 17:48:11 +0530 Subject: [PATCH] poll: Display ink splash UI feedback on voting This replaces a GestureDetector with a Material and InkWell combination for vote count button, the latter combination ensure a ripple effect on poll voting tap. Fixes: #1808 --- lib/widgets/poll.dart | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/widgets/poll.dart b/lib/widgets/poll.dart index b851c55525..1bc4f2e20b 100644 --- a/lib/widgets/poll.dart +++ b/lib/widgets/poll.dart @@ -87,32 +87,32 @@ class _PollWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.baseline, textBaseline: localizedTextBaseline(context), children: [ - GestureDetector( - // TODO: Implement feedback when the user taps the button - onTap: () => _toggleVote(option), - behavior: HitTestBehavior.translucent, - child: ConstrainedBox( - constraints: const BoxConstraints(minWidth: 44, minHeight: 44), - child: Padding( - // For accessibility, the touch target is padded to be larger - // than the vote count box. Still, we avoid padding at the - // start because we want to align all the poll options to the - // surrounding messages. - padding: const EdgeInsetsDirectional.only( - end: 5, top: verticalPadding, bottom: verticalPadding), - child: Container( - // Inner padding preserves whitespace even when the text's - // width approaches the button's min-width (e.g. because - // there are more than three digits). - padding: const EdgeInsets.symmetric(horizontal: 4), - decoration: BoxDecoration( - color: theme.colorPollVoteCountBackground, - border: Border.all(color: theme.colorPollVoteCountBorder), - borderRadius: BorderRadius.circular(3)), - child: Center( - child: Text(option.voters.length.toString(), - style: textStyleBold.copyWith( - color: theme.colorPollVoteCountText, fontSize: 20))))))), + ConstrainedBox( + constraints: const BoxConstraints(minWidth: 44, minHeight: 44), + child: Padding( + // For accessibility, the touch target is padded to be larger + // than the vote count box. Still, we avoid padding at the + // start because we want to align all the poll options to the + // surrounding messages. + padding: const EdgeInsetsDirectional.only( + end: 5, top: verticalPadding, bottom: verticalPadding), + child: Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(3), + side: BorderSide(color: theme.colorPollVoteCountBorder)), + color: theme.colorPollVoteCountBackground, + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: () => _toggleVote(option), + child: Padding( + // Inner padding preserves whitespace even when the text's + // width approaches the button's min-width (e.g. because + // there are more than three digits). + padding: const EdgeInsets.symmetric(horizontal: 4), + child: Center( + child: Text(option.voters.length.toString(), + style: textStyleBold.copyWith( + color: theme.colorPollVoteCountText, fontSize: 20)))))))), Expanded( child: Padding( // This and the padding on the vote count box both extend the row