|
|
|
@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../core/viewModel/profile/pharmacy_intervention_view_model.dart';
|
|
|
|
|
import '../../../../models/patient/patiant_info_model.dart';
|
|
|
|
|
import '../../../base/base_view.dart';
|
|
|
|
@ -15,15 +16,18 @@ import 'intervention_medication.dart';
|
|
|
|
|
class PharmacyInterventionScreen extends StatefulWidget {
|
|
|
|
|
final OutPatientFilterType outPatientFilterType;
|
|
|
|
|
|
|
|
|
|
const PharmacyInterventionScreen(
|
|
|
|
|
{Key key, this.outPatientFilterType, })
|
|
|
|
|
: super(key: key);
|
|
|
|
|
const PharmacyInterventionScreen({
|
|
|
|
|
Key key,
|
|
|
|
|
this.outPatientFilterType,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_PharmacyInterventionScreenState createState() => _PharmacyInterventionScreenState();
|
|
|
|
|
_PharmacyInterventionScreenState createState() =>
|
|
|
|
|
_PharmacyInterventionScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _PharmacyInterventionScreenState extends State<PharmacyInterventionScreen> {
|
|
|
|
|
class _PharmacyInterventionScreenState
|
|
|
|
|
extends State<PharmacyInterventionScreen> {
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
// TODO: implement initState
|
|
|
|
@ -35,145 +39,161 @@ class _PharmacyInterventionScreenState extends State<PharmacyInterventionScreen>
|
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
|
|
|
return BaseView<PharmacyInterventionViewModel>(
|
|
|
|
|
builder: (_, model, w) =>AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 1.0,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(0.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
BottomSheetTitle(
|
|
|
|
|
title: (OutPatientFilterType.Previous ==
|
|
|
|
|
widget.outPatientFilterType)
|
|
|
|
|
? ""
|
|
|
|
|
: " New Medication",
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10.0,
|
|
|
|
|
),
|
|
|
|
|
Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () => selectDate(context,model,
|
|
|
|
|
firstDate:
|
|
|
|
|
getFirstDate(widget.outPatientFilterType),
|
|
|
|
|
lastDate:
|
|
|
|
|
getLastDate(widget.outPatientFilterType)),
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).fromDate,
|
|
|
|
|
model
|
|
|
|
|
.selectedFromDate !=
|
|
|
|
|
null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)),
|
|
|
|
|
enabled: false,
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 1.0,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(0.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
BottomSheetTitle(
|
|
|
|
|
title: (OutPatientFilterType.Previous ==
|
|
|
|
|
widget.outPatientFilterType)
|
|
|
|
|
? ""
|
|
|
|
|
: " Pharmacy Intervention",
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10.0,
|
|
|
|
|
),
|
|
|
|
|
Center(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () => selectDate(
|
|
|
|
|
context,
|
|
|
|
|
model,
|
|
|
|
|
firstDate: DateTime(
|
|
|
|
|
DateTime.now().year - 20,
|
|
|
|
|
DateTime.now().month,
|
|
|
|
|
DateTime.now().day),
|
|
|
|
|
lastDate: DateTime(
|
|
|
|
|
DateTime.now().year,
|
|
|
|
|
DateTime.now().month,
|
|
|
|
|
DateTime.now().day + 100),
|
|
|
|
|
selectedDate: DateTime(
|
|
|
|
|
DateTime.now().year,
|
|
|
|
|
DateTime.now().month,
|
|
|
|
|
DateTime.now().day),
|
|
|
|
|
),
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).fromDate,
|
|
|
|
|
model.selectedFromDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () => selectDate(context,model,
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () => selectDate(
|
|
|
|
|
context,
|
|
|
|
|
model,
|
|
|
|
|
isFromDate: false,
|
|
|
|
|
firstDate:
|
|
|
|
|
getFirstDate(widget.outPatientFilterType),
|
|
|
|
|
lastDate:
|
|
|
|
|
getLastDate(widget.outPatientFilterType)),
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).toDate,
|
|
|
|
|
model
|
|
|
|
|
.selectedToDate !=
|
|
|
|
|
null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)),
|
|
|
|
|
enabled: false,
|
|
|
|
|
firstDate: DateTime(
|
|
|
|
|
DateTime.now().year - 20,
|
|
|
|
|
DateTime.now().month,
|
|
|
|
|
DateTime.now().day),
|
|
|
|
|
lastDate: DateTime(
|
|
|
|
|
DateTime.now().year,
|
|
|
|
|
DateTime.now().month,
|
|
|
|
|
DateTime.now().day + 100),
|
|
|
|
|
selectedDate: DateTime(
|
|
|
|
|
DateTime.now().year,
|
|
|
|
|
DateTime.now().month,
|
|
|
|
|
DateTime.now().day),
|
|
|
|
|
),
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).toDate,
|
|
|
|
|
model.selectedToDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(color: HexColor('#707070'), width: 0),
|
|
|
|
|
),
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.1,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: .80,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).search,
|
|
|
|
|
padding: 5,
|
|
|
|
|
color: Color(0xFF359846),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) => InterventionMedicationScreen(patient)),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
border: Border.all(color: HexColor('#707070'), width: 0),
|
|
|
|
|
),
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.1,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: .80,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).search,
|
|
|
|
|
padding: 5,
|
|
|
|
|
color: Color(0xFF359846),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
InterventionMedicationScreen(patient)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
);
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectDate(BuildContext context,PharmacyInterventionViewModel model,
|
|
|
|
|
{bool isFromDate = true, DateTime firstDate, lastDate}) async {
|
|
|
|
|
selectDate(BuildContext context, PharmacyInterventionViewModel model,
|
|
|
|
|
{bool isFromDate = true,
|
|
|
|
|
DateTime firstDate,
|
|
|
|
|
lastDate,
|
|
|
|
|
selectedDate}) async {
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
DateTime selectedDate = isFromDate
|
|
|
|
|
? model.selectedFromDate ?? firstDate
|
|
|
|
|
: model.selectedToDate ?? lastDate;
|
|
|
|
|
final DateTime picked = await showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate: selectedDate,
|
|
|
|
@ -199,25 +219,25 @@ class _PharmacyInterventionScreenState extends State<PharmacyInterventionScreen>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getFirstDate(OutPatientFilterType outPatientFilterType) {
|
|
|
|
|
if (outPatientFilterType == OutPatientFilterType.Previous) {
|
|
|
|
|
return DateTime(
|
|
|
|
|
DateTime.now().year - 20, DateTime.now().month, DateTime.now().day);
|
|
|
|
|
} else {
|
|
|
|
|
return DateTime(
|
|
|
|
|
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// getFirstDate(OutPatientFilterType outPatientFilterType) {
|
|
|
|
|
// if (outPatientFilterType == OutPatientFilterType.Previous) {
|
|
|
|
|
// return DateTime(F
|
|
|
|
|
// DateTime.now().year - 20, DateTime.now().month, DateTime.now().day);
|
|
|
|
|
// } else {
|
|
|
|
|
// return DateTime(
|
|
|
|
|
// DateTime.now().year, DateTime.now().month, DateTime.now().day + 1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
getLastDate(OutPatientFilterType outPatientFilterType) {
|
|
|
|
|
if (outPatientFilterType == OutPatientFilterType.Previous) {
|
|
|
|
|
return DateTime(
|
|
|
|
|
DateTime.now().year, DateTime.now().month, DateTime.now().day - 1);
|
|
|
|
|
} else {
|
|
|
|
|
return DateTime(
|
|
|
|
|
DateTime.now().year, DateTime.now().month, DateTime.now().day + 7);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// getLastDate(OutPatientFilterType outPatientFilterType) {
|
|
|
|
|
// if (outPatientFilterType == OutPatientFilterType.Previous) {
|
|
|
|
|
// return DateTime(
|
|
|
|
|
// DateTime.now().year, DateTime.now().month, DateTime.now().day - 1);
|
|
|
|
|
// } else {
|
|
|
|
|
// return DateTime(
|
|
|
|
|
// DateTime.now().year , DateTime.now().month , DateTime.now().day + 100);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
InputDecoration textFieldSelectorDecoration(
|
|
|
|
|
String hintText, String selectedText, bool isDropDown,
|
|
|
|
@ -238,11 +258,11 @@ class _PharmacyInterventionScreenState extends State<PharmacyInterventionScreen>
|
|
|
|
|
hintText: selectedText != null ? selectedText : hintText,
|
|
|
|
|
suffixIcon: isDropDown
|
|
|
|
|
? suffixIcon != null
|
|
|
|
|
? suffixIcon
|
|
|
|
|
: Icon(
|
|
|
|
|
Icons.keyboard_arrow_down_sharp,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
)
|
|
|
|
|
? suffixIcon
|
|
|
|
|
: Icon(
|
|
|
|
|
Icons.keyboard_arrow_down_sharp,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|