Commit a827a998 authored by Ade Fikriatul  Ilmi's avatar Ade Fikriatul Ilmi

menambahkan site title

parent dfc1191d
......@@ -27,18 +27,18 @@ Future<bool> createSetting(im, tt, em, no) async {
}
}
Future<bool> updateSetting(id, image, name, title, email, no,) async {
Future<bool> updateSetting(id, title, email, no,) async {
final response = await http
.put(Uri.parse('$cmd/setting/updateSetting'),
body: jsonEncode({
"idsetting": id,
"image": image,
"name": name,
// "image": image,
//"name": name,
"title": title,
// "tagline": tagline,
"email": email,
"no": no,
"idrole": "R001",
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
......
......@@ -59,7 +59,7 @@ class _SettingDashboardState extends State<SettingDashboard> {
String id = '';
String im = '';
String tt = '';
String tl = '';
String em = '';
String no = '';
final String role = 'MCS';
......@@ -76,19 +76,24 @@ class _SettingDashboardState extends State<SettingDashboard> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 10,),
SizedBox(
height: 10,
),
const Text(
"General Setting",
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.black, fontSize: 37, fontWeight: FontWeight.bold),
),
SizedBox(height: 10,),
SizedBox(
height: 10,
),
Container(
color: Colors.white,
height: screenSize.height*0.75,
width: screenSize.width*0.7,
padding: const EdgeInsets.only(left: 30,top: 15,right: 20,bottom: 15),
height: screenSize.height * 0.75,
width: screenSize.width * 0.7,
padding:
const EdgeInsets.only(left: 30, top: 13, right: 20, bottom: 13),
child: Form(
key: formKey,
child: Column(
......@@ -101,11 +106,15 @@ class _SettingDashboardState extends State<SettingDashboard> {
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.normal)),
// SizedBox(
// height: 0,
// width: 820,
// ),
ElevatedButton(
FutureBuilder<List<dynamic>>(
future: getSettingDesc(),
builder: (BuildContext context,
AsyncSnapshot snapshot) {
var pgm = snapshot.data[0];
final mcsController = TextEditingController();
return ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
......@@ -115,8 +124,39 @@ class _SettingDashboardState extends State<SettingDashboard> {
onPressed: () {
switch (btnText) {
case 'Save Setting':
if(em.isEmpty&&no.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt.toString(), em=pgm['email'].toString(), no=pgm['no'].toString());
print(pgm['idsetting']);
print('if pertama');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Title Success'),backgroundColor: Colors.green,),);
}else if(tt.isEmpty&&no.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt=pgm['title'], em.toString(), no=pgm['no'].toString());
print(pgm['idsetting']);
print('if kedua');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Email Success'),backgroundColor: Colors.green,),);
}else if(tt.isEmpty&&em.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt=pgm['title'], em=pgm['email'].toString(), no.toString());
print('if ketiga');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save No Success'),backgroundColor: Colors.green,),);
}else if(tt.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt=pgm['title'], em.toString(), no.toString());
print('if keempat');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Email and No Success'),backgroundColor: Colors.green,),);
}else if(em.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt.toString(), em=pgm['email'].toString(), no.toString());
print('if kelima');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Title and No Success'),backgroundColor: Colors.green,),);
}else if(no.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt.toString(), em.toString(), no=pgm['no'].toString());
print('if keenam');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Title and Email Success'),backgroundColor: Colors.green,),);
}
createSetting(im.toString(), tt.toString(),
em.toString(), no.toString());
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Data Success'),backgroundColor: Colors.green,),);
setState(() {
btnText = 'Update Setting';
enb = false;
......@@ -129,6 +169,39 @@ class _SettingDashboardState extends State<SettingDashboard> {
});
break;
case 'Save Update':
if(em.isEmpty&&no.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt.toString(), em=pgm['email'].toString(), no=pgm['no'].toString());
print(pgm['idsetting']);
print('if pertama');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Title Success'),backgroundColor: Colors.green,),);
}else if(tt.isEmpty&&no.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt=pgm['title'], em.toString(), no=pgm['no'].toString());
print(pgm['idsetting']);
print('if kedua');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Email Success'),backgroundColor: Colors.green,),);
}else if(tt.isEmpty&&em.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt=pgm['title'], em=pgm['email'].toString(), no.toString());
print('if ketiga');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save No Success'),backgroundColor: Colors.green,),);
}else if(tt.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt=pgm['title'], em.toString(), no.toString());
print('if keempat');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Email and No Success'),backgroundColor: Colors.green,),);
}else if(em.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt.toString(), em=pgm['email'].toString(), no.toString());
print('if kelima');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Title and No Success'),backgroundColor: Colors.green,),);
}else if(no.isEmpty){
updateSetting(id=pgm['idsetting'].toString(), tt.toString(), em.toString(), no=pgm['no'].toString());
print('if keenam');
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Title and Email Success'),backgroundColor: Colors.green,),);
}
createSetting(im.toString(), tt.toString(),
em.toString(), no.toString());
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Data Success'),backgroundColor: Colors.green,),);
break;
default:
}
......@@ -138,7 +211,10 @@ class _SettingDashboardState extends State<SettingDashboard> {
style: const TextStyle(
fontSize: 16, fontWeight: FontWeight.bold),
),
);
},
),
],
),
const Divider(
......@@ -148,11 +224,16 @@ class _SettingDashboardState extends State<SettingDashboard> {
// endIndent: 0,
color: Colors.grey,
),
SizedBox(height: 25,),
Text('Data Must Be Edited'),
Text(
'For data that is not modified, Please copy last data , delete then paste again'),
SizedBox(
height: 25,
),
Row(
children: [
Container(
height: 230,
height: 220,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
......@@ -235,7 +316,7 @@ class _SettingDashboardState extends State<SettingDashboard> {
width: screenSize.width * 0.05,
),
Container(
height: 230,
height: 220,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
......@@ -256,20 +337,36 @@ class _SettingDashboardState extends State<SettingDashboard> {
Container(
height: 40,
width: screenSize1 * 0.5,
child: TextFormField(
child: FutureBuilder<List<dynamic>>(
future: getSettingDesc(),
builder: (BuildContext context,
AsyncSnapshot snapshot) {
var pgm = snapshot.data[0];
final mcsController = TextEditingController();
if (snapshot.hasError ||
snapshot.data == null ||
snapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator();
}
return TextFormField(
initialValue: pgm['title'],
decoration: const InputDecoration(
labelText: "MedApp",
labelText: "Multi Cloud Solution",
hintStyle: TextStyle(),
border: OutlineInputBorder(
borderSide: BorderSide(
width: 1, color: Colors.grey))),
onChanged: (value) => tt = value,
enabled: enb,
);
},
),
),
// const SizedBox(
// height: 20,
// ),
const SizedBox(
height: 20,
),
// const Text(
// "Site tagline",
// style: TextStyle(
......@@ -277,9 +374,9 @@ class _SettingDashboardState extends State<SettingDashboard> {
// fontSize: 17,
// fontWeight: FontWeight.bold),
// ),
// const SizedBox(
// height: 7,
// ),
const SizedBox(
height: 7,
),
// Container(
// height: 40,
// width: screenSize1 * 0.5,
......@@ -294,23 +391,31 @@ class _SettingDashboardState extends State<SettingDashboard> {
// enabled: enb,
// ),
// ),
// const SizedBox(
// height: 10,
// ),
// const Text(
// "In a few words, explain what this site is about.",
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: Colors.grey,
// fontSize: 16,
// fontWeight: FontWeight.normal)),
const SizedBox(
height: 10,
),
const Text(
"In a few words, explain what this site is about.",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.grey,
fontSize: 16,
fontWeight: FontWeight.normal)),
],
),
),
],
),
Row(
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 Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
......@@ -330,6 +435,7 @@ class _SettingDashboardState extends State<SettingDashboard> {
height: 40,
width: screenSize1 * 0.5,
child: TextFormField(
initialValue: pgm['email'],
decoration: InputDecoration(
fillColor: Colors.grey[200],
labelText: "xxxxxx@eksad.com",
......@@ -344,10 +450,11 @@ class _SettingDashboardState extends State<SettingDashboard> {
const SizedBox(
height: 10,
),
],
),
SizedBox(width: 30,),
SizedBox(
width: 30,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
......@@ -366,6 +473,7 @@ class _SettingDashboardState extends State<SettingDashboard> {
height: 40,
width: screenSize1 * 0.5,
child: TextFormField(
initialValue: pgm['no'],
decoration: const InputDecoration(
labelText: "02x-xxxx-xxxx",
hintStyle: TextStyle(),
......@@ -385,7 +493,10 @@ class _SettingDashboardState extends State<SettingDashboard> {
// width: 30,
// ),
],
);
},
),
// const Spacer(
// flex: 20,
// ),
......
......@@ -81,6 +81,7 @@ flutter:
uses-material-design: true
assets:
- assets/file/
- assets/icons/
- assets/logo/
- assets/images/
......
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