fixed list view breaking layout
This commit is contained in:
@@ -311,14 +311,11 @@ class _ChatBubbleState extends State<ChatBubble> with SingleTickerProviderStateM
|
|||||||
if(snapshot.connectionState == ConnectionState.waiting) return const Column(mainAxisSize: MainAxisSize.min, children: [LoadingSpinner()]);
|
if(snapshot.connectionState == ConnectionState.waiting) return const Column(mainAxisSize: MainAxisSize.min, children: [LoadingSpinner()]);
|
||||||
|
|
||||||
var pollData = snapshot.data!.data;
|
var pollData = snapshot.data!.data;
|
||||||
return ListView(
|
return SingleChildScrollView(
|
||||||
shrinkWrap: true,
|
child: PollOptionsList(
|
||||||
children: [
|
pollData: pollData,
|
||||||
PollOptionsList(
|
chatToken: widget.chatData.token,
|
||||||
pollData: pollData,
|
),
|
||||||
chatToken: widget.chatData.token
|
|
||||||
)
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -17,51 +17,51 @@ class PollOptionsList extends StatefulWidget {
|
|||||||
class _PollOptionsListState extends State<PollOptionsList> {
|
class _PollOptionsListState extends State<PollOptionsList> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Column(
|
Widget build(BuildContext context) => Column(
|
||||||
children: [
|
children: [
|
||||||
...widget.pollData.options.map<Widget>((option) {
|
...widget.pollData.options.map<Widget>((option) {
|
||||||
var optionId = widget.pollData.options.indexOf(option);
|
var optionId = widget.pollData.options.indexOf(option);
|
||||||
var votedSelf = widget.pollData.votedSelf.contains(optionId);
|
var votedSelf = widget.pollData.votedSelf.contains(optionId);
|
||||||
var portionsVisible = widget.pollData.votes is Map<String, dynamic>;
|
var portionsVisible = widget.pollData.votes is Map<String, dynamic>;
|
||||||
var votes = portionsVisible
|
var votes = portionsVisible
|
||||||
? (widget.pollData.votes['option-$optionId'] as num?) ?? 0
|
? (widget.pollData.votes['option-$optionId'] as num?) ?? 0
|
||||||
: 0;
|
: 0;
|
||||||
var numVoters = widget.pollData.numVoters ?? 0;
|
var numVoters = widget.pollData.numVoters ?? 0;
|
||||||
double portion = numVoters == 0 ? 0 : (votes / numVoters);
|
double portion = numVoters == 0 ? 0 : (votes / numVoters);
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
enabled: false,
|
// enabled: false,
|
||||||
isThreeLine: portionsVisible,
|
isThreeLine: portionsVisible,
|
||||||
dense: true,
|
dense: true,
|
||||||
title: Text(
|
title: Text(
|
||||||
option,
|
option,
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
),
|
|
||||||
leading: Icon(
|
|
||||||
votedSelf ? Icons.check_circle_outlined : Icons.circle_outlined,
|
|
||||||
color: votedSelf
|
|
||||||
? Theme.of(context).colorScheme.primary.withValues(alpha: 0.6)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant.withValues(alpha: 0.6),
|
|
||||||
),
|
|
||||||
subtitle: portionsVisible ? Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: LinearProgressIndicator(value: portion.clamp(0.0, 1.0)),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.only(left: 10),
|
|
||||||
child: Text('${(portion * 100).round()}%'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
) : null,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
ListTile(
|
|
||||||
title: Linkify(
|
|
||||||
text: 'Wenn du abstimmen möchtest, verwende die Webversion unter https://cloud.marianum-fulda.de/call/${widget.chatToken}',
|
|
||||||
onOpen: UrlOpener.onOpen,
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
),
|
),
|
||||||
)
|
leading: Icon(
|
||||||
],
|
votedSelf ? Icons.check_circle_outlined : Icons.circle_outlined,
|
||||||
);
|
color: votedSelf
|
||||||
|
? Theme.of(context).colorScheme.primary.withValues(alpha: 0.6)
|
||||||
|
: Theme.of(context).colorScheme.onSurfaceVariant.withValues(alpha: 0.6),
|
||||||
|
),
|
||||||
|
subtitle: portionsVisible ? Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: LinearProgressIndicator(value: portion.clamp(0.0, 1.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(left: 10),
|
||||||
|
child: Text('${(portion * 100).round()}%'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
) : null,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
ListTile(
|
||||||
|
title: Linkify(
|
||||||
|
text: 'Wenn du abstimmen möchtest, verwende die Webversion unter https://cloud.marianum-fulda.de/call/${widget.chatToken}',
|
||||||
|
onOpen: UrlOpener.onOpen,
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user