Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
library-app-flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ilham Maulana
library-app-flutter
Commits
26b9540e
Commit
26b9540e
authored
Aug 01, 2024
by
Ilham Maulana
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: adding validator to loan book form
parent
bc0e46c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
book_loan_form.dart
lib/src/widgets/forms/book_loan_form.dart
+17
-5
No files found.
lib/src/widgets/forms/book_loan_form.dart
View file @
26b9540e
...
...
@@ -47,6 +47,15 @@ class _LoanBookForm extends State<LoanBookForm> {
),
keyboardType:
TextInputType
.
number
,
inputFormatters:
[
FilteringTextInputFormatter
.
digitsOnly
],
validator:
(
String
?
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
"Loan day cannot be empty"
;
}
else
if
(
value
is
int
)
{
return
"Please enter loan day in number"
;
}
else
{
return
null
;
}
},
),
),
actions:
[
...
...
@@ -58,11 +67,14 @@ class _LoanBookForm extends State<LoanBookForm> {
),
FilledButton
(
onPressed:
()
{
authProvider
.
createMemberLoan
(
authProvider
.
user
!.
accountId
,
widget
.
bookId
,
int
.
parse
(
loanDayController
.
text
),
);
if
(
_formKey
.
currentState
!.
validate
())
{}
authProvider
.
createMemberLoan
(
authProvider
.
user
!.
accountId
,
widget
.
bookId
,
int
.
parse
(
loanDayController
.
text
),
)
.
then
((
_
)
=>
Navigator
.
of
(
context
).
pop
());
},
child:
const
Text
(
'Submit'
),
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment