YSDoctorDetail.dart 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutterappfuyou/code/base/YSNetWorking.dart';
  4. class YSDoctorDetail extends StatefulWidget {
  5. final int doctorId;
  6. final bool isPolicy;
  7. const YSDoctorDetail({Key key, this.doctorId,this.isPolicy}) : super(key: key);
  8. @override
  9. _YSDoctorDetailState createState() => _YSDoctorDetailState();
  10. }
  11. class _YSDoctorDetailState extends State<YSDoctorDetail> {
  12. Map _infoDict;
  13. @override
  14. void initState() {
  15. Future.delayed(Duration(seconds: 0)).then((value){
  16. widget.isPolicy==false?_getDoctorDetailData():_getPolicyDoctorDetailData();
  17. });
  18. super.initState();
  19. }
  20. @override
  21. Widget build(BuildContext context) {
  22. return Scaffold(
  23. backgroundColor: Colors.white,
  24. body: Stack(
  25. children: [
  26. Container(
  27. height: 191.5,
  28. width: MediaQuery.of(context).size.width,
  29. child: Image(
  30. image: AssetImage('lib/images/diarybg.png'),
  31. fit: BoxFit.fill,
  32. )
  33. ),
  34. CupertinoButton(
  35. padding: EdgeInsets.all(0),
  36. child: Container(
  37. margin: EdgeInsets.only(left: 15,top: MediaQuery.of(context).padding.top+5),
  38. child: Icon(Icons.keyboard_arrow_left,size: 30,color: Colors.white,),
  39. ),
  40. onPressed: (){
  41. Navigator.pop(context);
  42. },
  43. ),
  44. Container(
  45. margin: EdgeInsets.only(top: 170),
  46. height: MediaQuery.of(context).size.height-170,
  47. decoration: BoxDecoration(
  48. borderRadius: BorderRadius.only(topLeft: Radius.circular(20),topRight: Radius.circular(20)),
  49. color: Colors.white,
  50. ),
  51. child: _infoDict==null?Container():SingleChildScrollView(
  52. padding: EdgeInsets.all(15),
  53. child: Column(
  54. children: [
  55. Container(
  56. height: 30,
  57. width: MediaQuery.of(context).size.width,
  58. child: Text('${_infoDict['name']}医生',style: TextStyle(fontSize: 22,color: Color(0xFF292929),fontWeight: FontWeight.w600),),
  59. margin: EdgeInsets.only(top: 5,bottom: 5),
  60. ),
  61. Container(
  62. width: MediaQuery.of(context).size.width,
  63. child: Text(_infoDict['hospital_name']==null?'':'任职医院:${_infoDict['hospital_name']}',style: TextStyle(fontSize: 12,color: Color(0xFF808080),fontWeight: FontWeight.normal),),
  64. ),
  65. Container(
  66. margin: EdgeInsets.only(top: _infoDict['hospital_name']==null?0:15,bottom: 15),
  67. width: MediaQuery.of(context).size.width,
  68. height: 1.5,
  69. child: Image.asset('lib/images/line.png'),
  70. ),
  71. Container(
  72. width: MediaQuery.of(context).size.width,
  73. child: Text('${_infoDict['introduction']}',
  74. style: TextStyle(fontSize: 12,color: Color(0xFF292929),fontWeight: FontWeight.normal),),
  75. ),
  76. ],
  77. ),
  78. ),
  79. ),
  80. ],
  81. ),
  82. );
  83. }
  84. _getDoctorDetailData() async{
  85. Map dict = await ysRequestHttp(context, requestType.post, 'doctor/info', {'doctor_id':widget.doctorId});
  86. if(dict!=null){
  87. if(dict['data'] is List)return;
  88. setState(() {
  89. _infoDict = dict['data'];
  90. });
  91. }
  92. }
  93. _getPolicyDoctorDetailData() async{
  94. Map dict = await ysRequestHttp(context, requestType.get, 'policy/doctorInfo', {'id':widget.doctorId});
  95. if(dict!=null){
  96. if(dict['data'] is List)return;
  97. setState(() {
  98. _infoDict = dict['data'];
  99. });
  100. }
  101. }
  102. }