A better state and alerts
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:go_router/go_router.dart';
|
||||
import '../../providers/auth_provider.dart';
|
||||
import '../../providers/tickets_provider.dart';
|
||||
import '../../widgets/responsive_body.dart';
|
||||
import '../../utils/snackbar.dart';
|
||||
|
||||
class SignUpScreen extends ConsumerStatefulWidget {
|
||||
const SignUpScreen({super.key});
|
||||
@@ -46,9 +47,7 @@ class _SignUpScreenState extends ConsumerState<SignUpScreen> {
|
||||
Future<void> _handleSignUp() async {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
if (_selectedOfficeIds.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Select at least one office.')),
|
||||
);
|
||||
showWarningSnackBar(context, 'Select at least one office.');
|
||||
return;
|
||||
}
|
||||
setState(() => _isLoading = true);
|
||||
@@ -66,9 +65,7 @@ class _SignUpScreenState extends ConsumerState<SignUpScreen> {
|
||||
}
|
||||
} on Exception catch (error) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('Sign up failed: $error')));
|
||||
showErrorSnackBar(context, 'Sign up failed: $error');
|
||||
}
|
||||
} finally {
|
||||
if (mounted) {
|
||||
|
||||
Reference in New Issue
Block a user