import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';

import 'BookSuccess.dart';

class BookConfirm extends StatefulWidget {
  @override
  _BookConfirmState createState() => _BookConfirmState();
}

class _BookConfirmState extends State<BookConfirm> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(TranslationBase.of(context).bookAppo),
      ),
      body: SingleChildScrollView(
        child: Container(
          margin: EdgeInsets.all(20.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.max,
            children: <Widget>[
              Container(
                  margin: EdgeInsets.only(bottom: 5.0),
                  alignment: Alignment.center,
                  child: Text(TranslationBase.of(context).confirmAppoHeading,
                      textAlign: TextAlign.center,
                      style: TextStyle(
                          fontSize: 22.0,
                          color: new Color(0xFF60686b),
                          letterSpacing: 0.9))),
              Divider(
                color: Colors.grey[400],
              ),
              Container(
                  margin: EdgeInsets.only(top: 15.0),
                  child: Text(TranslationBase.of(context).docInfo,
                      style: TextStyle(
                          fontSize: 22.0,
                          color: Colors.black,
                          letterSpacing: 0.9))),
              Container(
                child: Card(
                  color: Colors.white,
                  margin: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 16.0),
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(10),
                      side: BorderSide(color: Colors.grey[400], width: 0.6)),
                  child: Container(
                    padding: EdgeInsets.all(7.0),
                    width: MediaQuery.of(context).size.width,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: <Widget>[
                        ClipRRect(
                          borderRadius: BorderRadius.circular(100.0),
                          child: Image.network(
                              "https://hmgwebservices.com/Images/MobileImages/OALAY/2477.png",
                              fit: BoxFit.fill,
                              height: 70.0,
                              width: 70.0),
                        ),
                        Container(
                          width: MediaQuery.of(context).size.width * 0.6,
                          margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              Text("Dr. EYAD ISMAIL ABU-JAYAD",
                                  style: TextStyle(
                                      fontSize: 14.0,
                                      color: Colors.grey[700],
                                      letterSpacing: 1.0)),
                              Container(
                                margin: EdgeInsets.only(top: 3.0),
                                child: Text("INTERNAL MEDICINE CLINIC",
                                    style: TextStyle(
                                        fontSize: 12.0,
                                        color: Colors.grey[600],
                                        letterSpacing: 1.0)),
                              ),
                              Container(
                                margin: EdgeInsets.only(top: 3.0, bottom: 3.0),
                                child: Text("General Practioner",
                                    style: TextStyle(
                                        fontSize: 12.0,
                                        color: Colors.grey[600],
                                        letterSpacing: 1.0)),
                              ),
                              Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                mainAxisSize: MainAxisSize.max,
                                children: <Widget>[
                                  RatingBar.readOnly(
                                    initialRating: 4.0,
                                    size: 20.0,
                                    filledColor: Colors.yellow[700],
                                    emptyColor: Colors.grey[500],
                                    isHalfAllowed: true,
                                    halfFilledIcon: Icons.star_half,
                                    filledIcon: Icons.star,
                                    emptyIcon: Icons.star,
                                  ),
                                ],
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
              Container(
                  margin: EdgeInsets.only(top: 15.0),
                  child: Text(TranslationBase.of(context).appoInfo,
                      style: TextStyle(
                          fontSize: 22.0,
                          color: Colors.black,
                          letterSpacing: 0.9))),
              Container(
                child: Card(
                  color: Colors.white,
                  margin: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 16.0),
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(10),
                      side: BorderSide(color: Colors.grey[400], width: 0.6)),
                  child: Container(
                    padding: EdgeInsets.all(7.0),
                    width: MediaQuery.of(context).size.width,
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.max,
                      children: <Widget>[
                        Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: <Widget>[
                            Container(
                              margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
                              child: Image.asset(
                                  "assets/images/new-design/icon_hospital.png"),
                            ),
                            Container(
                              margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0),
                              child: Text("Hospital: Olaya Hospital",
                                  style: TextStyle(
                                      fontSize: 14.0,
                                      color: Colors.grey[700],
                                      letterSpacing: 1.0)),
                            ),
                          ],
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: <Widget>[
                            Container(
                              margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
                              child: Image.asset(
                                  "assets/images/new-design/icon_hospital.png"),
                            ),
                            Container(
                              margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0),
                              child: Text("Clinic: INTERNAL MEDICINE CLINIC",
                                  style: TextStyle(
                                      fontSize: 14.0,
                                      color: Colors.grey[700],
                                      letterSpacing: 1.0)),
                            ),
                          ],
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: <Widget>[
                            Container(
                              child: Icon(
                                Icons.today,
                                color: Colors.grey[700],
                              ),
                            ),
                            Container(
                              margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0),
                              child: Text("Date: Olaya Hospital",
                                  style: TextStyle(
                                      fontSize: 14.0,
                                      color: Colors.grey[700],
                                      letterSpacing: 1.0)),
                            ),
                          ],
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: <Widget>[
                            Container(
                              child: Icon(
                                Icons.timer,
                                color: Colors.grey[700],
                              ),
                            ),
                            Container(
                              margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0),
                              child: Text("Hospital: Olaya Hospital",
                                  style: TextStyle(
                                      fontSize: 14.0,
                                      color: Colors.grey[700],
                                      letterSpacing: 1.0)),
                            ),
                          ],
                        ),
                      ],
                    ),
                  ),
                ),
              ),
              Container(
                  margin: EdgeInsets.only(top: 15.0),
                  child: Text(TranslationBase.of(context).patientInfo,
                      style: TextStyle(
                          fontSize: 22.0,
                          color: Colors.black,
                          letterSpacing: 0.9))),
              Container(
                child: Card(
                  color: Colors.white,
                  margin: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 16.0),
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(10),
                      side: BorderSide(color: Colors.grey[400], width: 0.6)),
                  child: Container(
                    padding: EdgeInsets.all(7.0),
                    width: MediaQuery.of(context).size.width,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: <Widget>[
                        Container(
                          padding: EdgeInsets.all(10.0),
                          child: Image.asset(
                              "assets/images/new-design/appointment_info.png",
                              fit: BoxFit.fill,
                              height: 60.0,
                              width: 60.0),
                        ),
                        Container(
                          width: MediaQuery.of(context).size.width * 0.6,
                          margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              Text("TAMER FANASHEH",
                                  style: TextStyle(
                                      fontSize: 14.0,
                                      color: Colors.grey[900],
                                      letterSpacing: 1.0)),
                              Container(
                                margin: EdgeInsets.only(top: 5.0),
                                child: Text("Gender: Male",
                                    style: TextStyle(
                                        fontSize: 12.0,
                                        color: Colors.grey[600],
                                        letterSpacing: 1.0)),
                              ),
                              Container(
                                margin: EdgeInsets.only(top: 5.0, bottom: 3.0),
                                child: Text("Age: 33",
                                    style: TextStyle(
                                        fontSize: 12.0,
                                        color: Colors.grey[600],
                                        letterSpacing: 1.0)),
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
      bottomSheet: Container(
        width: MediaQuery.of(context).size.width,
        height: 50.0,
        margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0),
        child: ButtonTheme(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(10.0),
          ),
          minWidth: MediaQuery.of(context).size.width * 0.7,
          height: 45.0,
          child: RaisedButton(
            color: new Color(0xFF60686b),
            textColor: Colors.white,
            disabledTextColor: Colors.white,
            disabledColor: new Color(0xFFbcc2c4),
            onPressed: () {
              navigateToBookSuccess(context);
            },
            child: Text(TranslationBase.of(context).bookNow, style: TextStyle(fontSize: 18.0)),
          ),
        ),
      ),
    );
  }

  Future navigateToBookSuccess(context) async {
    Navigator.push(
        context, MaterialPageRoute(builder: (context) => BookSuccess()));
  }
}
