import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';

import '../DoctorProfile.dart';

class DoctorView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        navigateToDoctorProfile(context);
      },
      child: Card(
        margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0),
        color: Colors.white,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(10),
        ),
        child: Container(
          decoration: BoxDecoration(),
          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: 60.0,
                    width: 60.0),
              ),
              Container(
                width: MediaQuery.of(context).size.width * 0.6,
                margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.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(
                          child: Image.network(
                              "https://hmgwebservices.com/Images/flag/PSE.png",
                              width: 25.0,
                              height: 25.0),
                        ),
                      ],
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

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

}
