Merge branch 'SOAP' into 'development'

Soap

See merge request Cloud_Solution/doctor_app_flutter!196
merge-requests/197/merge
Elham 5 years ago
commit ac7bbfeb49

@ -79,28 +79,31 @@ class BaseAppClient {
'Accept': 'application/json' 'Accept': 'application/json'
}); });
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
print("status: $statusCode}");
if (statusCode < 200 || statusCode >= 400 || json == null) { if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode); onFailure('Error While Fetching data', statusCode);
} else { } else {
var parsed = json.decode(response.body.toString()); var parsed = json.decode(response.body.toString());
print("IsAuthenticated? ${parsed['IsAuthenticated']}"); // if (!parsed['IsAuthenticated']) {
if (!parsed['IsAuthenticated']) { // // TODO: return it back when IsAuthenticated work fine in all service
await helpers.logout(); // // await helpers.logout();
helpers.showErrorToast('Your session expired Please login again'); //
} else if (parsed['MessageStatus'] == 1) { // helpers.showErrorToast('Your session expired Please login agian');
// } else
if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
String error = String error =
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'];
if (parsed["ValidationErrors"] != null) { if (parsed["ValidationErrors"] != null) {
error =
parsed["ValidationErrors"]["StatusMessage"].toString() + "\n";
if (parsed["ValidationErrors"]["ValidationErrors"] != null && if (parsed["ValidationErrors"]["ValidationErrors"] != null &&
parsed["ValidationErrors"]["ValidationErrors"].length != 0) { parsed["ValidationErrors"]["ValidationErrors"].length != 0) {
error = '';
for (var i = 0; for (var i = 0;
i < parsed["ValidationErrors"]["ValidationErrors"].length; i < parsed["ValidationErrors"]["ValidationErrors"].length;
i++) { i++) {
error = error + error = error +
parsed["ValidationErrors"]["ValidationErrors"][i] parsed["ValidationErrors"]["ValidationErrors"][i]
["Messages"][0] + ["Messages"][0] +

@ -105,6 +105,8 @@ const GET_PATIENT_ARRIVAL_LIST =
const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies';
const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList';
const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies';
const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory';
const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint';
var selectedPatientType = 1; var selectedPatientType = 1;

@ -281,8 +281,11 @@ const Map<String, Map<String, String>> localizedValues = {
'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'},
'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'},
"empty-message": { "empty-message": {
"en": "Please enter message", "en": "Please enter Value",
"ar": "يرجى ادخال الموضوع" "ar": "يرجى ادخال القيمه"
},"chiefComplaintLength": {
"en": "Chief Complaint length should be greater than 25",
"ar": "يجب أن يكون طول شكوى الرئيس أكبر من 25"
}, },
'referTo': {'en': "Refer To", 'ar': 'محال إلى'}, 'referTo': {'en': "Refer To", 'ar': 'محال إلى'},
'referredFrom': {'en': "Referred From", 'ar': 'محال من'}, 'referredFrom': {'en': "Referred From", 'ar': 'محال من'},

@ -1,14 +1,13 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart';
import 'base/lookup-service.dart'; import 'base/lookup-service.dart';
class SOAPService extends LookupService { class SOAPService extends LookupService {
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
await baseAppClient.post( await baseAppClient.post(
GET_ALLERGIES, GET_ALLERGIES,
@ -27,13 +26,38 @@ class SOAPService extends LookupService {
} }
Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async {
hasError = false;
await baseAppClient.post(POST_ALLERGY, await baseAppClient.post(POST_ALLERGY,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: postAllergyRequestModel.toJson()); }, body: postAllergyRequestModel.toJson());
} }
Future postHistories(
PostHistoriesRequestModel postHistoriesRequestModel) async {
hasError = false;
await baseAppClient.post(POST_HISTORY,
onSuccess: (dynamic response, int statusCode) {
print("Success");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: postHistoriesRequestModel.toJson());
}
Future postChiefComplaint(
PostChiefComplaintRequestModel postChiefComplaintRequestModel) async {
hasError = false;
await baseAppClient.post(POST_CHIEF_COMPLAINT,
onSuccess: (dynamic response, int statusCode) {
print("Success");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: postChiefComplaintRequestModel.toJson());
}
} }

@ -26,9 +26,14 @@ class LookupService extends BaseService {
List<MasterKeyModel> get historySurgicalList => _historySurgicalList; List<MasterKeyModel> get historySurgicalList => _historySurgicalList;
List<MasterKeyModel> _historySurgicalList = []; List<MasterKeyModel> _historySurgicalList = [];
List<MasterKeyModel> get physicalExaminationList => _physicalExaminationList;
List<MasterKeyModel> _physicalExaminationList = [];
List<MasterKeyModel> listOfPhysiotherapyGoals = []; List<MasterKeyModel> listOfPhysiotherapyGoals = [];
Future getMasterLookup(MasterKeysService masterKeys) async { Future getMasterLookup(MasterKeysService masterKeys) async {
hasError = false;
Map<String, dynamic> body = { Map<String, dynamic> body = {
"MasterInput": masterKeys.getMasterKeyService() "MasterInput": masterKeys.getMasterKeyService()
}; };
@ -86,7 +91,11 @@ class LookupService extends BaseService {
}); });
break; break;
case MasterKeysService.PhysicalExamination: case MasterKeysService.PhysicalExamination:
return 59; _physicalExaminationList.clear();
entryList.forEach((v) {
_physicalExaminationList
.add(MasterKeyModel.fromJson(v));
});
break; break;
case MasterKeysService.AllergySeverity: case MasterKeysService.AllergySeverity:
_allergySeverityList.clear(); _allergySeverityList.clear();

@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart';
import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart';
import '../../locator.dart'; import '../../locator.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
@ -27,6 +29,7 @@ class SOAPViewModel extends BaseViewModel {
List<MasterKeyModel> get historySocialList => _SOAPService.historySocialList; List<MasterKeyModel> get historySocialList => _SOAPService.historySocialList;
List<MasterKeyModel> get historySurgicalList => _SOAPService.historySurgicalList; List<MasterKeyModel> get historySurgicalList => _SOAPService.historySurgicalList;
List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList];
List<MasterKeyModel> get physicalExaminationList => _SOAPService.physicalExaminationList;
@ -60,5 +63,25 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future postHistories(PostHistoriesRequestModel postHistoriesRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postHistories(postHistoriesRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postChiefComplaint(PostChiefComplaintRequestModel postChiefComplaintRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
} }

@ -0,0 +1,33 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedExamination {
MasterKeyModel selectedExamination;
String remark;
bool isNormal;
bool isAbnormal;
MySelectedExamination(
{this.selectedExamination, this.remark, this.isNormal = true, this.isAbnormal = false});
MySelectedExamination.fromJson(Map<String, dynamic> json) {
selectedExamination = json['selectedExamination'] != null
? new MasterKeyModel.fromJson(json['selectedExamination'])
: null;
remark = json['remark'];
remark = json['isNormal'];
remark = json['isAbnormal'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.selectedExamination != null) {
data['selectedExamination'] = this.selectedExamination.toJson();
}
data['remark'] = this.remark;
data['isNormal'] = this.isNormal;
data['isAbnormal'] = this.isAbnormal;
return data;
}
}

@ -0,0 +1,48 @@
class PostChiefComplaintRequestModel {
int appointmentNo;
int episodeID;
int patientMRN;
String chiefComplaint;
String hopi;
String currentMedication;
bool ispregnant;
bool isLactation;
int numberOfWeeks;
PostChiefComplaintRequestModel(
{this.appointmentNo,
this.episodeID,
this.patientMRN,
this.chiefComplaint,
this.hopi,
this.currentMedication,
this.ispregnant,
this.isLactation,
this.numberOfWeeks});
PostChiefComplaintRequestModel.fromJson(Map<String, dynamic> json) {
appointmentNo = json['AppointmentNo'];
episodeID = json['EpisodeID'];
patientMRN = json['PatientMRN'];
chiefComplaint = json['chiefComplaint'];
hopi = json['Hopi'];
currentMedication = json['CurrentMedication'];
ispregnant = json['ispregnant'];
isLactation = json['isLactation'];
numberOfWeeks = json['numberOfWeeks'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['AppointmentNo'] = this.appointmentNo;
data['EpisodeID'] = this.episodeID;
data['PatientMRN'] = this.patientMRN;
data['chiefComplaint'] = this.chiefComplaint;
data['Hopi'] = this.hopi;
data['CurrentMedication'] = this.currentMedication;
data['ispregnant'] = this.ispregnant;
data['isLactation'] = this.isLactation;
data['numberOfWeeks'] = this.numberOfWeeks;
return data;
}
}

@ -0,0 +1,64 @@
class PostHistoriesRequestModel {
List<ListMedicalHistoryVM> listMedicalHistoryVM;
PostHistoriesRequestModel({this.listMedicalHistoryVM});
PostHistoriesRequestModel.fromJson(Map<String, dynamic> json) {
if (json['listMedicalHistoryVM'] != null) {
listMedicalHistoryVM = new List<ListMedicalHistoryVM>();
json['listMedicalHistoryVM'].forEach((v) {
listMedicalHistoryVM.add(new ListMedicalHistoryVM.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.listMedicalHistoryVM != null) {
data['listMedicalHistoryVM'] =
this.listMedicalHistoryVM.map((v) => v.toJson()).toList();
}
return data;
}
}
class ListMedicalHistoryVM {
int patientMRN;
int historyType;
int historyId;
int episodeId;
int appointmentNo;
bool isChecked;
String remarks;
ListMedicalHistoryVM(
{this.patientMRN,
this.historyType,
this.historyId,
this.episodeId,
this.appointmentNo,
this.isChecked,
this.remarks});
ListMedicalHistoryVM.fromJson(Map<String, dynamic> json) {
patientMRN = json['patientMRN'];
historyType = json['historyType'];
historyId = json['historyId'];
episodeId = json['episodeId'];
appointmentNo = json['appointmentNo'];
isChecked = json['isChecked'];
remarks = json['remarks'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['patientMRN'] = this.patientMRN;
data['historyType'] = this.historyType;
data['historyId'] = this.historyId;
data['episodeId'] = this.episodeId;
data['appointmentNo'] = this.appointmentNo;
data['isChecked'] = this.isChecked;
data['remarks'] = this.remarks;
return data;
}
}

@ -0,0 +1,99 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class PostPhysicalExamRequestModel {
List<ListHisProgNotePhysicalVM> listHisProgNotePhysicalVM;
PostPhysicalExamRequestModel({this.listHisProgNotePhysicalVM});
PostPhysicalExamRequestModel.fromJson(Map<String, dynamic> json) {
if (json['listHisProgNotePhysicalVM'] != null) {
listHisProgNotePhysicalVM = new List<ListHisProgNotePhysicalVM>();
json['listHisProgNotePhysicalVM'].forEach((v) {
listHisProgNotePhysicalVM
.add(new ListHisProgNotePhysicalVM.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.listHisProgNotePhysicalVM != null) {
data['listHisProgNotePhysicalVM'] =
this.listHisProgNotePhysicalVM.map((v) => v.toJson()).toList();
}
return data;
}
}
class ListHisProgNotePhysicalVM {
int episodeId;
int appointmentNo;
int examType;
int examId;
int patientMRN;
bool isNormal;
bool isAbnormal;
String remarks;
int createdBy;
String createdOn;
int editedBy;
String editedOn;
bool notExamined;
MasterKeyModel masterDescription;
ListHisProgNotePhysicalVM(
{this.episodeId,
this.appointmentNo,
this.examType,
this.examId,
this.patientMRN,
this.isNormal,
this.isAbnormal,
this.remarks,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
this.notExamined,
this.masterDescription});
ListHisProgNotePhysicalVM.fromJson(Map<String, dynamic> json) {
episodeId = json['episodeId'];
appointmentNo = json['appointmentNo'];
examType = json['examType'];
examId = json['examId'];
patientMRN = json['patientMRN'];
isNormal = json['isNormal'];
isAbnormal = json['isAbnormal'];
remarks = json['remarks'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
editedBy = json['editedBy'];
editedOn = json['editedOn'];
notExamined = json['notExamined'];
masterDescription = json['masterDescription'] != null
? new MasterKeyModel.fromJson(json['masterDescription'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['episodeId'] = this.episodeId;
data['appointmentNo'] = this.appointmentNo;
data['examType'] = this.examType;
data['examId'] = this.examId;
data['patientMRN'] = this.patientMRN;
data['isNormal'] = this.isNormal;
data['isAbnormal'] = this.isAbnormal;
data['remarks'] = this.remarks;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['editedBy'] = this.editedBy;
data['editedOn'] = this.editedOn;
data['notExamined'] = this.notExamined;
if (this.masterDescription != null) {
data['masterDescription'] = this.masterDescription.toJson();
}
return data;
}
}

@ -301,6 +301,7 @@ class TranslationBase {
String get next => localizedValues['next'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode];
String get healthRecordInformation => localizedValues['healthRecordInformation'][locale.languageCode]; String get healthRecordInformation => localizedValues['healthRecordInformation'][locale.languageCode];
String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; String get emptyMessage => localizedValues['empty-message'][locale.languageCode];
String get chiefComplaintLength => localizedValues['chiefComplaintLength'][locale.languageCode];
String get referTo => localizedValues['referTo'][locale.languageCode]; String get referTo => localizedValues['referTo'][locale.languageCode];
String get referredFrom => localizedValues['referredFrom'][locale.languageCode]; String get referredFrom => localizedValues['referredFrom'][locale.languageCode];

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_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/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -30,6 +31,7 @@ class _AddSOAPIndexState extends State<AddSOAPIndex>
int _currentIndex = 0; int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList= List(); List<MySelectedAllergy> myAllergiesList= List();
List<MasterKeyModel> myHistoryList = List(); List<MasterKeyModel> myHistoryList = List();
List<MySelectedExamination> mySelectedExamination = List();
changePageViewIndex(pageIndex) { changePageViewIndex(pageIndex) {
_controller.jumpToPage(pageIndex); _controller.jumpToPage(pageIndex);
} }
@ -153,7 +155,7 @@ class _AddSOAPIndexState extends State<AddSOAPIndex>
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,),
ObjectivePage(changePageViewIndex: changePageViewIndex,), ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination),
AssessmentPage(changePageViewIndex: changePageViewIndex,), AssessmentPage(changePageViewIndex: changePageViewIndex,),
PlanPage(changePageViewIndex: changePageViewIndex,) PlanPage(changePageViewIndex: changePageViewIndex,)
], ],

@ -1,4 +1,10 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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/Text.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
@ -7,15 +13,17 @@ 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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hexcolor/hexcolor.dart';
class ObjectivePage extends StatefulWidget { class ObjectivePage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
final List<MySelectedExamination> mySelectedExamination;
ObjectivePage({Key key, this.changePageViewIndex}); ObjectivePage(
{Key key, this.changePageViewIndex, this.mySelectedExamination});
@override @override
_ObjectivePageState createState() => _ObjectivePageState(); _ObjectivePageState createState() => _ObjectivePageState();
@ -23,7 +31,6 @@ class ObjectivePage extends StatefulWidget {
class _ObjectivePageState extends State<ObjectivePage> { class _ObjectivePageState extends State<ObjectivePage> {
bool isSysExaminationExpand = false; bool isSysExaminationExpand = false;
List<dynamic> examinationsList;
TextEditingController remarksController = TextEditingController(); TextEditingController remarksController = TextEditingController();
BoxDecoration containerBorderDecoration( BoxDecoration containerBorderDecoration(
@ -117,115 +124,141 @@ class _ObjectivePageState extends State<ObjectivePage> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
Container( Column(
margin: children:
EdgeInsets.only(left: 15, right: 15, top: 15), widget.mySelectedExamination.map((examination) {
child: Column( return Container(
children: [ margin: EdgeInsets.only(
Row( left: 15, right: 15, top: 15),
mainAxisAlignment: child: Column(children: [
MainAxisAlignment.spaceBetween,
children: [
Texts('Abdomen'.toUpperCase(),
variant: "bodyText",
bold: true,
color: Colors.black)
],
),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row( Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
InkWell( Texts(
child: Center( examination
child: Container( .selectedExamination.nameEn
height: screenSize.height * 0.070, .toUpperCase(),
decoration: containerBorderDecoration( variant: "bodyText",
Colors.white,Colors.grey bold: true,
), color: Colors.black)
child: Center( ],
child: Padding( ),
padding: const EdgeInsets.all(8.0), SizedBox(
child: Text( height: 8,
"Normal", ),
style: TextStyle( Row(
fontSize: 12, mainAxisAlignment:
color: MainAxisAlignment.spaceBetween,
Colors.black, //Colors.black, children: [
fontWeight: FontWeight.bold, Row(
children: [
InkWell(
child: Center(
child: Container(
height:
screenSize.height *
0.070,
decoration:
containerBorderDecoration(
Colors.white,
Colors.grey),
child: Center(
child: Padding(
padding:
const EdgeInsets
.all(8.0),
child: Text(
"Normal",
style: TextStyle(
fontSize: 12,
color:
Colors.black,
//Colors.black,
fontWeight:
FontWeight
.bold,
),
),
), ),
), )),
), ),
)), onTap: () {}),
SizedBox(
width: 12,
), ),
onTap: () { InkWell(
child: Center(
}), child: Container(
SizedBox(width: 12,), height:
InkWell( screenSize.height *
child: Center( 0.070,
child: Container( decoration:
height: screenSize.height * 0.070, containerBorderDecoration(
decoration: containerBorderDecoration( Color(0xFF515A5D),
Color(0xFF515A5D), Colors.black Colors.black),
), child: Center(
child: Center( child: Padding(
child: Padding( padding:
padding: const EdgeInsets.all(8.0), const EdgeInsets
child: Text( .all(8.0),
"Abnormal", child: Text(
style: TextStyle( "Abnormal",
fontSize: 12, style: TextStyle(
color: fontSize: 12,
Colors.white, //Colors.black, color:
fontWeight: FontWeight.bold, Colors.white,
//Colors.black,
fontWeight:
FontWeight
.bold,
),
),
), ),
), )),
), ),
)), onTap: () {}),
), ],
onTap: () { ),
InkWell(
}), child: Icon(
FontAwesomeIcons.trash,
color: Colors.grey,
size: 20,
),
onTap: () => removeExamination(
examination.selectedExamination),
)
], ],
), ),
Icon( SizedBox(
FontAwesomeIcons.trash, height: 20,
color: Colors.grey, ),
size: 20, Container(
) margin: EdgeInsets.only(
], left: 10, right: 10, top: 15),
), child: TextFields(
SizedBox( hintText: "Remarks",
height: 20, fontSize: 13.5,
), // hintColor: Colors.black,
Container( fontWeight: FontWeight.w600,
margin: EdgeInsets.only(left: 10, right: 10, top: 15), maxLines: 25,
child: TextFields( minLines: 13,
hintText: "Remarks", controller: remarksController,
fontSize: 13.5, validator: (value) {
// hintColor: Colors.black, if (value == null)
fontWeight: FontWeight.w600, return TranslationBase.of(context)
maxLines: 25, .emptyMessage;
minLines: 13, else
controller: remarksController, return null;
validator: (value) { }),
if (value == null) ),
return TranslationBase.of(context).emptyMessage; SizedBox(
else height: 20,
return null; ),
}), ]));
), }).toList(),
SizedBox(
height: 20,
),
],
),
) )
], ],
) )
@ -249,10 +282,25 @@ class _ObjectivePageState extends State<ObjectivePage> {
)); ));
} }
removeExamination(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> history = widget.mySelectedExamination
.where(
(element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (history.length > 0)
setState(() {
widget.mySelectedExamination.remove(history.first);
});
}
openExaminationList(BuildContext context) { openExaminationList(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery
InputDecoration textFieldSelectorDecoration( .of(context)
String hintText, String selectedText, bool isDropDown) { .size;
InputDecoration textFieldSelectorDecoration(String hintText,
String selectedText, bool isDropDown) {
return InputDecoration( return InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
@ -275,228 +323,178 @@ class _ObjectivePageState extends State<ObjectivePage> {
); );
} }
;
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white, backgroundColor: Colors.white,
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: (context) { builder: (context) {
return FractionallySizedBox( return AddExaminationDailog(
heightFactor: 0.7, mySelectedExamination: widget.mySelectedExamination,
child: Container( addSelectedExamination: () {
child: FractionallySizedBox( setState(() {
widthFactor: 0.9, Navigator.of(context).pop();
child: Column( });
crossAxisAlignment: CrossAxisAlignment.start, },
children: [ removeExamination: (masterKey) => removeExamination(masterKey),);
SizedBox( });
height: 16, }
), }
AppText(
"Examinations", class AddExaminationDailog extends StatefulWidget {
fontWeight: FontWeight.bold, final List<MySelectedExamination> mySelectedExamination;
fontSize: 16, final Function addSelectedExamination;
), final Function (MasterKeyModel) removeExamination;
SizedBox(
height: 16, const AddExaminationDailog(
), {Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination})
Container( : super(key: key);
height: MediaQuery.of(context).size.height * 0.5,
child: Center( @override
child: Container( _AddExaminationDailogState createState() => _AddExaminationDailogState();
margin: EdgeInsets.only(top: 15), }
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), class _AddExaminationDailogState extends State<AddExaminationDailog> {
color: Colors.white), @override
child: ListView( Widget build(BuildContext context) {
children: [ return FractionallySizedBox(
Column( heightFactor: 0.7,
child: BaseView<SOAPViewModel>(
onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(
MasterKeysService.PhysicalExamination);
}
},
builder: (_, model, w) =>
AppScaffold(
// baseViewModel: model,
isShowAppBar: false,
body: Center(
child: Container(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( SizedBox(
children: [ height: 16,
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
DividerWithSpacesAround(),
Row(
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
DividerWithSpacesAround(),
Row(
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
DividerWithSpacesAround(),
Row(
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
), ),
DividerWithSpacesAround(), AppText(
Row( "Examinations",
children: [ fontWeight: FontWeight.bold,
Checkbox( fontSize: 16,
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
), ),
DividerWithSpacesAround(), SizedBox(
Row( height: 16,
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
), ),
DividerWithSpacesAround(), NetworkBaseView(
Row( baseViewModel: model,
children: [ child: Container(
Checkbox( height:
value: true, MediaQuery
activeColor: Colors.red[800], .of(context)
onChanged: (bool newValue) { .size
setState(() {}); .height * 0.5,
}), child: Center(
Expanded( child: Container(
child: Padding( margin: EdgeInsets.only(top: 15),
padding: const EdgeInsets.symmetric( decoration: BoxDecoration(
horizontal: 10, vertical: 0), borderRadius: BorderRadius
child: Texts('Examinations', .circular(12),
variant: "bodyText", color: Colors.white),
bold: true, child: ListView(
color: Colors.black), children: [
), Column(
), children: model
], .physicalExaminationList
.map((examinationInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value: isServiceSelected(
examinationInfo),
activeColor:
Colors.red[800],
onChanged:
(
bool newValue) {
setState(() {
if (isServiceSelected(
examinationInfo
)) {
widget
.removeExamination(
examinationInfo
);
}
else {
MySelectedExamination mySelectedExamination = new MySelectedExamination(
selectedExamination: examinationInfo
);
widget
.mySelectedExamination
.add(
mySelectedExamination);
}
});
}),
Expanded(
child: Padding(
padding:
const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts(
examinationInfo
.nameEn,
variant: "bodyText",
bold: true,
color:
Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
), ),
DividerWithSpacesAround(), SizedBox(
Row( height: 10,
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
), ),
DividerWithSpacesAround(), if (model.state == ViewState.Idle)
], AppButton(
), title: "Add SELECTED Examinations"
], .toUpperCase(),
), onPressed: () {
)), widget.addSelectedExamination();
), },
SizedBox( ),
height: 10, ]),
), ))),
AppButton( )),
title: "Add SELECTED Examinations".toUpperCase(), );
onPressed: () {},
),
]),
)),
);
});
} }
}
isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> exam =
widget
.mySelectedExamination
.where((element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (exam.length > 0) {
return true;
}
return false;
}
}

@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart';
@ -34,9 +36,9 @@ class _SubjectivePageState extends State<SubjectivePage> {
bool isChiefExpand = false; bool isChiefExpand = false;
bool isHistoryExpand = false; bool isHistoryExpand = false;
bool isAllergiesExpand = false; bool isAllergiesExpand = false;
List<MasterKeyModel> myHistoryList = List();
TextEditingController illnessController = TextEditingController(); TextEditingController illnessController = TextEditingController();
TextEditingController complaintsController = TextEditingController(); TextEditingController complaintsController = TextEditingController();
final formKey = GlobalKey<FormState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -83,56 +85,64 @@ class _SubjectivePageState extends State<SubjectivePage> {
isChiefExpand ? EvaIcons.minus : EvaIcons.plus)) isChiefExpand ? EvaIcons.minus : EvaIcons.plus))
], ],
), ),
bodyWidget: Column(children: [ bodyWidget: Form(
SizedBox( key: formKey,
height: 20, child: Column(children: [
), SizedBox(
Container( height: 20,
margin: EdgeInsets.only(left: 10, right: 10, top: 15), ),
child: TextFields( Container(
hintText: "Add Chief Complaints", margin: EdgeInsets.only(left: 10, right: 10, top: 15),
fontSize: 13.5, child: TextFields(
// hintColor: Colors.black, hintText: "Add Chief Complaints",
fontWeight: FontWeight.w600, fontSize: 13.5,
maxLines: 25, // hintColor: Colors.black,
minLines: 13, fontWeight: FontWeight.w600,
controller: complaintsController, maxLines: 25,
validator: (value) { minLines: 13,
if (value == null) controller: complaintsController,
return TranslationBase validator: (value) {
.of(context) if (value == null || value =="")
.emptyMessage; return TranslationBase
else .of(context)
return null; .emptyMessage;
}), else if (value.length < 25)
), return TranslationBase
SizedBox( .of(context)
height: 20, .chiefComplaintLength;
), //"";
Container( else
margin: EdgeInsets.only(left: 10, right: 10, top: 15), return null;
child: TextFields( }),
hintText: "History of Present Illness", ),
fontSize: 13.5, SizedBox(
// hintColor: Colors.black, height: 20,
fontWeight: FontWeight.w600, ),
maxLines: 25, Container(
minLines: 13, margin: EdgeInsets.only(left: 10, right: 10, top: 15),
controller: illnessController, child: TextFields(
validator: (value) { hintText: "History of Present Illness",
if (value == null) fontSize: 13.5,
return TranslationBase // hintColor: Colors.black,
.of(context) fontWeight: FontWeight.w600,
.emptyMessage; maxLines: 25,
else minLines: 13,
return null; controller: illnessController,
}), validator: (value) {
), if (value == null || value =="")
SizedBox( return TranslationBase
height: 20, .of(context)
), .emptyMessage;
AddMedication(), else
]), return null;
}),
),
SizedBox(
height: 20,
),
AddMedication(),
]),
),
isExpand: isChiefExpand, isExpand: isChiefExpand,
), ),
@ -177,7 +187,7 @@ class _SubjectivePageState extends State<SubjectivePage> {
), ),
bodyWidget: Column( bodyWidget: Column(
children: [ children: [
AddHistoryWidget(myHistoryList: myHistoryList) AddHistoryWidget(myHistoryList: widget.myHistoryList)
], ],
), ),
isExpand: isHistoryExpand, isExpand: isHistoryExpand,
@ -243,58 +253,118 @@ class _SubjectivePageState extends State<SubjectivePage> {
SizedBox( SizedBox(
height: 30, height: 30,
), ),
AppButton( AppButton(
title: TranslationBase title: TranslationBase.of(context).next,
.of(context) loading: model.state == ViewState.BusyLocal,
.next, onPressed: () async {
addSubjectiveInfo(
onPressed: () async { model: model,
addSubjectiveInfo(model: model, myAllergiesList: widget.myAllergiesList,
myAllergiesList: widget.myAllergiesList, myHistoryList: widget.myHistoryList);
myHistoryList: myHistoryList); },
),
},
),
], ],
), ),
), ),
), ),
),),); ),
),
);
} }
addSubjectiveInfo( addSubjectiveInfo(
{SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List< {SOAPViewModel model,
MasterKeyModel> myHistoryList }) async { List<MySelectedAllergy> myAllergiesList,
PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); List<MasterKeyModel> myHistoryList}) async {
await postChiefComplaint(model: model);
if (myHistoryList.length != 0)
await postHistories(model: model, myHistoryList: myHistoryList);
if (myAllergiesList.length != 0)
await postAllergy(myAllergiesList: myAllergiesList, model: model);
widget.changePageViewIndex(1);
}
postAllergy(
{List<MySelectedAllergy> myAllergiesList, SOAPViewModel model}) async {
PostAllergyRequestModel postAllergyRequestModel =
new PostAllergyRequestModel();
widget.myAllergiesList.forEach((allergy) { widget.myAllergiesList.forEach((allergy) {
if(postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==null) if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==
null)
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( //TODO: make static value dynamic
ListHisProgNotePatientAllergyDiseaseVM( postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM
allergyDiseaseId: allergy.selectedAllergy.id, .add(ListHisProgNotePatientAllergyDiseaseVM(
allergyDiseaseType: allergy.selectedAllergy.typeId, allergyDiseaseId: allergy.selectedAllergy.id,
patientMRN: 2500477, allergyDiseaseType: allergy.selectedAllergy.typeId,
episodeId: 200011502, patientMRN: 3120690,
appointmentNo: 2016053271, episodeId: 200012117,
severity: allergy.selectedAllergySeverity.id, appointmentNo: 2016054573,
remarks: allergy.remark, severity: allergy.selectedAllergySeverity.id,
createdBy: 1485, remarks: allergy.remark,
createdOn: "2020-08-14T20:37:22.780Z", createdBy: 1485,
editedBy: 1485, //
editedOn: "2020-08-14T20:37:22.780Z", createdOn: "2020-08-14T20:37:22.780Z",
isChecked: false, editedBy: 1485,
isUpdatedByNurse: false editedOn: "2020-08-14T20:37:22.780Z",
)); isChecked: false,
isUpdatedByNurse: false));
}); });
await model.postAllergy(postAllergyRequestModel); await model.postAllergy(postAllergyRequestModel);
if(model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error); helpers.showErrorToast(model.error);
} }
widget.changePageViewIndex(1); }
print(postAllergyRequestModel); postHistories(
{List<MasterKeyModel> myHistoryList, SOAPViewModel model}) async {
PostHistoriesRequestModel postHistoriesRequestModel =
new PostHistoriesRequestModel();
widget.myHistoryList.forEach((history) {
if (postHistoriesRequestModel.listMedicalHistoryVM == null)
postHistoriesRequestModel.listMedicalHistoryVM = [];
//TODO: make static value dynamic
postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM(
patientMRN: 3120690,
episodeId: 200012117,
appointmentNo: 2016054573,
remarks: "",
historyId: history.id,
historyType: history.typeId,
isChecked: false,
));
});
await model.postHistories(postHistoriesRequestModel);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
}
} }
postChiefComplaint({SOAPViewModel model}) async {
formKey.currentState.save();
if(formKey.currentState.validate()){
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
//TODO: make static value dynamic
new PostChiefComplaintRequestModel(
patientMRN: 3120690,
episodeID: 200012117,
appointmentNo: 2016054573,
chiefComplaint: complaintsController.text,
currentMedication: "currentMedication",
hopi: illnessController.text,
isLactation: false,
ispregnant: false,
numberOfWeeks: 22);
await model.postChiefComplaint(postChiefComplaintRequestModel);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
}
}
}
} }

