Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CHILD INTELLIGENT ASSESSMENT TOOL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-046
CHILD INTELLIGENT ASSESSMENT TOOL
Commits
d4d5d2bc
Commit
d4d5d2bc
authored
Oct 28, 2020
by
Dasun Madushanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update form
parent
6f49ad08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
0 deletions
+119
-0
MainAppDMT/lib/screens/Form/form.dart
MainAppDMT/lib/screens/Form/form.dart
+119
-0
No files found.
MainAppDMT/lib/screens/Form/form.dart
0 → 100644
View file @
d4d5d2bc
import
'package:DMTI_app/screens/Form/user.dart'
;
import
'package:flutter/material.dart'
;
typedef
OnDelete
(
);
class
UserForm
extends
StatefulWidget
{
final
User
user
;
final
state
=
_UserFormState
();
final
OnDelete
onDelete
;
UserForm
({
Key
key
,
this
.
user
,
this
.
onDelete
})
:
super
(
key:
key
);
@override
_UserFormState
createState
()
=>
state
;
bool
isValid
()
=>
state
.
validate
();
}
class
_UserFormState
extends
State
<
UserForm
>
{
final
form
=
GlobalKey
<
FormState
>();
@override
Widget
build
(
BuildContext
context
)
{
return
Padding
(
padding:
EdgeInsets
.
all
(
16
),
child:
Material
(
elevation:
1
,
clipBehavior:
Clip
.
antiAlias
,
borderRadius:
BorderRadius
.
circular
(
8
),
child:
Form
(
key:
form
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
AppBar
(
leading:
Icon
(
Icons
.
verified_user
),
elevation:
0
,
title:
Text
(
'User Details'
),
backgroundColor:
Theme
.
of
(
context
).
accentColor
,
centerTitle:
true
,
actions:
<
Widget
>[
IconButton
(
icon:
Icon
(
Icons
.
delete
),
onPressed:
widget
.
onDelete
,
)
],
),
Padding
(
padding:
EdgeInsets
.
only
(
left:
16
,
right:
16
,
top:
16
),
child:
TextFormField
(
initialValue:
widget
.
user
.
fullName
,
onSaved:
(
val
)
=>
widget
.
user
.
fullName
=
val
,
validator:
(
val
)
=>
val
.
length
>
3
?
null
:
'Full name is invalid'
,
decoration:
InputDecoration
(
labelText:
'Full Name'
,
hintText:
'Enter your full name'
,
icon:
Icon
(
Icons
.
person
),
isDense:
true
,
),
),
),
Padding
(
padding:
EdgeInsets
.
only
(
left:
16
,
right:
16
,
bottom:
24
),
child:
TextFormField
(
initialValue:
widget
.
user
.
email
,
onSaved:
(
val
)
=>
widget
.
user
.
email
=
val
,
validator:
(
val
)
=>
val
.
contains
(
'@'
)
?
null
:
'Email is invalid'
,
decoration:
InputDecoration
(
labelText:
'Email Address'
,
hintText:
'Enter your email'
,
icon:
Icon
(
Icons
.
email
),
isDense:
true
,
),
),
),
Padding
(
padding:
EdgeInsets
.
only
(
left:
16
,
right:
16
,
top:
16
),
child:
TextFormField
(
initialValue:
widget
.
user
.
age
,
onSaved:
(
val
)
=>
widget
.
user
.
age
=
val
,
validator:
(
val
)
=>
val
.
length
>
3
?
null
:
'Age is invalid'
,
decoration:
InputDecoration
(
labelText:
'4 years'
,
hintText:
'Enter Actual Age'
,
icon:
Icon
(
Icons
.
child_care
),
isDense:
true
,
),
),
),
Padding
(
padding:
EdgeInsets
.
only
(
left:
16
,
right:
16
,
top:
16
),
child:
TextFormField
(
initialValue:
widget
.
user
.
mentalage
,
onSaved:
(
val
)
=>
widget
.
user
.
mentalage
=
val
,
validator:
(
val
)
=>
val
.
length
>
3
?
null
:
'Mental age is invalid'
,
decoration:
InputDecoration
(
labelText:
'4 years'
,
hintText:
'Enter Mental age'
,
icon:
Icon
(
Icons
.
score
),
isDense:
true
,
),
),
)
],
),
),
),
);
}
///form validator
bool
validate
()
{
var
valid
=
form
.
currentState
.
validate
();
if
(
valid
)
form
.
currentState
.
save
();
return
valid
;
}
}
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