Update UI of screens

This commit is contained in:
2024-07-05 18:46:00 +02:00
parent f4d83bbd69
commit f46711de4a
4 changed files with 268 additions and 245 deletions

View File

@@ -1,50 +0,0 @@
import 'package:flutter/material.dart';
class PatientDetailItem extends StatefulWidget {
final String category;
final String value;
const PatientDetailItem({
super.key,
required this.category,
required this.value,
});
@override
State<PatientDetailItem> createState() => _PatientDetailItemState();
}
class _PatientDetailItemState extends State<PatientDetailItem> {
@override
Widget build(BuildContext context) {
return Expanded(
flex: 1,
child: Row(
children: [
Text(
"${widget.category}:",
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
const SizedBox(width: 10),
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 10.0),
child: Container(
//width: MediaQuery.of(context).size.width * 0.5,
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5.0))),
child: Text(
widget.value,
style: const TextStyle(
fontSize: 20,
),
),
),
),
),
],
),
);
}
}

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/components/patientDetailItem.dart'; import 'package:patient_manager/components/myTextInput.dart';
import 'package:patient_manager/objects/patients.dart'; import 'package:patient_manager/objects/patients.dart';
class PatientDetails extends StatefulWidget { class PatientDetails extends StatefulWidget {
@@ -11,20 +11,50 @@ class PatientDetails extends StatefulWidget {
} }
class _PatientDetailsState extends State<PatientDetails> { class _PatientDetailsState extends State<PatientDetails> {
final idController = TextEditingController();
final fnameController = TextEditingController();
final lnameController = TextEditingController();
final cellController = TextEditingController();
final emailController = TextEditingController();
final medNoController = TextEditingController();
final medNameController = TextEditingController();
final medSchemeController = TextEditingController();
final addressController = TextEditingController();
double? headingFontSize = 35.0; double? headingFontSize = 35.0;
double? bodyFonstSize = 20.0; double? bodyFonstSize = 20.0;
@override
void initState() {
setState(() {
idController.value = TextEditingValue(text: widget.selectedPatient.id_no);
fnameController.value =
TextEditingValue(text: widget.selectedPatient.first_name);
lnameController.value =
TextEditingValue(text: widget.selectedPatient.last_name);
cellController.value =
TextEditingValue(text: widget.selectedPatient.cell_no);
emailController.value =
TextEditingValue(text: widget.selectedPatient.email);
medNameController.value =
TextEditingValue(text: widget.selectedPatient.medical_aid_name);
medNoController.value =
TextEditingValue(text: widget.selectedPatient.medical_aid_no);
medSchemeController.value =
TextEditingValue(text: widget.selectedPatient.medical_aid_scheme);
addressController.value =
TextEditingValue(text: widget.selectedPatient.address);
});
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Card( return Container(
elevation: 20,
child: Container(
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
decoration: const BoxDecoration( decoration: BoxDecoration(
color: Color.fromARGB(255, 219, 218, 218), color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.circular(25.0),
Radius.circular(10), border: Border.all(color: Colors.blueAccent, width: 3.0),
),
), ),
//constraints: const BoxConstraints.expand(height: 250.0), //constraints: const BoxConstraints.expand(height: 250.0),
child: SelectionArea( child: SelectionArea(
@@ -39,11 +69,13 @@ class _PatientDetailsState extends State<PatientDetails> {
style: TextStyle( style: TextStyle(
fontSize: 35, fontSize: 35,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.blueAccent,
), ),
), ),
IconButton( IconButton(
icon: const Icon(Icons.edit), icon: const Icon(Icons.edit),
alignment: Alignment.topRight, alignment: Alignment.topRight,
color: Colors.blueAccent,
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/patient-manager/patient/edit', '/patient-manager/patient/edit',
@@ -52,40 +84,58 @@ class _PatientDetailsState extends State<PatientDetails> {
) )
], ],
), ),
const Divider(), const Divider(color: Colors.blueAccent),
const SizedBox(height: 10), const SizedBox(height: 10),
Column( Column(
children: [ children: [
Row( Row(
children: [ children: [
PatientDetailItem( Expanded(
category: "ID No. ", child: MyTextField(
value: widget.selectedPatient.id_no, controller: idController,
hintText: "ID No.",
editable: false,
required: false),
), ),
PatientDetailItem( Expanded(
category: "Name ", child: MyTextField(
value: widget.selectedPatient.first_name, controller: fnameController,
hintText: "Name",
editable: false,
required: false),
), ),
PatientDetailItem( Expanded(
category: "Surname ", child: MyTextField(
value: widget.selectedPatient.last_name, controller: lnameController,
hintText: "Surname",
editable: false,
required: false),
), ),
], ],
), ),
const SizedBox(height: 5), const SizedBox(height: 10),
Row( Row(
children: [ children: [
PatientDetailItem( Expanded(
category: "Cell No ", child: MyTextField(
value: widget.selectedPatient.cell_no, controller: cellController,
hintText: "Cell No.",
editable: false,
required: false),
), ),
PatientDetailItem( Expanded(
category: "Email ", child: MyTextField(
value: widget.selectedPatient.email, controller: emailController,
hintText: "Email",
editable: false,
required: false),
), ),
PatientDetailItem( Expanded(
category: "Address ", child: MyTextField(
value: widget.selectedPatient.address, controller: addressController,
hintText: "Address",
editable: false,
required: false),
), ),
], ],
), ),
@@ -98,26 +148,48 @@ class _PatientDetailsState extends State<PatientDetails> {
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.blueAccent,
), ),
), ),
const Divider(), const Divider(color: Colors.blueAccent),
const SizedBox(height: 10), const SizedBox(height: 10),
Column( Column(
children: [ children: [
Row( Row(
children: [ children: [
PatientDetailItem( Expanded(
category: "No. ", child: MyTextField(
value: widget.selectedPatient.medical_aid_no, controller: medNoController,
hintText: "No.",
editable: false,
required: false),
), ),
PatientDetailItem( Expanded(
category: "Name ", child: MyTextField(
value: widget.selectedPatient.medical_aid_name, controller: medNameController,
hintText: "Name",
editable: false,
required: false),
), ),
PatientDetailItem( Expanded(
category: "Scheme ", child: MyTextField(
value: widget.selectedPatient.medical_aid_scheme, controller: medSchemeController,
hintText: "Scheme",
editable: false,
required: false),
), ),
// PatientDetailItem(
// category: "No. ",
// value: widget.selectedPatient.medical_aid_no,
// ),
// PatientDetailItem(
// category: "Name ",
// value: widget.selectedPatient.medical_aid_name,
// ),
// PatientDetailItem(
// category: "Scheme ",
// value: widget.selectedPatient.medical_aid_scheme,
// ),
], ],
), ),
], ],
@@ -125,7 +197,6 @@ class _PatientDetailsState extends State<PatientDetails> {
], ],
), ),
), ),
),
); );
} }
} }

