123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutterappfuyou/code/base/YSNetWorking.dart';
- class YSDoctorDetail extends StatefulWidget {
- final int doctorId;
- final bool isPolicy;
- const YSDoctorDetail({Key key, this.doctorId,this.isPolicy}) : super(key: key);
- @override
- _YSDoctorDetailState createState() => _YSDoctorDetailState();
- }
- class _YSDoctorDetailState extends State<YSDoctorDetail> {
- Map _infoDict;
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value){
- widget.isPolicy==false?_getDoctorDetailData():_getPolicyDoctorDetailData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- body: Stack(
- children: [
- Container(
- height: 191.5,
- width: MediaQuery.of(context).size.width,
- child: Image(
- image: AssetImage('lib/images/diarybg.png'),
- fit: BoxFit.fill,
- )
- ),
- CupertinoButton(
- padding: EdgeInsets.all(0),
- child: Container(
- margin: EdgeInsets.only(left: 15,top: MediaQuery.of(context).padding.top+5),
- child: Icon(Icons.keyboard_arrow_left,size: 30,color: Colors.white,),
- ),
- onPressed: (){
- Navigator.pop(context);
- },
- ),
- Container(
- margin: EdgeInsets.only(top: 170),
- height: MediaQuery.of(context).size.height-170,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(topLeft: Radius.circular(20),topRight: Radius.circular(20)),
- color: Colors.white,
- ),
- child: _infoDict==null?Container():SingleChildScrollView(
- padding: EdgeInsets.all(15),
- child: Column(
- children: [
- Container(
- height: 30,
- width: MediaQuery.of(context).size.width,
- child: Text('${_infoDict['name']}医生',style: TextStyle(fontSize: 22,color: Color(0xFF292929),fontWeight: FontWeight.w600),),
- margin: EdgeInsets.only(top: 5,bottom: 5),
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- child: Text(_infoDict['hospital_name']==null?'':'任职医院:${_infoDict['hospital_name']}',style: TextStyle(fontSize: 12,color: Color(0xFF808080),fontWeight: FontWeight.normal),),
- ),
- Container(
- margin: EdgeInsets.only(top: _infoDict['hospital_name']==null?0:15,bottom: 15),
- width: MediaQuery.of(context).size.width,
- height: 1.5,
- child: Image.asset('lib/images/line.png'),
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- child: Text('${_infoDict['introduction']}',
- style: TextStyle(fontSize: 12,color: Color(0xFF292929),fontWeight: FontWeight.normal),),
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- );
- }
- _getDoctorDetailData() async{
- Map dict = await ysRequestHttp(context, requestType.post, 'doctor/info', {'doctor_id':widget.doctorId});
- if(dict!=null){
- if(dict['data'] is List)return;
- setState(() {
- _infoDict = dict['data'];
- });
- }
- }
- _getPolicyDoctorDetailData() async{
- Map dict = await ysRequestHttp(context, requestType.get, 'policy/doctorInfo', {'id':widget.doctorId});
- if(dict!=null){
- if(dict['data'] is List)return;
- setState(() {
- _infoDict = dict['data'];
- });
- }
- }
- }
|