Skip to content

Commit

Permalink
Redesign search doctor icon
Browse files Browse the repository at this point in the history
  • Loading branch information
rusiruavb committed Sep 19, 2021
1 parent 4fc9214 commit d774d93
Show file tree
Hide file tree
Showing 29 changed files with 830 additions and 176 deletions.
Binary file added assets/fonts/SF-Pro.ttf
Binary file not shown.
Binary file added assets/fonts/SF-Text.ttf
Binary file not shown.
Binary file added assets/images/header_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added flutter_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,27 @@ class _RoundedButtonState extends State<RoundedButton> {
padding: EdgeInsets.symmetric(vertical: 17.5, horizontal: 22),
color: color,
onPressed: action,
child: Text(
text,
style: TextStyle(
color: textColor,
fontFamily: FONT_FAMILY_PRIMARY,
fontSize: fontSize,
fontWeight: FontWeight.w100,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(right: 5),
child: Icon(
icon,
color: Colors.white,
size: 20,
),
),
Text(
text,
style: TextStyle(
color: textColor,
fontFamily: SF_PRO_FONT,
fontSize: fontSize,
fontWeight: FontWeight.w100,
),
),
],
),
),
),
Expand Down
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 lib/components/search_doctor/search_doctor_datepicker.dart
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 lib/components/search_doctor/search_doctor_hospital.dart
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',
];
Loading

0 comments on commit d774d93

Please sign in to comment.