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

import '../../YSAskQuestion.dart';

class YSDoctorListView extends StatelessWidget {
  final Map doctorItem;
  const YSDoctorListView({Key key, this.doctorItem}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: (){
        Navigator.of(context,rootNavigator: true).push(
            CupertinoPageRoute(
                builder: (context){
                  return YSAskQuestion(info: doctorItem,isPolicy: false,);
                }
            )
        );
      },
      child: Container(
        height: 90,
        child: Row(
          children: [
            Container(
              height: 70,
              width: 70,
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(35)),
                  color: Color(0xFFD1D1D1),
                  image: DecorationImage(
                    fit: BoxFit.fill,
                    image: NetworkImage('${doctorItem['avatar']}'),
                  )
              ),
            ),
            Container(
              margin: EdgeInsets.only(left: 10),
              height: 60,
              width: MediaQuery.of(context).size.width-140,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  RichText(text: TextSpan(
                      text: '${doctorItem['name']}医生',
                      style: TextStyle(color: Color(0xFF0F0F0F),fontSize: 14,decoration: TextDecoration.none,fontWeight: FontWeight.w600),
                      children: [
                        TextSpan(
                            text: '（${doctorItem['hospital_name']}）',
                            style: TextStyle(color: Color(0xFF7F3344),fontSize: 12)
                        )
                      ]
                  ),maxLines: 1,),
                  Text('${doctorItem['introduction']}',style: TextStyle(color: Color(0xFF0F0F0F),fontSize: 11,
                      decoration: TextDecoration.none,fontWeight: FontWeight.normal),maxLines: 2,overflow: TextOverflow.ellipsis,),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
