serach-text_fields

merge-requests/842/head
Elham Rababh 4 years ago
parent 47df7e5919
commit b27cc6ae9a

@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/AppTextFieldCustomerach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart';
@ -91,42 +92,18 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
SizedBox(
height: 20,
),
Center(
child: FractionallySizedBox(
widthFactor: .9,
child: Container(
width: double.maxFinite,
height: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: Color(0xffCCCCCC),
),
color: Colors.white),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
AppTextFieldCustomSerach(
searchController: _controller,
onChangeFun: (value) {
model.searchData(value);
},
marginTop: 5,
suffixIcon: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
),
),
model.state == ViewState.Idle
@ -135,7 +112,8 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
child: model.filterData.isEmpty
? Center(
child: ErrorMessage(
error: TranslationBase.of(context).youDontHaveAnyPatient,
error: TranslationBase.of(context)
.youDontHaveAnyPatient,
),
)
: ListView.builder(
@ -146,7 +124,8 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
return Padding(
padding: EdgeInsets.all(8.0),
child: PatientCard(
patientInfo: PatiantInformtion.fromJson(model.filterData[index].toJson()),
patientInfo: PatiantInformtion.fromJson(
model.filterData[index].toJson()),
patientType: "0",
arrivalType: "0",
isFromSearch: false,
@ -154,15 +133,20 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
isFromLiveCare: true,
onTap: () {
// TODO change the parameter to daynamic
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": PatiantInformtion.fromJson(model.filterData[index].toJson()),
"patientType": "0",
"isSearch": false,
"isInpatient": false,
"arrivalType": "0",
"isSearchAndOut": false,
"isFromLiveCare": true,
});
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient":
PatiantInformtion.fromJson(
model.filterData[index]
.toJson()),
"patientType": "0",
"isSearch": false,
"isInpatient": false,
"arrivalType": "0",
"isSearchAndOut": false,
"isFromLiveCare": true,
});
},
// isFromSearch: widget.isSearch,
),

@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/AppTextFieldCustomerach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
@ -138,23 +139,14 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
),
FractionallySizedBox(
widthFactor: 0.9,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(10),
child: AppTextFormField(
borderColor: Colors.white,
hintText:
TranslationBase.of(context).searchMedicineNameHere,
controller: myController,
onSaved: (value) {},
onFieldSubmitted: (value) {
searchMedicine(context, model);
},
inputFormatter: ONLY_LETTERS,
),
child: AppTextFieldCustomSerach(
hintText:
TranslationBase.of(context).searchMedicineNameHere,
searchController: myController,
onFieldSubmitted: (value) {
searchMedicine(context, model);
},
marginTop: 5,
),
),
SizedBox(
@ -226,7 +218,9 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
["ItemID"],
url: model.pharmacyItemsList[index]
["ImageSRCUrl"]),
settings: RouteSettings(name: 'PharmaciesListScreen'),),
settings: RouteSettings(
name: 'PharmaciesListScreen'),
),
);
},
);

