Commit c708746e authored by Fikri's avatar Fikri

mengubah design contact

parent e170bfe7
...@@ -80,225 +80,549 @@ class _Dashboard4State extends State<Dashboard4> { ...@@ -80,225 +80,549 @@ class _Dashboard4State extends State<Dashboard4> {
controller: ScrollController(), controller: ScrollController(),
children: [ children: [
FutureBuilder<List<dynamic>>( FutureBuilder<List<dynamic>>(
future: getcontact(), future: getcontact(),
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 ==
return const CircularProgressIndicator(); ConnectionState.waiting) {
} return const CircularProgressIndicator();
return DataTable( }
decoration: const BoxDecoration(color: Colors.white), return DataTable(
columnSpacing: 105, decoration:
columns: const [ const BoxDecoration(color: Colors.white),
DataColumn(label: Text("Date")), columnSpacing: 55,
DataColumn(label: Text("Name")), columns: const [
DataColumn(label: Text("Number")), DataColumn(
DataColumn(label: Text("Email")), label: Text(
DataColumn(label: Text("Action")), "Date",
], style: TextStyle(fontWeight: FontWeight.bold),
rows: List.generate( )),
snapshot.data.length, DataColumn(
(index) { label: Text(
var pgm = snapshot.data[index]; "Name",
return DataRow( style: TextStyle(fontWeight: FontWeight.bold),
cells: [ )),
DataCell( // DataColumn(label: Text("Telp Rumah Sakit")),
Text(pgm['dateContact']), DataColumn(
), label: Text(
DataCell( "Number",
Text(pgm['namaContact']), style: TextStyle(fontWeight: FontWeight.bold),
), )),
DataCell( // DataColumn(label: Text("Nama PIC")),
Text(pgm['noHp']), // DataColumn(label: Text("Telp PIC")),
), // DataColumn(label: Text("Email PIC")),
DataCell( DataColumn(
Text(pgm['emailContact']), label: Text(
), "Email",
DataCell( style: TextStyle(fontWeight: FontWeight.bold),
Row( )),
mainAxisAlignment: DataColumn(
MainAxisAlignment.spaceEvenly, label: Text(
crossAxisAlignment: "Action",
CrossAxisAlignment.center, style: TextStyle(fontWeight: FontWeight.bold),
children: [ ))
Column( ],
mainAxisAlignment: rows: List.generate(snapshot.data.length, (index) {
MainAxisAlignment.spaceEvenly, var pgm = snapshot.data[index];
crossAxisAlignment:
CrossAxisAlignment.start, final dateController = TextEditingController()
children: [ ..text = pgm['dateContact'].toString();
TextButton( final nameController = TextEditingController(
style: TextButton.styleFrom( text: pgm['namaContact'].toString());
padding: final nohpController = TextEditingController(
const EdgeInsets.all(16.0), text: pgm['noHp'].toString());
primary: Colors.white, final emailController = TextEditingController(
backgroundColor: Color.fromARGB( text: pgm['emailContact'].toString());
255, 15, 102, 223), final messageController = TextEditingController(
textStyle: text: pgm['messageContact'].toString());
const TextStyle(fontSize: 15),
), void viewUser(BuildContext context) {
onPressed: () { var screenSize = MediaQuery.of(context).size;
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text( content: Form(
"Information", child: Container(
style: GoogleFonts.poppins( padding: EdgeInsets.only(
fontSize: 16, left: screenSize.width * 0.045,
fontWeight: FontWeight.bold, top: screenSize.height * 0.01),
width: screenSize.width * 0.50,
height: screenSize.height * 0.50,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
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: [
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
Row(
children: [
Icon(
Icons
.drive_file_rename_outline,
color: Colors
.grey[500],
size: screenSize
.width *
0.01),
const SizedBox(
width: 10),
const Text("Nama",
style: TextStyle(
fontSize: 13))
],
), ),
), const SizedBox(height: 5),
content: Container( Row(
height:
screenSize.height *
0.3,
width: screenSize.width *
0.33,
child: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [ children: [
Text( SizedBox(
"Date : ${pgm['dateContact']}"), height: 60,
Text( width: screenSize
"Nama : ${pgm['namaContact']}"), .width *
Text( 0.2,
"No.Telp : ${pgm['noHp']}"), child:
Text( TextFormField(
"Email : ${pgm['emailContact']}"), controller:
Text( nameController,
"Message : ${pgm['messageContact']}"), 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;
}
},
),
)
],
)
],
),
const SizedBox(width: 30),
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.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(
actions: <Widget>[ height: 5,
TextButton( ),
style: TextButton Row(
.styleFrom( children: [
padding: SizedBox(
const EdgeInsets height: 60,
.all(16.0), width: screenSize
primary: Colors.white, .width *
backgroundColor: 0.2,
Color.fromARGB( child:
255, TextFormField(
15, controller:
102, dateController,
223), textAlign:
textStyle: TextAlign
const TextStyle( .start,
fontSize: 15), decoration:
), InputDecoration(
child: labelText:
const Text("Back"), "date",
onPressed: () { labelStyle: TextStyle(
Navigator.pop( fontSize:
context); 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(
child: const Text("View"), children: [
), Column(
], crossAxisAlignment:
), CrossAxisAlignment
SizedBox( .start,
width: 3, mainAxisAlignment:
), MainAxisAlignment
Column( .spaceEvenly,
mainAxisAlignment: children: [
MainAxisAlignment.spaceEvenly, // ===============alamat rs==========
crossAxisAlignment: Row(
CrossAxisAlignment.start, children: [
children: [ Icon(
TextButton( Icons.email,
style: TextButton.styleFrom( color: Colors
padding: .grey[500],
const EdgeInsets.all(16.0), size: screenSize
primary: Colors.white, .width *
backgroundColor: 0.01,
const Color.fromARGB( ),
255, 245, 27, 27), const SizedBox(
textStyle: width: 10,
const TextStyle(fontSize: 15), ),
), const Text(
onPressed: () { "Email",
showDialog( style: TextStyle(
context: context, fontSize: 13),
builder: (context) { ),
return AlertDialog( ],
title:
const Text("Warning"),
content: Text(
"Are you sure want to delete data user ${pgm['namaContact']}?"),
actions: <Widget>[
TextButton(
child:
const Text("Yes"),
onPressed: () {
Navigator.pop(
context);
deleteContact(pgm[
'idContact'])
.then(
(isSuccess) {
if (isSuccess) {
setState(() {});
ScaffoldMessenger.of(this
.context)
.showSnackBar(
const SnackBar(
content:
Text("Delete data success")));
} else {
ScaffoldMessenger.of(this
.context)
.showSnackBar(
const SnackBar(
content:
Text("Delete data failed")));
}
});
},
), ),
TextButton( const SizedBox(
child: const Text("No"), height: 5,
onPressed: () {
Navigator.pop(
context);
},
), ),
Row(
children: [
SizedBox(
height: 60,
width: screenSize
.width *
0.2,
child:
TextFormField(
controller:
emailController,
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),
)),
),
)
],
),
// ===============akhir alamat rs==========
], ],
); ),
}, const SizedBox(
); width: 30,
}, ),
child: const Text("Delete"), Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
// ===============email pic==========
Row(
children: [
Icon(
Icons.phone_android,
color: Colors
.grey[500],
size: screenSize
.width *
0.01,
),
const SizedBox(
width: 10,
),
const Text(
"No HP",
style: TextStyle(
fontSize: 13),
),
],
),
const SizedBox(
height: 5,
),
Row(
children: [
SizedBox(
height: 60,
width: screenSize
.width *
0.2,
child:
TextFormField(
controller:
nohpController,
textAlign:
TextAlign
.start,
readOnly: true,
validator:
(value) {
if (value ==
null ||
value
.isEmpty) {
return "No Hp";
}
return null;
},
decoration:
InputDecoration(
labelText:
"No Hp",
labelStyle: TextStyle(
fontSize:
13),
hintStyle:
const TextStyle(),
border:
OutlineInputBorder(
borderRadius:
BorderRadius.circular(5.0),
)),
),
)
],
),
// ===============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;
},
decoration:
InputDecoration(
labelText:
"Message",
labelStyle: TextStyle(
fontSize:
13),
hintStyle:
const TextStyle(),
border:
OutlineInputBorder(
borderRadius:
BorderRadius.circular(5.0),
)),
),
],
),
)
],
),
// ===============akhir email pic==========
],
),
],
),
],
), ),
)),
actions: [
MaterialButton(
child: Text("OK"),
onPressed: () {
Navigator.of(context).pop();
})
], ],
), );
], });
), }
),
], return DataRow(cells: [
); DataCell(Text(pgm['dateContact'].toString())),
}, DataCell(Text(pgm['namaContact'].toString())),
).toList(), 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