import 'package:hmg_patient_app/core/model/doctor/doctor_profile.dart';
import 'package:hmg_patient_app/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class DoctorInformation extends StatefulWidget {
  final DoctorProfile doctorProfile;

  const DoctorInformation({Key? key, required this.doctorProfile}) : super(key: key);

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

class _DoctorInformationState extends State<DoctorInformation> {
  bool _isShowInfo = true;
  bool _isScientificQualification = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey[200],
      body: SingleChildScrollView(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              margin: EdgeInsets.only(top: 10, right: 10, left: 10),
              padding: EdgeInsets.all(10.0),
              width: double.infinity,
              //height: 250,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.all(Radius.circular(10.0)),
              ),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Row(
                    children: <Widget>[
                      Icon(
                        Icons.person,
                        size: 25,
                        color: Colors.red[700],
                      ),
                      SizedBox(
                        width: 10,
                      ),
                      Expanded(child: Texts(widget.doctorProfile.doctorName)),
                      InkWell(
                        onTap: () {
                          setState(() {
                            _isShowInfo = !_isShowInfo;
                          });
                        },
                        child: Container(
                            margin: EdgeInsets.all(5),
                            decoration:
                                BoxDecoration(shape: BoxShape.circle, boxShadow: [
                              BoxShadow(
                                color: Colors.red[700]!,
                                blurRadius: 1.0,
                                spreadRadius: 0.0,
                              )
                            ]),
                            child: Icon(
                              _isShowInfo
                                  ? Icons.keyboard_arrow_up
                                  : Icons.keyboard_arrow_down ,
                              size: 25,
                              color: Colors.white,
                            )),
                      ),
                    ],
                  ),
                  if (_isShowInfo)
                    AnimatedContainer(
                      duration: Duration(milliseconds: 7000),
                      margin: EdgeInsets.only(top: 20),
                      //  height: 150,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: <Widget>[
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: <Widget>[
                                  Texts('Gender'),
                                  Texts(
                                    widget.doctorProfile.genderDescription,
                                    variant: 'overline',
                                  ),
                                ],
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: <Widget>[
                                  Texts('Nationality'),
                                  Texts(
                                    widget.doctorProfile.nationalityName,
                                    variant: 'overline',
                                  ),
                                ],
                              ),
                            ],
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          Divider(
                            height: 3,
                            color: Colors.grey,
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          Texts('Clinic'),
                          Texts(
                            widget.doctorProfile.clinicDescription,
                            variant: 'overline',
                          ),
                        ],
                      ),
                    )
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(top: 10, right: 10, left: 10),
              padding: EdgeInsets.all(10.0),
              width: double.infinity,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.all(Radius.circular(10.0)),
              ),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Row(
                    children: <Widget>[
                      Icon(
                        Icons.local_play,
                        size: 25,
                        color: Colors.red[700],
                      ),
                      SizedBox(
                        width: 10,
                      ),
                      Expanded(child: Texts(widget.doctorProfile.doctorName)),
                      InkWell(
                        onTap: () {
                          setState(() {
                            _isScientificQualification =
                                !_isScientificQualification;
                          });
                        },
                        child: Container(
                            margin: EdgeInsets.all(5),
                            decoration:
                                BoxDecoration(shape: BoxShape.circle, boxShadow: [
                              BoxShadow(
                                color: Colors.red[700]!,
                                blurRadius: 1.0,
                                spreadRadius: 0.0,
                              )
                            ]),
                            child: Icon(
                              _isScientificQualification
                                  ?  Icons.keyboard_arrow_up
                                  : Icons.keyboard_arrow_down,
                              size: 25,
                              color: Colors.white,
                            )),
                      ),
                    ],
                  ),
                  if (_isScientificQualification)
                    AnimatedContainer(
                      duration: Duration(milliseconds: 7000),
                      margin: EdgeInsets.only(top: 20),
                      //  height: 150,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Texts(widget.doctorProfile.doctorProfileInfo,)
                        ],
                      ),
                    )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
