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
799c82c4
Commit
799c82c4
authored
Sep 27, 2022
by
Ade Fikriatul Ilmi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menambahkan get public and post
parent
afdcae7d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
239 additions
and
336 deletions
+239
-336
sosmed_api.dart
lib/api/sosmed_api.dart
+3
-2
admin_sosmed.dart
lib/dashboard/admin/admin_sosmed.dart
+199
-313
whatsapp.dart
lib/widget/whatsapp.dart
+37
-21
No files found.
lib/api/sosmed_api.dart
View file @
799c82c4
...
...
@@ -26,10 +26,11 @@ Future<bool> createSosmed (wa, ln, tw, ig, yt) async{
}
}
Future
<
bool
>
updateSosmed
(
wa
,
ln
,
tw
,
ig
,
yt
)
async
{
Future
<
bool
>
updateSosmed
(
wa
,
ln
,
tw
,
ig
,
yt
)
async
{
final
response
=
await
http
.
put
(
Uri
.
parse
(
'
$cmd
/settingsosmed/
updat
eSettingSosmed'
),
.
put
(
Uri
.
parse
(
'
$cmd
/settingsosmed/
sav
eSettingSosmed'
),
body:
jsonEncode
({
// 'idSettingSosmed': id,
'whatsapp'
:
wa
,
'linkedin'
:
ln
,
'twitter'
:
tw
,
...
...
lib/dashboard/admin/admin_sosmed.dart
View file @
799c82c4
...
...
@@ -16,7 +16,7 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
final
formKey
=
GlobalKey
<
FormState
>();
TextEditingController
waController
=
new
TextEditingController
();
// final waController = TextEditingController();
// final waController = TextEditingController();
final
linkedController
=
TextEditingController
();
final
twitterController
=
TextEditingController
();
final
igController
=
TextEditingController
();
...
...
@@ -24,7 +24,7 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
String
wa
=
''
;
String
ln
=
''
;
String
tw
=
''
;
String
tw
=
''
;
String
ig
=
''
;
String
yt
=
''
;
...
...
@@ -34,8 +34,8 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
return
Container
(
color:
const
Color
.
fromRGBO
(
238
,
224
,
224
,
1
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
screenSize
.
width
*
0.
1
5
,
vertical:
screenSize
.
height
*
0.
1
5
),
horizontal:
screenSize
.
width
*
0.
0
5
,
vertical:
screenSize
.
height
*
0.
0
5
),
child:
Container
(
width:
screenSize
.
width
,
height:
screenSize
.
height
*
0.8
,
...
...
@@ -65,11 +65,10 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
onPressed:
()
{
switch
(
btnText
)
{
case
'Save Setting'
:
createSosmed
(
wa
,
ln
,
tw
,
ig
,
yt
);
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'Save Data Success'
),
));
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'Save Data Success'
),));
}
// waController.clear();
// linkedController.clear();
...
...
@@ -81,14 +80,16 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
setState
(()
{
btnText
=
'Update Setting'
;
enb
=
false
;
});
}
);
break
;
case
'Update Setting'
:
// waController.clear();
// linkedController.clear();
// twitterController.clear();
// igController.clear();
// youtubeController.clear();
// waController.clear();
// linkedController.clear();
// twitterController.clear();
// igController.clear();
// youtubeController.clear();
setState
(()
{
enb
=
true
;
btnText
=
'Save Update'
;
...
...
@@ -97,17 +98,13 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
case
'Save Update'
:
createSosmed
(
wa
,
ln
,
tw
,
ig
,
yt
);
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'Save Data Success'
),
));
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'Save Data Success'
),));
}
break
;
default
:
createSosmed
(
wa
,
ln
,
tw
,
ig
,
yt
);
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'Save Data Success'
),
));
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'Save Data Success'
),));
}
}
},
...
...
@@ -129,300 +126,189 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
SizedBox
(
height:
25
,
),
FutureBuilder
(
future:
getSosmedDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
final
waController
=
TextEditingController
();
final
linkedController
=
TextEditingController
();
final
twitterController
=
TextEditingController
();
final
igController
=
TextEditingController
();
final
youtubeController
=
TextEditingController
();
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
listsosmed
(
Icon
(
Icons
.
whatsapp
,
color:
Colors
.
green
,
),
TextFormField
(
// controller: waController,
initialValue:
pgm
[
'whatsapp'
],
decoration:
InputDecoration
(
hintText:
'Enter WhatsApp number without +, Ex : 6280000000000 '
),
onChanged:
(
value
)
=>
wa
=
value
,
enabled:
enb
,
),
// ElevatedButton(
// onPressed: () {
// showDialog(
// context: context,
// builder: (BuildContext context) => AlertDialog(
// content: FutureBuilder<List<dynamic>>(
// future: getSosmedDesc(),
// builder: (BuildContext context,
// AsyncSnapshot snapshot) {
// var pgm = snapshot.data[0];
// if (snapshot.hasError ||
// snapshot.data == null ||
// snapshot.connectionState ==
// ConnectionState.waiting) {
// return const CircularProgressIndicator();
// }
// return Text(
// 'Active WA : ' + pgm['whatsapp']);
// },
// ),
// ),
// );
// },
// child: Text('View Active'),
// ),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
=>
AlertDialog
(
content:
Text
(
'Active WA : '
+
pgm
[
'whatsapp'
],
),
),
);
},
child:
Text
(
'View Active'
),
),
),
SizedBox
(
height:
10
,
),
listsosmed
(
Icon
(
FontAwesomeIcons
.
linkedin
,
color:
Colors
.
blue
,
),
TextFormField
(
// controller: linkedController,
initialValue:
pgm
[
'linkedin'
],
decoration:
InputDecoration
(
hintText:
'Enter a new Linkedin link address'
),
onChanged:
(
value
)
=>
ln
=
value
,
enabled:
enb
,
),
// ElevatedButton(
// onPressed: () {
// showDialog(
// context: context,
// builder: (BuildContext context) => AlertDialog(
// content: FutureBuilder<List<dynamic>>(
// future: getSosmedDesc(),
// builder: (BuildContext context,
// AsyncSnapshot snapshot) {
// var pgm = snapshot.data[0];
// if (snapshot.hasError ||
// snapshot.data == null ||
// snapshot.connectionState ==
// ConnectionState.waiting) {
// return const CircularProgressIndicator();
// }
// return Text('Active Linkedin : ' +
// pgm['linkedin']);
// },
// ),
// ),
// );
// },
// child: Text('View Active'),
// ),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
=>
AlertDialog
(
content:
Text
(
'Active Linkedin : '
+
pgm
[
'linkedin'
],
),
),
);
},
child:
Text
(
'View Active'
),
),
),
SizedBox
(
height:
10
,
),
listsosmed
(
Icon
(
FontAwesomeIcons
.
twitterSquare
,
color:
Colors
.
blueAccent
,
),
TextFormField
(
// controller: twitterController,
initialValue:
pgm
[
'twitter'
],
decoration:
InputDecoration
(
hintText:
'Enter a new Twitter link address'
),
onChanged:
(
value
)
=>
tw
=
value
,
enabled:
enb
,
),
// ElevatedButton(
// onPressed: () {
// showDialog(
// context: context,
// builder: (BuildContext context) => AlertDialog(
// content: FutureBuilder<List<dynamic>>(
// future: getSosmedDesc(),
// builder: (BuildContext context,
// AsyncSnapshot snapshot) {
// var pgm = snapshot.data[0];
// if (snapshot.hasError ||
// snapshot.data == null ||
// snapshot.connectionState ==
// ConnectionState.waiting) {
// return const CircularProgressIndicator();
// }
// return Text(
// 'Active Twitter : ' + pgm['twitter']);
// },
// ),
// ),
// );
// },
// child: Text('View Active'),
// ),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
=>
AlertDialog
(
content:
Text
(
'Active Twitter : '
+
pgm
[
'twitter'
],
),
),
);
},
child:
Text
(
'View Active'
),
),
),
SizedBox
(
height:
10
,
),
listsosmed
(
Icon
(
FontAwesomeIcons
.
instagramSquare
,
color:
Colors
.
pink
,
),
TextFormField
(
// controller: igController,
initialValue:
pgm
[
'instagram'
],
decoration:
InputDecoration
(
hintText:
'Enter a new Instagram link address'
),
onChanged:
(
value
)
=>
ig
=
value
,
enabled:
enb
,
),
// ElevatedButton(
// onPressed: () {
// showDialog(
// context: context,
// builder: (BuildContext context) => AlertDialog(
// content: FutureBuilder<List<dynamic>>(
// future: getSosmedDesc(),
// builder: (BuildContext context,
// AsyncSnapshot snapshot) {
// var pgm = snapshot.data[0];
// if (snapshot.hasError ||
// snapshot.data == null ||
// snapshot.connectionState ==
// ConnectionState.waiting) {
// return const CircularProgressIndicator();
// }
// return Text('Active Instagram : ' +
// pgm['instagram']);
// },
// ),
// ),
// );
// },
// child: Text('View Active'),
// ),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
=>
AlertDialog
(
content:
Text
(
'Active Instagram : '
+
pgm
[
'instagram'
],
),
),
);
},
child:
Text
(
'View Active'
),
),
),
SizedBox
(
height:
10
,
),
listsosmed
(
Icon
(
FontAwesomeIcons
.
youtube
,
color:
Colors
.
red
,
),
TextFormField
(
// controller: youtubeController,
initialValue:
pgm
[
'youtube'
],
decoration:
InputDecoration
(
hintText:
'Enter a new Youtube link address'
),
onChanged:
(
value
)
=>
yt
=
value
,
enabled:
enb
,
),
// ElevatedButton(
// onPressed: () {
// showDialog(
// context: context,
// builder: (BuildContext context) => AlertDialog(
// content: FutureBuilder<List<dynamic>>(
// future: getSosmedDesc(),
// builder: (BuildContext context,
// AsyncSnapshot snapshot) {
// var pgm = snapshot.data[0];
// if (snapshot.hasError ||
// snapshot.data == null ||
// snapshot.connectionState ==
// ConnectionState.waiting) {
// return const CircularProgressIndicator();
// }
// return Text(
// 'Active Youtube : ' + pgm['youtube']);
// },
// ),
// ),
// );
// },
// child: Text('View Active'),
// ),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
=>
AlertDialog
(
content:
Text
(
'Active Youtube : '
+
pgm
[
'youtube'
],
),
),
);
},
child:
Text
(
'View Active'
),
),
),
],
);
}),
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
listsosmed
(
Icon
(
Icons
.
whatsapp
,
color:
Colors
.
green
,
),
TextFormField
(
controller:
waController
,
decoration:
InputDecoration
(
hintText:
'Enter WhatsApp number without +, Ex : 6280000000000 '
),
onChanged:
(
value
)
=>
wa
=
value
,
enabled:
enb
,
),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)=>
AlertDialog
(
content:
FutureBuilder
<
List
<
dynamic
>>(
future:
getSosmedDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
Text
(
'Active WA : '
+
pgm
[
'whatsapp'
]);
},
),
)
,
);
},
child:
Text
(
'View Active'
))),
SizedBox
(
height:
10
,
),
listsosmed
(
Icon
(
FontAwesomeIcons
.
linkedin
,
color:
Colors
.
blue
,
),
TextFormField
(
controller:
linkedController
,
decoration:
InputDecoration
(
hintText:
'Enter a new Linkedin link address'
),
onChanged:
(
value
)
=>
ln
=
value
,
enabled:
enb
,
),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)=>
AlertDialog
(
content:
FutureBuilder
<
List
<
dynamic
>>(
future:
getSosmedDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
Text
(
'Active Linkedin : '
+
pgm
[
'linkedin'
]);
},
),
)
,
);
},
child:
Text
(
'View Active'
))),
SizedBox
(
height:
10
,
),
listsosmed
(
Icon
(
FontAwesomeIcons
.
twitterSquare
,
color:
Colors
.
blueAccent
,
),
TextFormField
(
controller:
twitterController
,
decoration:
InputDecoration
(
hintText:
'Enter a new Twitter link address'
),
onChanged:
(
value
)
=>
tw
=
value
,
enabled:
enb
,
),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)=>
AlertDialog
(
content:
FutureBuilder
<
List
<
dynamic
>>(
future:
getSosmedDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
Text
(
'Active Twitter : '
+
pgm
[
'twitter'
]);
},
),
)
,
);
},
child:
Text
(
'View Active'
))),
SizedBox
(
height:
10
,
),
listsosmed
(
Icon
(
FontAwesomeIcons
.
instagramSquare
,
color:
Colors
.
pink
,
),
TextFormField
(
controller:
igController
,
decoration:
InputDecoration
(
hintText:
'Enter a new Instagram link address'
),
onChanged:
(
value
)
=>
ig
=
value
,
enabled:
enb
,
),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)=>
AlertDialog
(
content:
FutureBuilder
<
List
<
dynamic
>>(
future:
getSosmedDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
Text
(
'Active Instagram : '
+
pgm
[
'instagram'
]);
},
),
)
,
);
},
child:
Text
(
'View Active'
))),
SizedBox
(
height:
10
,
),
listsosmed
(
Icon
(
FontAwesomeIcons
.
youtube
,
color:
Colors
.
red
,
),
TextFormField
(
controller:
youtubeController
,
decoration:
InputDecoration
(
hintText:
'Enter a new Youtube link address'
),
onChanged:
(
value
)
=>
yt
=
value
,
enabled:
enb
,
),
ElevatedButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)=>
AlertDialog
(
content:
FutureBuilder
<
List
<
dynamic
>>(
future:
getSosmedDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
Text
(
'Active Youtube : '
+
pgm
[
'youtube'
]);
},
),
)
,
);
},
child:
Text
(
'View Active'
))),
],
),
],
),
),
...
...
lib/widget/whatsapp.dart
View file @
799c82c4
import
'package:flutter/material.dart'
;
import
'package:medapp_eksad/api/sosmed_api.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
import
'package:spring/spring.dart'
;
...
...
@@ -6,7 +7,7 @@ class WAChat extends StatelessWidget {
WAChat
({
Key
?
key
})
:
super
(
key:
key
);
void
launchWhatsApp
({
required
final
int
phone
,
required
final
String
phone
,
required
String
message
,
})
async
{
String
url
()
{
...
...
@@ -21,32 +22,47 @@ class WAChat extends StatelessWidget {
}
final
SpringController
springController
=
SpringController
(
initialAnim:
Motion
.
play
);
SpringController
(
initialAnim:
Motion
.
play
);
String
wa
=
''
;
@override
Widget
build
(
BuildContext
context
)
{
return
FloatingActionButton
(
onPressed:
()
{},
backgroundColor:
Colors
.
green
,
onPressed:
(){
springController
.
play
(
motion:
Motion
.
reverse
,
animDuration:
const
Duration
(
milliseconds:
1000
),
curve:
Curves
.
easeInBack
,
delay:
const
Duration
(
milliseconds:
100
));
launchWhatsApp
(
phone:
6287701892981
,
message:
'Hallo, saya tertarik dan saya ingin tahu lebih lanjut tentang program Medapp dari EKSAD'
);
},
child:
Spring
.
rotate
(
endAngle:
360
*
10
,
animDuration:
const
Duration
(
seconds:
3
*
10
),
springController:
springController
,
alignment:
Alignment
.
center
,
animStatus:
(
AnimStatus
status
)
{},
child:
const
Icon
(
Icons
.
whatsapp
,
size:
40
,
color:
Colors
.
white
,),
child:
FutureBuilder
<
List
<
dynamic
>>(
future:
getSosmedDesc
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
var
pgm
=
snapshot
.
data
[
0
];
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
GestureDetector
(
onTap:
()
{
wa
=
pgm
[
'whatsapp'
];
springController
.
play
(
motion:
Motion
.
reverse
,
animDuration:
const
Duration
(
milliseconds:
1000
),
curve:
Curves
.
easeInBack
,
delay:
const
Duration
(
milliseconds:
100
));
launchWhatsApp
(
phone:
wa
,
message:
'Hallo, saya tertarik dan saya ingin tahu lebih lanjut tentang program Medapp dari EKSAD'
);
},
child:
Spring
.
rotate
(
endAngle:
360
*
10
,
animDuration:
const
Duration
(
seconds:
3
*
10
),
springController:
springController
,
alignment:
Alignment
.
center
,
animStatus:
(
AnimStatus
status
)
{},
child:
const
Icon
(
Icons
.
whatsapp
,
size:
30
),
),
);
},
),
);
}
}
//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