Hi everyone,
I am new to Flutter and currently learn to build the sign-in & register experience for my app. I am using the Flutter build-in SignInScreen to speed up my development to support email and google sign-in. Here is my code snipit
class AuthGate extends StatelessWidget {
const AuthGate({super.key, required this.title});
final String title;
static const routeName = '/auth_gate';
static const pageName = 'Auth Gate';
@override
Widget build(BuildContext context) {
return StreamBuilder<User?>(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return SignInScreen(
providers: [
EmailAuthProvider(),
GoogleProvider(clientId: CLIENT_ID),
],
headerBuilder: (context, constraints, shrinkOffset) {
return Padding(
padding: const EdgeInsets.all(20),
child: AspectRatio(
aspectRatio: 1,
child: Image.asset('assets/images/flutter_logo.png'),
),
);
},
subtitleBuilder: (context, action) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: action == AuthAction.signIn
? const Text('Welcome to APP, please sign in!')
: const Text('Welcome to APP, please sign up!'),
);
},
footerBuilder: (context, action) {
return const Padding(
padding: EdgeInsets.only(top: 16),
child: Text(
'By signing in, you agree to our terms and conditions.',
style: TextStyle(color: Colors.grey),
),
);
},
);
}
return const MyHomePage(title: MyHomePage.pageName);
},
);
}
}
The sign in page looks good to me. But the register page (by clicking the “Register” text) also shows the google sign-in button:
I spent a lot of time to read the source code but cannot figure out a way to disable (remove) the google sign-in button in the build-in register screen.
Any thoughts? Is the only way to build customized login and register screen?
Thanks!