Commit 799c82c4 authored by Ade Fikriatul  Ilmi's avatar Ade Fikriatul Ilmi

menambahkan get public and post

parent afdcae7d
...@@ -26,10 +26,11 @@ Future<bool> createSosmed (wa, ln, tw, ig, yt) async{ ...@@ -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 final response = await http
.put(Uri.parse('$cmd/settingsosmed/updateSettingSosmed'), .put(Uri.parse('$cmd/settingsosmed/saveSettingSosmed'),
body: jsonEncode({ body: jsonEncode({
// 'idSettingSosmed': id,
'whatsapp': wa, 'whatsapp': wa,
'linkedin': ln, 'linkedin': ln,
'twitter': tw, 'twitter': tw,
......
This diff is collapsed.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:medapp_eksad/api/sosmed_api.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:spring/spring.dart'; import 'package:spring/spring.dart';
...@@ -6,7 +7,7 @@ class WAChat extends StatelessWidget { ...@@ -6,7 +7,7 @@ class WAChat extends StatelessWidget {
WAChat({Key? key}) : super(key: key); WAChat({Key? key}) : super(key: key);
void launchWhatsApp({ void launchWhatsApp({
required final int phone, required final String phone,
required String message, required String message,
}) async { }) async {
String url() { String url() {
...@@ -22,19 +23,32 @@ class WAChat extends StatelessWidget { ...@@ -22,19 +23,32 @@ class WAChat extends StatelessWidget {
final SpringController springController = final SpringController springController =
SpringController(initialAnim: Motion.play); SpringController(initialAnim: Motion.play);
String wa = '';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FloatingActionButton( return FloatingActionButton(
onPressed: () {},
backgroundColor: Colors.green, backgroundColor: Colors.green,
onPressed: (){ 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( 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: 6287701892981, phone: wa,
message: message:
'Hallo, saya tertarik dan saya ingin tahu lebih lanjut tentang program Medapp dari EKSAD'); 'Hallo, saya tertarik dan saya ingin tahu lebih lanjut tentang program Medapp dari EKSAD');
}, },
...@@ -44,9 +58,11 @@ class WAChat extends StatelessWidget { ...@@ -44,9 +58,11 @@ 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: 40,color: Colors.white,), child: const Icon(Icons.whatsapp, size: 30),
),
);
},
), ),
); );
} }
} }
//phone: 81807890777,
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment