Commit f6f3af4a authored by Fikri's avatar Fikri

menampilkan hasil get setting di public

parent 00648504
......@@ -24,7 +24,7 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
String wa = '';
String ln = '';
String tw ='';
String tw = '';
String ig = '';
String yt = '';
......@@ -34,13 +34,13 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
return Container(
color: const Color.fromRGBO(238, 224, 224, 1),
padding: EdgeInsets.symmetric(
horizontal: screenSize.width * 0.05,
vertical: screenSize.height * 0.05),
horizontal: screenSize.width * 0.15,
vertical: screenSize.height * 0.15),
child: Container(
width: screenSize.width,
height: screenSize.height * 0.8,
padding:
const EdgeInsets.only(left: 30, top: 15, right: 30, bottom: 15),
const EdgeInsets.only(left: 30, top: 15, right: 30, bottom: 15),
color: Colors.white,
child: Form(
key: formKey,
......@@ -65,10 +65,11 @@ 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();
......@@ -80,16 +81,14 @@ 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';
......@@ -98,13 +97,17 @@ 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'),
));
}
}
},
......@@ -126,189 +129,300 @@ class _SosmedDashboardState extends State<SosmedDashboard> {
SizedBox(
height: 25,
),
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'))),
],
),
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'),
),
),
],
);
}),
],
),
),
......
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/setting_api.dart';
import 'package:url_launcher/url_launcher.dart';
class Footer extends StatelessWidget {
......@@ -268,53 +269,8 @@ class Footer extends StatelessWidget {
),
),
const SizedBox(height: 8),
Container(
width: screenSize.width * 0.2,
child: ListTile(
leading: const Icon(
Icons.phone,
size: 22,
),
title: TextButton(
onPressed: () {
launch('tel:02157958040');
},
child: Container(
height: screenSize.height * 0.04,
child: Text(
'(021) 5795 - 8040',
style: GoogleFonts.poppins(
fontSize: 16,
color: Colors.black87,
),
),
),
),
),
),
Container(
width: screenSize.width * 0.2,
child: ListTile(
leading: const Icon(
Icons.mail,
size: 22,
),
title: TextButton(
onPressed: () {
launch(
'mailto:Hello@eksad.com?subject=Hello saya ingin bertanya tentang Medapp');
},
child: Container(
height: screenSize.height * 0.04,
child: Text(
'Hello@eksad.com',
style: GoogleFonts.poppins(
fontSize: 16, color: Colors.black87),
),
),
),
),
),
TelphoneApi(),
EmailAPI(),
Container(
width: screenSize.width * 0.25,
height: screenSize.height * 0.29,
......@@ -385,3 +341,97 @@ class itemBawah extends StatelessWidget {
));
}
}
class TelphoneApi extends StatefulWidget {
const TelphoneApi({Key? key}) : super(key: key);
@override
State<TelphoneApi> createState() => _TelphoneApiState();
}
class _TelphoneApiState extends State<TelphoneApi> {
String no = '';
@override
Widget build(BuildContext context) {
var screenSize = MediaQuery.of(context).size;
return FutureBuilder<List<dynamic>>(
future: getSettingDesc(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
var pgm = snapshot.data[0];
if (snapshot.hasError ||
snapshot.data == null ||
snapshot.connectionState == ConnectionState.waiting) {
return const CircularProgressIndicator();
}
return Container(
width: screenSize.width * 0.19,
child: ListTile(
leading: const Icon(
Icons.phone,
size: 23,
color: Colors.black,
),
title: TextButton(
onPressed: () {
no = pgm['no'];
//02157958040
launch('tel:$no');
},
child: Text(
pgm['no'],
style: GoogleFonts.poppins(
fontSize: 16, color: Colors.black87, letterSpacing: 1.5),
)),
),
);
},
);
}
}
class EmailAPI extends StatefulWidget {
const EmailAPI({Key? key}) : super(key: key);
@override
State<EmailAPI> createState() => _EmailAPIState();
}
class _EmailAPIState extends State<EmailAPI> {
String email = '';
@override
Widget build(BuildContext context) {
var screenSize = MediaQuery.of(context).size;
return FutureBuilder<List<dynamic>>(
future: getSettingDesc(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
var pgm = snapshot.data[0];
if (snapshot.hasError ||
snapshot.data == null ||
snapshot.connectionState == ConnectionState.waiting) {
return const CircularProgressIndicator();
}
return Container(
width: screenSize.width * 0.2,
child: ListTile(
leading: const Icon(
Icons.mail,
size: 23,
color: Colors.black,
),
title: TextButton(
onPressed: () {
email = pgm['email'];
launch('mailto:$email?subject=Info MCS');
},
// child: SettingAPI(),
child: Text(
pgm['email'],
style: GoogleFonts.poppins(
fontSize: 16, color: Colors.black87, letterSpacing: 1.1),
)),
),
);
},
);
}
}
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