You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RSGDoctorApp/lib/screens/pharmacy_intervention/widgets/InterventionHistoryBottomSh...

88 lines
3.9 KiB
Dart

import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
import 'package:doctor_app_flutter/screens/pharmacy_intervention/PharmacyIntervention.dart';
import 'package:doctor_app_flutter/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart';
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/intervention_history_item.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
class InterventionHistoryBottomSheet extends StatelessWidget {
final List<InterventionHistory> interventionList;
final ScrollController controller;
final PharmacyInterventionViewModel model;
const InterventionHistoryBottomSheet(
{super.key, required this.interventionList, required this.controller, 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) {
model.updateInterventionDiseaseStatus(
isAccepted: true,
interventionID: interventionList[index].interventionId.toString(),
successMessage: TranslationBase.of(context).interventionRejectedSuccessfully,
errorMessage: TranslationBase.of(context).unableToPerformTheAction
);
Navigator.pop(context);
},
onRejectClick: (intervention) {
model.updateInterventionDiseaseStatus(
interventionID: interventionList[index].interventionId.toString(),
successMessage: TranslationBase.of(context).interventionAcceptedSuccessfully,
errorMessage: TranslationBase.of(context).unableToPerformTheAction
);
Navigator.pop(context);
},
),
),
separatorBuilder: (_, __) => Divider(),
))
],
),
)
],
),
),
);
}
}