@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/AppTextFieldCustomerach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -24,326 +25,396 @@ class _DischargedPatientState extends State<DischargedPatient> {
@override
Widget build(BuildContext context) {
return BaseView<DischargedPatientViewModel>(
onModelReady: (model) => model.getDischargedPatient(),
builder: (_, model, w) => AppScaffold(
//appBarTitle: 'Discharged Patient',
//subtitle: "Last Three Months",
backgroundColor: Colors.grey[200],
isShowAppBar: false,
baseViewModel: model,
body: model.myDischargedPatient.isEmpty? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
'No Discharged Patient',
color: Theme.of(context).errorColor,
),
)
],
),
):Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(height: 12,),
Container(
width: double.maxFinite,
height: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: Color(0xffCCCCCC),
),
color: Colors.white),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
left: 10, top: 10),
onModelReady: (model) => model.getDischargedPatient(),
builder: (_, model, w) => AppScaffold(
//appBarTitle: 'Discharged Patient',
//subtitle: "Last Three Months",
backgroundColor: Colors.grey[200],
isShowAppBar: false,
baseViewModel: model,
body: model.myDischargedPatient.isEmpty
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(
context)
.searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
'No Discharged Patient',
color: Theme.of(context).errorColor,
),
)
],
),
)
: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(
height: 12,
),
AppTextFieldCustomSerach(
searchController: _controller,
onChangeFun: (value) {
model.searchData(value);
},
marginTop: 5,
suffixIcon: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding:
EdgeInsets.only(
bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
SizedBox(height: 5,),
Expanded(child: SingleChildScrollView(
child: Column(
children: [
...List.generate(model.filterData.length, (index) => InkWell(
onTap: () {
Navigator.of(context)
.pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model.filterData[index],
"patientType": "1",
"isSearch": false,
"isInpatient":true,
"isDischargedPatient":true
});
},
child: Container(
width: double.maxFinite,
margin: EdgeInsets.all(8),
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(left: 12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(children: [
Container(
width: 170,
child: AppText(
(Helpers.capitalize(model
.filterData[index]
.firstName) +
" " +
Helpers.capitalize(model
.filterData[index]
.lastName)),
fontSize: 16,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
textOverflow: TextOverflow.ellipsis,
),
),
model.filterData[index].gender == 1
? Icon(
DoctorApp.male_2,
color: Colors.blue,
)
: Icon(
DoctorApp.female_1,
color: Colors.pink,
),
]),
Row(
children: [
AppText(
model.filterData[index].nationalityName != null
? model.filterData[index].nationalityName.trim()
: model.filterData[index].nationality != null
? model.filterData[index].nationality.trim()
: model.filterData[index].nationalityId != null
? model.filterData[index].nationalityId
: "",
fontWeight: FontWeight.bold,
fontSize: 14,
textOverflow: TextOverflow.ellipsis,
),
model.filterData[index]
.nationality !=
null ||
model.filterData[index]
.nationalityId !=
null
? ClipRRect(
borderRadius:
BorderRadius.circular(20.0),
child: Image.network(
model.filterData[index].nationalityFlagURL != null ?
model.filterData[index].nationalityFlagURL
: '',
height: 25,
width: 30,
errorBuilder:
(BuildContext context,
Object exception,
StackTrace stackTrace) {
return AppText(
'',
fontSize: 10,
);
},
))
: SizedBox()
],
)
],
)),
Row(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 12.0),
child: Container(
width: 60,
height: 60,
child: Image.asset(
model.filterData[index].gender ==
1
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover,
),
),
),
],
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize:
2.0 * SizeConfig.textMultiplier,
color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context)
.fileNumber,
style: TextStyle(
fontSize: 14,
fontFamily: 'Poppins')),
new TextSpan(
text: model
.filterData[index]
.patientId
.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
fontSize: 15)),
],
),
),
),
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize:
2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: model.filterData[index].admissionDate == null ? "" :
TranslationBase.of(context).admissionDate + " : ",
style: TextStyle(fontSize: 14)),
new TextSpan(
text: model.filterData[index].admissionDate == null ? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].admissionDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 15)),
],
),
),
),
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize:
2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
SizedBox(
height: 5,
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
...List.generate(
model.filterData.length,
(index) => InkWell(
onTap: () {
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient":
model.filterData[index],
"patientType": "1",
"isSearch": false,
"isInpatient": true,
"isDischargedPatient": true
});
},
child: Container(
width: double.maxFinite,
margin: EdgeInsets.all(8),
padding: EdgeInsets.only(
left: 0,
right: 5,
bottom: 5,
top: 5),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(15),
color: Colors.white,
),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(
left: 12.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Row(children: [
Container(
width: 170,
child: AppText(
(Helpers.capitalize(model
.filterData[
index]
.firstName) +
" " +
Helpers.capitalize(model
.filterData[
index]
.lastName)),
fontSize: 16,
fontWeight:
FontWeight
.bold,
fontFamily:
'Poppins',
textOverflow:
TextOverflow
.ellipsis,
),
),
model.filterData[index]
.gender ==
1
? Icon(
DoctorApp
.male_2,
color: Colors
.blue,
)
: Icon(
DoctorApp
.female_1,
color: Colors
.pink,
),
]),
Row(
children: [
AppText(
model.filterData[index].nationalityName !=
null
? model
.filterData[
index]
.nationalityName
.trim()
: model.filterData[index].nationality !=
null
? model
.filterData[
index]
.nationality
.trim()
: model.filterData[index].nationalityId !=
null
? model.filterData[index].nationalityId
: "",
fontWeight:
FontWeight
.bold,
fontSize: 14,
textOverflow:
TextOverflow
.ellipsis,
),
model.filterData[index].nationality !=
null ||
model.filterData[index].nationalityId !=
null
? ClipRRect(
borderRadius:
BorderRadius.circular(
20.0),
child: Image
.network(
model.filterData[index].nationalityFlagURL !=
null
? model.filterData[index].nationalityFlagURL
: '',
height:
25,
width:
30,
errorBuilder: (BuildContext context,
Object
exception,
StackTrace
stackTrace) {
return AppText(
'',
fontSize:
10,
);
},
))
: SizedBox()
],
)
],
)),
Row(
children: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment
.start,
children: <Widget>[
Padding(
padding:
EdgeInsets.only(
left: 12.0),
child: Container(
width: 60,
height: 60,
child:
Image.asset(
model.filterData[index]
.gender ==
1
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit
.cover,
),
),
),
],
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Container(
child: RichText(
text:
new TextSpan(
style: new TextStyle(
fontSize: 2.0 *
SizeConfig
.textMultiplier,
color: Colors
.black),
children: <
TextSpan>[
new TextSpan(
text: TranslationBase.of(context)
.fileNumber,
style: TextStyle(
fontSize:
14,
fontFamily:
'Poppins')),
new TextSpan(
text: model
.filterData[
index]
.patientId
.toString(),
style: TextStyle(
fontWeight: FontWeight
.w700,
fontFamily:
'Poppins',
fontSize:
15)),
],
),
),
),
Container(
child: RichText(
text:
new TextSpan(
style:
new TextStyle(
fontSize: 2.0 *
SizeConfig
.textMultiplier,
color: Colors
.black,
fontFamily:
'Poppins',
),
children: <
TextSpan>[
new TextSpan(
text: model.filterData[index].admissionDate ==
null
? ""
: TranslationBase.of(context).admissionDate +
" : ",
style: TextStyle(
fontSize:
14)),
new TextSpan(
text: model.filterData[index].admissionDate ==
null
? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].admissionDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight:
FontWeight.w700,
fontSize: 15)),
],
),
),
),
Container(
child: RichText(
text:
new TextSpan(
style:
new TextStyle(
fontSize: 2.0 *
SizeConfig
.textMultiplier,
color: Colors
.black,
fontFamily:
'Poppins',
),
children: <
TextSpan>[
new TextSpan(
text: model.filterData[index].dischargeDate ==
null
? ""
: "Discharge Date : ",
style: TextStyle(
fontSize:
14)),
new TextSpan(
text: model.filterData[index].dischargeDate ==
null
? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].dischargeDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight:
FontWeight.w700,
fontSize: 15)),
],
),
),
),
Row(
children: [
AppText(
"${TranslationBase.of(context).numOfDays}: ",
fontSize: 14,
fontWeight:
FontWeight
.w300,
),
AppText(
"${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate)).inDays + 1}",
fontSize:
15,
fontWeight:
FontWeight
.w700),
],
),
],
),
),
Icon(
Icons.arrow_forward,
size: 24,
),
],
)
],
),
),
children: <TextSpan>[
new TextSpan(
text: model.filterData[index].dischargeDate == null ? ""
: "Discharge Date : ",
style: TextStyle(fontSize: 14)),
new TextSpan(
text: model.filterData[index].dischargeDate == null ? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].dischargeDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 15)),
],
),
),
),
Row(
children: [
AppText(
"${TranslationBase.of(context).numOfDays}: ",
fontSize: 14,fontWeight: FontWeight.w300,
),
AppText(
"${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700),
],
),
],
),
),
Icon(
Icons.arrow_forward,
size: 24,
),
],
)
],
),
)),
],
),
),
),
],
),
)),
],
),
),
),],
),
),)
);
),
));
}
}

