-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
830 additions
and
176 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
127 changes: 127 additions & 0 deletions
127
lib/components/search_doctor/search_doctor_datepicker.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import 'package:dialog_doc990_mobile/constants.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; | ||
import 'package:intl/intl.dart'; | ||
|
||
class SearchDoctorDatePickerField extends StatefulWidget { | ||
final ValueChanged<DateTime> onChange; | ||
final String text; | ||
final bool isRequiredFeild; | ||
|
||
const SearchDoctorDatePickerField({ | ||
Key key, | ||
this.onChange, | ||
this.text, | ||
this.isRequiredFeild, | ||
}); | ||
|
||
@override | ||
_SearchDoctorDatePickerFieldState createState() => | ||
_SearchDoctorDatePickerFieldState( | ||
onChange: onChange, | ||
text: text, | ||
isRequiredFeild: isRequiredFeild, | ||
); | ||
} | ||
|
||
class _SearchDoctorDatePickerFieldState | ||
extends State<SearchDoctorDatePickerField> { | ||
final ValueChanged<DateTime> onChange; | ||
final String text; | ||
final bool isRequiredFeild; | ||
var date = ''; | ||
|
||
_SearchDoctorDatePickerFieldState({ | ||
this.onChange, | ||
this.text, | ||
this.isRequiredFeild, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final size = MediaQuery.of(context).size; | ||
|
||
return Container( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Text( | ||
text, | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 14, | ||
fontWeight: FontWeight.normal, | ||
), | ||
textAlign: TextAlign.left, | ||
), | ||
SizedBox( | ||
height: size.height * 0.005, | ||
), | ||
SearchDoctorDateContainer( | ||
child: TextFormField( | ||
initialValue: date, | ||
style: TextStyle(fontFamily: FONT_FAMILY_PRIMARY), | ||
onTap: () { | ||
FocusScope.of(context).requestFocus(new FocusNode()); | ||
DatePicker.showDatePicker( | ||
context, | ||
showTitleActions: true, | ||
onChanged: (data) {}, | ||
onConfirm: (selectedDate) { | ||
onChange(selectedDate); | ||
setState(() { | ||
date = DateFormat('yyyy-MM-dd').format(selectedDate); | ||
}); | ||
}, | ||
); | ||
}, | ||
decoration: InputDecoration( | ||
hintText: date != '' | ||
? Text( | ||
date, | ||
style: TextStyle( | ||
color: Colors.black, | ||
), | ||
).data.toString() | ||
: Text( | ||
'Any Date', | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 18, | ||
color: Colors.grey[600], | ||
), | ||
).data.toString(), | ||
hintStyle: date != '' | ||
? TextStyle(color: Colors.black) | ||
: TextStyle(color: Colors.grey), | ||
contentPadding: EdgeInsets.only( | ||
left: 2, | ||
top: 2, | ||
), | ||
border: InputBorder.none, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
class SearchDoctorDateContainer extends StatelessWidget { | ||
final Widget child; | ||
const SearchDoctorDateContainer({Key key, this.child}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Size size = MediaQuery.of(context).size; | ||
return Container( | ||
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 1.5), | ||
width: size.width * 0.9, | ||
height: 50, | ||
decoration: BoxDecoration( | ||
color: Colors.grey[300], borderRadius: BorderRadius.circular(8)), | ||
child: child, | ||
); | ||
} | ||
} |
167 changes: 167 additions & 0 deletions
167
lib/components/search_doctor/search_doctor_hospital.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
import 'package:dialog_doc990_mobile/constants.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class SearchDoctorHospitalDrodown extends StatefulWidget { | ||
final ValueChanged<String> onChange; | ||
final String text; | ||
final bool isRequiredFeild; | ||
final String value; | ||
|
||
const SearchDoctorHospitalDrodown({ | ||
Key key, | ||
this.isRequiredFeild, | ||
this.onChange, | ||
this.text, | ||
this.value, | ||
}) : super(key: key); | ||
|
||
@override | ||
_SearchDoctorHospitalDrodownState createState() => | ||
_SearchDoctorHospitalDrodownState( | ||
isRequiredFeild: isRequiredFeild, | ||
onChange: onChange, | ||
text: text, | ||
value: value, | ||
); | ||
} | ||
|
||
class _SearchDoctorHospitalDrodownState | ||
extends State<SearchDoctorHospitalDrodown> { | ||
final ValueChanged<String> onChange; | ||
final String text; | ||
final bool isRequiredFeild; | ||
final String value; | ||
bool _isFieldValid; | ||
|
||
_SearchDoctorHospitalDrodownState({ | ||
Key key, | ||
this.isRequiredFeild, | ||
this.onChange, | ||
this.text, | ||
this.value, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final size = MediaQuery.of(context).size; | ||
return Container( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Text( | ||
text, | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 14, | ||
fontWeight: FontWeight.normal, | ||
), | ||
textAlign: TextAlign.left, | ||
), | ||
SizedBox( | ||
height: size.height * 0.005, | ||
), | ||
DropDownContainer( | ||
child: DropdownButtonFormField<String>( | ||
validator: (value) { | ||
if (value == null) { | ||
value = ''; | ||
} | ||
if (value.isEmpty) { | ||
setState(() { | ||
_isFieldValid = false; | ||
}); | ||
return null; | ||
} else { | ||
setState(() { | ||
_isFieldValid = true; | ||
}); | ||
return null; | ||
} | ||
}, | ||
items: hospitals | ||
.map( | ||
(item) => DropdownMenuItem( | ||
child: Text( | ||
item, | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 16, | ||
), | ||
), | ||
value: item, | ||
), | ||
) | ||
.toList(), | ||
hint: Text( | ||
'Any Hospital', | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 18, | ||
color: Colors.grey[600], | ||
), | ||
), | ||
decoration: InputDecoration( | ||
border: InputBorder.none, | ||
), | ||
onChanged: onChange, | ||
), | ||
), | ||
isRequiredFeild != null && | ||
isRequiredFeild && | ||
_isFieldValid != null && | ||
!_isFieldValid | ||
? Padding( | ||
padding: EdgeInsets.only(left: 5), | ||
child: Text( | ||
text + ' is required!', | ||
style: TextStyle( | ||
color: Colors.red[800], | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 12, | ||
), | ||
), | ||
) | ||
: Text(''), | ||
SizedBox( | ||
height: size.height * 0.010, | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
class DropDownContainer extends StatelessWidget { | ||
final Widget child; | ||
|
||
const DropDownContainer({ | ||
Key key, | ||
this.child, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final size = MediaQuery.of(context).size; | ||
|
||
return Container( | ||
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 2), | ||
width: size.width * 0.9, | ||
height: 50, | ||
decoration: BoxDecoration( | ||
color: Colors.grey[300], borderRadius: BorderRadius.circular(8)), | ||
child: child, | ||
); | ||
} | ||
} | ||
|
||
List<String> hospitals = [ | ||
'Any Hospital', | ||
'hospital 1', | ||
'Asia Hospital - Kotte', | ||
'Asia Hospital - Maharagama', | ||
'Asiri Central Hospital - Colombo 10', | ||
'Asiri Hospital - Galle', | ||
'Asiri Hospital - Kandy', | ||
'Body Doc Medicare - Malabe', | ||
'CDEM Hospital - Colombo 10', | ||
]; |
Oops, something went wrong.