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.
171 lines
6.6 KiB
Dart
171 lines
6.6 KiB
Dart
import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/medical/EyeViewModel.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';
|
|
|
|
class ClassesPage extends StatelessWidget {
|
|
final ListHISGetGlassPerscription glassPerscription;
|
|
final int appointmentNo;
|
|
final String projectName;
|
|
final int projectID;
|
|
|
|
const ClassesPage(
|
|
{Key key,
|
|
this.glassPerscription,
|
|
this.appointmentNo,
|
|
this.projectName,
|
|
this.projectID})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<EyeViewModel>(
|
|
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).sphere,
|
|
'${glassPerscription.rightEyeSpherical}', '-'),
|
|
getRow(TranslationBase.of(context).cylinder,
|
|
'${glassPerscription.rightEyeCylinder}', '-'),
|
|
getRow(TranslationBase.of(context).axis,
|
|
'${glassPerscription.rightEyeAxis}', '-'),
|
|
getRow(TranslationBase.of(context).prism,
|
|
'${glassPerscription.rightEyePrism}', '-'),
|
|
getRow(TranslationBase.of(context).va,
|
|
'${glassPerscription.rightEyeVA}', '-'),
|
|
],
|
|
),
|
|
),
|
|
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).sphere,
|
|
'${glassPerscription.leftEyeSpherical}', '-'),
|
|
getRow(TranslationBase.of(context).cylinder,
|
|
'${glassPerscription.leftEyeCylinder}', '-'),
|
|
getRow(TranslationBase.of(context).axis,
|
|
'${glassPerscription.leftEyeAxis}', '-'),
|
|
getRow(TranslationBase.of(context).prism,
|
|
'${glassPerscription.leftEyePrism}', '-'),
|
|
getRow(TranslationBase.of(context).va,
|
|
'${glassPerscription.leftEyeVA}', '-'),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 17,
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
child: SecondaryButton(
|
|
label: TranslationBase.of(context).sendEmail,
|
|
onTap: () {
|
|
showConfirmMessage(context, () async {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
await model.sendGlassesPrescriptionEmail(
|
|
appointmentNo: appointmentNo,
|
|
projectName: projectName,
|
|
projectID: projectID);
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
}, model.user.emailAddress);
|
|
},
|
|
textColor: Colors.white,
|
|
color: Colors.red[700],
|
|
icon: Icon(
|
|
Icons.email,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void showConfirmMessage(
|
|
BuildContext context, GestureTapCallback onTap, String email) {
|
|
showDialog(
|
|
context: context,
|
|
child: ConfirmSendEmailDialog(
|
|
email: email,
|
|
onTapSendEmail: () {
|
|
onTap();
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget getRow(String title, String val1, String val2) => Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Expanded(flex: 4, child: Texts(title)),
|
|
Expanded(
|
|
flex: 2,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Texts(val1 == 'null' ? '-' : val1),
|
|
Texts(val2 != 'null' ? '-' : val2),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
Divider()
|
|
],
|
|
),
|
|
);
|
|
}
|