import 'package:hmg_patient_app/core/viewModels/dashboard_view_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/extensions/string_extensions.dart';
import 'package:hmg_patient_app/models/slider_data.dart';
import 'package:hmg_patient_app/uitl/date_uitl.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/uitl/utils_new.dart';
import 'package:hmg_patient_app/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class LoggedSliderView extends StatelessWidget {
  ProjectViewModel projectViewModel;
  SliderData sliderData;
  DashboardViewModel model;

  LoggedSliderView(this.projectViewModel, this.sliderData, this.model);

  @override
  Widget build(BuildContext context) {
    //'${DateUtil.getMonthDayYearDateFormatted(sliderData.dateofBirthDataTime)} ,${model.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${model.user.age.toString() + "y"}',
    return Container(
      decoration: cardRadius(20),

      margin: EdgeInsets.all(0),
      child: Container(
        decoration: cardRadius(20,color: sliderData.darkColor),
        clipBehavior: Clip.antiAlias,
        margin: EdgeInsets.zero,

        // padding: EdgeInsets.zero,
        child: Stack(
          children: [
            Card(
              child: Container(
                width: double.infinity,
                height: double.infinity,
              ),
              color: Colors.transparent,
              margin: EdgeInsets.zero,
              elevation: 8,
            ),
            Container(
              width: double.infinity,
              height: double.infinity,
              clipBehavior: Clip.antiAlias,
              margin: EdgeInsets.zero,
              decoration: projectViewModel.isArabic
                  ? containerBottomRightRadiusWithGradientForAr(MediaQuery.of(context).size.width / 4, darkColor: sliderData.darkColor, lightColor: sliderData.lightColor)
                  : containerBottomRightRadiusWithGradient(MediaQuery.of(context).size.width / 4, darkColor: sliderData.darkColor, lightColor: sliderData.lightColor),
              child: Card(
                color: Colors.transparent,
                margin: EdgeInsets.zero,
                elevation: 8,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    mFlex(2),
                    Row(
                      children: [
                        Container(
                          decoration: projectViewModel.isArabic ? containerColorRadiusLeft(Color(0xFFFBF2E31), 100) : containerColorRadiusRight(Color(0xFFFBF2E31), 100),
                          padding: EdgeInsets.only(left: 20, right: 16, top: 6, bottom: 6),
                          child: Text(
                            TranslationBase.of(context).medicalFile,
                            style: TextStyle(
                              color: Colors.white,
                              fontWeight: FontWeight.bold,
                              fontSize: 10,
                              letterSpacing: -0.3,
                              height: 1.2,
                            ),
                          ),
                        ),
                        mWidth(MediaQuery.of(context).size.width / 50),
                        //circularAviator(MediaQuery.of(context).size.width / 14, brColor: Colors.white),
                        mFlex(1),
                        projectViewModel.isArabic ? circularAviator(MediaQuery.of(context).size.width / 28, brColor: Colors.white, icon: Icons.done, bcColor: Colors.white) : Container(),
                        Text(
                          TranslationBase.of(context).verified,
                          style: TextStyle(
                            color: Colors.white,
                            fontSize: 10,
                            letterSpacing: -0.3,
                            height: 1,
                          ),
                        ),
                        !projectViewModel.isArabic ? circularAviator(MediaQuery.of(context).size.width / 28, brColor: Colors.white, icon: Icons.done, bcColor: Colors.white) : Container(),
                        mWidth(MediaQuery.of(context).size.width / 70),
                      ],
                    ),
                    mFlex(1),
                    Padding(
                      padding: const EdgeInsets.only(left: 20, right: 20),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            sliderData.pateintName.toLowerCase().capitalizeFirstofEach,
                            style: TextStyle(
                              color: Colors.white,
                              fontWeight: FontWeight.bold,
                              fontSize: 17,
                              letterSpacing: -0.25,
                              height: 25 / 17,
                            ),
                          ),
                          mHeight(2),
                          Text(
                            sliderData.pateintId,
                            style: TextStyle(
                              color: Colors.white,
                              fontSize: 12,
                              letterSpacing: -0.36,
                              height: 1,
                            ),
                          ),
                        ],
                      ),
                    ),
                    mHeight(3),
                    Padding(
                      padding: const EdgeInsets.only(left: 20, right: 20),
                      child: Text(
                        '${DateUtil.getMonthDayYearDateFormatted(projectViewModel.user.dateofBirthDataTime!)} ,${projectViewModel.user!.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${projectViewModel.user!.age.toString() + " " + TranslationBase.of(context).patientAge.toString()}',
                        style: TextStyle(
                          color: Colors.white,
                          fontSize: 12,
                          letterSpacing: -0.33,
                          height: 1,
                        ),
                      ),
                    ),
                    mFlex(3),
                    Padding(
                      padding: const EdgeInsets.only(left: 20, right: 20),
                      child: Row(
                        children: <Widget>[
                          Expanded(
                            flex: 3,
                            child: Row(
                              children: <Widget>[
                                SvgPicture.asset(
                                  'assets/images/new/height.svg',
                                  width: 11,
                                  height: 11,
                                ),
                                mWidth(6),
                                Texts(
                                  "${TranslationBase.of(context).height}: ${model.heightCm} ${TranslationBase.of(context).cm}",
                                  color: Colors.white,
                                  fontSize: 8,
                                )
                              ],
                            ),
                          ),
                          SizedBox(
                            width: 3,
                          ),
                          Expanded(
                            flex: 3,
                            child: Row(
                              children: <Widget>[
                                SvgPicture.asset(
                                  'assets/images/new/weight.svg',
                                  width: 11,
                                  height: 11,
                                ),
                                mWidth(6),
                                Texts(
                                  '${TranslationBase.of(context).weight}: ${model.weightKg} ${TranslationBase.of(context).kg}',
                                  color: Colors.white,
                                  fontSize: 8,
                                )
                              ],
                            ),
                          ),
                          SizedBox(
                            width: 3,
                          ),
                          Expanded(
                            flex: 3,
                            child: Row(
                              children: <Widget>[
                                SvgPicture.asset(
                                  'assets/images/new/blood.svg',
                                  width: 11,
                                  height: 11,
                                ),
                                mWidth(6),
                                Texts(
                                  '${TranslationBase.of(context).bloodType1} ${model.booldType}',
                                  color: Colors.white,
                                  fontSize: 7,
                                )
                              ],
                            ),
                          ),
                          mFlex(1),
                        ],
                      ),
                    ),
                    mFlex(2),
                  ],
                ),
              ),
            ),
            projectViewModel.isArabic
                ? Positioned(
                    child: Icon(
                      Icons.arrow_forward,
                      color: Colors.white,
                      size: 20,
                    ),
                    bottom: 8,
                    left: 8,
                  )
                : Positioned(
                    child: Icon(
                      Icons.arrow_forward_rounded,
                      color: Colors.white,
                      size: 20,
                    ),
                    bottom: 8,
                    right: 8,
                  ),
          ],
        ),
      ),
    );
  }
}
