Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into sultan
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 940 B |
After Width: | Height: | Size: 417 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 995 B |
After Width: | Height: | Size: 854 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 399 B |
@ -0,0 +1,319 @@
|
|||||||
|
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'entity_list_checkbox_search_widget.dart';
|
||||||
|
import 'entity_list_procedure_widget.dart';
|
||||||
|
|
||||||
|
valdateProcedure(ProcedureViewModel model, PatiantInformtion patient,
|
||||||
|
List<EntityList> entityList) async {
|
||||||
|
ProcedureValadteRequestModel procedureValadteRequestModel =
|
||||||
|
new ProcedureValadteRequestModel();
|
||||||
|
|
||||||
|
procedureValadteRequestModel.patientMRN = patient.appointmentNo;
|
||||||
|
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
||||||
|
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
postProcedure(
|
||||||
|
{ProcedureViewModel model,
|
||||||
|
String remarks,
|
||||||
|
String orderType,
|
||||||
|
PatiantInformtion patient,
|
||||||
|
List<EntityList> entityList}) async {
|
||||||
|
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
|
||||||
|
ProcedureValadteRequestModel procedureValadteRequestModel =
|
||||||
|
new ProcedureValadteRequestModel();
|
||||||
|
procedureValadteRequestModel.patientMRN = patient.patientMRN;
|
||||||
|
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
||||||
|
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
||||||
|
|
||||||
|
List<Procedures> controlsProcedure = List();
|
||||||
|
|
||||||
|
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
||||||
|
|
||||||
|
postProcedureReqModel.episodeID = patient.episodeNo;
|
||||||
|
postProcedureReqModel.patientMRN = patient.patientMRN;
|
||||||
|
|
||||||
|
entityList.forEach((element) {
|
||||||
|
procedureValadteRequestModel.procedure = [element.procedureId];
|
||||||
|
List<Controls> controls = List();
|
||||||
|
controls.add(
|
||||||
|
Controls(
|
||||||
|
code: "remarks",
|
||||||
|
controlValue: element.remarks != null ? element.remarks : ""),
|
||||||
|
);
|
||||||
|
controls.add(
|
||||||
|
Controls(code: "ordertype", controlValue: "0"),
|
||||||
|
);
|
||||||
|
controlsProcedure.add(Procedures(
|
||||||
|
category: element.categoryID,
|
||||||
|
procedure: element.procedureId,
|
||||||
|
controls: controls));
|
||||||
|
});
|
||||||
|
|
||||||
|
postProcedureReqModel.procedures = controlsProcedure;
|
||||||
|
await model.valadteProcedure(procedureValadteRequestModel);
|
||||||
|
if (model.state == ViewState.Idle) {
|
||||||
|
if (model.valadteProcedureList[0].entityList.length == 0) {
|
||||||
|
await model.postProcedure(postProcedureReqModel, patient.patientMRN);
|
||||||
|
|
||||||
|
if (model.state == ViewState.ErrorLocal) {
|
||||||
|
helpers.showErrorToast(model.error);
|
||||||
|
model.getLabs(patient);
|
||||||
|
} else if (model.state == ViewState.Idle) {
|
||||||
|
DrAppToastMsg.showSuccesToast('procedure has been added');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (model.state == ViewState.ErrorLocal) {
|
||||||
|
helpers.showErrorToast(model.error);
|
||||||
|
model.getLabs(patient);
|
||||||
|
} else if (model.state == ViewState.Idle) {
|
||||||
|
helpers.showErrorToast(
|
||||||
|
model.valadteProcedureList[0].entityList[0].warringMessages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
helpers.showErrorToast(model.error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addSelectedLabOrder(
|
||||||
|
context, ProcedureViewModel model, PatiantInformtion patient) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (BuildContext bc) {
|
||||||
|
return AddSelectedLabOrder(
|
||||||
|
model: model,
|
||||||
|
patient: patient,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddSelectedLabOrder extends StatefulWidget {
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
|
||||||
|
const AddSelectedLabOrder({Key key, this.model, this.patient})
|
||||||
|
: super(key: key);
|
||||||
|
@override
|
||||||
|
_AddSelectedLabOrderState createState() =>
|
||||||
|
_AddSelectedLabOrderState(patient: patient, model: model);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddSelectedLabOrderState extends State<AddSelectedLabOrder> {
|
||||||
|
int selectedType;
|
||||||
|
ProcedureViewModel model;
|
||||||
|
PatiantInformtion patient;
|
||||||
|
_AddSelectedLabOrderState({this.patient, this.model});
|
||||||
|
TextEditingController procedureController = TextEditingController();
|
||||||
|
TextEditingController remarksController = TextEditingController();
|
||||||
|
List<EntityList> entityList = List();
|
||||||
|
List<EntityList> entityListProcedure = List();
|
||||||
|
|
||||||
|
dynamic selectedCategory;
|
||||||
|
|
||||||
|
setSelectedType(int val) {
|
||||||
|
setState(() {
|
||||||
|
selectedType = val;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final screenSize = MediaQuery.of(context).size;
|
||||||
|
return BaseView<ProcedureViewModel>(
|
||||||
|
onModelReady: (model) => model.getProcedureCategory(
|
||||||
|
categoryName: "Laboratory", categoryID: "02"),
|
||||||
|
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: DraggableScrollableSheet(
|
||||||
|
minChildSize: 0.90,
|
||||||
|
initialChildSize: 0.95,
|
||||||
|
maxChildSize: 1.0,
|
||||||
|
builder: (BuildContext context, ScrollController scrollController) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 1.20,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
'New Lab Order',
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
fontSize: 18.0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
if (widget.model.categoriesList.length != 0)
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: EntityListCheckboxSearchWidget(
|
||||||
|
model: widget.model,
|
||||||
|
masterList:
|
||||||
|
widget.model.categoriesList[0].entityList,
|
||||||
|
removeHistory: (item) {
|
||||||
|
setState(() {
|
||||||
|
entityList.remove(item);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addHistory: (history) {
|
||||||
|
setState(() {
|
||||||
|
entityList.add(history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addSelectedHistories: () {
|
||||||
|
//TODO build your fun herr
|
||||||
|
// widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
isEntityListSelected: (master) =>
|
||||||
|
isEntityListSelected(master),
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 15.0,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
// Container(
|
||||||
|
// child: Row(
|
||||||
|
// children: [
|
||||||
|
// AppText(
|
||||||
|
// TranslationBase.of(context).orderType),
|
||||||
|
// Radio(
|
||||||
|
// activeColor: Color(0xFFB9382C),
|
||||||
|
// value: 1,
|
||||||
|
// groupValue: selectedType,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setSelectedType(value);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// Text('routine'),
|
||||||
|
// Radio(
|
||||||
|
// activeColor: Color(0xFFB9382C),
|
||||||
|
// groupValue: selectedType,
|
||||||
|
// value: 0,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setSelectedType(value);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// Text(TranslationBase.of(context).urgent),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 15.0,
|
||||||
|
// ),
|
||||||
|
// TextFields(
|
||||||
|
// hintText: TranslationBase.of(context).remarks,
|
||||||
|
// controller: remarksController,
|
||||||
|
// minLines: 3,
|
||||||
|
// maxLines: 5,
|
||||||
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
height: 100.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(
|
||||||
|
SizeConfig.widthMultiplier * 5),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: TranslationBase.of(context)
|
||||||
|
.addSelectedProcedures,
|
||||||
|
color: Color(0xff359846),
|
||||||
|
onPressed: () {
|
||||||
|
//print(entityList.toString());
|
||||||
|
onPressed:
|
||||||
|
if (entityList.isEmpty == true) {
|
||||||
|
DrAppToastMsg.showErrorToast(
|
||||||
|
"Fill the mandatory procedure details");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Navigator.pop(context);
|
||||||
|
postProcedure(
|
||||||
|
orderType: selectedType.toString(),
|
||||||
|
entityList: entityList,
|
||||||
|
patient: patient,
|
||||||
|
model: widget.model,
|
||||||
|
remarks: remarksController.text);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEntityListSelected(EntityList masterKey) {
|
||||||
|
Iterable<EntityList> history = entityList
|
||||||
|
.where((element) => masterKey.procedureId == element.procedureId);
|
||||||
|
if (history.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputDecoration textFieldSelectorDecoration(
|
||||||
|
String hintText, String selectedText, bool isDropDown,
|
||||||
|
{Icon suffixIcon}) {
|
||||||
|
return InputDecoration(
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
disabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
hintText: selectedText != null ? selectedText : hintText,
|
||||||
|
suffixIcon: isDropDown
|
||||||
|
? suffixIcon != null
|
||||||
|
? suffixIcon
|
||||||
|
: Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
color: Colors.black,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,319 @@
|
|||||||
|
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'entity_list_checkbox_search_widget.dart';
|
||||||
|
import 'entity_list_procedure_widget.dart';
|
||||||
|
|
||||||
|
valdateProcedure(ProcedureViewModel model, PatiantInformtion patient,
|
||||||
|
List<EntityList> entityList) async {
|
||||||
|
ProcedureValadteRequestModel procedureValadteRequestModel =
|
||||||
|
new ProcedureValadteRequestModel();
|
||||||
|
|
||||||
|
procedureValadteRequestModel.patientMRN = patient.appointmentNo;
|
||||||
|
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
||||||
|
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
postProcedure(
|
||||||
|
{ProcedureViewModel model,
|
||||||
|
String remarks,
|
||||||
|
String orderType,
|
||||||
|
PatiantInformtion patient,
|
||||||
|
List<EntityList> entityList}) async {
|
||||||
|
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
|
||||||
|
ProcedureValadteRequestModel procedureValadteRequestModel =
|
||||||
|
new ProcedureValadteRequestModel();
|
||||||
|
procedureValadteRequestModel.patientMRN = patient.patientMRN;
|
||||||
|
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
||||||
|
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
||||||
|
|
||||||
|
List<Procedures> controlsProcedure = List();
|
||||||
|
|
||||||
|
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
||||||
|
|
||||||
|
postProcedureReqModel.episodeID = patient.episodeNo;
|
||||||
|
postProcedureReqModel.patientMRN = patient.patientMRN;
|
||||||
|
|
||||||
|
entityList.forEach((element) {
|
||||||
|
procedureValadteRequestModel.procedure = [element.procedureId];
|
||||||
|
List<Controls> controls = List();
|
||||||
|
controls.add(
|
||||||
|
Controls(
|
||||||
|
code: "remarks",
|
||||||
|
controlValue: element.remarks != null ? element.remarks : ""),
|
||||||
|
);
|
||||||
|
controls.add(
|
||||||
|
Controls(code: "ordertype", controlValue: "0"),
|
||||||
|
);
|
||||||
|
controlsProcedure.add(Procedures(
|
||||||
|
category: element.categoryID,
|
||||||
|
procedure: element.procedureId,
|
||||||
|
controls: controls));
|
||||||
|
});
|
||||||
|
|
||||||
|
postProcedureReqModel.procedures = controlsProcedure;
|
||||||
|
await model.valadteProcedure(procedureValadteRequestModel);
|
||||||
|
if (model.state == ViewState.Idle) {
|
||||||
|
if (model.valadteProcedureList[0].entityList.length == 0) {
|
||||||
|
await model.postProcedure(postProcedureReqModel, patient.patientMRN);
|
||||||
|
|
||||||
|
if (model.state == ViewState.ErrorLocal) {
|
||||||
|
helpers.showErrorToast(model.error);
|
||||||
|
model.getPatientRadOrders(patient);
|
||||||
|
} else if (model.state == ViewState.Idle) {
|
||||||
|
DrAppToastMsg.showSuccesToast('procedure has been added');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (model.state == ViewState.ErrorLocal) {
|
||||||
|
helpers.showErrorToast(model.error);
|
||||||
|
model.getPatientRadOrders(patient);
|
||||||
|
} else if (model.state == ViewState.Idle) {
|
||||||
|
helpers.showErrorToast(
|
||||||
|
model.valadteProcedureList[0].entityList[0].warringMessages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
helpers.showErrorToast(model.error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addSelectedRadiologyOrder(
|
||||||
|
context, ProcedureViewModel model, PatiantInformtion patient) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (BuildContext bc) {
|
||||||
|
return AddSelectedRadiologyOrder(
|
||||||
|
model: model,
|
||||||
|
patient: patient,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddSelectedRadiologyOrder extends StatefulWidget {
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
|
||||||
|
const AddSelectedRadiologyOrder({Key key, this.model, this.patient})
|
||||||
|
: super(key: key);
|
||||||
|
@override
|
||||||
|
_AddSelectedRadiologyOrderState createState() =>
|
||||||
|
_AddSelectedRadiologyOrderState(patient: patient, model: model);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddSelectedRadiologyOrderState extends State<AddSelectedRadiologyOrder> {
|
||||||
|
int selectedType;
|
||||||
|
ProcedureViewModel model;
|
||||||
|
PatiantInformtion patient;
|
||||||
|
_AddSelectedRadiologyOrderState({this.patient, this.model});
|
||||||
|
TextEditingController procedureController = TextEditingController();
|
||||||
|
TextEditingController remarksController = TextEditingController();
|
||||||
|
List<EntityList> entityList = List();
|
||||||
|
List<EntityList> entityListProcedure = List();
|
||||||
|
|
||||||
|
dynamic selectedCategory;
|
||||||
|
|
||||||
|
setSelectedType(int val) {
|
||||||
|
setState(() {
|
||||||
|
selectedType = val;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final screenSize = MediaQuery.of(context).size;
|
||||||
|
return BaseView<ProcedureViewModel>(
|
||||||
|
onModelReady: (model) => model.getProcedureCategory(
|
||||||
|
categoryName: "Radiology", categoryID: "03"),
|
||||||
|
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: DraggableScrollableSheet(
|
||||||
|
minChildSize: 0.90,
|
||||||
|
initialChildSize: 0.95,
|
||||||
|
maxChildSize: 1.0,
|
||||||
|
builder: (BuildContext context, ScrollController scrollController) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 1.20,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
'New Radiology Order',
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
fontSize: 18.0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
if (widget.model.categoriesList.length != 0)
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: EntityListCheckboxSearchWidget(
|
||||||
|
model: widget.model,
|
||||||
|
masterList:
|
||||||
|
widget.model.categoriesList[0].entityList,
|
||||||
|
removeHistory: (item) {
|
||||||
|
setState(() {
|
||||||
|
entityList.remove(item);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addHistory: (history) {
|
||||||
|
setState(() {
|
||||||
|
entityList.add(history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addSelectedHistories: () {
|
||||||
|
//TODO build your fun herr
|
||||||
|
// widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
isEntityListSelected: (master) =>
|
||||||
|
isEntityListSelected(master),
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 15.0,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
// Container(
|
||||||
|
// child: Row(
|
||||||
|
// children: [
|
||||||
|
// AppText(
|
||||||
|
// TranslationBase.of(context).orderType),
|
||||||
|
// Radio(
|
||||||
|
// activeColor: Color(0xFFB9382C),
|
||||||
|
// value: 1,
|
||||||
|
// groupValue: selectedType,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setSelectedType(value);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// Text('routine'),
|
||||||
|
// Radio(
|
||||||
|
// activeColor: Color(0xFFB9382C),
|
||||||
|
// groupValue: selectedType,
|
||||||
|
// value: 0,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setSelectedType(value);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// Text(TranslationBase.of(context).urgent),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 15.0,
|
||||||
|
// ),
|
||||||
|
// TextFields(
|
||||||
|
// hintText: TranslationBase.of(context).remarks,
|
||||||
|
// controller: remarksController,
|
||||||
|
// minLines: 3,
|
||||||
|
// maxLines: 5,
|
||||||
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
height: 100.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(
|
||||||
|
SizeConfig.widthMultiplier * 5),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: TranslationBase.of(context)
|
||||||
|
.addSelectedProcedures,
|
||||||
|
color: Color(0xff359846),
|
||||||
|
onPressed: () {
|
||||||
|
//print(entityList.toString());
|
||||||
|
onPressed:
|
||||||
|
if (entityList.isEmpty == true) {
|
||||||
|
DrAppToastMsg.showErrorToast(
|
||||||
|
"Fill the mandatory procedure details");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Navigator.pop(context);
|
||||||
|
postProcedure(
|
||||||
|
orderType: selectedType.toString(),
|
||||||
|
entityList: entityList,
|
||||||
|
patient: patient,
|
||||||
|
model: widget.model,
|
||||||
|
remarks: remarksController.text);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEntityListSelected(EntityList masterKey) {
|
||||||
|
Iterable<EntityList> history = entityList
|
||||||
|
.where((element) => masterKey.procedureId == element.procedureId);
|
||||||
|
if (history.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputDecoration textFieldSelectorDecoration(
|
||||||
|
String hintText, String selectedText, bool isDropDown,
|
||||||
|
{Icon suffixIcon}) {
|
||||||
|
return InputDecoration(
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
disabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
hintText: selectedText != null ? selectedText : hintText,
|
||||||
|
suffixIcon: isDropDown
|
||||||
|
? suffixIcon != null
|
||||||
|
? suffixIcon
|
||||||
|
: Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
color: Colors.black,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,462 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||||
|
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/Text.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'large_avatar.dart';
|
||||||
|
|
||||||
|
class PatientProfileHeaderWhitAppointment extends StatelessWidget {
|
||||||
|
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
final String patientType;
|
||||||
|
final String arrivalType;
|
||||||
|
final String doctorName;
|
||||||
|
final String branch;
|
||||||
|
final DateTime appointmentDate;
|
||||||
|
final String profileUrl;
|
||||||
|
final String invoiceNO;
|
||||||
|
final String orderNo;
|
||||||
|
|
||||||
|
PatientProfileHeaderWhitAppointment(
|
||||||
|
{this.patient,
|
||||||
|
this.patientType,
|
||||||
|
this.arrivalType,
|
||||||
|
this.doctorName,
|
||||||
|
this.branch,
|
||||||
|
this.appointmentDate,
|
||||||
|
this.profileUrl,
|
||||||
|
this.invoiceNO,
|
||||||
|
this.orderNo});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 0, right: 5, bottom: 5, top: 5),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
//height: 300,
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
|
||||||
|
margin: EdgeInsets.only(top: 50),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(left: 12.0),
|
||||||
|
child: Row(children: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.arrow_back_ios),
|
||||||
|
color: Colors.black, //Colors.black,
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
(Helpers.capitalize(patient.firstName) +
|
||||||
|
" " +
|
||||||
|
Helpers.capitalize(
|
||||||
|
patient.lastName)),
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
backGroundcolor: Colors.white,
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
),
|
||||||
|
patient.gender == 1
|
||||||
|
? Icon(
|
||||||
|
DoctorApp.male_2,
|
||||||
|
color: Colors.blue,
|
||||||
|
)
|
||||||
|
: Icon(
|
||||||
|
DoctorApp.female_1,
|
||||||
|
color: Colors.pink,
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
Row(children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 12.0),
|
||||||
|
child: Container(
|
||||||
|
width: 60,
|
||||||
|
height: 60,
|
||||||
|
child: Image.asset(
|
||||||
|
patient.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: [
|
||||||
|
SERVICES_PATIANT2[
|
||||||
|
int.parse(patientType)] ==
|
||||||
|
"patientArrivalList"
|
||||||
|
? Container(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment
|
||||||
|
.spaceBetween,
|
||||||
|
children: [
|
||||||
|
patient.patientStatusType ==
|
||||||
|
43
|
||||||
|
? AppText(
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.arrivedP,
|
||||||
|
color: Colors.green,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
|
fontFamily:
|
||||||
|
'Poppins',
|
||||||
|
fontSize: 12,
|
||||||
|
)
|
||||||
|
: AppText(
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.notArrived,
|
||||||
|
color:
|
||||||
|
Colors.red[800],
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
|
fontFamily:
|
||||||
|
'Poppins',
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
arrivalType == '1'
|
||||||
|
? AppText(
|
||||||
|
patient.startTime !=
|
||||||
|
null
|
||||||
|
? patient
|
||||||
|
.startTime
|
||||||
|
: '',
|
||||||
|
fontFamily:
|
||||||
|
'Poppins',
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
|
)
|
||||||
|
: AppText(
|
||||||
|
DateUtils.convertStringToDateFormat(
|
||||||
|
patient
|
||||||
|
.arrivedOn,
|
||||||
|
'MM-dd-yyyy HH:mm'),
|
||||||
|
fontFamily:
|
||||||
|
'Poppins',
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
))
|
||||||
|
: SizedBox(),
|
||||||
|
if (SERVICES_PATIANT2[
|
||||||
|
int.parse(patientType)] ==
|
||||||
|
"List_MyOutPatient")
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.appointmentDate +
|
||||||
|
" : ",
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
patient.startTime != null
|
||||||
|
? Container(
|
||||||
|
height: 15,
|
||||||
|
width: 60,
|
||||||
|
decoration:
|
||||||
|
BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius
|
||||||
|
.circular(
|
||||||
|
25),
|
||||||
|
color: HexColor(
|
||||||
|
"#20A169"),
|
||||||
|
),
|
||||||
|
child: AppText(
|
||||||
|
patient.startTime,
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 1.5 *
|
||||||
|
SizeConfig
|
||||||
|
.textMultiplier,
|
||||||
|
textAlign: TextAlign
|
||||||
|
.center,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: SizedBox(),
|
||||||
|
SizedBox(
|
||||||
|
width: 3.5,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: AppText(
|
||||||
|
convertDateFormat2(patient
|
||||||
|
.appointmentDate
|
||||||
|
.toString()),
|
||||||
|
fontSize: 1.5 *
|
||||||
|
SizeConfig
|
||||||
|
.textMultiplier,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 0.5,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
top: 8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 1.6 *
|
||||||
|
SizeConfig
|
||||||
|
.textMultiplier,
|
||||||
|
color: Colors.black),
|
||||||
|
children: <TextSpan>[
|
||||||
|
new TextSpan(
|
||||||
|
text:
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.fileNumber,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontFamily:
|
||||||
|
'Poppins')),
|
||||||
|
new TextSpan(
|
||||||
|
text: patient.patientId
|
||||||
|
.toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w700,
|
||||||
|
fontFamily:
|
||||||
|
'Poppins',
|
||||||
|
fontSize: 14)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
patient.nationalityName ??
|
||||||
|
patient.nationality,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
patient.nationality != null
|
||||||
|
? ClipRRect(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius
|
||||||
|
.circular(
|
||||||
|
20.0),
|
||||||
|
child: Image.network(
|
||||||
|
patient
|
||||||
|
.nationalityFlagURL,
|
||||||
|
height: 25,
|
||||||
|
width: 30,
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext
|
||||||
|
context,
|
||||||
|
Object
|
||||||
|
exception,
|
||||||
|
StackTrace
|
||||||
|
stackTrace) {
|
||||||
|
return Text(
|
||||||
|
'No Image');
|
||||||
|
},
|
||||||
|
))
|
||||||
|
: SizedBox()
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: RichText(
|
||||||
|
text: new TextSpan(
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 1.6 *
|
||||||
|
SizeConfig.textMultiplier,
|
||||||
|
color: Colors.black,
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
),
|
||||||
|
children: <TextSpan>[
|
||||||
|
new TextSpan(
|
||||||
|
text: TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.age +
|
||||||
|
" : ",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14)),
|
||||||
|
new TextSpan(
|
||||||
|
text:
|
||||||
|
"${DateUtils.getAgeByBirthday(patient.dateofBirth, context)}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w700,
|
||||||
|
fontSize: 14)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 30,
|
||||||
|
height: 30,
|
||||||
|
margin: EdgeInsets.only(left: projectViewModel.isArabic?10:85, right: projectViewModel.isArabic?85:10,top: 5),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
border: Border(
|
||||||
|
bottom:BorderSide(color: Colors.grey[400],width: 2.5),
|
||||||
|
left: BorderSide(color: Colors.grey[400],width: 2.5),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 10),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
child: LargeAvatar(
|
||||||
|
name: doctorName,
|
||||||
|
url: profileUrl,
|
||||||
|
),
|
||||||
|
width: 25,
|
||||||
|
height: 25,
|
||||||
|
margin: EdgeInsets.only(top: 10),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(10),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Texts(
|
||||||
|
'${TranslationBase.of(context).dr}.$doctorName',
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
if (orderNo != null)
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Texts(
|
||||||
|
'Order No:',
|
||||||
|
color: Colors.grey[800],
|
||||||
|
),
|
||||||
|
Texts(
|
||||||
|
orderNo ?? '',
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (invoiceNO != null)
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Texts(
|
||||||
|
'Invoice:',
|
||||||
|
color: Colors.grey[800],
|
||||||
|
),
|
||||||
|
Texts(
|
||||||
|
invoiceNO,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Texts(
|
||||||
|
'Result Date:',
|
||||||
|
color: Colors.grey[800],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
convertDateFormat2(String str) {
|
||||||
|
String timeConvert;
|
||||||
|
const start = "/Date(";
|
||||||
|
const end = "+0300)";
|
||||||
|
|
||||||
|
final startIndex = str.indexOf(start);
|
||||||
|
final endIndex = str.indexOf(end, startIndex + start.length);
|
||||||
|
|
||||||
|
var date = new DateTime.fromMillisecondsSinceEpoch(
|
||||||
|
int.parse(str.substring(startIndex + start.length, endIndex)));
|
||||||
|
String newDate = date.year.toString() +
|
||||||
|
"/" +
|
||||||
|
date.month.toString().padLeft(2, '0') +
|
||||||
|
"/" +
|
||||||
|
date.day.toString().padLeft(2, '0');
|
||||||
|
|
||||||
|
return newDate.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
isToday(date) {
|
||||||
|
DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date);
|
||||||
|
return DateFormat("yyyy-MM-dd").format(tempDate) ==
|
||||||
|
DateFormat("yyyy-MM-dd").format(DateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
myBoxDecoration() {
|
||||||
|
return BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
color: Colors.green,
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(10));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,140 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'app_texts_widget.dart';
|
||||||
|
|
||||||
|
class AppTextFieldCustom extends StatefulWidget {
|
||||||
|
final double height;
|
||||||
|
final Function onClick;
|
||||||
|
final String hintText;
|
||||||
|
final TextEditingController controller;
|
||||||
|
final bool isDropDown;
|
||||||
|
final Icon suffixIcon;
|
||||||
|
final Color dropDownColor;
|
||||||
|
|
||||||
|
AppTextFieldCustom(
|
||||||
|
{this.height = 0,
|
||||||
|
this.onClick,
|
||||||
|
this.hintText,
|
||||||
|
this.controller,
|
||||||
|
this.isDropDown = false,
|
||||||
|
this.suffixIcon,
|
||||||
|
this.dropDownColor});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AppTextFieldCustomState createState() => _AppTextFieldCustomState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
height: widget.height != 0 ? widget.height : null,
|
||||||
|
decoration:
|
||||||
|
containerBorderDecoration(Color(0Xffffffff), Color(0xFFEFEFEF)),
|
||||||
|
padding: EdgeInsets.only(top: 4.0, bottom: 4.0, left: 8.0, right: 8.0),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: widget.onClick ?? null,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
if (widget.controller.text != "")
|
||||||
|
AppText(
|
||||||
|
widget.hintText,
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
fontSize: SizeConfig.textMultiplier * 1.4,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
decoration: textFieldSelectorDecoration(
|
||||||
|
widget.hintText, null, true),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
),
|
||||||
|
controller: widget.controller,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
widget.isDropDown
|
||||||
|
? widget.suffixIcon != null
|
||||||
|
? widget.suffixIcon
|
||||||
|
: Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
color: widget.dropDownColor != null
|
||||||
|
? widget.dropDownColor
|
||||||
|
: Colors.black,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
BoxDecoration containerBorderDecoration(
|
||||||
|
Color containerColor, Color borderColor,
|
||||||
|
{double borderWidth = -1}) {
|
||||||
|
return BoxDecoration(
|
||||||
|
color: containerColor,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
|
border: Border.fromBorderSide(BorderSide(
|
||||||
|
color: borderColor,
|
||||||
|
width: borderWidth == -1 ? 2.0 : borderWidth,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static InputDecoration textFieldSelectorDecoration(
|
||||||
|
String hintText, String selectedText, bool isDropDown,
|
||||||
|
{Icon suffixIcon, Color dropDownColor}) {
|
||||||
|
return InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0Xffffffff)),
|
||||||
|
),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0Xffffffff)),
|
||||||
|
),
|
||||||
|
border: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0Xffffffff)),
|
||||||
|
),
|
||||||
|
/*focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
disabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),*/
|
||||||
|
hintText: selectedText != null ? selectedText : hintText,
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
),
|
||||||
|
/*suffixIcon: isDropDown
|
||||||
|
? suffixIcon != null
|
||||||
|
? suffixIcon
|
||||||
|
: Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
color: dropDownColor != null ? dropDownColor : Colors.black,
|
||||||
|
)
|
||||||
|
: null,*/
|
||||||
|
// labelText:
|
||||||
|
// labelStyle:
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|