|
|
|
|
@ -1,18 +1,21 @@
|
|
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
|
|
|
|
import '../../config/size_config.dart';
|
|
|
|
|
import '../../util/text_validator.dart';
|
|
|
|
|
import '../../widgets/shared/app_buttons_widget.dart';
|
|
|
|
|
import '../../widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import '../../widgets/shared/app_text_form_field.dart';
|
|
|
|
|
import '../../widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import '../../widgets/shared/rounded_container_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/rendering.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import '../../lookups/patient_lookup.dart';
|
|
|
|
|
import '../../models/patient_model.dart';
|
|
|
|
|
import '../../routes.dart';
|
|
|
|
|
import '../../widgets/patients/dynamic_elements.dart';
|
|
|
|
|
|
|
|
|
|
// OWNER : Ibrahim albitar
|
|
|
|
|
// DATE : 19-04-2020
|
|
|
|
|
// DESCRIPTION : Patient Search Screen.
|
|
|
|
|
|
|
|
|
|
class PatientSearchScreen extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_PatientSearchScreenState createState() => _PatientSearchScreenState();
|
|
|
|
|
@ -22,7 +25,9 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
|
|
|
|
|
String _selectedType = '1';
|
|
|
|
|
String _selectedLocation = '1';
|
|
|
|
|
|
|
|
|
|
final _patientSearchForm = GlobalKey<FormState>();
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
bool _autoValidate = false;
|
|
|
|
|
|
|
|
|
|
var _patientSearchFormValues = PatientModel(
|
|
|
|
|
ProjectID: 12,
|
|
|
|
|
ClinicID: 17,
|
|
|
|
|
@ -45,18 +50,18 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
|
|
|
|
|
IsLoginForDoctorApp: true,
|
|
|
|
|
PatientOutSA: false);
|
|
|
|
|
|
|
|
|
|
void _saveForm() {
|
|
|
|
|
_patientSearchForm.currentState.save();
|
|
|
|
|
|
|
|
|
|
// Navigator.pushNamed(context,routeName)
|
|
|
|
|
print(_patientSearchFormValues.From);
|
|
|
|
|
print(_patientSearchFormValues.To);
|
|
|
|
|
|
|
|
|
|
Navigator.of(context).pushNamed(PATIENTS, arguments: {
|
|
|
|
|
'patientSearchForm': _patientSearchFormValues,
|
|
|
|
|
'selectedType': _selectedType
|
|
|
|
|
void _validateInputs() {
|
|
|
|
|
if (_formKey.currentState.validate()) {
|
|
|
|
|
// If all data are correct then save data to out variables
|
|
|
|
|
_formKey.currentState.save();
|
|
|
|
|
} else {
|
|
|
|
|
// If all data are not valid then start auto validation.
|
|
|
|
|
setState(() {
|
|
|
|
|
_autoValidate = true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -75,7 +80,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
|
|
|
|
|
padding: EdgeInsets.all(15),
|
|
|
|
|
width: SizeConfig.screenWidth * 1,
|
|
|
|
|
child: Form(
|
|
|
|
|
key: _patientSearchForm,
|
|
|
|
|
key: _formKey,
|
|
|
|
|
autovalidate: _autoValidate,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
@ -143,127 +149,47 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
hintText: 'First Name',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30)),
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(color: Color(0xff707070)),
|
|
|
|
|
),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30)),
|
|
|
|
|
borderSide: BorderSide(
|
|
|
|
|
color: Theme.of(context).primaryColor),
|
|
|
|
|
)
|
|
|
|
|
//BorderRadius.all(Radius.circular(20));
|
|
|
|
|
),
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_patientSearchFormValues.FirstName = value;
|
|
|
|
|
},
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return TextValidator().validateName(value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
hintText: 'Middle Name',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30)),
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(color: Color(0xff707070)),
|
|
|
|
|
),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30)),
|
|
|
|
|
borderSide: BorderSide(
|
|
|
|
|
color: Theme.of(context).primaryColor),
|
|
|
|
|
)
|
|
|
|
|
//BorderRadius.all(Radius.circular(20));
|
|
|
|
|
),
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_patientSearchFormValues.MiddleName = value;
|
|
|
|
|
},
|
|
|
|
|
validator: (value) {
|
|
|
|
|
return TextValidator().validateName(value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
hintText: 'Last Name',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30)),
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(color: Color(0xff707070)),
|
|
|
|
|
),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30.0)),
|
|
|
|
|
borderSide: BorderSide(
|
|
|
|
|
color: Theme.of(context).primaryColor),
|
|
|
|
|
)
|
|
|
|
|
//BorderRadius.all(Radius.circular(20));
|
|
|
|
|
),
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_patientSearchFormValues.LastName = value;
|
|
|
|
|
},
|
|
|
|
|
validator: (value) {
|
|
|
|
|
return TextValidator().validateName(value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
hintText: 'Phone Number',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30)),
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(color: Color(0xff707070)),
|
|
|
|
|
),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30.0)),
|
|
|
|
|
borderSide: BorderSide(
|
|
|
|
|
color: Theme.of(context).primaryColor),
|
|
|
|
|
)
|
|
|
|
|
//BorderRadius.all(Radius.circular(20));
|
|
|
|
|
),
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return TextValidator().validateMobile(value);
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_patientSearchFormValues.PatientMobileNumber =
|
|
|
|
|
@ -273,64 +199,24 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
hintText: 'Patiant ID',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30)),
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(color: Color(0xff707070)),
|
|
|
|
|
),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30.0)),
|
|
|
|
|
borderSide: BorderSide(
|
|
|
|
|
color: Theme.of(context).primaryColor),
|
|
|
|
|
)
|
|
|
|
|
//BorderRadius.all(Radius.circular(20));
|
|
|
|
|
),
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return TextValidator().validateIdNumber(value);
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_patientSearchFormValues.PatientID =
|
|
|
|
|
int.parse(value);
|
|
|
|
|
89000;
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
hintText: 'Patiant File',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 2),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30)),
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(color: Color(0xff707070)),
|
|
|
|
|
),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(30.0)),
|
|
|
|
|
borderSide: BorderSide(
|
|
|
|
|
color: Theme.of(context).primaryColor),
|
|
|
|
|
)
|
|
|
|
|
//BorderRadius.all(Radius.circular(20));
|
|
|
|
|
),
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return TextValidator().validateIdNumber(value);
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
//_patientSearchFormValues. = value;
|
|
|
|
|
@ -432,7 +318,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
|
|
|
|
|
title: "Search",
|
|
|
|
|
color: Color(0xff58434F),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
print("Tapped Me");
|
|
|
|
|
_validateInputs();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|