Widget build()

in packages/amplify_auth_cognito/example/lib/Widgets/SignInWidget.dart [92:208]


  Widget build(BuildContext context) {
    return Row(
      key: Key('signin-component'),
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: <Widget>[
        Expanded(
          // wrap your Column in Expanded
          child: Column(
            children: [
              TextFormField(
                  key: Key('signin-username-input'),
                  controller: usernameController,
                  decoration: const InputDecoration(
                    icon: Icon(Icons.person),
                    hintText: 'Your username',
                    labelText: 'Username *',
                  )),
              TextFormField(
                  key: Key('signin-password-input'),
                  obscureText: true,
                  controller: passwordController,
                  decoration: const InputDecoration(
                    icon: Icon(Icons.lock),
                    hintText: 'Your password',
                    labelText: 'Password *',
                  )),
              const Padding(padding: EdgeInsets.all(5.0)),
              GridView.count(
                shrinkWrap: true,
                crossAxisCount: 3,
                crossAxisSpacing: 3,
                mainAxisSpacing: 4,
                childAspectRatio: 3,
                padding: const EdgeInsets.all(5.0),
                children: [
                  ElevatedButton(
                    key: Key('signin-button'),
                    onPressed: _signIn,
                    child: const Text('Sign In'),
                  ),
                  ElevatedButton(
                    key: Key('signin-webui-button'),
                    onPressed: _signInWithWebUI,
                    child: const Text('Hosted UI Sign In'),
                  ),
                  ElevatedButton(
                    key: Key('goto-signup-button'),
                    onPressed: widget.showCreateUser,
                    child: const Text('Create User'),
                  ),
                  ElevatedButton(
                    key: Key('reset-button'),
                    onPressed: _resetPassword,
                    child: const Text('Reset Password'),
                  ),
                  ElevatedButton(
                    key: Key('signout-button'),
                    onPressed: widget.signOut,
                    child: const Text('SignOut'),
                  ),
                  ElevatedButton(
                    key: Key('session-button'),
                    onPressed: widget.fetchSession,
                    child: const Text('Get Session'),
                  ),
                  ElevatedButton(
                    key: Key('current-user-button'),
                    onPressed: widget.getCurrentUser,
                    child: const Text('Get Current User'),
                  ),
                ],
              ),
              ListView(
                  shrinkWrap: true,
                  padding: const EdgeInsets.all(5.0),
                  children: [
                    ElevatedButton(
                      key: Key('signin-webui-button'),
                      onPressed: _signInWithSocialWebUI,
                      child: const Text('Sign In With Social Provider'),
                    ),
                    DropdownButton<AuthProvider>(
                      value: provider,
                      icon: Icon(Icons.arrow_downward),
                      iconSize: 24,
                      elevation: 16,
                      style: TextStyle(color: Colors.deepPurple),
                      underline: Container(
                        height: 2,
                        color: Colors.deepPurpleAccent,
                      ),
                      onChanged: (AuthProvider? newValue) {
                        setState(() {
                          if (newValue != null) {
                            provider = newValue;
                          }
                        });
                      },
                      items: <AuthProvider>[
                        AuthProvider.google,
                        AuthProvider.facebook,
                        AuthProvider.amazon
                      ].map<DropdownMenuItem<AuthProvider>>(
                          (AuthProvider value) {
                        return DropdownMenuItem<AuthProvider>(
                          value: value,
                          child: Text(value.toString()),
                        );
                      }).toList(),
                    ),
                  ])
            ],
          ),
        ),
      ],
    );
  }