import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';

class DoctorInformation extends StatelessWidget {

  DoctorProfileList docProfileList;

  DoctorInformation({@required this.docProfileList});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
      child: Column(
        children: <Widget>[
          Card(
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(10),
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.max,
              children: <Widget>[
                Container(
                  margin: EdgeInsets.all(15.0),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Image.asset(
                          "assets/images/new-design/doctor_information_icon.png"),
                      Container(
                        margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0),
                        child: Text(TranslationBase.of(context).docInfo,
                            style:
                                TextStyle(fontSize: 16.0, letterSpacing: 0.8)),
                      ),
                    ],
                  ),
                ),
                Container(
                  padding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 10.0),
                  child: Table(
                    children: [
                      TableRow(children: [
                        TableCell(child: _getHeadingText(TranslationBase.of(context).gender)),
                        TableCell(child: _getHeadingText(TranslationBase.of(context).nationality)),
                      ]),
                      TableRow(children: [
                        TableCell(child: _getNormalText(docProfileList.genderDescription)),
                        TableCell(child: _getNormalTextWithIcon(docProfileList.nationalityName, docProfileList.nationalityFlagURL)),
                      ]),
                    ],
                  ),
                ),
                Divider(
                  color: Colors.grey[400],
                ),
                Container(
                  margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 10.0),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      _getHeadingText(TranslationBase.of(context).clinic),
                      _getNormalText(docProfileList.clinicDescription)
                    ],
                  ),
                )
              ],
            ),
          ),
          Card(
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(10),
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.max,
              children: <Widget>[
                Container(
                  margin: EdgeInsets.all(15.0),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Image.asset(
                          "assets/images/new-design/doctor_qualification_icon.png"),
                      Container(
                        margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0),
                        child: Text(TranslationBase.of(context).docQualifications,
                            style:
                            TextStyle(fontSize: 16.0, letterSpacing: 0.8)),
                      ),
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.fromLTRB(20.0, 0.0, 10.0, 5.0),
                  child: Column(
                    children: <Widget>[
                      _getNormalText(docProfileList.doctorProfileInfo)
                    ],
                  ),
                )
              ],
            ),
          ),
        ],
      ),
    );
  }

  _getHeadingText(text) {
    return Text(text,
        style: TextStyle(
            fontSize: 13,
            fontFamily: 'Open-Sans',
            fontWeight: FontWeight.bold,
            letterSpacing: 0.5,
            color: Colors.grey[800]));
  }

  _getNormalText(text) {
    return Container(
      margin: EdgeInsets.only(top: 5.0),
      child: Text(text,
          style: TextStyle(
              fontSize: 13,
              fontFamily: 'Open-Sans',
              letterSpacing: 0.5,
              color: Colors.grey[700])),
    );
  }

  _getNormalTextWithIcon(String text, icon) {
    return Container(
      margin: EdgeInsets.only(top: 5.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        mainAxisSize: MainAxisSize.max,
        children: <Widget>[
          Text(text.trim(),
              style: TextStyle(
                  fontSize: 13,
                  fontFamily: 'Open-Sans',
                  letterSpacing: 0.5,
                  color: Colors.grey[700])),
          Container(
            margin: EdgeInsets.only(left: 5.0, right: 5.0),
            child: Image.network(
                icon,
                width: 18.0,
                height: 18.0),
          ),
        ],
      ),
    );
  }
}