@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/AppTextFieldCustomerach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -140,57 +141,35 @@ class _InPatientListPageState extends State<InPatientListPage> {
],
),
),
Container(
margin: EdgeInsets.only(
left: 16,
right: 16,
bottom: 16,
top: widget.isMyInPatient ? 15 : 5),
child: Stack(
children: [
AppTextFieldCustom(
hintText: TranslationBase.of(context).searchPatientName,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
controller: _searchController,
onChanged: (value) {
setState(() {
hasQuery = true;
});
widget.patientSearchViewModel.filterSearchResults(value,
isAllClinic: widget.isAllClinic,
isMyInPatient: widget.isMyInPatient);
}),
Positioned(
right: 35,
top: 5,
child: IconButton(
icon: Icon(
isSortDes
? FontAwesomeIcons.sortAmountDown
: FontAwesomeIcons.sortAmountUp,
color: Colors.black,
),
iconSize: 20,
// padding: EdgeInsets.only(bottom: 30),
onPressed: () {
GifLoaderDialogUtils.showMyDialog(context);
widget.patientSearchViewModel.sortInPatient(
isDes: isSortDes,
isAllClinic: widget.isAllClinic,
isMyInPatient: widget.isMyInPatient);
isSortDes = !isSortDes;
GifLoaderDialogUtils.hideDialog(context);
},
),
)
],
AppTextFieldCustomSerach(
searchController: _searchController,
onChangeFun: (value) {
setState(() {
hasQuery = true;
});
widget.patientSearchViewModel.filterSearchResults(value,
isAllClinic: widget.isAllClinic,
isMyInPatient: widget.isMyInPatient);
},
marginTop: widget.isMyInPatient ? 15 : 5,
positionedChild: IconButton(
icon: Icon(
isSortDes
? FontAwesomeIcons.sortAmountDown
: FontAwesomeIcons.sortAmountUp,
color: Colors.black,
),
iconSize: 20,
// padding: EdgeInsets.only(bottom: 30),
onPressed: () {
GifLoaderDialogUtils.showMyDialog(context);
widget.patientSearchViewModel.sortInPatient(
isDes: isSortDes,
isAllClinic: widget.isAllClinic,
isMyInPatient: widget.isMyInPatient);
isSortDes = !isSortDes;
GifLoaderDialogUtils.hideDialog(context);
},
),
),
widget.patientSearchViewModel.state == ViewState.Idle

@ -17,6 +17,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/AppTextFieldCustomerach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart';
@ -105,13 +106,15 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
Container(
// color: Colors.red,
height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC),
decoration: TextFieldsUtils.containerBorderDecoration(
Color(0Xffffffff), Color(0xFFCCCCCC),
borderRadius: 4, borderWidth: 0),
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: _times.map((item) {
bool _isActive = _times[_activeLocation] == item ? true : false;
bool _isActive =
_times[_activeLocation] == item ? true : false;
return Expanded(
child: InkWell(
@ -131,7 +134,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
await model.getPatientBasedOnDate(
item: item,
selectedPatientType: widget.selectedPatientType,
patientSearchRequestModel: widget.patientSearchRequestModel,
patientSearchRequestModel:
widget.patientSearchRequestModel,
isSearchWithKeyInfo: widget.isSearchWithKeyInfo,
outPatientFilterType: outPatientFilterType);
GifLoaderDialogUtils.hideDialog(context);
@ -139,11 +143,16 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: Center(
child: Container(
height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
_isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA),
_isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
decoration:
TextFieldsUtils.containerBorderDecoration(
_isActive
? Color(0xFFD02127 /*B8382B*/)
: Color(0xFFEAEAEA),
_isActive
? Color(0xFFD02127)
: Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -151,16 +160,22 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
AppText(
item,
fontSize: SizeConfig.textMultiplier * 1.8,
color: _isActive ? Colors.white : Color(0xFF2B353E),
color: _isActive
? Colors.white
: Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
_isActive && _activeLocation != 0 && model.state == ViewState.Idle
_isActive &&
_activeLocation != 0 &&
model.state == ViewState.Idle
? Container(
padding: EdgeInsets.all(2),
margin: EdgeInsets.symmetric(horizontal: 5),
margin: EdgeInsets.symmetric(
horizontal: 5),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(50),
borderRadius:
BorderRadius.circular(50),
),
constraints: BoxConstraints(
minWidth: 20,
@ -168,7 +183,9 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
),
child: new Text(
model.filterData.length.toString(),
style: new TextStyle(color: Colors.red, fontSize: 10),
style: new TextStyle(
color: Colors.red,
fontSize: 10),
textAlign: TextAlign.center,
),
)
@ -184,69 +201,50 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
),
),
SizedBox(height: 18.5),
Container(
width: SizeConfig.screenWidth * 0.9,
height: 85,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"),
),
color: Colors.white),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
Stack(
children: [
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
_activeLocation != 0 ? DoctorApp.filter_1 : FontAwesomeIcons.slidersH,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
onPressed: _activeLocation != 0
? null
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => FilterDatePage(
outPatientFilterType: outPatientFilterType,
patientSearchViewModel: model,
),settings: RouteSettings(name: 'FilterOutPatentDateScreen'),));
},
),
onChanged: (String str) {
model.searchData(str);
}),
Positioned(
right: 25,
child: IconButton(
icon: Icon(
isSortDes ? FontAwesomeIcons.sortAmountDown : FontAwesomeIcons.sortAmountUp,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
onPressed: () {
model.sortOutPatient(isDes: isSortDes);
isSortDes = !isSortDes;
},
),
)
],
),
])),
AppTextFieldCustomSerach(
searchController: _controller,
onChangeFun: (value) {
model.searchData(value);
},
marginTop: 5,
suffixIcon: IconButton(
icon: Icon(
_activeLocation != 0
? DoctorApp.filter_1
: FontAwesomeIcons.slidersH,
color: Colors.black,
),
iconSize: 20,
onPressed: _activeLocation != 0
? null
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
FilterDatePage(
outPatientFilterType: outPatientFilterType,
patientSearchViewModel: model,
),
settings: RouteSettings(
name: 'FilterOutPatentDateScreen'),
));
},
),
positionedChild: IconButton(
icon: Icon(
isSortDes
? FontAwesomeIcons.sortAmountDown
: FontAwesomeIcons.sortAmountUp,
color: Colors.black,
),
iconSize: 20,
onPressed: () {
model.sortOutPatient(isDes: isSortDes);
isSortDes = !isSortDes;
},
),
),
SizedBox(
height: 10.0,
),
@ -255,7 +253,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: model.filterData.isEmpty
? Center(
child: ErrorMessage(
error: TranslationBase.of(context).youDontHaveAnyPatient,
error: TranslationBase.of(context)
.youDontHaveAnyPatient,
),
)
: ListView.builder(
@ -264,8 +263,11 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) {
if (_activeLocation != 0 ||
(model.filterData[index].patientStatusType != null &&
model.filterData[index].patientStatusType == 43))
(model.filterData[index].patientStatusType !=
null &&
model.filterData[index]
.patientStatusType ==
43))
return Padding(
padding: EdgeInsets.all(8.0),
child: PatientCard(
@ -276,16 +278,20 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
isInpatient: widget.isInpatient,
onTap: () {
// TODO change the parameter to daynamic
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filterData[index],
"patientType": "1",
"from": widget.patientSearchRequestModel.from,
"to": widget.patientSearchRequestModel.from,
"isSearch": false,
"isInpatient": false,
"arrivalType": "7",
"isSearchAndOut": false,
});
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model.filterData[index],
"patientType": "1",
"from": widget
.patientSearchRequestModel.from,
"to": widget
.patientSearchRequestModel.from,
"isSearch": false,
"isInpatient": false,
"arrivalType": "7",
"isSearchAndOut": false,
});
},
// isFromSearch: widget.isSearch,
),

