Commit c708746e authored by Fikri's avatar Fikri

mengubah design contact

parent e170bfe7
...@@ -84,221 +84,545 @@ class _Dashboard4State extends State<Dashboard4> { ...@@ -84,221 +84,545 @@ class _Dashboard4State extends State<Dashboard4> {
builder: (BuildContext context, AsyncSnapshot snapshot) { builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasError || if (snapshot.hasError ||
snapshot.data == null || snapshot.data == null ||
snapshot.connectionState == ConnectionState.waiting) { snapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator(); return const CircularProgressIndicator();
} }
return DataTable( return DataTable(
decoration: const BoxDecoration(color: Colors.white), decoration:
columnSpacing: 105, const BoxDecoration(color: Colors.white),
columnSpacing: 55,
columns: const [ columns: const [
DataColumn(label: Text("Date")), DataColumn(
DataColumn(label: Text("Name")), label: Text(
DataColumn(label: Text("Number")), "Date",
DataColumn(label: Text("Email")), style: TextStyle(fontWeight: FontWeight.bold),
DataColumn(label: Text("Action")), )),
DataColumn(
label: Text(
"Name",
style: TextStyle(fontWeight: FontWeight.bold),
)),
// DataColumn(label: Text("Telp Rumah Sakit")),
DataColumn(
label: Text(
"Number",
style: TextStyle(fontWeight: FontWeight.bold),
)),
// DataColumn(label: Text("Nama PIC")),
// DataColumn(label: Text("Telp PIC")),
// DataColumn(label: Text("Email PIC")),
DataColumn(
label: Text(
"Email",
style: TextStyle(fontWeight: FontWeight.bold),
)),
DataColumn(
label: Text(
"Action",
style: TextStyle(fontWeight: FontWeight.bold),
))
], ],
rows: List.generate( rows: List.generate(snapshot.data.length, (index) {
snapshot.data.length,
(index) {
var pgm = snapshot.data[index]; var pgm = snapshot.data[index];
return DataRow(
cells: [ final dateController = TextEditingController()
DataCell( ..text = pgm['dateContact'].toString();
Text(pgm['dateContact']), final nameController = TextEditingController(
), text: pgm['namaContact'].toString());
DataCell( final nohpController = TextEditingController(
Text(pgm['namaContact']), text: pgm['noHp'].toString());
), final emailController = TextEditingController(
DataCell( text: pgm['emailContact'].toString());
Text(pgm['noHp']), final messageController = TextEditingController(
), text: pgm['messageContact'].toString());
DataCell(
Text(pgm['emailContact']), void viewUser(BuildContext context) {
), var screenSize = MediaQuery.of(context).size;
DataCell( showDialog(
Row( context: context,
builder: (BuildContext context) {
return AlertDialog(
content: Form(
child: Container(
padding: EdgeInsets.only(
left: screenSize.width * 0.045,
top: screenSize.height * 0.01),
width: screenSize.width * 0.50,
height: screenSize.height * 0.50,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceEvenly, MainAxisAlignment.spaceEvenly,
crossAxisAlignment: children: [
CrossAxisAlignment.center, const Spacer(),
Container(
padding: EdgeInsets.only(
left: screenSize.width *
0.15),
height: screenSize.width * 0.03,
child: Image.asset(
"assets/logo/medapp-logo.png"),
),
const SizedBox(height: 20),
Row(
children: [ children: [
Column( Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [ children: [
TextButton( Row(
style: TextButton.styleFrom( children: [
padding: Icon(
const EdgeInsets.all(16.0), Icons
primary: Colors.white, .drive_file_rename_outline,
backgroundColor: Color.fromARGB( color: Colors
255, 15, 102, 223), .grey[500],
textStyle: size: screenSize
const TextStyle(fontSize: 15), .width *
0.01),
const SizedBox(
width: 10),
const Text("Nama",
style: TextStyle(
fontSize: 13))
],
), ),
onPressed: () { const SizedBox(height: 5),
showDialog( Row(
context: context, children: [
builder: (context) { SizedBox(
return AlertDialog( height: 60,
title: Text( width: screenSize
"Information", .width *
style: GoogleFonts.poppins( 0.2,
fontSize: 16, child:
fontWeight: FontWeight.bold, TextFormField(
controller:
nameController,
textAlign:
TextAlign
.start,
decoration: InputDecoration(
labelText:
"Nama",
labelStyle:
TextStyle(
fontSize:
13),
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(
5.0))),
readOnly: true,
validator:
(value) {
if (value ==
null ||
value
.isEmpty) {
return "Nama";
} else {
return null;
}
},
), ),
)
],
)
],
), ),
content: Container( const SizedBox(width: 30),
height: Column(
screenSize.height * crossAxisAlignment:
0.3, CrossAxisAlignment
width: screenSize.width * .start,
0.33,
child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment MainAxisAlignment
.spaceBetween, .spaceEvenly,
children: [
// ===============nama pic=============
Row(
children: [
Icon(
Icons
.calendar_month,
color: Colors
.grey[500],
size: screenSize
.width *
0.01,
),
const SizedBox(
width: 10,
),
const Text(
"Date",
style: TextStyle(
fontSize: 13),
),
],
),
const SizedBox(
height: 5,
),
Row(
children: [
SizedBox(
height: 60,
width: screenSize
.width *
0.2,
child:
TextFormField(
controller:
dateController,
textAlign:
TextAlign
.start,
decoration:
InputDecoration(
labelText:
"date",
labelStyle: TextStyle(
fontSize:
13),
border:
OutlineInputBorder(
borderRadius:
BorderRadius.circular(5.0),
)),
readOnly: true,
validator:
(value) {
if (value ==
null ||
value
.isEmpty) {
return "Date";
}
return null;
},
),
)
],
),
// ===============akhir nama pic=============
],
)
],
),
Row(
children: [
Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment CrossAxisAlignment
.start, .start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [ children: [
Text( // ===============alamat rs==========
"Date : ${pgm['dateContact']}"), Row(
Text( children: [
"Nama : ${pgm['namaContact']}"), Icon(
Text( Icons.email,
"No.Telp : ${pgm['noHp']}"), color: Colors
Text( .grey[500],
"Email : ${pgm['emailContact']}"), size: screenSize
Text( .width *
"Message : ${pgm['messageContact']}"), 0.01,
], ),
const SizedBox(
width: 10,
), ),
const Text(
"Email",
style: TextStyle(
fontSize: 13),
), ),
actions: <Widget>[ ],
TextButton( ),
style: TextButton const SizedBox(
.styleFrom( height: 5,
padding:
const EdgeInsets
.all(16.0),
primary: Colors.white,
backgroundColor:
Color.fromARGB(
255,
15,
102,
223),
textStyle:
const TextStyle(
fontSize: 15),
), ),
Row(
children: [
SizedBox(
height: 60,
width: screenSize
.width *
0.2,
child: child:
const Text("Back"), TextFormField(
onPressed: () { controller:
Navigator.pop( emailController,
context); textAlign:
TextAlign
.start,
readOnly: true,
validator:
(value) {
if (value ==
null ||
value
.isEmpty) {
return "Email";
}
return null;
}, },
decoration:
InputDecoration(
labelText:
"Email",
labelStyle: TextStyle(
fontSize:
13),
hintStyle:
const TextStyle(),
border:
OutlineInputBorder(
borderRadius:
BorderRadius.circular(5.0),
)),
), ),
)
], ],
);
},
);
},
child: const Text("View"),
), ),
// ===============akhir alamat rs==========
], ],
), ),
SizedBox( const SizedBox(
width: 3, width: 30,
), ),
Column( Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
// ===============email pic==========
Row(
children: [ children: [
TextButton( Icon(
style: TextButton.styleFrom( Icons.phone_android,
padding: color: Colors
const EdgeInsets.all(16.0), .grey[500],
primary: Colors.white, size: screenSize
backgroundColor: .width *
const Color.fromARGB( 0.01,
255, 245, 27, 27),
textStyle:
const TextStyle(fontSize: 15),
), ),
onPressed: () { const SizedBox(
showDialog( width: 10,
context: context, ),
builder: (context) { const Text(
return AlertDialog( "No HP",
title: style: TextStyle(
const Text("Warning"), fontSize: 13),
content: Text( ),
"Are you sure want to delete data user ${pgm['namaContact']}?"), ],
actions: <Widget>[ ),
TextButton( const SizedBox(
height: 5,
),
Row(
children: [
SizedBox(
height: 60,
width: screenSize
.width *
0.2,
child: child:
const Text("Yes"), TextFormField(
onPressed: () { controller:
Navigator.pop( nohpController,
context); textAlign:
deleteContact(pgm[ TextAlign
'idContact']) .start,
.then( readOnly: true,
(isSuccess) { validator:
if (isSuccess) { (value) {
setState(() {}); if (value ==
ScaffoldMessenger.of(this null ||
.context) value
.showSnackBar( .isEmpty) {
const SnackBar( return "No Hp";
content:
Text("Delete data success")));
} else {
ScaffoldMessenger.of(this
.context)
.showSnackBar(
const SnackBar(
content:
Text("Delete data failed")));
} }
}); return null;
}, },
decoration:
InputDecoration(
labelText:
"No Hp",
labelStyle: TextStyle(
fontSize:
13),
hintStyle:
const TextStyle(),
border:
OutlineInputBorder(
borderRadius:
BorderRadius.circular(5.0),
)),
), ),
TextButton( )
child: const Text("No"), ],
onPressed: () {
Navigator.pop(
context);
},
), ),
// ===============akhir email pic==========
], ],
); ),
}, ],
); ),
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
// ===============email pic==========
Row(
children: [
Icon(
Icons.message,
color: Colors
.grey[500],
size: screenSize
.width *
0.01,
),
const SizedBox(
width: 10,
),
const Text(
"Message",
style: TextStyle(
fontSize: 13),
),
],
),
const SizedBox(
height: 5,
),
Row(
children: [
Container(
height: 90,
width: screenSize
.width *
0.42,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
TextFormField(
keyboardType:
TextInputType
.multiline,
textInputAction:
TextInputAction
.newline,
minLines: 1,
maxLines: 5,
controller:
messageController,
textAlign:
TextAlign
.start,
readOnly:
true,
validator:
(value) {
if (value ==
null ||
value
.isEmpty) {
return "Message";
}
return null;
}, },
child: const Text("Delete"), decoration:
InputDecoration(
labelText:
"Message",
labelStyle: TextStyle(
fontSize:
13),
hintStyle:
const TextStyle(),
border:
OutlineInputBorder(
borderRadius:
BorderRadius.circular(5.0),
)),
), ),
], ],
), ),
)
], ],
), ),
// ===============akhir email pic==========
],
), ),
], ],
);
},
).toList(),
);
},
), ),
], ],
), ),
)),
actions: [
MaterialButton(
child: Text("OK"),
onPressed: () {
Navigator.of(context).pop();
})
],
);
});
}
return DataRow(cells: [
DataCell(Text(pgm['dateContact'].toString())),
DataCell(Text(pgm['namaContact'].toString())),
DataCell(Text(pgm['noHp'].toString())),
DataCell(Text(pgm['emailContact'].toString())),
DataCell(PopupMenuButton(
icon: Icon(Icons.more_vert_outlined),
itemBuilder: (context) => [
PopupMenuItem(
child: Text("View"), value: 1),
PopupMenuItem(
child: Text("Delete"), value: 2),
],
onSelected: (value) {
if (value == 1) {
print("you choose View...");
viewUser(context);
} else if (value == 2) {
print("you choose Delete...");
viewUser(context);
}
},
))
]);
}).toList());
})
],
), ),
)
], ],
), ),
), ),
......
...@@ -687,12 +687,14 @@ class _UserControlState extends State<UserControl> { ...@@ -687,12 +687,14 @@ class _UserControlState extends State<UserControl> {
} }
}, },
)) ))
]); ]);
}).toList()); }).toList());
}) })
], ],
), ),
) )
], ],
), ),
), ),
......
...@@ -128,6 +128,12 @@ class ContactUs2 extends StatelessWidget { ...@@ -128,6 +128,12 @@ class ContactUs2 extends StatelessWidget {
borderSide: BorderSide(width: 1, color: Colors.white), borderSide: BorderSide(width: 1, color: Colors.white),
), ),
), ),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Name cannot be empty!!!';
}
return null;
},
), ),
), ),
const SizedBox( const SizedBox(
...@@ -175,6 +181,12 @@ class ContactUs2 extends StatelessWidget { ...@@ -175,6 +181,12 @@ class ContactUs2 extends StatelessWidget {
BorderSide(width: 1, color: Colors.white), BorderSide(width: 1, color: Colors.white),
), ),
), ),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Phone cannot be empty!!!';
}
return null;
},
), ),
), ),
const SizedBox( const SizedBox(
...@@ -199,6 +211,12 @@ class ContactUs2 extends StatelessWidget { ...@@ -199,6 +211,12 @@ class ContactUs2 extends StatelessWidget {
BorderSide(width: 1, color: Colors.white), BorderSide(width: 1, color: Colors.white),
), ),
), ),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Email cannot be empty!!!';
}
return null;
},
), ),
), ),
const SizedBox( const SizedBox(
...@@ -237,7 +255,7 @@ class ContactUs2 extends StatelessWidget { ...@@ -237,7 +255,7 @@ class ContactUs2 extends StatelessWidget {
maxLines: 5, maxLines: 5,
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return '*Required'; return 'Message cannot be empty!!!';
} }
return null; return null;
}, },
......
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