🐛 Fix poll percentage background

This commit is contained in:
LittleSheep 2025-03-16 22:13:19 +08:00
parent ec7650a920
commit e5212419ae

View File

@ -80,6 +80,8 @@ class _PostPollState extends State<PostPoll> {
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
return Card(
margin: EdgeInsets.zero,
child: Column(
@ -91,10 +93,11 @@ class _PostPollState extends State<PostPoll> {
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: Container(
height: 60,
width: MediaQuery.of(context).size.width *
width: constraints.maxWidth *
(_poll.metric.byOptionsPercentage[option.id] ?? 0)
.toDouble(),
color: Theme.of(context).colorScheme.surfaceContainerHigh,
color:
Theme.of(context).colorScheme.surfaceContainerHigh,
),
),
ListTile(
@ -114,8 +117,8 @@ class _PostPollState extends State<PostPoll> {
mainAxisSize: MainAxisSize.min,
children: [
Text(
'pollVotes'
.plural(_poll.metric.byOptions[option.id] ?? 0),
'pollVotes'.plural(
_poll.metric.byOptions[option.id] ?? 0),
),
Text(' · ').padding(horizontal: 4),
Text(
@ -134,5 +137,7 @@ class _PostPollState extends State<PostPoll> {
],
),
);
},
);
}
}