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/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.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( builder: (_,model,w)=> AppScaffold( body: SingleChildScrollView( child: Container( margin: EdgeInsets.only(top: 70, left: 15, right: 15, bottom: 15), child: Column( children: [ Container( decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.all(Radius.circular(8)), color: Colors.white), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.all(8.0), child: Texts( TranslationBase.of(context).rightEye, fontSize: 23, bold: true, ), ), 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}'), ], ), ), SizedBox( height: 17, ), Container( decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.all(Radius.circular(8)), color: Colors.white), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.all(8.0), child: Texts( TranslationBase.of(context).leftEye, fontSize: 23, bold: true, ), ), 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}'), ], ), ), 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) => Padding( padding: const EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded(flex: 4, child: Texts(title)), Expanded( flex: 2, child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(val1 == 'null' ? '-' : val1), ], ), ) ], ), Divider() ], ), ); void showConfirmMessage( BuildContext context, GestureTapCallback onTap, String email) { showDialog( context: context, child: ConfirmSendEmailDialog( email: email, onTapSendEmail: () { onTap(); }, ), ); } }