From 86bacaa9f53c944d2600c76632a14263d556b332 Mon Sep 17 00:00:00 2001 From: Rafael <1024481@stud.hs-mannheim.de> Date: Sun, 16 Jun 2024 01:45:29 +0200 Subject: [PATCH] Navigate to AuthGate upon registration completion. --- lib/forms/risks_form.dart | 14 +++++--------- lib/main.dart | 1 - lib/pages/registration_complete_page.dart | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/forms/risks_form.dart b/lib/forms/risks_form.dart index 07d3a43..e3839df 100644 --- a/lib/forms/risks_form.dart +++ b/lib/forms/risks_form.dart @@ -5,6 +5,7 @@ import '../constants.dart'; import '../enumerations.dart'; import '../pages/registration_complete_page.dart'; import '../services/auth/auth_service.dart'; +import '../utils/helper_dialogs.dart'; class RisksFormPage extends StatefulWidget { const RisksFormPage( @@ -77,22 +78,17 @@ class RisksFormPageState extends State { } void _showSnackBar(String message) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(message)), - ); + showErrorSnackBar(context, message); } Future handleSubmit() async { if (communicationPreference == null) { - ScaffoldMessenger.of(context).showSnackBar(const SnackBar( - content: Text('Please select a communication preference.'), - )); + showErrorSnackBar(context, 'Please select a communication preference.'); return; } if (riskPreference == null) { - ScaffoldMessenger.of(context).showSnackBar(const SnackBar( - content: Text('Please select the willingness to take risks.'), - )); + showErrorSnackBar( + context, 'Please select the willingness to take risks.'); return; } // Handle the form submission logic here diff --git a/lib/main.dart b/lib/main.dart index aebd4e6..0fa28d7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -28,7 +28,6 @@ void main() async { class MyApp extends StatelessWidget { const MyApp({super.key}); - // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( diff --git a/lib/pages/registration_complete_page.dart b/lib/pages/registration_complete_page.dart index 1c6569b..a5c6560 100644 --- a/lib/pages/registration_complete_page.dart +++ b/lib/pages/registration_complete_page.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'home_page.dart'; +import '../services/auth/auth_gate.dart'; class RegistrationCompletePage extends StatelessWidget { const RegistrationCompletePage({super.key}); @@ -45,7 +45,7 @@ class RegistrationCompletePage extends StatelessWidget { onPressed: () { Navigator.push( context, - MaterialPageRoute(builder: (context) => const HomePage()), + MaterialPageRoute(builder: (context) => const AuthGate()), ); }, child: const Text('S T A R T'),