import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.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/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ContactLensPage extends StatelessWidget {
  final ListHISGetContactLensPerscription listHISGetContactLensPerscription;

  const ContactLensPage({Key key, this.listHISGetContactLensPerscription})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return 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,
              ),
              Container(
                width: double.infinity,
                child: SecondaryButton(
                  label: TranslationBase.of(context).sendEmail,
                  textColor: Colors.white,
                  color: Colors.red[700],
                  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()
          ],
        ),
      );
}
