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
51056ab5
Commit
51056ab5
authored
Sep 02, 2022
by
Arham Aulia Nugraha
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/qorridi/medapp_eksad
parents
85d2ba63
d65976f2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
35 deletions
+88
-35
wa_api.dart
lib/api/wa_api.dart
+2
-2
admin_whatsapp.dart
lib/dashboard/admin/admin_whatsapp.dart
+67
-6
whatsapp.dart
lib/widget/whatsapp.dart
+19
-27
No files found.
lib/api/wa_api.dart
View file @
51056ab5
...
@@ -3,7 +3,7 @@ import 'dart:convert';
...
@@ -3,7 +3,7 @@ import 'dart:convert';
import
'package:http/http.dart'
as
http
;
import
'package:http/http.dart'
as
http
;
import
'package:medapp_eksad/model/wa_model.dart'
;
import
'package:medapp_eksad/model/wa_model.dart'
;
Future
<
bool
>
save
w
a
(
nama
,
nohp
)
async
{
Future
<
bool
>
save
W
a
(
nama
,
nohp
)
async
{
final
response
=
await
http
.
post
(
final
response
=
await
http
.
post
(
Uri
.
parse
(
'http://10.3.4.231:8081/medapp/v1/api/whatapps/save'
),
Uri
.
parse
(
'http://10.3.4.231:8081/medapp/v1/api/whatapps/save'
),
body:
jsonEncode
({
body:
jsonEncode
({
...
@@ -19,7 +19,7 @@ Future<bool> savewa(nama, nohp) async {
...
@@ -19,7 +19,7 @@ Future<bool> savewa(nama, nohp) async {
return
false
;
return
false
;
}
}
}
}
Future
<
List
<
dynamic
>>
showa
()
async
{
Future
<
List
<
dynamic
>>
getWA
()
async
{
var
response
=
await
http
var
response
=
await
http
.
get
(
Uri
.
parse
(
'http://10.3.4.231:8082/medapp/v1/api/whatapps/get'
));
.
get
(
Uri
.
parse
(
'http://10.3.4.231:8082/medapp/v1/api/whatapps/get'
));
var
resultJson
=
jsonDecode
(
response
.
body
)[
'data'
];
var
resultJson
=
jsonDecode
(
response
.
body
)[
'data'
];
...
...
lib/dashboard/admin/admin_whatsapp.dart
View file @
51056ab5
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:medapp_eksad/api/wa_api.dart'
;
class
Dashboard3
extends
StatefulWidget
{
class
Dashboard3
extends
StatefulWidget
{
...
@@ -40,8 +41,11 @@ class _Dashboard3State extends State<Dashboard3> {
...
@@ -40,8 +41,11 @@ class _Dashboard3State extends State<Dashboard3> {
ListWhatsapp
=
ListWhatsapp
;
ListWhatsapp
=
ListWhatsapp
;
});
});
}
}
final
TextEditingController
nameController
=
TextEditingController
();
final
TextEditingController
phoneController
=
TextEditingController
();
final
TextEditingController
waController
=
TextEditingController
();
final
formKey
=
GlobalKey
<
FormState
>();
String
nameWa
=
''
;
String
whatsapp
=
''
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -88,17 +92,47 @@ class _Dashboard3State extends State<Dashboard3> {
...
@@ -88,17 +92,47 @@ class _Dashboard3State extends State<Dashboard3> {
),
),
),
),
Form
(
Form
(
key:
formKey
,
child:
Row
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
children:
[
Container
(
height:
48
,
width:
120
,
child:
TextFormField
(
controller:
nameController
,
//initialValue: '+62',
decoration:
const
InputDecoration
(
labelText:
"Enter a name"
,
hintText:
'Ex: Jaenudin'
,
fillColor:
Colors
.
white
,
filled:
true
,
enabledBorder:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
zero
,
borderSide:
BorderSide
(
width:
1
,
color:
Colors
.
blue
),
),
focusedBorder:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
zero
,
borderSide:
BorderSide
(
width:
1
,
color:
Colors
.
blue
),
),
),
onChanged:
(
value
)
=>
nameWa
=
value
,
),
),
SizedBox
(
width:
15
,),
Container
(
Container
(
height:
48
,
height:
48
,
width:
250
,
width:
250
,
child:
TextFormField
(
child:
TextFormField
(
controller:
phoneController
,
controller:
waController
,
//initialValue: '+62',
decoration:
const
InputDecoration
(
decoration:
const
InputDecoration
(
hintText:
"Enter a whatsapp number"
,
labelText:
"Enter a whatsapp number"
,
hintText:
'Ex: 62xxxxxxxxxxx'
,
fillColor:
Colors
.
white
,
fillColor:
Colors
.
white
,
filled:
true
,
filled:
true
,
enabledBorder:
OutlineInputBorder
(
enabledBorder:
OutlineInputBorder
(
...
@@ -112,6 +146,7 @@ class _Dashboard3State extends State<Dashboard3> {
...
@@ -112,6 +146,7 @@ class _Dashboard3State extends State<Dashboard3> {
BorderSide
(
width:
1
,
color:
Colors
.
blue
),
BorderSide
(
width:
1
,
color:
Colors
.
blue
),
),
),
),
),
onChanged:
(
value
)
=>
whatsapp
=
value
,
),
),
),
),
SizedBox
(
width:
15
,),
SizedBox
(
width:
15
,),
...
@@ -119,7 +154,33 @@ class _Dashboard3State extends State<Dashboard3> {
...
@@ -119,7 +154,33 @@ class _Dashboard3State extends State<Dashboard3> {
height
:
45
,
height
:
45
,
width
:
175
,
width
:
175
,
child:
ElevatedButton
(
child:
ElevatedButton
(
onPressed:
(){},
onPressed:
(){
if
(
whatsapp
.
trim
().
isEmpty
){
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
const
SnackBar
(
content:
Text
(
'Number Can
\'
t Be Empty'
)),
);
}
else
{
nameController
.
clear
();
waController
.
clear
();
saveWa
(
nameWa
,
whatsapp
).
then
(
(
isSuccess
)
{
if
(
isSuccess
)
{
setState
(()
{});
Scaffold
.
of
(
this
.
context
).
showSnackBar
(
const
SnackBar
(
content:
Text
(
"Input Data success"
)));
}
else
{
Scaffold
.
of
(
this
.
context
).
showSnackBar
(
const
SnackBar
(
content:
Text
(
"Input Data failed!!!"
)));
}
},
);
}
},
style:
ElevatedButton
.
styleFrom
(
style:
ElevatedButton
.
styleFrom
(
primary:
Colors
.
blueAccent
[
200
],
primary:
Colors
.
blueAccent
[
200
],
onSurface:
Colors
.
white
,
onSurface:
Colors
.
white
,
...
...
lib/widget/whatsapp.dart
View file @
51056ab5
...
@@ -10,7 +10,7 @@ class WAChat extends StatelessWidget {
...
@@ -10,7 +10,7 @@ class WAChat extends StatelessWidget {
required
String
message
,
required
String
message
,
})
async
{
})
async
{
String
url
()
{
String
url
()
{
return
"https://api.whatsapp.com/send?phone=
+62
$phone
&text=
${Uri.parse(message)}
"
;
return
"https://api.whatsapp.com/send?phone=
$phone
&text=
${Uri.parse(message)}
"
;
}
}
if
(
await
canLaunch
(
url
()))
{
if
(
await
canLaunch
(
url
()))
{
...
@@ -26,25 +26,17 @@ class WAChat extends StatelessWidget {
...
@@ -26,25 +26,17 @@ class WAChat extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
FloatingActionButton
(
return
FloatingActionButton
(
onPressed:
()
{
launchWhatsApp
(
//phone: 81807890777,
phone:
87701892981
,
message:
'Hallo, saya tertarik dan saya ingin tahu lebih lanjut tentang program Medapp by EKSAD'
);
},
backgroundColor:
Colors
.
green
,
backgroundColor:
Colors
.
green
,
child:
GestureDetector
(
onPressed:
(){
onTap:
()
{
springController
.
play
(
springController
.
play
(
motion:
Motion
.
reverse
,
motion:
Motion
.
reverse
,
animDuration:
const
Duration
(
milliseconds:
1000
),
animDuration:
const
Duration
(
milliseconds:
1000
),
curve:
Curves
.
easeInBack
,
curve:
Curves
.
easeInBack
,
delay:
const
Duration
(
milliseconds:
100
));
delay:
const
Duration
(
milliseconds:
100
));
launchWhatsApp
(
launchWhatsApp
(
phone:
6281807890777
,
phone:
6287701892981
,
message:
message:
'Hallo, saya tertarik dengan produk EKSAD dan saya ingin tahu lebih lanjut tentang program Protalent
'
);
'Hallo, saya tertarik dan saya ingin tahu lebih lanjut tentang program Medapp dari EKSAD
'
);
},
},
child:
Spring
.
rotate
(
child:
Spring
.
rotate
(
endAngle:
360
*
10
,
endAngle:
360
*
10
,
...
@@ -52,9 +44,9 @@ class WAChat extends StatelessWidget {
...
@@ -52,9 +44,9 @@ class WAChat extends StatelessWidget {
springController:
springController
,
springController:
springController
,
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
animStatus:
(
AnimStatus
status
)
{},
animStatus:
(
AnimStatus
status
)
{},
child:
const
Icon
(
Icons
.
whatsapp
,
size:
30
),
child:
const
Icon
(
Icons
.
whatsapp
,
size:
40
,
color:
Colors
.
white
,),
),
),
),
);
);
}
}
}
}
//phone: 81807890777,
\ No newline at end of file
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