2) remove Unnesasay signed in user from widget, add menu height. 3) add medicine object to cater for results of med api call. 4) update search input to cater for new parameters. 5) create prescriotion popUp widget. 6) Create medicine search pop Up widget
101 lines
2.8 KiB
Dart
101 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:patient_manager/components/myDropdownInput.dart';
|
|
import 'package:patient_manager/components/myErrorMessage.dart';
|
|
import 'package:patient_manager/components/myTextInput.dart';
|
|
import 'package:patient_manager/components/mybutton.dart';
|
|
import 'package:patient_manager/objects/appUser.dart';
|
|
|
|
class ProfileUserUpdate extends StatefulWidget {
|
|
final AppUser signedInUser;
|
|
//final String userEmail;
|
|
const ProfileUserUpdate({
|
|
super.key,
|
|
required this.signedInUser,
|
|
});
|
|
|
|
@override
|
|
State<ProfileUserUpdate> createState() => _ProfileUserUpdateState();
|
|
}
|
|
|
|
class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
|
|
final fnameController = TextEditingController();
|
|
final lnameController = TextEditingController();
|
|
final titleController = TextEditingController();
|
|
|
|
bool isFieldsFilled() {
|
|
if (fnameController.text.isEmpty ||
|
|
lnameController.text.isEmpty ||
|
|
titleController.text.isEmpty) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
fnameController.text = widget.signedInUser.fname;
|
|
lnameController.text = widget.signedInUser.lname;
|
|
titleController.text = widget.signedInUser.title;
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
const SizedBox(height: 15.0),
|
|
const Text(
|
|
"Update User profile:",
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 25,
|
|
),
|
|
),
|
|
const SizedBox(height: 15.0),
|
|
MyTextField(
|
|
controller: fnameController,
|
|
hintText: "First Name",
|
|
editable: true,
|
|
required: true,
|
|
),
|
|
const SizedBox(height: 10.0),
|
|
MyTextField(
|
|
controller: lnameController,
|
|
hintText: "Last Name",
|
|
editable: true,
|
|
required: true,
|
|
),
|
|
const SizedBox(height: 10.0),
|
|
MyDropdownField(
|
|
controller: titleController,
|
|
hintText: "Title",
|
|
dropdownOptions: const <String>["Dr.", "Assistant"],
|
|
required: true,
|
|
),
|
|
const SizedBox(height: 10.0),
|
|
SizedBox(
|
|
width: 500.0,
|
|
height: 100.0,
|
|
child: MyButton(
|
|
onTap: () {
|
|
if (isFieldsFilled()) {
|
|
} else {
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return const MyErrorMessage(errorType: "Input Error");
|
|
},
|
|
);
|
|
}
|
|
},
|
|
buttonText: "Update",
|
|
buttonColor: Colors.blueAccent,
|
|
textColor: Colors.white,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|