Network status, poll submit feedback

This commit is contained in:
2025-08-08 02:56:44 +08:00
parent af8d87857e
commit 19c2457895
7 changed files with 214 additions and 58 deletions

View File

@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:island/models/poll.dart';
import 'package:island/pods/network.dart';
import 'package:island/widgets/alert.dart';
class PollSubmit extends ConsumerStatefulWidget {
const PollSubmit({
@@ -193,12 +195,11 @@ class _PollSubmitState extends ConsumerState<PollSubmit> {
// Only call onSubmit after server accepts
widget.onSubmit(Map<String, dynamic>.unmodifiable(_answers));
showSnackBar('Poll answer has been submitted.');
HapticFeedback.heavyImpact();
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Failed to submit poll: $e')));
}
showErrorAlert(e);
} finally {
if (mounted) {
setState(() {