pop up design alignment
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:file_picker/file_picker.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:patient_manager/components/buildFilesList.dart';
|
import 'package:patient_manager/components/buildFilesList.dart';
|
||||||
import 'package:patient_manager/components/medCertInput.dart';
|
import 'package:patient_manager/components/medCertInput.dart';
|
||||||
|
import 'package:patient_manager/components/myErrorMessage.dart';
|
||||||
import 'package:patient_manager/components/myTextInput.dart';
|
import 'package:patient_manager/components/myTextInput.dart';
|
||||||
import 'package:patient_manager/components/mybutton.dart';
|
import 'package:patient_manager/components/mybutton.dart';
|
||||||
import 'package:patient_manager/main.dart';
|
import 'package:patient_manager/main.dart';
|
||||||
@@ -87,10 +88,10 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
String message = "Successfully added file";
|
String message = "Successfully added file";
|
||||||
messagePopUp(message);
|
messagePopUp(message);
|
||||||
} else {
|
} else {
|
||||||
messagePopUp("error response 2");
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messagePopUp("error respose 1");
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,10 +125,10 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
String message = "Successfully added file";
|
String message = "Successfully added file";
|
||||||
messagePopUp(message);
|
messagePopUp(message);
|
||||||
} else {
|
} else {
|
||||||
messagePopUp("error response 2");
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messagePopUp("error respose 1");
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +140,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
appUser =
|
appUser =
|
||||||
AppUser.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
|
AppUser.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
|
||||||
} else {
|
} else {
|
||||||
|
internetConnectionPopUp();
|
||||||
throw Exception('Failed to load user');
|
throw Exception('Failed to load user');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,6 +165,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
List<PFile>.from(l.map((model) => PFile.fromJson(model)));
|
List<PFile>.from(l.map((model) => PFile.fromJson(model)));
|
||||||
return files;
|
return files;
|
||||||
} else {
|
} else {
|
||||||
|
internetConnectionPopUp();
|
||||||
throw Exception('failed to load patients');
|
throw Exception('failed to load patients');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -181,58 +184,108 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
void medCertPopUp() {
|
void medCertPopUp() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => Dialog(
|
||||||
title: const Row(
|
child: Stack(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Text("Create Medical Certificate"),
|
Container(
|
||||||
],
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
width: 700.0,
|
||||||
|
//height: 475.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(color: Colors.blueAccent, width: 5.0),
|
||||||
),
|
),
|
||||||
content: Medcertinput(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
"Create Medical Certificate",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
fontSize: 35.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25.0),
|
||||||
|
Medcertinput(
|
||||||
startDateController: startDateController,
|
startDateController: startDateController,
|
||||||
endDateTextController: endDateTextController,
|
endDateTextController: endDateTextController,
|
||||||
retDateTextController: retDateTextController,
|
retDateTextController: retDateTextController,
|
||||||
),
|
),
|
||||||
actions: [
|
SizedBox(
|
||||||
TextButton(
|
width: 300,
|
||||||
onPressed: () {
|
height: 100,
|
||||||
|
child: MyButton(
|
||||||
|
onTap: () {
|
||||||
|
if (isMedCertFieldsFilled()) {
|
||||||
generateMedCert();
|
generateMedCert();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
} else {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MyErrorMessage(
|
||||||
|
errorType: "Input Error");
|
||||||
},
|
},
|
||||||
child: const Text(
|
);
|
||||||
"Generate",
|
}
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
},
|
||||||
|
buttonText: "Add Note"))
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
Positioned(
|
||||||
|
top: 5,
|
||||||
|
right: 5,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
startDateController.clear();
|
|
||||||
endDateTextController.clear();
|
|
||||||
retDateTextController.clear();
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: const Text("Cancel"),
|
icon: const Icon(
|
||||||
)
|
Icons.close,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uploudFilePopUp() {
|
void uploudFilePopUp() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => Dialog(
|
||||||
title: const Row(
|
child: Stack(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Text("Upload File"),
|
Container(
|
||||||
],
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
width: 700.0,
|
||||||
|
//height: 475.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(color: Colors.blueAccent, width: 5.0),
|
||||||
),
|
),
|
||||||
content: SizedBox(
|
|
||||||
width: 700,
|
|
||||||
height: 250,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
const Text(
|
||||||
|
"Upload File",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
fontSize: 35.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25.0),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 700,
|
width: 700,
|
||||||
child: MyButton(
|
child: MyButton(
|
||||||
@@ -241,11 +294,6 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
await FilePicker.platform.pickFiles();
|
await FilePicker.platform.pickFiles();
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
final selectedFile = result.files.first;
|
final selectedFile = result.files.first;
|
||||||
//selectedFile
|
|
||||||
// print("Name: ${selectedFile.name}");
|
|
||||||
// print("Extension: ${selectedFile.extension}");
|
|
||||||
// print("Content: ${selectedFile.bytes}");
|
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
selected = selectedFile;
|
selected = selectedFile;
|
||||||
});
|
});
|
||||||
@@ -261,33 +309,78 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
hintText: "Selected FIle",
|
hintText: "Selected FIle",
|
||||||
editable: false,
|
editable: false,
|
||||||
required: true,
|
required: true,
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
actions: [
|
width: 300,
|
||||||
TextButton(
|
height: 100,
|
||||||
onPressed: () {
|
child: MyButton(
|
||||||
|
onTap: () {
|
||||||
|
if (isFileFieldsFilled()) {
|
||||||
uploadSelectedFile(selected);
|
uploadSelectedFile(selected);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
} else {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MyErrorMessage(
|
||||||
|
errorType: "Input Error");
|
||||||
},
|
},
|
||||||
child: const Text(
|
);
|
||||||
"Upload",
|
}
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
selectedFileController.clear();
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
},
|
||||||
child: const Text("Cancel"),
|
buttonText: "Add Note"))
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 5,
|
||||||
|
right: 5,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void internetConnectionPopUp() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MyErrorMessage(errorType: "Internet Connection");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isMedCertFieldsFilled() {
|
||||||
|
if (startDateController.text.isEmpty ||
|
||||||
|
endDateTextController.text.isEmpty ||
|
||||||
|
retDateTextController.text.isEmpty) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isFileFieldsFilled() {
|
||||||
|
if (selectedFileController.text.isEmpty) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
futueFiles = fetchFiles(endpointFiles + widget.patientIndex.toString());
|
futueFiles = fetchFiles(endpointFiles + widget.patientIndex.toString());
|
||||||
|
|||||||
@@ -2,23 +2,13 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:patient_manager/components/buildNotesList.dart';
|
import 'package:patient_manager/components/buildNotesList.dart';
|
||||||
|
import 'package:patient_manager/components/myErrorMessage.dart';
|
||||||
import 'package:patient_manager/components/myMLTextInput.dart';
|
import 'package:patient_manager/components/myMLTextInput.dart';
|
||||||
import 'package:patient_manager/components/myTextInput.dart';
|
import 'package:patient_manager/components/myTextInput.dart';
|
||||||
|
import 'package:patient_manager/components/mybutton.dart';
|
||||||
import 'package:patient_manager/objects/notes.dart';
|
import 'package:patient_manager/objects/notes.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
Future<List<Note>> fetchNotes(String endpoint) async {
|
|
||||||
final response = await http.get(Uri.parse(endpoint));
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
Iterable l = jsonDecode(response.body);
|
|
||||||
List<Note> notes = List<Note>.from(l.map((model) => Note.fromJson(model)));
|
|
||||||
//print("Here notes");
|
|
||||||
return notes;
|
|
||||||
} else {
|
|
||||||
throw Exception('failed to load patients');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class PatientNotes extends StatefulWidget {
|
class PatientNotes extends StatefulWidget {
|
||||||
final int patientIndex;
|
final int patientIndex;
|
||||||
const PatientNotes({super.key, required this.patientIndex});
|
const PatientNotes({super.key, required this.patientIndex});
|
||||||
@@ -34,6 +24,20 @@ class _PatientNotesState extends State<PatientNotes> {
|
|||||||
final noteTextController = TextEditingController();
|
final noteTextController = TextEditingController();
|
||||||
late Future<List<Note>> futueNotes;
|
late Future<List<Note>> futueNotes;
|
||||||
|
|
||||||
|
Future<List<Note>> fetchNotes(String endpoint) async {
|
||||||
|
final response = await http.get(Uri.parse(endpoint));
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Iterable l = jsonDecode(response.body);
|
||||||
|
List<Note> notes =
|
||||||
|
List<Note>.from(l.map((model) => Note.fromJson(model)));
|
||||||
|
//print("Here notes");
|
||||||
|
return notes;
|
||||||
|
} else {
|
||||||
|
internetConnectionPopUp();
|
||||||
|
throw Exception('failed to load patients');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> addPatientNoteAPICall() async {
|
Future<void> addPatientNoteAPICall() async {
|
||||||
var response = await http.post(
|
var response = await http.post(
|
||||||
Uri.parse(apiUrlAddNote),
|
Uri.parse(apiUrlAddNote),
|
||||||
@@ -55,10 +59,19 @@ class _PatientNotesState extends State<PatientNotes> {
|
|||||||
String message = "Successfully added Note";
|
String message = "Successfully added Note";
|
||||||
messagePopUp(message);
|
messagePopUp(message);
|
||||||
} else {
|
} else {
|
||||||
messagePopUp("error");
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void internetConnectionPopUp() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MyErrorMessage(errorType: "Internet Connection");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void messagePopUp(error) {
|
void messagePopUp(error) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -70,6 +83,106 @@ class _PatientNotesState extends State<PatientNotes> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addNotePopUp() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => Dialog(
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
width: 700.0,
|
||||||
|
//height: 475.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(color: Colors.blueAccent, width: 5.0),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
//mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
"Add Note",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
fontSize: 35.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25.0),
|
||||||
|
SizedBox(
|
||||||
|
width: 700,
|
||||||
|
child: MyTextField(
|
||||||
|
controller: titleController,
|
||||||
|
hintText: "Title of Note",
|
||||||
|
editable: true,
|
||||||
|
required: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25.0),
|
||||||
|
Expanded(
|
||||||
|
child: MyMLTextField(
|
||||||
|
controller: noteTextController,
|
||||||
|
hintText: "Note Details",
|
||||||
|
editable: true,
|
||||||
|
required: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 300,
|
||||||
|
height: 100,
|
||||||
|
child: MyButton(
|
||||||
|
onTap: () {
|
||||||
|
if (isFieldsFilled()) {
|
||||||
|
addPatientNoteAPICall();
|
||||||
|
Navigator.pop(context);
|
||||||
|
} else {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MyErrorMessage(
|
||||||
|
errorType: "Input Error");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
buttonText: "Add Note"))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 5,
|
||||||
|
right: 5,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
titleController.clear();
|
||||||
|
noteTextController.clear();
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isFieldsFilled() {
|
||||||
|
if (titleController.text.isEmpty || noteTextController.text.isEmpty) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
futueNotes = fetchNotes(endpoint + widget.patientIndex.toString());
|
futueNotes = fetchNotes(endpoint + widget.patientIndex.toString());
|
||||||
@@ -115,61 +228,7 @@ class _PatientNotesState extends State<PatientNotes> {
|
|||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
addNotePopUp();
|
||||||
context: context,
|
|
||||||
builder: (context) => AlertDialog(
|
|
||||||
title: const Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text("Add Note"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
content: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 700,
|
|
||||||
child: MyTextField(
|
|
||||||
controller: titleController,
|
|
||||||
hintText: "Title of Note",
|
|
||||||
editable: true,
|
|
||||||
required: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 25.0,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: MyMLTextField(
|
|
||||||
controller: noteTextController,
|
|
||||||
hintText: "Note Details",
|
|
||||||
editable: true,
|
|
||||||
required: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
addPatientNoteAPICall();
|
|
||||||
Navigator.pop(context);
|
|
||||||
//print(widget.patientIndex);
|
|
||||||
},
|
|
||||||
child: const Text(
|
|
||||||
"Submit",
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
child: const Text("Cancel"),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.add),
|
icon: const Icon(Icons.add),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:patient_manager/components/myDropdownInput.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/myTextInput.dart';
|
||||||
import 'package:patient_manager/components/mybutton.dart';
|
import 'package:patient_manager/components/mybutton.dart';
|
||||||
import 'package:patient_manager/objects/appUser.dart';
|
import 'package:patient_manager/objects/appUser.dart';
|
||||||
@@ -21,6 +22,16 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
|
|||||||
final lnameController = TextEditingController();
|
final lnameController = TextEditingController();
|
||||||
final titleController = TextEditingController();
|
final titleController = TextEditingController();
|
||||||
|
|
||||||
|
bool isFieldsFilled() {
|
||||||
|
if (fnameController.text.isEmpty ||
|
||||||
|
lnameController.text.isEmpty ||
|
||||||
|
titleController.text.isEmpty) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
fnameController.text = widget.signedInUser.fname;
|
fnameController.text = widget.signedInUser.fname;
|
||||||
@@ -70,24 +81,12 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
|
|||||||
height: 100.0,
|
height: 100.0,
|
||||||
child: MyButton(
|
child: MyButton(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (fnameController.text == "") {
|
if (isFieldsFilled()) {
|
||||||
showDialog<void>(
|
} else {
|
||||||
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return const MyErrorMessage(errorType: "Input Error");
|
||||||
title: const Text('Incomplete Field\\s'),
|
|
||||||
content: const Text(
|
|
||||||
'Please conplete all fields',
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: const Text('Disable'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,8 +149,10 @@ class _EditPatientState extends State<EditPatient> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget deletePatientPopUp() {
|
void deletePatientPopUp() {
|
||||||
return Dialog(
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => Dialog(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@@ -246,6 +248,7 @@ class _EditPatientState extends State<EditPatient> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,10 +318,7 @@ class _EditPatientState extends State<EditPatient> {
|
|||||||
icon: const Icon(Icons.delete),
|
icon: const Icon(Icons.delete),
|
||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
deletePatientPopUp();
|
||||||
context: context,
|
|
||||||
builder: (context) => deletePatientPopUp(),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user