changed poll dialog to only show results
This commit is contained in:
@@ -7,8 +7,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:open_filex/open_filex.dart';
|
||||
import '../../../../api/marianumcloud/talk/getPoll/getPollState.dart';
|
||||
import '../../../../api/marianumcloud/talk/votePoll/votePoll.dart';
|
||||
import '../../../../api/marianumcloud/talk/votePoll/votePollParams.dart';
|
||||
import '../../../../extensions/text.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -305,7 +303,6 @@ class _ChatBubbleState extends State<ChatBubble> with SingleTickerProviderStateM
|
||||
if(message.originalData?['object']?.type == RichObjectStringObjectType.talkPoll) {
|
||||
var pollId = int.parse(message.originalData!['object']!.id);
|
||||
var pollState = GetPollState(token: widget.bubbleData.token, pollId: pollId).run();
|
||||
List<int>? ownVotes;
|
||||
showDialog(context: context, builder: (context) => AlertDialog(
|
||||
title: Text(message.originalData!['object']!.name, textScaler: TextScaler.linear(0.9)),
|
||||
content: FutureBuilder(
|
||||
@@ -314,26 +311,20 @@ class _ChatBubbleState extends State<ChatBubble> with SingleTickerProviderStateM
|
||||
if(snapshot.connectionState == ConnectionState.waiting) return const Column(mainAxisSize: MainAxisSize.min, children: [LoadingSpinner()]);
|
||||
|
||||
var pollData = snapshot.data!.data;
|
||||
ownVotes = pollData.votedSelf;
|
||||
return PollOptionsList(
|
||||
pollData: pollData,
|
||||
callback: (votes) => ownVotes = votes
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
PollOptionsList(
|
||||
pollData: pollData
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
),
|
||||
actions: [
|
||||
FutureBuilder(future: pollState, builder: (context, snapshot) => TextButton(
|
||||
onPressed: () async {
|
||||
if(snapshot.connectionState != ConnectionState.done) return;
|
||||
Navigator.of(context).pop();
|
||||
if(ownVotes == null) return;
|
||||
VotePoll(pollId: pollId, token: widget.bubbleData.token, params: VotePollParams(optionIds: ownVotes!)).run();
|
||||
},
|
||||
child: const Text('Stimme abgeben')
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Abbrechen')
|
||||
child: const Text('Zurück')
|
||||
),
|
||||
],
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user