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/eye/ContactLensPage.dart

179 lines
7.7 KiB
Dart

import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/EyeViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.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';
class ContactLensPage extends StatelessWidget {
final ListHISGetContactLensPerscription listHISGetContactLensPerscription;
final int appointmentNo;
final String projectName;
final int projectID;
const ContactLensPage({Key key, this.listHISGetContactLensPerscription, this.appointmentNo, this.projectName, this.projectID}) : super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<EyeViewModel>(
builder: (_, model, w) => AppScaffold(
body: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 20),
child: Column(
children: [
Container(
decoration: cardRadius(12),
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
TranslationBase.of(context).rightEye,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.64,
),
),
),
getRow(TranslationBase.of(context).brand, '${listHISGetContactLensPerscription.brand}'),
getRow('B.C', '${listHISGetContactLensPerscription.baseCurve}'),
getRow(TranslationBase.of(context).power, '${listHISGetContactLensPerscription.power}'),
getRow(TranslationBase.of(context).diameter, '${listHISGetContactLensPerscription.diameter}'),
getRow('OZ', '${listHISGetContactLensPerscription.oZ}'),
getRow('CT', '${listHISGetContactLensPerscription.cT}'),
getRow('Blend', '${listHISGetContactLensPerscription.blend}'),
getRow(TranslationBase.of(context).reminder, '${listHISGetContactLensPerscription.remarks}', isLast: true),
],
),
),
),
SizedBox(
height: 12,
),
Container(
decoration: cardRadius(12),
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
TranslationBase.of(context).leftEye,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.64,
),
),
),
getRow(TranslationBase.of(context).brand, '${listHISGetContactLensPerscription.brand}'),
getRow('B.C', '${listHISGetContactLensPerscription.baseCurve}'),
getRow(TranslationBase.of(context).power, '${listHISGetContactLensPerscription.power}'),
getRow(TranslationBase.of(context).diameter, '${listHISGetContactLensPerscription.diameter}'),
getRow('OZ', '${listHISGetContactLensPerscription.oZ}'),
getRow('CT', '${listHISGetContactLensPerscription.cT}'),
getRow('Blend', '${listHISGetContactLensPerscription.blend}'),
getRow(TranslationBase.of(context).reminder, '${listHISGetContactLensPerscription.remarks}', isLast: true),
],
),
),
),
SizedBox(
height: 17,
),
// if (projectViewModel.havePrivilege(15))
// Container(
// width: double.infinity,
// child: SecondaryButton(
// label: TranslationBase.of(context).sendEmail,
// textColor: Colors.white,
// color: Colors.red[700],
// onTap: (){
// showConfirmMessage(context, () async {
// GifLoaderDialogUtils.showMyDialog(context);
// await model.sendContactLensPrescriptionEmail(
// appointmentNo: appointmentNo,
// projectName: projectName,
// projectID: projectID);
// GifLoaderDialogUtils.hideDialog(context);
// }, model.user.emailAddress);
// },
// icon: Icon(
// Icons.email,
// color: Colors.white,
// ),
// ),
// )
],
),
),
),
),
);
}
Widget getRow(String title, String val1, {bool isLast = false}) => Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
flex: 4,
child: Text(
title,
style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.4),
)),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
val1 == 'null' ? '-' : val1,
style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.4),
),
],
),
)
],
),
),
isLast
? Container(
height: 4,
)
: Divider()
],
),
);
void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();
},
),
);
}
}