sign in smoothness

This commit is contained in:
2024-08-26 16:09:15 +02:00
parent 3efa6f9df1
commit 339c6868ef
4 changed files with 28 additions and 28 deletions

View File

@@ -12,14 +12,16 @@ class AuthCheck extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: doesSessionExist(),
builder: (context, snapshot) {
if (snapshot.data == true) {
return const Home();
} else {
return const SignInOrRegister();
}
});
return Scaffold(
body: FutureBuilder(
future: doesSessionExist(),
builder: (context, snapshot) {
if (snapshot.data == true) {
return const Home();
} else {
return const SignInOrRegister();
}
}),
);
}
}

View File

@@ -55,25 +55,23 @@ class _AddOrViewPatientState extends State<AddOrViewPatient> {
return FutureBuilder(
future: fetchPatient(),
builder: (ctx, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
// Extracting data from snapshot object
//final data = snapshot.data as String;
return PatientView(
arguments: PatientViewArguments(
widget.arguments.signedInUser,
snapshot.requireData,
null,
null,
widget.arguments.type,
));
} else if (snapshot.connectionState == ConnectionState.waiting) {
return const Mihloadingcircle();
} else {
return AddPatient(signedInUser: widget.arguments.signedInUser);
}
// Checking if future is resolved
else if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasData) {
// Extracting data from snapshot object
//final data = snapshot.data as String;
return PatientView(
arguments: PatientViewArguments(
widget.arguments.signedInUser,
snapshot.requireData,
null,
null,
widget.arguments.type,
));
}
}
return AddPatient(signedInUser: widget.arguments.signedInUser);
},
);
}

View File

@@ -49,7 +49,7 @@ class _RegisterState extends State<Register> {
}),
);
if (response.statusCode == 201) {
Navigator.of(context).popAndPushNamed('/home');
Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false);
signUpSuccess();
// setState(() {
// successfulSignUp = true;

View File

@@ -95,7 +95,7 @@ class _SignInState extends State<SignIn> {
} else {
await signUserIn();
if (successfulSignIn) {
Navigator.of(context).popAndPushNamed('/home');
Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false);
}
}
}