|
|
|
@ -1,9 +1,10 @@
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
import '../../models/patient_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/routes.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PatientSearch extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_PatientSearchState createState() => _PatientSearchState();
|
|
|
|
@ -25,6 +26,8 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
];
|
|
|
|
|
String _selectedType = '1';
|
|
|
|
|
String _selectedLocation = '1';
|
|
|
|
|
TextEditingController _toDateController = new TextEditingController();
|
|
|
|
|
TextEditingController _fromDateController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
final _patientSearchForm = GlobalKey<FormState>();
|
|
|
|
|
var _patientSearchFormValues = PatientModel(
|
|
|
|
@ -51,7 +54,11 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
|
|
|
|
|
void _saveForm() {
|
|
|
|
|
_patientSearchForm.currentState.save();
|
|
|
|
|
|
|
|
|
|
// Navigator.pushNamed(context,routeName)
|
|
|
|
|
print(_patientSearchFormValues.From);
|
|
|
|
|
print(_patientSearchFormValues.To);
|
|
|
|
|
|
|
|
|
|
Navigator.of(context).pushNamed(PATIENTS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -326,6 +333,7 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText: 'Patiant File',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
@ -365,8 +373,10 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
controller: _fromDateController,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText: 'From',
|
|
|
|
|
hintText: '3/11/2020',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: isSmallScreen
|
|
|
|
|
? 14
|
|
|
|
@ -389,6 +399,9 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
onTap: () {
|
|
|
|
|
_presentDatePicker('_selectedFromDate');
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_patientSearchFormValues.From = value;
|
|
|
|
|
},
|
|
|
|
@ -404,8 +417,10 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
controller: _toDateController,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText: 'To',
|
|
|
|
|
hintText: '3/11/2020',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: isSmallScreen
|
|
|
|
|
? 14
|
|
|
|
@ -422,6 +437,9 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
)
|
|
|
|
|
//BorderRadius.all(Radius.circular(20));
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
_presentDatePicker('_selectedToDate');
|
|
|
|
|
},
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
@ -474,7 +492,7 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
value: _selectedType,
|
|
|
|
|
value: _selectedLocation,
|
|
|
|
|
iconSize: 24,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder: (BuildContext context) {
|
|
|
|
@ -484,7 +502,7 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
},
|
|
|
|
|
onChanged: (String newValue) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedType = newValue;
|
|
|
|
|
_selectedLocation = newValue;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
items: _locations.map((item) {
|
|
|
|
@ -539,4 +557,27 @@ class _PatientSearchState extends State<PatientSearch> {
|
|
|
|
|
}),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _presentDatePicker(id) {
|
|
|
|
|
showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
|
firstDate: DateTime(2019),
|
|
|
|
|
lastDate: DateTime.now(),
|
|
|
|
|
).then((pickedDate) {
|
|
|
|
|
if (pickedDate == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setState(() {
|
|
|
|
|
print(id);
|
|
|
|
|
var selectedDate = DateFormat.yMd().format(pickedDate);
|
|
|
|
|
|
|
|
|
|
if (id == '_selectedFromDate') {
|
|
|
|
|
_fromDateController.text = selectedDate;
|
|
|
|
|
} else {
|
|
|
|
|
_toDateController.text = selectedDate;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|