Commit b0fc2c8b authored by Budi Prasetyo's avatar Budi Prasetyo
parents 9fa277cb e18fa4d4
...@@ -3,9 +3,21 @@ import 'dart:convert'; ...@@ -3,9 +3,21 @@ import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
var qry = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry'; var qry = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry';
var cmd = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/cmd';
Future<List<dynamic>> getUserControl() async { Future<List<dynamic>> getUserControl() async {
var response = await http.get(Uri.parse('$qry/user/get')); var response = await http.get(Uri.parse('$qry/user/get'));
return jsonDecode(response.body)['data']; return jsonDecode(response.body)['data'];
} }
Future<bool> deleteUserControl(idUser) async {
final response = await http.post(Uri.parse('$cmd/user/updateUser'),
body: jsonEncode({"idUser": idUser}),
headers: {'Content-type': 'application/json; charset=UTF-8'});
if (response.statusCode == 200) {
return true;
} else {
return false;
}
}
...@@ -631,7 +631,7 @@ class _Dashboard4State extends State<Dashboard4> { ...@@ -631,7 +631,7 @@ class _Dashboard4State extends State<Dashboard4> {
(isSuccess) { (isSuccess) {
if (isSuccess) { if (isSuccess) {
setState(() {}); setState(() {});
Scaffold.of( ScaffoldMessenger.of(
this.context) this.context)
.showSnackBar( .showSnackBar(
const SnackBar( const SnackBar(
...@@ -640,7 +640,7 @@ class _Dashboard4State extends State<Dashboard4> { ...@@ -640,7 +640,7 @@ class _Dashboard4State extends State<Dashboard4> {
), ),
); );
} else { } else {
Scaffold.of( ScaffoldMessenger.of(
this.context) this.context)
.showSnackBar( .showSnackBar(
const SnackBar( const SnackBar(
......
...@@ -657,6 +657,48 @@ class _UserControlState extends State<UserControl> { ...@@ -657,6 +657,48 @@ class _UserControlState extends State<UserControl> {
}); });
} }
void deleteUser(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Warning"),
content: Text(
"Are you sure want to delete data ${pgm['idUser']} ?"),
actions: <Widget>[
TextButton(
child: const Text("Yes"),
onPressed: () {
Navigator.pop(context);
deleteUserControl(pgm['idUser'])
.then((isSuccess) {
if (isSuccess) {
setState(() {});
ScaffoldMessenger.of(
this.context)
.showSnackBar(const SnackBar(
content: Text(
"Delete data success")));
} else {
ScaffoldMessenger.of(
this.context)
.showSnackBar(const SnackBar(
content: Text(
"Delete data failed")));
}
});
},
),
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("No"))
],
);
});
}
return DataRow(cells: [ return DataRow(cells: [
DataCell(Text(pgm['idUser'].toString())), DataCell(Text(pgm['idUser'].toString())),
DataCell(Text(pgm['namaRs'].toString())), DataCell(Text(pgm['namaRs'].toString())),
...@@ -681,20 +723,19 @@ class _UserControlState extends State<UserControl> { ...@@ -681,20 +723,19 @@ class _UserControlState extends State<UserControl> {
viewUser(context); viewUser(context);
} else if (value == 2) { } else if (value == 2) {
print("you choose Delete..."); print("you choose Delete...");
deleteUser(context);
} else if (value == 3) { } else if (value == 3) {
print("you choose View..."); print("you choose View...");
viewUser(context); viewUser(context);
} }
}, },
)) ))
]); ]);
}).toList()); }).toList());
}) })
], ],
), ),
) )
], ],
), ),
), ),
......
...@@ -63,7 +63,7 @@ class _HomePageState extends State<HomePage> { ...@@ -63,7 +63,7 @@ class _HomePageState extends State<HomePage> {
const Home3(), const Home3(),
const Home4(), const Home4(),
ContactUs2(), ContactUs2(),
const Footer(), Footer(),
], ],
), ),
); );
......
...@@ -63,7 +63,7 @@ class _AboutUsState extends State<AboutUs> { ...@@ -63,7 +63,7 @@ class _AboutUsState extends State<AboutUs> {
const Home3(), const Home3(),
const Home4(), const Home4(),
ContactUs2(), ContactUs2(),
const Footer(), Footer(),
], ],
), ),
); );
......
...@@ -2,10 +2,15 @@ import 'package:flutter/material.dart'; ...@@ -2,10 +2,15 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart'; import 'package:medapp_eksad/api/setting_api.dart';
import 'package:medapp_eksad/api/sosmed_api.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
class Footer extends StatelessWidget { class Footer extends StatelessWidget {
const Footer({Key? key}) : super(key: key); Footer({Key? key}) : super(key: key);
String ln = '';
String tw = '';
String ig = '';
String yt = '';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -43,9 +48,10 @@ class Footer extends StatelessWidget { ...@@ -43,9 +48,10 @@ class Footer extends StatelessWidget {
decoration: const BoxDecoration( decoration: const BoxDecoration(
//color: Colors.lightBlueAccent, //color: Colors.lightBlueAccent,
image: DecorationImage( image: DecorationImage(
image: AssetImage( image:
'assets/logo/medapp-logo.png'), AssetImage('assets/logo/medapp-logo.png'),
fit: BoxFit.fill)), fit: BoxFit.fill),
),
), ),
const Spacer( const Spacer(
flex: 8, flex: 8,
...@@ -56,9 +62,10 @@ class Footer extends StatelessWidget { ...@@ -56,9 +62,10 @@ class Footer extends StatelessWidget {
decoration: const BoxDecoration( decoration: const BoxDecoration(
//color: Colors.lightBlueAccent, //color: Colors.lightBlueAccent,
image: DecorationImage( image: DecorationImage(
image: AssetImage( image:
'assets/logo/logo-eksad.png'), AssetImage('assets/logo/logo-eksad.png'),
fit: BoxFit.fill)), fit: BoxFit.fill),
),
), ),
const Spacer( const Spacer(
flex: 8, flex: 8,
...@@ -86,55 +93,72 @@ class Footer extends StatelessWidget { ...@@ -86,55 +93,72 @@ class Footer extends StatelessWidget {
width: screenSize.width * 0.14, width: screenSize.width * 0.14,
height: screenSize.height * 0.03, height: screenSize.height * 0.03,
//color: Colors.blue, //color: Colors.blue,
child: Row( 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 Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
IconButton( IconButton(
onPressed: () { onPressed: () {
launch( ln = pgm['linkedin'];
'https://www.linkedin.com/company/pt-tiga-daya-digital-indonesia-triputra-group-eksad-technology'); launch(ln);
// _launchLinkedIn();
}, },
icon: const Icon( icon: const Icon(
FontAwesomeIcons.linkedinIn, FontAwesomeIcons.linkedinIn,
size: 30, size: 25,
),
iconSize: 20,
), ),
iconSize: 25,
color: Colors.black),
IconButton( IconButton(
onPressed: () { onPressed: () {
launch( tw = pgm['twitter'];
'https://twitter.com/eksadtechnology/'); launch(tw);
//_launchTwitter();
}, },
icon: const Icon( icon: const Icon(
FontAwesomeIcons.twitter, FontAwesomeIcons.twitter,
size: 30, size: 25,
), ),
iconSize: 20, iconSize: 25,
color: Colors.black,
), ),
IconButton( IconButton(
onPressed: () { onPressed: () {
launch( ig = pgm['instagram'];
'https://www.instagram.com/eksad_technology/'); launch(ig);
// _launchInstagram();
}, },
icon: const Icon( icon: const Icon(
FontAwesomeIcons.instagram, FontAwesomeIcons.instagram,
size: 30, size: 25,
),
iconSize: 20,
), ),
iconSize: 25,
color: Colors.black),
IconButton( IconButton(
onPressed: () { onPressed: () {
launch( yt = pgm['youtube'];
'https://www.youtube.com/channel/UCiZgIbpWgrAMrHW-TaS9EPw'); launch(yt);
// _launchYoutube();
}, },
icon: const Icon( icon: const Icon(
FontAwesomeIcons.youtube, FontAwesomeIcons.youtube,
size: 30, size: 25,
), ),
iconSize: 20, iconSize: 25,
) color: Colors.black)
], ],
);
},
), ),
), ),
const Spacer( const Spacer(
flex: 8, flex: 8,
......
...@@ -63,7 +63,7 @@ class _HomePageUserState extends State<HomePageUser> { ...@@ -63,7 +63,7 @@ class _HomePageUserState extends State<HomePageUser> {
const Home3(), const Home3(),
const Home4(), const Home4(),
ContactUs2(), ContactUs2(),
const Footer(), Footer(),
], ],
), ),
); );
......
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