|
|
|
@ -6,9 +6,11 @@ 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/app_buttons_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
@ -34,26 +36,18 @@ class ReferPatientScreen extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
var doctorsList;
|
|
|
|
|
final _remarksController = TextEditingController();
|
|
|
|
|
dynamic _selectedClinic;
|
|
|
|
|
dynamic _selectedDoctor;
|
|
|
|
|
final _extController = TextEditingController();
|
|
|
|
|
var _isInit = true;
|
|
|
|
|
bool isValid;
|
|
|
|
|
|
|
|
|
|
var clinicId;
|
|
|
|
|
var doctorId;
|
|
|
|
|
var freqId;
|
|
|
|
|
|
|
|
|
|
String _selectedClinic;
|
|
|
|
|
String _selectedDoctor;
|
|
|
|
|
String _selectedReferralFrequancy;
|
|
|
|
|
|
|
|
|
|
int _activePriority = 1;
|
|
|
|
|
|
|
|
|
|
FocusNode myFocusNode = FocusNode();
|
|
|
|
|
dynamic _selectedFrequency;
|
|
|
|
|
final _remarksController = TextEditingController();
|
|
|
|
|
bool isValid;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
|
|
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getClinicsList(),
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
@ -62,399 +56,255 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
body: model.clinicsList == null
|
|
|
|
|
? DrAppEmbeddedError(error: 'Something Wrong!')
|
|
|
|
|
: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).clinic,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
marginLeft: 15,
|
|
|
|
|
marginTop: 15,
|
|
|
|
|
),
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
margin: 10,
|
|
|
|
|
showBorder: true,
|
|
|
|
|
raduis: 30,
|
|
|
|
|
borderColor: Color(0xff707070),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: _selectedClinic,
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return model
|
|
|
|
|
.getClinicNameList()
|
|
|
|
|
.map((item) {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
item,
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.textMultiplier *
|
|
|
|
|
2.1,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
onChanged: (newValue) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedDoctor = null;
|
|
|
|
|
_selectedClinic = newValue;
|
|
|
|
|
var clinicInfo = model
|
|
|
|
|
.clinicsList
|
|
|
|
|
.where((i) =>
|
|
|
|
|
i['ClinicDescription']
|
|
|
|
|
.toString()
|
|
|
|
|
.contains(
|
|
|
|
|
_selectedClinic))
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
clinicId = clinicInfo[0]['ClinicID']
|
|
|
|
|
.toString();
|
|
|
|
|
|
|
|
|
|
model.getDoctorsList(clinicId);
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
items: model
|
|
|
|
|
.getClinicNameList()
|
|
|
|
|
.map((item) {
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
value: item.toString(),
|
|
|
|
|
child: Text(
|
|
|
|
|
item,
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
//--------------------------------------------------------------------//
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).doctor,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
marginLeft: 15,
|
|
|
|
|
marginTop: 15,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
margin: 10,
|
|
|
|
|
showBorder: true,
|
|
|
|
|
raduis: 30,
|
|
|
|
|
borderColor: Color(0xff707070),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: _selectedDoctor,
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return model
|
|
|
|
|
.getDoctorNameList()
|
|
|
|
|
.map((item) {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
item,
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.textMultiplier *
|
|
|
|
|
2.1,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
onChanged: (newValue) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedDoctor = newValue;
|
|
|
|
|
doctorsList =
|
|
|
|
|
model.doctorsList;
|
|
|
|
|
|
|
|
|
|
var doctorInfo = doctorsList
|
|
|
|
|
.where((i) => i['DoctorName']
|
|
|
|
|
.toString()
|
|
|
|
|
.contains(_selectedDoctor))
|
|
|
|
|
.toList();
|
|
|
|
|
doctorId = doctorInfo[0]['DoctorID']
|
|
|
|
|
.toString();
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
items: model
|
|
|
|
|
.getDoctorNameList()
|
|
|
|
|
.map((item) {
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
value: item.toString(),
|
|
|
|
|
child: Text(
|
|
|
|
|
item,
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
), //-----------------------------///
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).ext,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
marginLeft: 15,
|
|
|
|
|
marginTop: 15,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(10.0),
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
|
hintText: TranslationBase.of(context).ext,
|
|
|
|
|
controller: _extController,
|
|
|
|
|
inputFormatter: ONLY_NUMBERS,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
onChanged: (value) => {},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).priority,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
marginLeft: 15,
|
|
|
|
|
marginTop: 15,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
priorityBar(context),
|
|
|
|
|
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).referralFrequency +
|
|
|
|
|
getPriority(),
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
marginLeft: 15,
|
|
|
|
|
marginTop: 15,
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.clinicsList != null &&
|
|
|
|
|
model.clinicsList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.clinicsList,
|
|
|
|
|
attributeName: 'ClinicDescription',
|
|
|
|
|
attributeValueId: 'ClinicID',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedDoctor = null;
|
|
|
|
|
_selectedClinic = selectedValue;
|
|
|
|
|
model.getDoctorsList(
|
|
|
|
|
_selectedClinic['ClinicID']
|
|
|
|
|
.toString());
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).clinicSelect,
|
|
|
|
|
_selectedClinic != null
|
|
|
|
|
? _selectedClinic['ClinicDescription']
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).referralFrequency,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
marginLeft: 15,
|
|
|
|
|
marginTop: 15,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.doctorsList != null &&
|
|
|
|
|
model.doctorsList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.doctorsList,
|
|
|
|
|
attributeName: 'DoctorName',
|
|
|
|
|
attributeValueId: 'DoctorID',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedDoctor = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).doctorSelect,
|
|
|
|
|
_selectedDoctor != null
|
|
|
|
|
? _selectedDoctor['DoctorName']
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
margin: 10,
|
|
|
|
|
showBorder: true,
|
|
|
|
|
raduis: 30,
|
|
|
|
|
borderColor: Color(0xff707070),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
|
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
|
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
value: _selectedReferralFrequancy,
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return model
|
|
|
|
|
.getReferralNamesList()
|
|
|
|
|
.map((item) {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
item,
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.textMultiplier *
|
|
|
|
|
2.1,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
onChanged: (newValue) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedReferralFrequancy = newValue;
|
|
|
|
|
var freqInfo = model
|
|
|
|
|
.referalFrequancyList
|
|
|
|
|
.singleWhere((i) => i[
|
|
|
|
|
'Description']
|
|
|
|
|
.toString()
|
|
|
|
|
.contains(
|
|
|
|
|
_selectedReferralFrequancy));
|
|
|
|
|
freqId = freqInfo['ParameterCode']
|
|
|
|
|
.toString();
|
|
|
|
|
myFocusNode.requestFocus();
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
items: model
|
|
|
|
|
.getReferralNamesList()
|
|
|
|
|
.map((item) {
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
value: item.toString(),
|
|
|
|
|
child: Text(
|
|
|
|
|
item,
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).ext, null, false),
|
|
|
|
|
enabled: true,
|
|
|
|
|
controller: _extController,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
priorityBar(context, screenSize),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
"${TranslationBase.of(context).referralFrequency} ${getPriority()}",
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.referralFrequencyList != null &&
|
|
|
|
|
model.referralFrequencyList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.referralFrequencyList,
|
|
|
|
|
attributeName: 'Description',
|
|
|
|
|
attributeValueId: 'ParameterCode',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedFrequency = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.selectReferralFrequency,
|
|
|
|
|
_selectedFrequency != null
|
|
|
|
|
? _selectedFrequency['Description']
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).clinicDetailsandRemarks,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
marginLeft: 15,
|
|
|
|
|
marginTop: 15,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(10.0),
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
|
hintText: TranslationBase.of(context).remarks,
|
|
|
|
|
focusNode: myFocusNode,
|
|
|
|
|
controller: _remarksController,
|
|
|
|
|
inputFormatter: ONLY_LETTERS,
|
|
|
|
|
textInputType: TextInputType.text,
|
|
|
|
|
onChanged: (value) => {},
|
|
|
|
|
null,
|
|
|
|
|
false),
|
|
|
|
|
enabled: true,
|
|
|
|
|
controller: _remarksController,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_LETTERS))
|
|
|
|
|
],
|
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
|
minLines: 4,
|
|
|
|
|
maxLines: 6,
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).pleaseFill,
|
|
|
|
|
color: HexColor("#B8382B"),
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
margin: 10,
|
|
|
|
|
visibility: isValid == null ? false : !isValid,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(20.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).pleaseFill,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
margin: 10,
|
|
|
|
|
visibility:
|
|
|
|
|
isValid == null ? false : !isValid,
|
|
|
|
|
),
|
|
|
|
|
// TODO replace AppButton with secondary button and add loading
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.send,
|
|
|
|
|
color: Color(PRIMARY_COLOR),
|
|
|
|
|
onPressed: () =>
|
|
|
|
|
{
|
|
|
|
|
referToDoctor(context, model)
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
// TODO replace AppButton with secondary button and add loading
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase.of(context).send,
|
|
|
|
|
color: HexColor("#B8382B"),
|
|
|
|
|
onPressed: () => {referToDoctor(context, model)},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),);
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget priorityBar(BuildContext _context) {
|
|
|
|
|
Widget priorityBar(BuildContext _context, Size screenSize) {
|
|
|
|
|
List<String> _priorities = [
|
|
|
|
|
TranslationBase.of(context).veryUrgent,
|
|
|
|
|
TranslationBase.of(context).urgent,
|
|
|
|
|
TranslationBase.of(context).routine,
|
|
|
|
|
];
|
|
|
|
|
return Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.065,
|
|
|
|
|
width: SizeConfig.screenWidth * 0.9,
|
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)),
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
decoration:
|
|
|
|
|
containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: _priorities.map((item) {
|
|
|
|
|
bool _isActive = _priorities[_activePriority] == item ? true : false;
|
|
|
|
|
return Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
|
|
|
|
InkWell(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: 40,
|
|
|
|
|
width: 90,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(50),
|
|
|
|
|
color: _isActive ? HexColor("#B8382B") : Colors.white,
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
item,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: _isActive
|
|
|
|
|
? Colors.white
|
|
|
|
|
: Colors.black, //Colors.black,
|
|
|
|
|
// backgroundColor:_isActive
|
|
|
|
|
// ? Hexcolor("#B8382B")
|
|
|
|
|
// : Colors.white,//sideColor,
|
|
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
return Expanded(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
decoration: containerBorderDecoration(
|
|
|
|
|
_isActive ? HexColor("#B8382B") : Colors.white,
|
|
|
|
|
_isActive ? HexColor("#B8382B") : Colors.white),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
item,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: _isActive
|
|
|
|
|
? Colors.white
|
|
|
|
|
: Colors.black, //Colors.black,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
print(_priorities.indexOf(item));
|
|
|
|
|
setState(() {
|
|
|
|
|
_activePriority = _priorities.indexOf(item);
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
_isActive
|
|
|
|
|
? Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
height: 3,
|
|
|
|
|
width: 90,
|
|
|
|
|
)
|
|
|
|
|
: Container()
|
|
|
|
|
]);
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
print(_priorities.indexOf(item));
|
|
|
|
|
setState(() {
|
|
|
|
|
_activePriority = _priorities.indexOf(item);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
@ -484,10 +334,7 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final routeArgs = ModalRoute
|
|
|
|
|
.of(context)
|
|
|
|
|
.settings
|
|
|
|
|
.arguments as Map;
|
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
@ -495,17 +342,16 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
extension: _extController.value.text,
|
|
|
|
|
admissionNo: int.parse(patient.admissionNo),
|
|
|
|
|
referringDoctorRemarks: _remarksController.value.text,
|
|
|
|
|
frequency: freqId,
|
|
|
|
|
frequency: _selectedFrequency['ParameterCode'].toString(),
|
|
|
|
|
patientID: patient.patientId,
|
|
|
|
|
patientTypeID: patient.patientType,
|
|
|
|
|
priority: (_activePriority + 1).toString(),
|
|
|
|
|
roomID: patient.roomId,
|
|
|
|
|
selectedClinicID: clinicId.toString(),
|
|
|
|
|
selectedDoctorID: doctorId.toString(),
|
|
|
|
|
selectedClinicID: _selectedClinic['ClinicID'].toString(),
|
|
|
|
|
selectedDoctorID: _selectedDoctor['DoctorID'].toString(),
|
|
|
|
|
projectID: patient.projectId);
|
|
|
|
|
// TODO: Add Translation
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
|
'Reply Successfully');
|
|
|
|
|
DrAppToastMsg.showSuccesToast('Reply Successfully');
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(e);
|
|
|
|
@ -516,10 +362,47 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
setState(() {
|
|
|
|
|
isValid = !_extController.value.text.isNullOrEmpty() &&
|
|
|
|
|
!_remarksController.value.text.isNullOrEmpty() &&
|
|
|
|
|
freqId != null &&
|
|
|
|
|
clinicId != null &&
|
|
|
|
|
doctorId != null;
|
|
|
|
|
_selectedClinic != null &&
|
|
|
|
|
_selectedDoctor != null &&
|
|
|
|
|
_selectedFrequency != null;
|
|
|
|
|
});
|
|
|
|
|
return isValid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InputDecoration textFieldSelectorDecoration(
|
|
|
|
|
String hintText, String selectedText, bool isDropDown) {
|
|
|
|
|
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 ? Icon(Icons.arrow_drop_down) : null,
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: Colors.grey.shade600,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BoxDecoration containerBorderDecoration(
|
|
|
|
|
Color containerColor, Color borderColor) {
|
|
|
|
|
return BoxDecoration(
|
|
|
|
|
color: containerColor,
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6)),
|
|
|
|
|
border: Border.fromBorderSide(BorderSide(
|
|
|
|
|
color: borderColor,
|
|
|
|
|
width: 2.0,
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|