🐛 Fix poll percentage background
This commit is contained in:
parent
ec7650a920
commit
e5212419ae
@ -80,59 +80,64 @@ class _PostPollState extends State<PostPoll> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return LayoutBuilder(
|
||||||
margin: EdgeInsets.zero,
|
builder: (context, constraints) {
|
||||||
child: Column(
|
return Card(
|
||||||
children: [
|
margin: EdgeInsets.zero,
|
||||||
for (final option in _poll.options)
|
child: Column(
|
||||||
Stack(
|
children: [
|
||||||
children: [
|
for (final option in _poll.options)
|
||||||
ClipRRect(
|
Stack(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
children: [
|
||||||
child: Container(
|
ClipRRect(
|
||||||
height: 60,
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
width: MediaQuery.of(context).size.width *
|
child: Container(
|
||||||
(_poll.metric.byOptionsPercentage[option.id] ?? 0)
|
height: 60,
|
||||||
.toDouble(),
|
width: constraints.maxWidth *
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
(_poll.metric.byOptionsPercentage[option.id] ?? 0)
|
||||||
),
|
.toDouble(),
|
||||||
),
|
color:
|
||||||
ListTile(
|
Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
shape: RoundedRectangleBorder(
|
),
|
||||||
borderRadius: BorderRadius.circular(8),
|
),
|
||||||
),
|
ListTile(
|
||||||
minTileHeight: 60,
|
shape: RoundedRectangleBorder(
|
||||||
leading: _answeredChoice == option.id
|
borderRadius: BorderRadius.circular(8),
|
||||||
? const Icon(Symbols.circle, fill: 1)
|
),
|
||||||
: const Icon(Symbols.circle),
|
minTileHeight: 60,
|
||||||
title: Text(option.name),
|
leading: _answeredChoice == option.id
|
||||||
subtitle: Column(
|
? const Icon(Symbols.circle, fill: 1)
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
: const Icon(Symbols.circle),
|
||||||
mainAxisSize: MainAxisSize.min,
|
title: Text(option.name),
|
||||||
children: [
|
subtitle: Column(
|
||||||
Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Row(
|
||||||
'pollVotes'
|
mainAxisSize: MainAxisSize.min,
|
||||||
.plural(_poll.metric.byOptions[option.id] ?? 0),
|
children: [
|
||||||
),
|
Text(
|
||||||
Text(' · ').padding(horizontal: 4),
|
'pollVotes'.plural(
|
||||||
Text(
|
_poll.metric.byOptions[option.id] ?? 0),
|
||||||
'${((_poll.metric.byOptionsPercentage[option.id] ?? 0).toDouble() * 100).toStringAsFixed(2)}%',
|
),
|
||||||
|
Text(' · ').padding(horizontal: 4),
|
||||||
|
Text(
|
||||||
|
'${((_poll.metric.byOptionsPercentage[option.id] ?? 0).toDouble() * 100).toStringAsFixed(2)}%',
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
if (option.description.isNotEmpty)
|
||||||
|
Text(option.description),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (option.description.isNotEmpty)
|
onTap: _isBusy ? null : () => _voteForOption(option),
|
||||||
Text(option.description),
|
),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
onTap: _isBusy ? null : () => _voteForOption(option),
|
],
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
)
|
},
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user