import 'package:diplomaticquarterapp/core/enum/patient_lookup.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/vital_sign_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_item.dart';
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_item_details_screen.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';

import '../../../d_q_icons_icons.dart';

class VitalSignDetailsScreen extends StatelessWidget {
  static const String url = "assets/images/";

  int appointmentNo;
  int projectID;
  bool isNotOneAppointment;
  VitalSignDetailsScreen({this.appointmentNo, this.projectID,this.isNotOneAppointment=true});
  List<ImagesInfo> imagesInfo = List();


  @override
  Widget build(BuildContext context) {
    imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/0.png'));
    imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/1.png'));
    return BaseView<VitalSignViewModel>(
      onModelReady: appointmentNo != null && projectID != null
          ? (model) => model.getPatientVitalSign(
              appointmentNo: appointmentNo, projectID: projectID)
          : (model) => model.getPatientVitalSign(),
      builder: (_, mode, widget) => AppScaffold(
        isShowAppBar: true,
        appBarTitle: TranslationBase.of(context).vitalSigns,
        baseViewModel: mode,
        description: TranslationBase.of(context).infoSigns,
        imagesInfo: imagesInfo,
        body: mode.vitalSignResModelList.length > 0
            ? Container(
                child: ListView(
                  children: <Widget>[
                    Row(
                      children: <Widget>[
                        InkWell(
                          onTap: () =>isNotOneAppointment? Navigator.push(
                            context,
                            FadePage(
                              page: VitalSignItemDetailsScreen(
                                pageKey: VitalSignDetails.Height,
                                pageTitle: TranslationBase.of(context).height,
                                vitalList: mode.vitalSignResModelList,
                              ),
                            ),
                          ):null,
                          child: Container(
                            child: VitalSignItem(
                              des: TranslationBase.of(context).height,
                              icon: DQIcons.height,
                              lastVal: mode.heightCm,
                              unit: TranslationBase.of(context).cm,
                            ),
                          ),
                        ),
                        InkWell(
                          onTap: () => isNotOneAppointment ? Navigator.push(
                            context,
                            FadePage(
                              page: VitalSignItemDetailsScreen(
                                pageKey: VitalSignDetails.Weight,
                                pageTitle: TranslationBase.of(context).weight,
                                vitalList: mode.vitalSignResModelList,
                              ),
                            ),
                          ):null,
                          child: VitalSignItem(
                            des: TranslationBase.of(context).weight,
                            icon: DQIcons.weight_scale,
                            unit: TranslationBase.of(context).kg,
                            lastVal: mode.weightKg,
                          ),
                        ),
                      ],
                    ),
                    Row(
                      children: <Widget>[
                        InkWell(
                          onTap: () => isNotOneAppointment ?  Navigator.push(
                            context,
                            FadePage(
                              page: VitalSignItemDetailsScreen(
                                pageKey: VitalSignDetails.BodyMeasurements,
                                pageTitle: TranslationBase.of(context)
                                    .bodyMeasurements,
                                vitalList: mode.vitalSignResModelList,
                              ),
                            ),
                          ): null,
                          child: VitalSignItem(
                            des: TranslationBase.of(context).body,
                            icon: DQIcons.bmi,
                            lastVal: mode.bodyMax,
                            unit: TranslationBase.of(context).mass,
                          ),
                        ),
                        InkWell(
                          onTap: () => isNotOneAppointment ?  Navigator.push(
                            context,
                            FadePage(
                              page: VitalSignItemDetailsScreen(
                                pageKey: VitalSignDetails.Temperature,
                                pageTitle:
                                    TranslationBase.of(context).temperature,
                                vitalList: mode.vitalSignResModelList,
                              ),
                            ),
                          ):null,
                          child: Container(
                            child: VitalSignItem(
                              des: TranslationBase.of(context).temperature,
                              icon: DQIcons.thermometer,
                              lastVal: mode.temperatureCelcius,
                              unit: TranslationBase.of(context).tempC,
                            ),
                          ),
                        ),
                      ],
                    ),
                    Row(
                      children: <Widget>[
                        InkWell(
                          onTap: () => isNotOneAppointment ? Navigator.push(
                            context,
                            FadePage(
                              page: VitalSignItemDetailsScreen(
                                pageKey: VitalSignDetails.heart,
                                pageTitle: TranslationBase.of(context).heart,
                                vitalList: mode.vitalSignResModelList,
                              ),
                            ),
                          ):null,
                          child: VitalSignItem(
                            des: TranslationBase.of(context).heart,
                            icon: DQIcons.heart,
                            lastVal: mode.hartRat,
                            unit: TranslationBase.of(context).bpm,
                          ),
                        ),
                        InkWell(
                          onTap: () => isNotOneAppointment ?  Navigator.push(
                            context,
                            FadePage(
                              page: VitalSignItemDetailsScreen(
                                pageKey: VitalSignDetails.Respiration,
                                pageTitle:
                                    TranslationBase.of(context).respirationRate,
                                vitalList: mode.vitalSignResModelList,
                              ),
                            ),
                          ):null,
                          child: VitalSignItem(
                            des: TranslationBase.of(context).respirationRate,
                            icon: DQIcons.outline,
                            lastVal: mode.respirationBeatPerMinute,
                            unit: TranslationBase.of(context).bpm,
                          ),
                        ),
                      ],
                    ),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        InkWell(
                          onTap: () => isNotOneAppointment ? Navigator.push(
                            context,
                            FadePage(
                              page: VitalSignItemDetailsScreen(
                                pageKey: VitalSignDetails.BloodPressure,
                                pageTitle: TranslationBase.of(context).bloodPressure,
                                vitalList: mode.vitalSignResModelList,
                              ),
                            ),
                          ):null,
                          child: VitalSignItem(
                            des: TranslationBase.of(context).bloodPressure,
                            icon: DQIcons.blood_pressure,
                            lastVal: mode.bloodPressure,
                            unit: TranslationBase.of(context).sysDias,
                          ),
                        ),
                      ],
                    ),
                  ],
                ),
              )
            : Center(
                child: Texts('No Data'),
              ),
      ),
    );
  }
}