@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dar
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/AppTextFieldCustomerach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
@ -81,41 +82,21 @@ class _PatientsSearchResultScreenState
body: Column(
children: [
SizedBox(height: 18.5),
Container(
width: SizeConfig.screenWidth * 0.9,
height: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"),
),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
AppTextFieldCustomSerach(
searchController: _controller,
onChangeFun: (value) {
model.searchData(value);
},
marginTop: 5,
suffixIcon: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
// padding: EdgeInsets.only(bottom: 30),
),
),
SizedBox(
height: 10.0,
),

@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/AppTextFieldCustomerach.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -47,7 +48,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
BottomSheetTitle(
title: TranslationBase.of(context).searchPatient),
FractionallySizedBox(
widthFactor: 0.9,
// widthFactor: 0.9,
child: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Column(
@ -59,35 +60,25 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
SizedBox(
height: 10,
),
Container(
margin:
EdgeInsets.only(left: 0, right: 0, top: 15),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context)
.patpatientIDMobilenationalientID,
isTextFieldHasSuffix: false,
maxLines: 1,
minLines: 1,
inputType: TextInputType.number,
hasBorder: true,
controller: patientFileInfoController,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
onChanged: (_) {},
validationError: (isFormSubmitted &&
(patientFileInfoController
.text.isEmpty &&
firstNameInfoController
.text.isEmpty &&
middleNameInfoController
.text.isEmpty &&
lastNameFileInfoController
.text.isEmpty))
? TranslationBase.of(context).emptyMessage
: null,
),
AppTextFieldCustomSerach(
searchController: patientFileInfoController,
onChangeFun: (value) {},
marginTop: 5,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
inputType: TextInputType.number,
validationError: (isFormSubmitted &&
(patientFileInfoController.text.isEmpty &&
firstNameInfoController
.text.isEmpty &&
middleNameInfoController
.text.isEmpty &&
lastNameFileInfoController
.text.isEmpty))
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 5,

@ -45,7 +45,8 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
AuthenticationViewModel authenticationViewModel;
ProjectViewModel projectViewModel;
getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async {
getProgressNoteList(BuildContext context, PatientViewModel model,
{bool isLocalBusy = false}) async {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String token = await sharedPref.getString(TOKEN);
@ -60,7 +61,10 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
tokenID: token,
patientTypeID: patient.patientType,
languageID: 2);
model.getPatientProgressNote(progressNoteRequest.toJson(), isLocalBusy: isLocalBusy).then((c) {
model
.getPatientProgressNote(progressNoteRequest.toJson(),
isLocalBusy: isLocalBusy)
.then((c) {
notesList = model.patientProgressNoteList;
});
}
@ -72,7 +76,8 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String arrivalType = routeArgs['arrivalType'];
if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient'];
if (routeArgs.containsKey('isDischargedPatient'))
isDischargedPatient = routeArgs['isDischargedPatient'];
return BaseView<PatientViewModel>(
onModelReady: (model) => getProgressNoteList(context, model),
builder: (_, model, w) => AppScaffold(
@ -83,8 +88,10 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
patient,
isInpatient: true,
),
body: model.patientProgressNoteList == null || model.patientProgressNoteList.length == 0
? DrAppEmbeddedError(error: TranslationBase.of(context).errorNoProgressNote)
body: model.patientProgressNoteList == null ||
model.patientProgressNoteList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).errorNoProgressNote)
: Container(
color: Colors.grey[200],
child: Column(
@ -122,60 +129,105 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
widthFactor: 0.95,
child: CardWithBgWidget(
hasBorder: false,
bgColor: model.patientProgressNoteList[index].status == 1 &&
authenticationViewModel.doctorProfile.doctorID !=
model.patientProgressNoteList[index].createdBy
bgColor: model.patientProgressNoteList[index]
.status ==
1 &&
authenticationViewModel
.doctorProfile.doctorID !=
model
.patientProgressNoteList[
index]
.createdBy
? Color(0xFFCC9B14)
: model.patientProgressNoteList[index].status == 4
: model.patientProgressNoteList[index]
.status ==
4
? Colors.red.shade700
: model.patientProgressNoteList[index].status == 2
: model.patientProgressNoteList[index]
.status ==
2
? Colors.green[600]
: Color(0xFFCC9B14),
widget: Column(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
if (model.patientProgressNoteList[index].status == 1 &&
authenticationViewModel.doctorProfile.doctorID !=
model.patientProgressNoteList[index].createdBy)
if (model
.patientProgressNoteList[
index]
.status ==
1 &&
authenticationViewModel
.doctorProfile.doctorID !=
model
.patientProgressNoteList[
index]
.createdBy)
AppText(
TranslationBase.of(context).notePending,
TranslationBase.of(context)
.notePending,
fontWeight: FontWeight.bold,
color: Color(0xFFCC9B14),
fontSize: 12,
),
if (model.patientProgressNoteList[index].status == 4)
if (model
.patientProgressNoteList[
index]
.status ==
4)
AppText(
TranslationBase.of(context).noteCanceled,
TranslationBase.of(context)
.noteCanceled,
fontWeight: FontWeight.bold,
color: Colors.red.shade700,
fontSize: 12,
),
if (model.patientProgressNoteList[index].status == 2)
if (model
.patientProgressNoteList[
index]
.status ==
2)
AppText(
TranslationBase.of(context).noteVerified,
TranslationBase.of(context)
.noteVerified,
fontWeight: FontWeight.bold,
color: Colors.green[600],
fontSize: 12,
),
if (model.patientProgressNoteList[index].status != 2 &&
model.patientProgressNoteList[index].status != 4 &&
authenticationViewModel.doctorProfile.doctorID ==
model.patientProgressNoteList[index].createdBy)
model
.patientProgressNoteList[
index]
.status !=
4 &&
authenticationViewModel
.doctorProfile.doctorID ==
model
.patientProgressNoteList[
index]
.createdBy)
Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => UpdateNoteOrder(
note: model.patientProgressNoteList[index],
patientModel: model,
patient: patient,
visitType: widget.visitType,
builder: (context) =>
UpdateNoteOrder(
note: model
.patientProgressNoteList[
index],
patientModel:
model,
patient:
patient,
visitType: widget
.visitType,
isUpdate: true,
)),
);
@ -183,7 +235,9 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
child: Container(
decoration: BoxDecoration(
color: Colors.grey[600],
borderRadius: BorderRadius.circular(10),
borderRadius:
BorderRadius.circular(
10),
),
// color:Colors.red[600],
@ -198,7 +252,9 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
width: 2,
),
AppText(
TranslationBase.of(context).update,
TranslationBase.of(
context)
.update,
fontSize: 10,
color: Colors.white,
),
@ -216,33 +272,61 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
context: context,
actionName: "verify",
confirmFun: () async {
GifLoaderDialogUtils.showMyDialog(context);
UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: int.parse(patient.admissionNo),
cancelledNote: false,
lineItemNo: model.patientProgressNoteList[index].lineItemNo,
createdBy: model.patientProgressNoteList[index].createdBy,
notes: model.patientProgressNoteList[index].notes,
GifLoaderDialogUtils
.showMyDialog(
context);
UpdateNoteReqModel
reqModel =
UpdateNoteReqModel(
admissionNo: int
.parse(patient
.admissionNo),
cancelledNote:
false,
lineItemNo: model
.patientProgressNoteList[
index]
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
verifiedNote: true,
patientTypeID: patient.patientType,
patientTypeID:
patient
.patientType,
patientOutSA: false,
);
await model.updatePatientProgressNote(reqModel);
await getProgressNoteList(context, model, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
await model
.updatePatientProgressNote(
reqModel);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
});
},
child: Container(
decoration: BoxDecoration(
color: Colors.green[600],
borderRadius: BorderRadius.circular(10),
borderRadius:
BorderRadius.circular(
10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
FontAwesomeIcons.check,
FontAwesomeIcons
.check,
size: 12,
color: Colors.white,
),
@ -250,7 +334,9 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
width: 2,
),
AppText(
TranslationBase.of(context).noteVerify,
TranslationBase.of(
context)
.noteVerify,
fontSize: 10,
color: Colors.white,
),
@ -266,37 +352,66 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
onTap: () async {
showMyDialog(
context: context,
actionName: TranslationBase.of(context).cancel,
actionName:
TranslationBase.of(
context)
.cancel,
confirmFun: () async {
GifLoaderDialogUtils.showMyDialog(
GifLoaderDialogUtils
.showMyDialog(
context,
);
UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: int.parse(patient.admissionNo),
UpdateNoteReqModel
reqModel =
UpdateNoteReqModel(
admissionNo: int
.parse(patient
.admissionNo),
cancelledNote: true,
lineItemNo: model.patientProgressNoteList[index].lineItemNo,
createdBy: model.patientProgressNoteList[index].createdBy,
notes: model.patientProgressNoteList[index].notes,
lineItemNo: model
.patientProgressNoteList[
index]
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
verifiedNote: false,
patientTypeID: patient.patientType,
patientTypeID:
patient
.patientType,
patientOutSA: false,
);
await model.updatePatientProgressNote(reqModel);
await getProgressNoteList(context, model, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
await model
.updatePatientProgressNote(
reqModel);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
});
},
child: Container(
decoration: BoxDecoration(
color: Colors.red[600],
borderRadius: BorderRadius.circular(10),
borderRadius:
BorderRadius.circular(
10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
FontAwesomeIcons.trash,
FontAwesomeIcons
.trash,
size: 12,
color: Colors.white,
),
@ -322,25 +437,40 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width * 0.60,
width: MediaQuery.of(context)
.size
.width *
0.60,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
AppText(
TranslationBase.of(context).createdBy,
TranslationBase.of(
context)
.createdBy,
fontSize: 10,
),
Expanded(
child: AppText(
model.patientProgressNoteList[index].doctorName ?? '',
fontWeight: FontWeight.w600,
model
.patientProgressNoteList[
index]
.doctorName ??
'',
fontWeight:
FontWeight.w600,
fontSize: 12,
),
),
@ -352,40 +482,70 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
Column(
children: [
AppText(
model.patientProgressNoteList[index].createdOn != null
model
.patientProgressNoteList[
index]
.createdOn !=
null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.getDateTimeFromServerFormat(
model.patientProgressNoteList[index].createdOn),
isArabic: projectViewModel.isArabic)
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(),
isArabic: projectViewModel.isArabic),
AppDateUtils
.getDateTimeFromServerFormat(model
.patientProgressNoteList[
index]
.createdOn),
isArabic:
projectViewModel
.isArabic,
isMonthshort: true)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now(),
isArabic:
projectViewModel
.isArabic),
fontWeight: FontWeight.w600,
fontSize: 14,
),
AppText(
model.patientProgressNoteList[index].createdOn != null
? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(
model.patientProgressNoteList[index].createdOn))
: AppDateUtils.getHour(DateTime.now()),
model
.patientProgressNoteList[
index]
.createdOn !=
null
? AppDateUtils.getHour(
AppDateUtils
.getDateTimeFromServerFormat(model
.patientProgressNoteList[
index]
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600,
fontSize: 14,
),
],
crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
)
],
),
SizedBox(
height: 8,
),
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
Expanded(
child: AppText(
model.patientProgressNoteList[index].notes,
fontSize: 10,
),
),
])
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Expanded(
child: AppText(
model
.patientProgressNoteList[
index]
.notes,
fontSize: 10,
),
),
])
],
),
SizedBox(

@ -16,9 +16,9 @@ class AppDateUtils {
}
static String convertStringToDateFormat(String date, String dateFormat) {
DateTime dateTime ;
if(date.contains("/Date"))
dateTime= getDateTimeFromServerFormat(date);
DateTime dateTime;
if (date.contains("/Date"))
dateTime = getDateTimeFromServerFormat(date);
else
dateTime = DateTime.parse(date);
return convertDateToFormat(dateTime, dateFormat);
@ -41,7 +41,8 @@ class AppDateUtils {
final endIndex = str.indexOf(end, startIndex + start.length);
date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex)));
date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(str.substring(startIndex + start.length, endIndex)));
} else {
date = DateTime.now();
}
@ -52,7 +53,8 @@ class AppDateUtils {
return date;
}
static String differenceBetweenDateAndCurrentInYearMonthDay(DateTime firstDate, BuildContext context) {
static String differenceBetweenDateAndCurrentInYearMonthDay(
DateTime firstDate, BuildContext context) {
DateTime now = DateTime.now();
// now = now.add(Duration(days: 400, minutes: 0));
var difference = firstDate.difference(now);
@ -72,13 +74,16 @@ class AppDateUtils {
return "$days ${TranslationBase.of(context).days}, $months ${TranslationBase.of(context).months}, $years ${TranslationBase.of(context).years}";
}
static String differenceBetweenDateAndCurrent(DateTime firstDate, BuildContext context, {bool isShowSecond = false, bool isShowDays = true }) {
static String differenceBetweenDateAndCurrent(
DateTime firstDate, BuildContext context,
{bool isShowSecond = false, bool isShowDays = true}) {
DateTime now = DateTime.now();
var difference = now.difference(firstDate);
int minutesInDays = difference.inMinutes;
int secondInDays = difference.inSeconds;
int hoursInDays = minutesInDays ~/ 60; // ~/ : truncating division to make the result int
int hoursInDays =
minutesInDays ~/ 60; // ~/ : truncating division to make the result int
int second = secondInDays % 60;
int minutes = minutesInDays % 60;
int days = hoursInDays ~/ 24;
@ -94,7 +99,8 @@ class AppDateUtils {
(isShowSecond ? ", $second Sec" : "");
}
static String differenceBetweenServerDateAndCurrent(String str, BuildContext context) {
static String differenceBetweenServerDateAndCurrent(
String str, BuildContext context) {
const start = "/Date(";
const end = "+0300)";
@ -103,7 +109,8 @@ class AppDateUtils {
final endIndex = str.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex)));
var date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(str.substring(startIndex + start.length, endIndex)));
return differenceBetweenDateAndCurrent(date, context);
}
@ -262,29 +269,39 @@ class AppDateUtils {
/// [dateTime] convert DateTime to data formatted Arabic
static String getMonthDayYearDateFormattedAr(DateTime dateTime) {
if (dateTime != null)
return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
return getMonthArabic(dateTime.month) +
" " +
dateTime.day.toString() +
", " +
dateTime.year.toString();
else
return "";
}
/// get data formatted like Apr 26,2020
/// [dateTime] convert DateTime to data formatted
static String getMonthDayYearDateFormatted(DateTime dateTime, {bool isArabic = false}) {
static String getMonthDayYearDateFormatted(DateTime dateTime,
{bool isArabic = false}) {
if (dateTime != null)
return isArabic
? getMonthArabic(dateTime.month)
: getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
: getMonth(dateTime.month) +
" " +
dateTime.day.toString() +
", " +
dateTime.year.toString();
else
return "";
}
/// get data formatted like 26 Apr 2020
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDateFormatted(DateTime dateTime, {bool isArabic = false}) {
static String getDayMonthYearDateFormatted(DateTime dateTime,
{bool isArabic = false, bool isMonthshort = false}) {
if (dateTime != null)
return dateTime.day.toString() +
" " +
"${isArabic ? getMonthArabic(dateTime.month) : getMonth(dateTime.month)}" +
"${isArabic ? getMonthArabic(dateTime.month) : isMonthshort ? getMonth(dateTime.month).toString().substring(0, 3) : getMonth(dateTime.month)}" +
" " +
dateTime.year.toString();
else
@ -293,9 +310,14 @@ class AppDateUtils {
/// get data formatted like 26/4/2020
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDate(DateTime dateTime, {bool isArabic = false}) {
static String getDayMonthYearDate(DateTime dateTime,
{bool isArabic = false}) {
if (dateTime != null)
return dateTime.day.toString() + "/" + "${dateTime.month}" + "/" + dateTime.year.toString();
return dateTime.day.toString() +
"/" +
"${dateTime.month}" +
"/" +
dateTime.year.toString();
else
return "";
}
@ -306,7 +328,8 @@ class AppDateUtils {
return DateFormat('hh:mm a').format(dateTime);
}
static String getAgeByBirthday(String birthOfDate, BuildContext context, {bool isServerFormat = true}) {
static String getAgeByBirthday(String birthOfDate, BuildContext context,
{bool isServerFormat = true}) {
// https://leechy.dev/calculate-dates-diff-in-dart
DateTime birthDate;
if (birthOfDate.contains("/Date")) {
@ -331,7 +354,9 @@ class AppDateUtils {
static bool isToday(DateTime dateTime) {
DateTime todayDate = DateTime.now().toUtc();
if (dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) {
if (dateTime.day == todayDate.day &&
dateTime.month == todayDate.month &&
dateTime.year == todayDate.year) {
return true;
}
return false;
@ -340,7 +365,11 @@ class AppDateUtils {
static String getDate(DateTime dateTime) {
print(dateTime);
if (dateTime != null)
return getMonth(dateTime.month) + " " + dateTime.day.toString() + "," + dateTime.year.toString();
return getMonth(dateTime.month) +
" " +
dateTime.day.toString() +
"," +
dateTime.year.toString();
else
return "";
}
@ -348,7 +377,11 @@ class AppDateUtils {
static String getDateFormatted(DateTime dateTime) {
print(dateTime);
if (dateTime != null)
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString();
return dateTime.day.toString() +
"/" +
dateTime.month.toString() +
"/" +
dateTime.year.toString();
else
return "";
}
@ -376,25 +409,23 @@ class AppDateUtils {
return "";
}
// handel date like "09/05/2021 17:00"
static DateTime getDateTimeFromString(String str) {
List<String> array = str.split('/');
List<String> array = str.split('/');
int day = int.parse(array[0]);
int month = int.parse(array[1]);
List<String> array2 = array[2].split(' ');
List<String> array2 = array[2].split(' ');
int year = int.parse(array2[0]);
String hour = array2[1];
List<String> hourList = hour.split(":");
DateTime date = DateTime(year, month, day, int.parse(hourList[0]), int.parse(hourList[1]));
DateTime date = DateTime(
year, month, day, int.parse(hourList[0]), int.parse(hourList[1]));
return date;
}
static convertDateFormatImproved(String str) {
String newDate;
const start = "/Date(";
@ -413,6 +444,6 @@ class AppDateUtils {
date.day.toString().padLeft(2, '0');
}
return newDate??'';
return newDate ?? '';
}
}

@ -0,0 +1,66 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'app-textfield-custom.dart';
class AppTextFieldCustomSerach extends StatelessWidget {
const AppTextFieldCustomSerach({
Key key,
this.onChangeFun,
this.positionedChild,
this.marginTop,
this.suffixIcon,
this.validationError,
this.inputType,
this.inputFormatters,
this.searchController,
this.onFieldSubmitted,
this.hintText,
});
final TextEditingController searchController;
final Function onChangeFun;
final Function onFieldSubmitted;
final Widget positionedChild;
final IconButton suffixIcon;
final double marginTop;
final String validationError;
final String hintText;
final TextInputType inputType;
final List<TextInputFormatter> inputFormatters;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: marginTop),
child: Stack(
children: [
AppTextFieldCustom(
hintText:
hintText ?? TranslationBase.of(context).searchPatientName,
isTextFieldHasSuffix: true,
hasHintmargin: true,
inputFormatters: inputFormatters,
suffixIcon: suffixIcon ??
IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
controller: searchController,
onChanged: onChangeFun,
onFieldSubmitted: onFieldSubmitted,
validationError: validationError),
if (positionedChild != null)
Positioned(right: 35, top: 5, child: positionedChild)
],
),
);
}
}

@ -24,11 +24,16 @@ class AppTextFieldCustom extends StatefulWidget {
final int maxLines;
final List<TextInputFormatter> inputFormatters;
final Function(String) onChanged;
final Function onFieldSubmitted;
final String validationError;
final bool isPrscription;
final bool isSecure;
final bool focus;
///TODO Rename it to isCustomSearchablFiels
final bool hasHintmargin;
AppTextFieldCustom({
this.height = 0,
this.onClick,
@ -49,6 +54,8 @@ class AppTextFieldCustom extends StatefulWidget {
this.isPrscription = false,
this.isSecure = false,
this.focus = false,
this.hasHintmargin = false,
this.onFieldSubmitted,
});
@override
@ -109,7 +116,9 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
Expanded(
child: Container(
padding: widget.dropDownText == null
? EdgeInsets.symmetric(vertical: 0)
? widget.hasHintmargin
? EdgeInsets.only(top: 10)
: EdgeInsets.symmetric(vertical: 0)
: EdgeInsets.symmetric(vertical: 0), // 8.0
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -120,9 +129,11 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.dropDownText != null)
AppText(
widget.hintText,
// marginTop: widget.hasHintmargin ? 0 : 30,
color: Color(0xFF2E303A),
fontSize: widget.isPrscription == false
? SizeConfig.getHeightMultiplier() * (SizeConfig.isWidthLarge?1.1: 1.3)
? SizeConfig.getHeightMultiplier() *
(SizeConfig.isWidthLarge ? 1.1 : 1.3)
: 0,
fontWeight: FontWeight.w700,
),
@ -163,6 +174,7 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.onChanged(value);
}
},
onFieldSubmitted: widget.onFieldSubmitted,
obscureText: widget.isSecure),
)
: AppText(
@ -177,7 +189,15 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
),
widget.isTextFieldHasSuffix
? widget.suffixIcon != null
? widget.suffixIcon
? Container(
margin: EdgeInsets.only(
bottom: widget.hasHintmargin
? (widget.controller.text.isEmpty ||
widget.controller == null)
? 10
: 25
: 0),
child: widget.suffixIcon)
: InkWell(
child: Icon(
Icons.keyboard_arrow_down,
@ -196,5 +216,4 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
],
);
}
}

Loading…
Cancel
Save