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