import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class PrescriptionsPage extends StatelessWidget { final PrescriptionsViewModel prescriptionsViewModel; const PrescriptionsPage({Key key, this.prescriptionsViewModel}) : super(key: key); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( baseViewModel: prescriptionsViewModel, body: FractionallySizedBox( widthFactor: 1.0, child: ListView( physics: BouncingScrollPhysics(), children: [ Row( children: [ MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, prescriptionsViewModel.filterType, () { prescriptionsViewModel.setFilterType(FilterType.Clinic); }), MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, prescriptionsViewModel.filterType, () { prescriptionsViewModel.setFilterType(FilterType.Hospital); }), ], ), // ...List.generate( // prescriptionsViewModel.prescriptionsOrderList.length, // (index) => AppExpandableNotifier( // title: prescriptionsViewModel // .prescriptionsOrderList[index].filterName, // bodyWidget: Column( // crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: prescriptionsViewModel // .prescriptionsOrderList[index].prescriptionsList // .map((prescriptions) { // return InkWell( // onTap: () => Navigator.push( // context, // FadePage( // page: PrescriptionItemsPage(prescriptions: prescriptions,), // ), // ), // child: DoctorCard( // name: prescriptions.doctorName, // profileUrl: prescriptions.doctorImageURL, // rat: prescriptions.actualDoctorRate.toDouble(), // subName: prescriptions.name, // isInOutPatient: prescriptions.isInOutPatient, // isLiveCareAppointment: prescriptions.isLiveCareAppointment, // date:DateUtil.convertStringToDate(prescriptions.appointmentDate)//projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), // ), // ); // }).toList(), // )), // ), ListView.separated( physics: NeverScrollableScrollPhysics(), shrinkWrap: true, // padding: EdgeInsets.only(left: 21, right: 21), separatorBuilder: (context, index) { return Container( height: 1, margin: EdgeInsets.only(left: 21, right: 21), color: Color(0xffD9D9D9), ); }, itemBuilder: (context, index) { List prescriptionsList = prescriptionsViewModel.prescriptionsOrderList[index].prescriptionsList; return AppExpandableNotifier( title: prescriptionsViewModel.prescriptionsOrderList[index].filterName, bodyWidget: ListView.separated( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), itemBuilder: (context, _index) { Prescriptions prescriptions = prescriptionsList[_index]; return DoctorCard( onTap: () => Navigator.push( context, FadePage( page: PrescriptionItemsPage( prescriptions: prescriptions, ), ), ), name: prescriptions.doctorName, profileUrl: prescriptions.doctorImageURL, rat: prescriptions.actualDoctorRate.toDouble(), subName: prescriptions.name, isInOutPatient: prescriptions.isInOutPatient, isLiveCareAppointment: prescriptions.isLiveCareAppointment, date: DateUtil.convertStringToDate(prescriptions .appointmentDate) //projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), ); }, separatorBuilder: (context, index) => SizedBox(height: 14), itemCount: prescriptionsList.length), ); }, itemCount: prescriptionsViewModel.prescriptionsOrderList.length, ) ], ), ), ); } }