How to disable the Google signin button on Flutter build-in registration page

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!

1 Like

It’s probably not supposed to be disabled. But you can always just hit F12 on the class name and copy the source code to your project so you can modify it.

I suppose deleting GoogleProvider(clientId: CLIENT_ID), from providers would do the trick?

I would try to figure out how the list of providers that it gives you buttons for works. Why is google there but not apple or Facebook or any of the others? That would give you an idea of what has to happen. @tenhobi is likely correct, but if you knew how to add Sign in with Apple, that would probably tell you for sure.

1 Like