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.
diplomatic-quarter/lib/pages/medical/reports/reports_page.dart

218 lines
9.2 KiB
Dart

import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart';
4 years ago
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';
4 years ago
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
4 years ago
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,
child: ConfirmDialog(
appointmentHistory: model,
onOkSelected: (model) => reportsViewModel.insertRequestForMedicalReport(model, TranslationBase.of(context).successSendReport),
),
);
}
4 years ago
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<ReportsViewModel>(
onModelReady: (model) => model.getPatentAppointmentHistory(),
builder: (_, model, widget) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
4 years ago
appBarTitle: TranslationBase.of(context).medReport,
showNewAppBar: true,
showNewAppBarTitle: true,
backgroundColor: Color(0xffF7F7F7),
body: 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.formatDateToDate(_appointmenHistory.appointmentDate, projectViewModel.isArabic),
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: <Widget>[
LargeAvatar(
name: _appointmenHistory.doctorName,
url: _appointmenHistory.doctorImageURL,
width: 48,
height: 48,
),
SizedBox(width: 11),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
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: <Widget>[
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))
],
),
],
),
),
],
),
],
),
),
),
);
},
),
),
);
}
}
class ConfirmDialog extends StatefulWidget {
final Function(AppointmentHistory) onOkSelected;
final AppointmentHistory appointmentHistory;
ConfirmDialog({this.onOkSelected, this.appointmentHistory});
@override
_ConfirmDialogState createState() => _ConfirmDialogState();
}
class _ConfirmDialogState extends State<ConfirmDialog> {
@override
Widget build(BuildContext context) {
return SimpleDialog(
4 years ago
title: Texts(TranslationBase.of(context).confirm),
children: <Widget>[
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
4 years ago
Texts(TranslationBase.of(context).confirmMsgReport),
SizedBox(
height: 5.0,
),
Divider(
height: 2.5,
color: Colors.grey[500],
),
SizedBox(
height: 5,
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.pop(context),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Center(
child: Texts(
4 years ago
TranslationBase.of(context).cancel,
color: Colors.red,
),
),
),
),
),
),
Container(
width: 1,
height: 30,
color: Colors.grey[500],
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
widget.onOkSelected(widget.appointmentHistory);
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(
4 years ago
TranslationBase.of(context).ok,
fontWeight: FontWeight.w400,
),
),
),
),
),
],
)
],
),
)
],
);
}
}