Poll answer

This commit is contained in:
2025-08-06 01:37:38 +08:00
parent f3a8699389
commit a6d869ebf6
9 changed files with 1171 additions and 23 deletions

View File

@@ -36,6 +36,10 @@ class ComposeToolbar extends HookConsumerWidget {
ComposeLogic.saveDraft(ref, state);
}
void pickPoll() {
ComposeLogic.pickPoll(ref, state, context);
}
void showDraftManager() {
showModalBottomSheet(
context: context,
@@ -88,6 +92,25 @@ class ComposeToolbar extends HookConsumerWidget {
tooltip: 'linkAttachment'.tr(),
color: colorScheme.primary,
),
// Poll button with visual state when a poll is linked
ListenableBuilder(
listenable: state.pollId,
builder: (context, _) {
return IconButton(
onPressed: pickPoll,
icon: const Icon(Symbols.how_to_vote),
tooltip: 'poll'.tr(),
color: colorScheme.primary,
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(
state.pollId.value != null
? colorScheme.primary.withOpacity(0.15)
: null,
),
),
);
},
),
const Spacer(),
if (originalPost == null && state.isEmpty)
IconButton(