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

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

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

Loading…
Cancel
Save