refactored broad range of the application, split files, modularized calendar and file views, centralized bottom sheets and clipboard handling, and implemented unit test coverage
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../api/marianumcloud/talk/get_poll/get_poll_state.dart';
|
||||
import '../../../../widget/loading_spinner.dart';
|
||||
import 'poll_options_list.dart';
|
||||
|
||||
/// Opens the poll dialog that lets a user vote on a Talk poll attached to
|
||||
/// a message. Loads the poll state lazily and renders the option list.
|
||||
void showChatBubblePollDialog(
|
||||
BuildContext context, {
|
||||
required String chatToken,
|
||||
required String messageToken,
|
||||
required int pollId,
|
||||
required String pollName,
|
||||
}) {
|
||||
final pollState = GetPollState(token: messageToken, pollId: pollId).run();
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogCtx) => AlertDialog(
|
||||
title: Text(pollName, overflow: TextOverflow.ellipsis),
|
||||
content: FutureBuilder(
|
||||
future: pollState,
|
||||
builder: (_, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Column(mainAxisSize: MainAxisSize.min, children: [LoadingSpinner()]);
|
||||
}
|
||||
final pollData = snapshot.data!.data;
|
||||
return SingleChildScrollView(
|
||||
child: PollOptionsList(
|
||||
pollData: pollData,
|
||||
chatToken: chatToken,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogCtx).pop(),
|
||||
child: const Text('Zurück'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user