import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class TimeLineWidget extends StatelessWidget {
  final bool isUp;
  final AppoitmentAllHistoryResultList appoitmentAllHistoryResul;

  TimeLineWidget({Key key, this.isUp, this.appoitmentAllHistoryResul});

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Container(
          width: 140,
          height: 190,
          color: Colors.transparent,
          child: Center(
            child: Divider(
              color: Colors.white,
              height: 3,
              thickness: 3,
            ),
          ),
        ),
        if (isUp)
          Positioned(
            top: 20,
            child: Container(
              margin: EdgeInsets.only(left: 2, right: 2),
              child: Column(
                children: <Widget>[
                  Texts(
                    appoitmentAllHistoryResul.doctorNameObj,
                    color: Colors.white,
                    fontSize: 10.5,
                    fontWeight: FontWeight.normal,
                  ),
                  SizedBox(
                    height: 3,
                  ),
                  LargeAvatar(
                    onTap: () {
                      //AppointmentDetails
                      Navigator.push(context,
                          FadePage(page: AppointmentDetails(appo: appoitmentAllHistoryResul,)));
                    },
                    name: appoitmentAllHistoryResul.doctorNameObj,
                    url: appoitmentAllHistoryResul.doctorImageURL,
                    width: 30,
                    height: 30,
                  ),
                  Container(
                    height: 20,
                    width: 3,
                    color: Colors.white,
                  ),
                  Container(
                    width: 15,
                    height: 15,
                    decoration: BoxDecoration(
                      color: Colors.yellow[700],
                      border: Border.all(color: Colors.yellow[700], width: 2),
                      shape: BoxShape.rectangle,
                      borderRadius: BorderRadius.all(
                        Radius.circular(25.0),
                      ),
                    ),
                  ),
                  SizedBox(
                    height: 4,
                  ),
                  Texts(
                    DateUtil.getMonthDayYearDateFormatted(
                        DateUtil.convertStringToDate(
                            appoitmentAllHistoryResul.appointmentDate)),
                    color: Colors.white,
                    fontSize: 10.5,
                    fontWeight: FontWeight.normal,
                  )
                ],
              ),
            ),
          )
        else
          Positioned(
            top: 70,
            child: Container(
              margin: EdgeInsets.only(left: 2, right: 2),
              child: Column(
                children: <Widget>[
                  Texts(
                    DateUtil.getMonthDayYearDateFormatted(
                        DateUtil.convertStringToDate(
                            appoitmentAllHistoryResul.appointmentDate)),
                    color: Colors.white,
                    fontSize: 10.5,
                    fontWeight: FontWeight.normal,
                  ),
                  SizedBox(
                    height: 5,
                  ),
                  Container(
                    width: 15,
                    height: 15,
                    decoration: BoxDecoration(
                      color: Colors.yellow[700],
                      border: Border.all(color: Colors.yellow[700], width: 2),
                      shape: BoxShape.rectangle,
                      borderRadius: BorderRadius.all(
                        Radius.circular(25.0),
                      ),
                    ),
                  ),
                  Container(
                    height: 20,
                    width: 3,
                    color: Colors.white,
                  ),
                  LargeAvatar(
                    onTap: (){
                      Navigator.push(context,
                          FadePage(page: AppointmentDetails(appo: appoitmentAllHistoryResul,)));
                    },
                    name: appoitmentAllHistoryResul.doctorNameObj,
                    url: appoitmentAllHistoryResul.doctorImageURL,
                    width: 30,
                    height: 30,
                  ),
                  SizedBox(
                    height: 3,
                  ),
                  Texts(
                    appoitmentAllHistoryResul.doctorNameObj,
                    color: Colors.white,
                    fontSize: 10.5,
                    fontWeight: FontWeight.normal,
                  ),
                ],
              ),
            ),
          ),
        Container()
      ],
    );
  }
}
