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,11 +106,15 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -101,11 +106,15 @@ 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,
AsyncSnapshot snapshot) {
var pgm = snapshot.data[0];
final mcsController = TextEditingController();
return ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
...@@ -115,8 +124,39 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -115,8 +124,39 @@ class _SettingDashboardState extends State<SettingDashboard> {
onPressed: () { onPressed: () {
switch (btnText) { switch (btnText) {
case 'Save Setting': 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(), createSetting(im.toString(), tt.toString(),
em.toString(), no.toString()); em.toString(), no.toString());
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Save Data Success'),backgroundColor: Colors.green,),);
setState(() { setState(() {
btnText = 'Update Setting'; btnText = 'Update Setting';
enb = false; enb = false;
...@@ -129,6 +169,39 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -129,6 +169,39 @@ class _SettingDashboardState extends State<SettingDashboard> {
}); });
break; break;
case 'Save Update': 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; break;
default: default:
} }
...@@ -138,7 +211,10 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -138,7 +211,10 @@ class _SettingDashboardState extends State<SettingDashboard> {
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontWeight: FontWeight.bold), 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>>(
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( decoration: const InputDecoration(
labelText: "MedApp", labelText: "Multi Cloud Solution",
hintStyle: TextStyle(), hintStyle: TextStyle(),
border: OutlineInputBorder( border: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
width: 1, color: Colors.grey))), width: 1, color: Colors.grey))),
onChanged: (value) => tt = value, onChanged: (value) => tt = value,
enabled: enb, 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,23 +391,31 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -294,23 +391,31 @@ 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(),
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: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -330,6 +435,7 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -330,6 +435,7 @@ class _SettingDashboardState extends State<SettingDashboard> {
height: 40, height: 40,
width: screenSize1 * 0.5, width: screenSize1 * 0.5,
child: TextFormField( child: TextFormField(
initialValue: pgm['email'],
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.grey[200], fillColor: Colors.grey[200],
labelText: "xxxxxx@eksad.com", labelText: "xxxxxx@eksad.com",
...@@ -344,10 +450,11 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -344,10 +450,11 @@ class _SettingDashboardState extends State<SettingDashboard> {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
], ],
), ),
SizedBox(width: 30,), SizedBox(
width: 30,
),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
...@@ -366,6 +473,7 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -366,6 +473,7 @@ class _SettingDashboardState extends State<SettingDashboard> {
height: 40, height: 40,
width: screenSize1 * 0.5, width: screenSize1 * 0.5,
child: TextFormField( child: TextFormField(
initialValue: pgm['no'],
decoration: const InputDecoration( decoration: const InputDecoration(
labelText: "02x-xxxx-xxxx", labelText: "02x-xxxx-xxxx",
hintStyle: TextStyle(), hintStyle: TextStyle(),
...@@ -385,7 +493,10 @@ class _SettingDashboardState extends State<SettingDashboard> { ...@@ -385,7 +493,10 @@ class _SettingDashboardState extends State<SettingDashboard> {
// width: 30, // 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