D1APP-43 submit action added

This commit is contained in:
MohammadTaha Basiri 2022-01-15 15:58:12 +03:30
parent 09eb21841a
commit f692eb77fb
2 changed files with 4 additions and 2 deletions

View File

@ -29,6 +29,7 @@ class _PasswordInputState extends State<PasswordInput> {
key: _formKey,
child: DidvanTextField(
onChanged: (value) => state.password = value,
onSubmitted: (value) => _onLogin(context),
autoFocus: true,
title: 'کلمه عبور',
hintText: 'کلمه عبور',
@ -51,7 +52,7 @@ class _PasswordInputState extends State<PasswordInput> {
),
const Spacer(),
DidvanButton(
onPressed: () => _onPressed(context),
onPressed: () => _onLogin(context),
title: 'ورود',
),
const SizedBox(
@ -61,7 +62,7 @@ class _PasswordInputState extends State<PasswordInput> {
);
}
Future<void> _onPressed(BuildContext context) async {
Future<void> _onLogin(BuildContext context) async {
if (!_formKey.currentState!.validate()) {
return;
}

View File

@ -29,6 +29,7 @@ class _UsernameInputState extends State<UsernameInput> {
title: 'نام کاربری یا شماره موبایل',
hintText: 'نام کاربری یا شماره موبایل',
textAlign: TextAlign.center,
onSubmitted: (value) => state.confirmUsername(),
validator: (value) {
if (value.contains(' ')) {
return 'نام کاربری باید بدون فاصله باشد';