View File

@@ -536,15 +536,12 @@ class _PatientFilesState extends State<PatientFiles> {
flex: 1, flex: 1,
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: Card(
elevation: 20.0,
child: Container( child: Container(
//height: 300.0, //height: 300.0,
decoration: const BoxDecoration( decoration: BoxDecoration(
color: Color.fromARGB(255, 219, 218, 218), color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.circular(25.0),
Radius.circular(10), border: Border.all(color: Colors.blueAccent, width: 3.0),
),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 5.0), padding: const EdgeInsets.only(top: 5.0),
@@ -558,25 +555,35 @@ class _PatientFilesState extends State<PatientFiles> {
style: TextStyle( style: TextStyle(
fontSize: 35, fontSize: 35,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.blueAccent,
), ),
), ),
IconButton( IconButton(
onPressed: () { onPressed: () {
medCertPopUp(); medCertPopUp();
}, },
icon: const Icon(Icons.sick_outlined), icon: const Icon(
Icons.sick_outlined,
color: Colors.blueAccent,
),
), ),
IconButton( IconButton(
onPressed: () { onPressed: () {
prescritionPopUp(); prescritionPopUp();
}, },
icon: const Icon(Icons.medication_outlined), icon: const Icon(
Icons.medication_outlined,
color: Colors.blueAccent,
),
), ),
IconButton( IconButton(
onPressed: () { onPressed: () {
uploudFilePopUp(); uploudFilePopUp();
}, },
icon: const Icon(Icons.add), icon: const Icon(
Icons.add,
color: Colors.blueAccent,
),
) )
], ],
), ),
@@ -590,7 +597,6 @@ class _PatientFilesState extends State<PatientFiles> {
), ),
), ),
), ),
),
); );
} else { } else {
return const Center( return const Center(

View File

@@ -221,15 +221,12 @@ class _PatientNotesState extends State<PatientNotes> {
flex: 1, flex: 1,
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: Card(
elevation: 20.0,
child: Container( child: Container(
//height: 300.0, //height: 300.0,
decoration: const BoxDecoration( decoration: BoxDecoration(
color: Color.fromARGB(255, 219, 218, 218), color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.circular(25.0),
Radius.circular(10), border: Border.all(color: Colors.blueAccent, width: 3.0),
),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 5.0), padding: const EdgeInsets.only(top: 5.0),
@@ -243,13 +240,13 @@ class _PatientNotesState extends State<PatientNotes> {
style: TextStyle( style: TextStyle(
fontSize: 35, fontSize: 35,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), color: Colors.blueAccent),
), ),
IconButton( IconButton(
onPressed: () { onPressed: () {
addNotePopUp(); addNotePopUp();
}, },
icon: const Icon(Icons.add), icon: const Icon(Icons.add, color: Colors.blueAccent),
) )
], ],
), ),
@@ -263,7 +260,6 @@ class _PatientNotesState extends State<PatientNotes> {
), ),
), ),
), ),
),
); );
} else { } else {
return const Center( return const Center(