date picker

merge-requests/622/head
Elham Rababah 5 years ago
parent fe581ae7ce
commit 7337dc4f87

@ -16,6 +16,9 @@ class PatientSearchViewModel extends BaseViewModel{
List<PatiantInformtion> filterData = [];
DateTime selectedFromDate;
DateTime selectedToDate;
searchData(String str) {
var strExist = str.length > 0 ? true : false;
if (strExist) {
@ -83,14 +86,19 @@ class PatientSearchViewModel extends BaseViewModel{
String dateTo;
String dateFrom;
if (item == 'Previous') {
selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month-1,
DateTime.now().day);
selectedToDate = DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day-1);
dateTo = DateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day-1),
selectedToDate,
'yyyy-MM-dd');
dateFrom = DateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month-3,
DateTime.now().day),
selectedFromDate,
'yyyy-MM-dd');
} else if (item == 'Next Week') {

@ -16,6 +16,7 @@ class FilterDatePage extends StatefulWidget {
final OutPatientFilterType outPatientFilterType;
final PatientSearchViewModel patientSearchViewModel;
const FilterDatePage(
{Key key, this.outPatientFilterType, this.patientSearchViewModel})
: super(key: key);
@ -30,6 +31,8 @@ class _FilterDatePageState extends State<FilterDatePage> {
@override
Widget build(BuildContext context) {
DateTime selectedFromDate = widget.patientSearchViewModel.selectedFromDate;
DateTime selectedToDate= widget.patientSearchViewModel.selectedToDate;
var screenSize;
return AppScaffold(
isShowAppBar: false,
@ -235,9 +238,9 @@ class _FilterDatePageState extends State<FilterDatePage> {
return DateTime(
DateTime
.now()
.year, DateTime
.year -20, DateTime
.now()
.month - 3, DateTime
.month, DateTime
.now()
.day);
} else {
@ -257,7 +260,7 @@ class _FilterDatePageState extends State<FilterDatePage> {
return DateTime(
DateTime
.now()
.year, DateTime
.year +20, DateTime
.now()
.month, (DateTime
.now()

@ -199,7 +199,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
,
prefix: IconButton(
icon: Icon(
_activeLocation == 1
_activeLocation !=0
? DoctorApp.filter_1
: FontAwesomeIcons.slidersH,
color: Colors.black,
@ -208,7 +208,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
padding:
EdgeInsets.only(
bottom: 30),
onPressed: _activeLocation == 1 ? null : () {
onPressed: _activeLocation !=0 ? null : () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) =>
FilterDatePage(outPatientFilterType: outPatientFilterType,patientSearchViewModel: model,)));

Loading…
Cancel
Save