Skip to content

Commit 7165307

Browse files
committed
poll: Move vote count paddings inside children of Row
It makes it easier to adjust the size of the vote count box touch target later. This preserves most of the visuals. Except that when the vote count box is shorter than the voter names text, the padding between rows is gone. The end padding is equivalent to the spacing previously specified on the Row; the bottom padding is (mostly) equivalent to the padding specified on the outer (now removed) Padding. The ConstrainedBox is expanded because it now also contains the paddings. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 3b9131d commit 7165307

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

lib/widgets/poll.dart

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ class _PollWidgetState extends State<PollWidget> {
6868
store.users[userId]?.fullName ?? zulipLocalizations.unknownUserName)
6969
.join(', ');
7070

71-
return Padding(
72-
padding: const EdgeInsets.only(bottom: 5),
73-
child: Row(
74-
spacing: 5,
75-
crossAxisAlignment: CrossAxisAlignment.baseline,
76-
textBaseline: localizedTextBaseline(context),
77-
children: [
78-
ConstrainedBox(
79-
constraints: const BoxConstraints(minWidth: 25, minHeight: 25),
71+
return Row(
72+
crossAxisAlignment: CrossAxisAlignment.baseline,
73+
textBaseline: localizedTextBaseline(context),
74+
children: [
75+
ConstrainedBox(
76+
constraints: const BoxConstraints(
77+
minWidth: 25 + 5, minHeight: 25 + 5),
78+
child: Padding(
79+
padding: const EdgeInsetsDirectional.only(bottom: 5, end: 5),
8080
child: Container(
8181
// Inner padding preserves whitespace even when the text's
8282
// width approaches the button's min-width (e.g. because
@@ -89,17 +89,17 @@ class _PollWidgetState extends State<PollWidget> {
8989
child: Center(
9090
child: Text(option.voters.length.toString(),
9191
style: textStyleBold.copyWith(
92-
color: theme.colorPollVoteCountText, fontSize: 13))))),
93-
Expanded(
94-
child: Wrap(
95-
spacing: 5,
96-
children: [
97-
Text(option.text, style: textStyleBold.copyWith(fontSize: 16)),
98-
if (option.voters.isNotEmpty)
99-
// TODO(i18n): Localize parenthesis characters.
100-
Text('($voterNames)', style: textStyleVoterNames),
101-
])),
102-
]));
92+
color: theme.colorPollVoteCountText, fontSize: 13)))))),
93+
Expanded(
94+
child: Wrap(
95+
spacing: 5,
96+
children: [
97+
Text(option.text, style: textStyleBold.copyWith(fontSize: 16)),
98+
if (option.voters.isNotEmpty)
99+
// TODO(i18n): Localize parenthesis characters.
100+
Text('($voterNames)', style: textStyleVoterNames),
101+
])),
102+
]);
103103
}
104104

105105
return Column(

0 commit comments

Comments
 (0)