Update API to update patient. Update mytextfield to table is editable paramiter. add edit page to edit user information.
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:patient_manager/objects/patients.dart';
|
||||
class BuildPatientsList extends StatefulWidget {
|
||||
final List<Patient> patients;
|
||||
final searchString;
|
||||
|
||||
const BuildPatientsList({
|
||||
super.key,
|
||||
required this.patients,
|
||||
|
||||
@@ -3,19 +3,30 @@ import 'package:flutter/material.dart';
|
||||
class MyTextField extends StatelessWidget {
|
||||
final controller;
|
||||
final String hintText;
|
||||
final bool editable;
|
||||
|
||||
const MyTextField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.hintText,
|
||||
required this.editable,
|
||||
});
|
||||
|
||||
bool makeEditable() {
|
||||
if (editable) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 25.0),
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
readOnly: makeEditable(),
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
|
||||
@@ -30,13 +30,27 @@ class _PatientDetailsState extends State<PatientDetails> {
|
||||
child: SelectionArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
"Patient Details",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 35,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"Patient Details",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 35,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit),
|
||||
alignment: Alignment.topRight,
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/patient-manager/patient/edit',
|
||||
arguments: widget.selectedPatient);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
Reference in New Issue
Block a user