import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class MedicalReports extends StatelessWidget { @override Widget build(BuildContext context) { void confirmBox(AppointmentHistory model, ReportsViewModel reportsViewModel) { showDialog( context: context, builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).confirmMsgReport, onTap: () => reportsViewModel.insertRequestForMedicalReport(model, TranslationBase.of(context).successSendReport), ), ).then((value) { Navigator.pop(context); }); return; } ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPatentAppointmentHistory(), builder: (_, model, widget) => AppScaffold( baseViewModel: model, isShowAppBar: true, appBarTitle: TranslationBase.of(context).medReport, showNewAppBar: true, showNewAppBarTitle: true, backgroundColor: Color(0xffF7F7F7), body: model.appointHistoryList.isEmpty ? getNoDataWidget(context) : ListView.separated( physics: BouncingScrollPhysics(), itemCount: model.appointHistoryList.length, padding: EdgeInsets.all(21), separatorBuilder: (context, index) => SizedBox(height: 14), itemBuilder: (context, index) { AppointmentHistory _appointmenHistory = model.appointHistoryList[index]; return InkWell( onTap: () => confirmBox(model.appointHistoryList[index], model), child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(10.0), ), boxShadow: [ BoxShadow( color: Color(0xff000000).withOpacity(.05), //spreadRadius: 5, blurRadius: 27, offset: Offset(0, -3), ), ], color: Colors.white), child: Padding( padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ if ((_appointmenHistory.doctorName ?? _appointmenHistory.doctorNameObj) != null) Text( _appointmenHistory.doctorTitle.toString() + " " + (_appointmenHistory.doctorName ?? _appointmenHistory.doctorNameObj), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), Text( DateUtil.getDayMonthYearDateFormatted(_appointmenHistory.appointmentDate), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ), ], ), if ((_appointmenHistory.doctorName ?? _appointmenHistory.doctorNameObj) != null) SizedBox(height: 6), Row( mainAxisSize: MainAxisSize.min, children: [ LargeAvatar( name: _appointmenHistory.doctorName, url: _appointmenHistory.doctorImageURL, width: 48, height: 48, ), SizedBox(width: 11), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ if (_appointmenHistory.projectName != null) MyRichText(TranslationBase.of(context).clinic + ":", _appointmenHistory.projectName, projectViewModel.isArabic), if (_appointmenHistory.clinicName != null) MyRichText(TranslationBase.of(context).hospital + ":", _appointmenHistory.clinicName, projectViewModel.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, children: [ RatingBar.readOnly( initialRating: _appointmenHistory.actualDoctorRate.toDouble(), size: 16.0, filledColor: Color(0XFFD02127), emptyColor: Color(0XFFD02127), isHalfAllowed: true, halfFilledIcon: Icons.star_half, filledIcon: Icons.star, emptyIcon: Icons.star_border, ), Icon(Icons.email, color: Color(0xff2B353E)) ], ), ], ), ), ], ), ], ), ), ), ); }, ), ), ); } }