import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/discharge_summary/GetDischargeSummaryResModel.dart';
import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';

class DischargeSummaryWidget extends StatefulWidget {
  final GetDischargeSummaryResModel dischargeSummary;
  bool isShowMore = false;

  DischargeSummaryWidget({Key key, this.dischargeSummary});

  @override
  _DischargeSummaryWidgetState createState() => _DischargeSummaryWidgetState();
}

class _DischargeSummaryWidgetState extends State<DischargeSummaryWidget> {
  @override
  Widget build(BuildContext context) {
    ProjectViewModel projectViewModel = Provider.of(context);

    return Container(
      child: CardWithBgWidget(
        bgColor:Colors.transparent,
        hasBorder: false,
        widget: Container(
            child: InkWell(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.end,
                    children: [
                      AppText(
                        AppDateUtils.getDateTimeFromServerFormat(
                                    widget.dischargeSummary.createdOn)
                                .day
                                .toString() +
                            " " +
                            AppDateUtils.getMonth(
                                    AppDateUtils.getDateTimeFromServerFormat(
                                            widget.dischargeSummary.createdOn)
                                        .month)
                                .toString()
                                .substring(0, 3) +
                            ' ' +
                            AppDateUtils.getDateTimeFromServerFormat(
                                    widget.dischargeSummary.createdOn)
                                .year
                                .toString(),
                        fontFamily: 'Poppins',
                        fontWeight: FontWeight.w600,
                      ),
                      AppText(
                        AppDateUtils.getDateTimeFromServerFormat(
                                    widget.dischargeSummary.createdOn)
                                .hour
                                .toString() +
                            ":" +
                            AppDateUtils.getDateTimeFromServerFormat(
                                    widget.dischargeSummary.createdOn)
                                .minute
                                .toString(),
                        fontFamily: 'Poppins',
                        fontWeight: FontWeight.w600,
                      )
                    ],
                  ),
                ],
              ),
              SizedBox(
                height: 20,
              ),

              Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  SizedBox(
                    width: 20,
                  ),
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      // SizedBox(height: 10,),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              CustomRow(
                                label: TranslationBase.of(context).fileNumber,
                                value: widget.dischargeSummary.patientID.toString(),
                                  isCopyable:false,
                              ),
                              SizedBox(
                                height: 8,
                              ),
                            ],
                          ),
                        ],
                      ),

                      Container(
                        width: MediaQuery.of(context).size.width * 0.5,
                        child: RichText(
                          maxLines: 3,
                          overflow: TextOverflow.ellipsis,
                          text: new TextSpan(
                            style: new TextStyle(
                                fontSize: 1.3 * SizeConfig.textMultiplier,
                                color: Color(0xFF575757)),
                            children: <TextSpan>[
                              new TextSpan(
                                  text:
                                      TranslationBase.of(context).requestType +
                                          ": ",
                                  style: TextStyle(
                                    fontSize: SizeConfig
                                            .getTextMultiplierBasedOnWidth() *
                                        2.8,
                                    color: Color(0xFF575757),
                                    //TranslationBase.of(context).doctorResponse + " : ",
                                  )),
                              new TextSpan(
                                  text:
                                      "${widget.dischargeSummary.dischargeInstructions}",
                                  style: TextStyle(
                                    fontFamily: 'Poppins',
                                    fontSize: SizeConfig
                                            .getTextMultiplierBasedOnWidth() *
                                        3,
                                    color: Color(0xFF2E303A),
                                    fontWeight: FontWeight.w700,
                                  )),
                            ],
                          ),
                        ),
                      ),
                    ],
                  )
                ],
              ),
              // Container(
              //   alignment: projectViewModel.isArabic?Alignment.centerLeft:Alignment.centerRight,
              //   child: Icon(FontAwesomeIcons.arrowRight,
              //       size: 20, color: Colors.black),)
            ],
          ),
          // onTap: onTap,
        )),
      ),
    );
  }
}