@ -157,7 +157,7 @@ class _TextFieldsState extends State<TextFields> {
: :
Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]),
errorStyle: TextStyle(fontSize: 14.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), errorStyle: TextStyle(fontSize: 12.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0),
borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)

@ -14,50 +14,78 @@ class AppButton extends StatefulWidget {
final Color color; final Color color;
final double fontSize; final double fontSize;
final double padding; final double padding;
final bool loading;
final bool disabled;
AppButton({@required this.onPressed, this.title, this.icon, this.color, this.fontSize = 2, this.padding = 13}); AppButton(
{@required this.onPressed,
this.title,
this.icon,
this.color,
this.fontSize = 2,
this.padding = 13,
this.loading = false,
this.disabled = false});
_AppButtonState createState() => _AppButtonState(); _AppButtonState createState() => _AppButtonState();
} }
class _AppButtonState extends State<AppButton>{ class _AppButtonState extends State<AppButton>{
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return return
RawMaterialButton( IgnorePointer(
fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), ignoring: widget.loading,
splashColor: widget.color, child: RawMaterialButton(
child: Padding( fillColor: widget.color != null ? widget.color : HexColor("#B8382C"),
padding: EdgeInsets.only( splashColor: widget.color,
top: widget.padding, child: Padding(
bottom: widget.padding, padding: EdgeInsets.only(
//right: SizeConfig.widthMultiplier * widget.padding, top: widget.padding,
//left: SizeConfig.widthMultiplier * widget.padding bottom: widget.padding,
), //right: SizeConfig.widthMultiplier * widget.padding,
child: Row( //left: SizeConfig.widthMultiplier * widget.padding
mainAxisSize: MainAxisSize.max, ),
mainAxisAlignment: MainAxisAlignment.center, child: Row(
children: <Widget>[ mainAxisSize: MainAxisSize.max,
if (widget.icon != null) mainAxisAlignment: MainAxisAlignment.center,
Icon( children: <Widget>[
widget.icon, if (widget.icon != null)
color: Colors.white, Icon(
), widget.icon,
if (widget.icon != null) color: Colors.white,
SizedBox( ),
width: 5.0, if (widget.icon != null)
), SizedBox(
AppText( width: 5.0,
widget.title.toUpperCase(), ),
color: Colors.white, widget.loading
fontSize: SizeConfig.textMultiplier * widget.fontSize , ? Padding(
), padding: EdgeInsets.all(2.6),
], child: SizedBox(
height: 19.0,
width: 19.0,
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor:
AlwaysStoppedAnimation<Color>(
Colors.grey[300],
),
),
),
)
: AppText(
widget.title.toUpperCase(),
color: Colors.white,
fontSize: SizeConfig.textMultiplier * widget.fontSize,
),
],
),
), ),
onPressed: widget.onPressed,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(6))),
), ),
onPressed: widget.onPressed, );
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(6))),
);
} }
} }
Loading…
Cancel
Save