develop-polls #93
@@ -1 +1,3 @@
|
|||||||
extensions:
|
extensions:
|
||||||
|
- provider: true
|
||||||
|
- shared_preferences: true
|
||||||
@@ -311,7 +311,7 @@ class _ChatBubbleState extends State<ChatBubble> with SingleTickerProviderStateM
|
|||||||
content: FutureBuilder(
|
content: FutureBuilder(
|
||||||
future: pollState,
|
future: pollState,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if(snapshot.connectionState == ConnectionState.waiting) return const LoadingSpinner();
|
if(snapshot.connectionState == ConnectionState.waiting) return const Column(mainAxisSize: MainAxisSize.min, children: [LoadingSpinner()]);
|
||||||
|
|
||||||
var pollData = snapshot.data!.data;
|
var pollData = snapshot.data!.data;
|
||||||
ownVotes = pollData.votedSelf;
|
ownVotes = pollData.votedSelf;
|
||||||
@@ -322,14 +322,15 @@ class _ChatBubbleState extends State<ChatBubble> with SingleTickerProviderStateM
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
FutureBuilder(future: pollState, builder: (context, snapshot) => TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.of(context).pop();
|
if(snapshot.connectionState != ConnectionState.done) return;
|
||||||
if(ownVotes == null) return;
|
Navigator.of(context).pop();
|
||||||
VotePoll(pollId: pollId, token: widget.bubbleData.token, params: VotePollParams(optionIds: ownVotes!)).run();
|
if(ownVotes == null) return;
|
||||||
},
|
VotePoll(pollId: pollId, token: widget.bubbleData.token, params: VotePollParams(optionIds: ownVotes!)).run();
|
||||||
child: const Text('Stimme abgeben')
|
},
|
||||||
),
|
child: const Text('Stimme abgeben')
|
||||||
|
)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
child: const Text('Abbrechen')
|
child: const Text('Abbrechen')
|
||||||
|
|||||||
@@ -22,11 +22,10 @@ class _PollOptionsListState extends State<PollOptionsList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => ListView(
|
Widget build(BuildContext context) => Column(
|
||||||
|
Pupsi marked this conversation as resolved
Outdated
|
|||||||
shrinkWrap: true,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
...widget.pollData.options.map<Widget>(
|
...widget.pollData.options.map<Widget>((option) => CheckboxListTile(
|
||||||
(option) => CheckboxListTile(
|
|
||||||
value: ownVotes.contains(widget.pollData.options.indexOf(option)),
|
value: ownVotes.contains(widget.pollData.options.indexOf(option)),
|
||||||
title: Text(option),
|
title: Text(option),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user
format ist komisch