Skip to content

Instantly share code, notes, and snippets.

@salihgueler
Created August 26, 2022 15:03
Show Gist options
  • Save salihgueler/f5137deacab6006b45a349fd5d979728 to your computer and use it in GitHub Desktop.
Save salihgueler/f5137deacab6006b45a349fd5d979728 to your computer and use it in GitHub Desktop.
@override
Widget build(BuildContext context) {
return AppBackground(
child: AnimatedSize(
duration: const Duration(milliseconds: 250),
(1)
child: FutureBuilder<AuthSession>(
(2)
future: Amplify.Auth.fetchAuthSession(),
builder: (context, snapshot) {
(3)
if (snapshot.hasData) {
if (snapshot.data!.isSignedIn) {
context.go('/home');
}
// Update the UI on next step
return const SizedBox.shrink();
} else {
(4)
return const SizedBox(
height: 100,
child: Center(
child: CircularProgressIndicator(),
),
);
}
},
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment