Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
medapp_eksad
Project
Project
Details
Activity
Releases
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
qorri_di
medapp_eksad
Commits
d65976f2
Commit
d65976f2
authored
Sep 02, 2022
by
Budi Prasetyo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/qorridi/medapp_eksad
parents
34fbd5f8
697b8c40
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
42 deletions
+138
-42
contact_api.dart
lib/api/contact_api.dart
+1
-0
user_api.dart
lib/api/user_api.dart
+24
-0
register.dart
lib/register.dart
+113
-41
small_contact_us2.dart
lib/screen_small/small_contact/small_contact_us2.dart
+0
-1
No files found.
lib/api/contact_api.dart
View file @
d65976f2
...
...
@@ -19,6 +19,7 @@ Future savecontact(nama, email, nohp, message) async {
// } else {
// return false;
// }
return
response
.
statusCode
;
}
Future
<
List
<
contact
>>
showcontact
()
async
{
...
...
lib/api/user_api.dart
View file @
d65976f2
import
'dart:convert'
;
import
'package:http/http.dart'
as
http
;
Future
<
bool
>
signup
(
nama
,
email
,
nohp
,
username
,
password
)
async
{
final
response
=
await
http
.
post
(
Uri
.
parse
(
'http://10.3.4.250:8081/medapp/v1/api/user/save'
),
body:
jsonEncode
({
"namaUser"
:
nama
,
"emailUser"
:
email
,
"noHp"
:
nohp
,
"username"
:
username
,
"password"
:
password
}),
headers:
{
'Content-type'
:
'application/json; charset=UTF-8'
,
}
);
if
(
response
.
statusCode
==
200
)
{
return
true
;
}
else
{
return
false
;
}
// return response.statusCode;
}
\ No newline at end of file
lib/register.dart
View file @
d65976f2
import
'package:flutter/material.dart'
;
import
'package:medapp_eksad/api/user_api.dart'
;
class
Register
extends
StatefulWidget
{
const
Register
({
Key
?
key
})
:
super
(
key:
key
);
...
...
@@ -10,6 +11,15 @@ class Register extends StatefulWidget {
class
_RegisterState
extends
State
<
Register
>
{
bool
_isObscure
=
true
;
final
_formKey
=
GlobalKey
<
FormState
>();
final
nameController
=
TextEditingController
();
final
emailController
=
TextEditingController
();
final
phoneController
=
TextEditingController
();
final
usernameController
=
TextEditingController
();
final
pwController
=
TextEditingController
();
@override
Widget
build
(
BuildContext
context
)
{
var
screenize
=
MediaQuery
.
of
(
context
).
size
;
...
...
@@ -17,7 +27,7 @@ class _RegisterState extends State<Register> {
body:
Container
(
height:
screenize
.
height
,
width:
screenize
.
width
,
decoration:
BoxDecoration
(
decoration:
const
BoxDecoration
(
image:
DecorationImage
(
image:
AssetImage
(
"assets/images/register.jpg"
),
fit:
BoxFit
.
fill
,
...
...
@@ -32,7 +42,7 @@ class _RegisterState extends State<Register> {
children:
[
Container
(
decoration:
BoxDecoration
(
color:
Color
.
fromARGB
(
255
,
10
,
116
,
255
),
color:
const
Color
.
fromARGB
(
255
,
10
,
116
,
255
),
borderRadius:
BorderRadius
.
circular
(
20
),
),
width:
screenize
.
width
*
0.36
,
...
...
@@ -54,27 +64,28 @@ class _RegisterState extends State<Register> {
borderRadius:
BorderRadius
.
circular
(
20
),
border:
Border
.
all
(
width:
5
,
color:
Color
.
fromARGB
(
255
,
10
,
116
,
255
),
color:
const
Color
.
fromARGB
(
255
,
10
,
116
,
255
),
),
boxShadow:
[
BoxShadow
(
color:
Color
.
fromARGB
(
255
,
10
,
116
,
255
).
withAlpha
(
60
),
color:
const
Color
.
fromARGB
(
255
,
10
,
116
,
255
).
withAlpha
(
60
),
blurRadius:
15.0
,
spreadRadius:
20.0
,
offset:
Offset
(
offset:
const
Offset
(
0.0
,
3.0
,
),
),],
),
child:
Form
(
key:
_formKey
,
child:
Container
(
padding:
EdgeInsets
.
only
(
left:
screenize
.
width
*
0.045
,
top:
screenize
.
height
*
0.0
5
top:
screenize
.
height
*
0.0
2
),
width:
screenize
.
width
*
0.36
,
height:
screenize
.
height
*
0.
9
,
height:
screenize
.
height
*
0.
8
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -85,7 +96,7 @@ class _RegisterState extends State<Register> {
height:
screenize
.
width
*
0.02
,
child:
Image
.
asset
(
"assets/logo/medapp-logo.png"
),
),
SizedBox
(
height:
20
,),
const
SizedBox
(
height:
20
,),
Row
(
children:
[
Icon
(
...
...
@@ -93,34 +104,34 @@ class _RegisterState extends State<Register> {
color:
Colors
.
grey
[
500
],
size:
screenize
.
width
*
0.01
,
),
SizedBox
(
const
SizedBox
(
width:
10
,
),
Text
(
"Nama"
),
const
Text
(
"Nama"
),
],
),
SizedBox
(
height:
5
,),
const
SizedBox
(
height:
5
,),
Row
(
children:
[
Container
(
SizedBox
(
height:
40
,
width:
screenize
.
width
*
0.2
,
child:
TextFormField
(
controller:
nameController
,
textAlign:
TextAlign
.
start
,
decoration:
InputDecoration
(
labelText:
"Nama Lengkap"
,
hintStyle:
TextStyle
(),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)
),
onChanged:
null
,
),
)
],
),
SizedBox
(
height:
10
,),
const
SizedBox
(
height:
10
,),
Row
(
children:
[
Icon
(
...
...
@@ -128,34 +139,34 @@ class _RegisterState extends State<Register> {
color:
Colors
.
grey
[
500
],
size:
screenize
.
width
*
0.01
,
),
SizedBox
(
const
SizedBox
(
width:
10
,
),
Text
(
"Email"
),
const
Text
(
"Email"
),
],
),
SizedBox
(
height:
5
,),
const
SizedBox
(
height:
5
,),
Row
(
children:
[
Container
(
SizedBox
(
height:
40
,
width:
screenize
.
width
*
0.2
,
child:
TextFormField
(
controller:
emailController
,
textAlign:
TextAlign
.
start
,
decoration:
InputDecoration
(
labelText:
"Email Valid"
,
hintStyle:
TextStyle
(),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)
),
onChanged:
null
,
),
)
],
),
SizedBox
(
height:
10
,),
const
SizedBox
(
height:
10
,),
Row
(
children:
[
Icon
(
...
...
@@ -163,34 +174,33 @@ class _RegisterState extends State<Register> {
color:
Colors
.
grey
[
500
],
size:
screenize
.
width
*
0.01
,
),
SizedBox
(
const
SizedBox
(
width:
10
,
),
Text
(
"No Hp"
),
const
Text
(
"No Hp"
),
],
),
SizedBox
(
height:
5
,),
const
SizedBox
(
height:
5
,),
Row
(
children:
[
Container
(
SizedBox
(
height:
40
,
width:
screenize
.
width
*
0.2
,
child:
TextFormField
(
controller:
phoneController
,
textAlign:
TextAlign
.
start
,
decoration:
InputDecoration
(
labelText:
"Nomor Handphone"
,
hintStyle:
TextStyle
(),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)
),
onChanged:
null
,
),
)
],
),
SizedBox
(
height:
10
,),
const
SizedBox
(
height:
10
,),
Row
(
children:
[
Icon
(
...
...
@@ -198,17 +208,53 @@ class _RegisterState extends State<Register> {
color:
Colors
.
grey
[
500
],
size:
screenize
.
width
*
0.01
,
),
const
SizedBox
(
width:
10
,
),
const
Text
(
"Username"
),
],
),
const
SizedBox
(
height:
5
,),
Row
(
children:
[
SizedBox
(
height:
40
,
width:
screenize
.
width
*
0.2
,
child:
TextFormField
(
controller:
usernameController
,
textAlign:
TextAlign
.
start
,
decoration:
InputDecoration
(
labelText:
"Username"
,
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)
),
),
)
],
),
const
SizedBox
(
height:
10
,),
Row
(
children:
[
Icon
(
Icons
.
email_outlined
,
color:
Colors
.
grey
[
500
],
size:
screenize
.
width
*
0.01
,
),
const
SizedBox
(
width:
10
,
),
Text
(
"Username
"
),
const
Text
(
"Password
"
),
],
),
SizedBox
(
height:
5
,),
Container
(
const
SizedBox
(
height:
5
,),
SizedBox
(
height:
40
,
width:
screenize
.
width
*
0.2
,
child:
TextFormField
(
controller:
pwController
,
textAlign:
TextAlign
.
start
,
obscureText:
_isObscure
,
decoration:
InputDecoration
(
...
...
@@ -224,43 +270,69 @@ class _RegisterState extends State<Register> {
});
},
),
hintStyle:
TextStyle
(),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
)
),
),
),
),
Spacer
(
const
Spacer
(
flex:
4
,
),
Row
(
children:
[
Container
(
SizedBox
(
height:
30
,
width:
screenize
.
width
*
0.09
,
child:
ElevatedButton
(
onPressed:
(){
},
child:
Text
(
"LOGIN"
),
child:
const
Text
(
"LOGIN"
),
),
),
SizedBox
(
width:
screenize
.
width
*
0.02
,
),
Container
(
SizedBox
(
height:
30
,
width:
screenize
.
width
*
0.09
,
child:
ElevatedButton
(
onPressed:
(){
onPressed:
()
async
{
if
(
_formKey
.
currentState
!.
validate
()){
final
response
=
await
signup
(
nameController
.
value
.
text
,
emailController
.
value
.
text
,
phoneController
.
value
.
text
,
usernameController
.
value
.
text
,
pwController
.
value
.
text
);
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
response
==
true
?
const
SnackBar
(
content:
Text
(
"Registrasi berhasil ! cek email untuk validasi"
),
backgroundColor:
Colors
.
green
,)
:
const
SnackBar
(
content:
Text
(
"Registrasi gagal"
),
backgroundColor:
Colors
.
red
,)
);
print
(
nameController
.
value
.
text
+
emailController
.
value
.
text
+
phoneController
.
value
.
text
+
usernameController
.
value
.
text
+
pwController
.
value
.
text
);
nameController
.
clear
();
emailController
.
clear
();
phoneController
.
clear
();
usernameController
.
clear
();
pwController
.
clear
();
}
},
child:
Text
(
"REGISTER"
),
child:
const
Text
(
"REGISTER"
),
),
)
],
),
Spacer
(
const
Spacer
(
flex:
7
,
)
],
...
...
lib/screen_small/small_contact/small_contact_us2.dart
View file @
d65976f2
...
...
@@ -249,7 +249,6 @@ class _ContactUs2_smallState extends State<ContactUs2_small> {
Text
(
'Failed to send message!'
),
backgroundColor:
Colors
.
red
),
);
nameController
.
clear
();
phoneController
.
clear
();
emailController
.
clear
();
...
...
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