ThunderIDSignedOut
ThunderIDSignedOut is a guard widget that renders its child only when the user is not authenticated. When the user is signed in it renders fallback instead (or nothing, if no fallback is provided).
This widget re-renders automatically whenever the auth state in the parent ThunderIDProvider changes.
Usage
import 'package:thunderid_flutter/thunderid_flutter.dart';
ThunderIDSignedOut(
child: const AuthScreen(),
fallback: const HomeScreen(),
)
Using ThunderIDSignedOut and ThunderIDSignedIn together in a root router:
Widget build(BuildContext context) {
final thunder = ThunderIDProvider.of(context);
if (!thunder.initialized) {
return const Scaffold(
body: Center(child: CircularProgressIndicator()),
);
}
return Scaffold(
body: Stack(
children: [
ThunderIDSignedIn(child: const HomeScreen()),
ThunderIDSignedOut(child: const AuthScreen()),
],
),
);
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
child | Widget | ✅ | Rendered when ThunderIDProvider.of(context).isSignedIn is false. |
fallback | Widget? | Rendered when the user is signed in. Defaults to const SizedBox.shrink() if omitted. |