I want to store the details of the user in a collection in my firestore database when I signup with the flutter fire UI auth package. so I can update the user details when I click on the profile screen
Here is my code:
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutterfire_ui/auth.dart';
import 'package:ghibliapp/src/screens/home_screen.dart';
import 'package:lottie/lottie.dart';
class AuthGate extends StatelessWidget {
const AuthGate({super.key});
@override
Widget build(BuildContext context) {
return StreamBuilder<User?>(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return SignInScreen(
showAuthActionSwitch: true,
subtitleBuilder: (context, action) {
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Text(
action == AuthAction.signIn
? 'Welcome to Ghibli! Please sign in to continue.'
: 'Welcome to Ghibli! Please create an account to continue',
),
);
},
footerBuilder: (context, action) {
return Padding(
padding: const EdgeInsets.only(top: 16),
child: Text(
action == AuthAction.signIn
? 'By signing in, you agree to our terms and conditions.'
: 'By signing up, you agree to our terms and conditions.',
style: const TextStyle(color: Colors.black),
),
);
},
headerBuilder: (context, constraints, _) {
return Padding(
padding: const EdgeInsets.all(20),
child: AspectRatio(aspectRatio: 1, child: LottieBuilder.asset("lib/assets/splash.json"),),
);
},
providerConfigs: const [
EmailProviderConfiguration(),
],
);
}
return const HomeScreen();
});
}
}
Any help would be appreciated.
1