Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 他の関数など...
void _updateFormType(EmailPasswordSignInFormType formType) {
model.updateFormType(formType);
_emailController.clear();
_passwordController.clear();
}
Widget _buildContent() {
return FocusScope(
node: _node,
child: Form(
onChanged: () => model.updateWith(
email: _emailController.text, password: _passwordController.text),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const SizedBox(height: 8.0),
_buildEmailField(),
if (model.formType != EmailPasswordSignInFormType.forgotPassword) ...<Widget>[
const SizedBox(height: 8.0),
_buildPasswordField(),
],
const SizedBox(height: 8.0),
FormSubmitButton(
key: const Key('primary-button'),
text: model.primaryButtonText,
initialLoading: model.isLoading,
onPressed: model.isLoading ? null : _submit,
),
const SizedBox(height: 8.0),
TextButton(
key: const Key('secondary-button'),
child: Text(model.secondaryButtonText),
onPressed: model.isLoading
? null
: () => _updateFormType(model.secondaryActionFormType),
),
if (model.formType == EmailPasswordSignInFormType.signIn)
TextButton(
key: const Key('tertiary-button'),
child: const Text(
EmailPasswordSignInStrings.forgotPasswordQuestion),
onPressed: model.isLoading
? null
: () => _updateFormType(
EmailPasswordSignInFormType.forgotPassword),
),
],
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment