|
|
|
|
@ -8,79 +8,74 @@ import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
class InterventionHistoryBottomSheet extends StatelessWidget {
|
|
|
|
|
final List<InterventionHistory> interventionList;
|
|
|
|
|
final ScrollController controller;
|
|
|
|
|
|
|
|
|
|
// final ScrollController controller;
|
|
|
|
|
final PharmacyInterventionViewModel model;
|
|
|
|
|
|
|
|
|
|
const InterventionHistoryBottomSheet(
|
|
|
|
|
{super.key, required this.interventionList, required this.controller, required this.model});
|
|
|
|
|
const InterventionHistoryBottomSheet({super.key, required this.interventionList, required this.model});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Material(
|
|
|
|
|
color: Color(0xFFF7F7F7),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
|
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 32),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.histories,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
color: Color(0xFF2B353E),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 16,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
controller: controller,
|
|
|
|
|
itemCount: interventionList.length,
|
|
|
|
|
itemBuilder: (context, index) =>
|
|
|
|
|
Material(
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10)),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InterventionHistoryItem(
|
|
|
|
|
interventionHistory: interventionList[index],
|
|
|
|
|
onAcceptClick: (intervention, remarks) {
|
|
|
|
|
model.updateInterventionDiseaseStatus(
|
|
|
|
|
remarks: remarks,
|
|
|
|
|
isAccepted: true,
|
|
|
|
|
interventionID: interventionList[index].interventionId.toString(),
|
|
|
|
|
successMessage: TranslationBase.of(context).interventionAcceptedSuccessfully,
|
|
|
|
|
errorMessage: TranslationBase.of(context).unableToPerformTheAction);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
onRejectClick: (intervention, remarks) {
|
|
|
|
|
model.updateInterventionDiseaseStatus(
|
|
|
|
|
remarks: remarks,
|
|
|
|
|
interventionID: interventionList[index].interventionId.toString(),
|
|
|
|
|
successMessage: TranslationBase.of(context).interventionRejectedSuccessfully,
|
|
|
|
|
errorMessage: TranslationBase.of(context).unableToPerformTheAction
|
|
|
|
|
);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
return SizedBox(
|
|
|
|
|
height: MediaQuery.sizeOf(context).height * (interventionList.length == 1 ? 0.5 : 0.7),
|
|
|
|
|
child: Material(
|
|
|
|
|
color: Color(0xFFF7F7F7),
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 32),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).histories,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
color: Color(0xFF2B353E),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 16,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: interventionList.length,
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) => Material(
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InterventionHistoryItem(
|
|
|
|
|
remarksController: interventionList[index].remarksController,
|
|
|
|
|
interventionHistory: interventionList[index],
|
|
|
|
|
onAcceptClick: (intervention, remarks) {
|
|
|
|
|
model.updateInterventionDiseaseStatus(
|
|
|
|
|
remarks: remarks,
|
|
|
|
|
isAccepted: true,
|
|
|
|
|
interventionID: interventionList[index].interventionId.toString(),
|
|
|
|
|
successMessage: TranslationBase.of(context).interventionAcceptedSuccessfully,
|
|
|
|
|
errorMessage: TranslationBase.of(context).unableToPerformTheAction);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
onRejectClick: (intervention, remarks) {
|
|
|
|
|
model.updateInterventionDiseaseStatus(
|
|
|
|
|
remarks: remarks,
|
|
|
|
|
interventionID: interventionList[index].interventionId.toString(),
|
|
|
|
|
successMessage: TranslationBase.of(context).interventionRejectedSuccessfully,
|
|
|
|
|
errorMessage: TranslationBase.of(context).unableToPerformTheAction);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
separatorBuilder: (_, __) => Divider(),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
separatorBuilder: (_, __) => Divider(),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|