Introduce.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import 'package:cached_network_image/cached_network_image.dart';
  2. import 'package:eitc_erm_app/utils/Constants.dart';
  3. import 'package:eitc_erm_app/utils/logger.dart';
  4. import 'package:eitc_erm_app/widget/image_error.dart';
  5. import 'package:flutter/material.dart';
  6. import 'bean/hospital_detail.dart';
  7. /*void main() {
  8. WidgetsFlutterBinding.ensureInitialized();
  9. runApp(Introduce());
  10. }*/
  11. HospitalDetail mHospitalDetail = new HospitalDetail();
  12. class Introduce extends StatefulWidget {
  13. Introduce({required Key key, required hospitalDetail}) : super(key: key) {
  14. mHospitalDetail = hospitalDetail;
  15. logd(mHospitalDetail.data?.bannerPic);
  16. }
  17. @override
  18. State<StatefulWidget> createState() => IntroduceState();
  19. }
  20. class IntroduceState extends State<Introduce> {
  21. @override
  22. void initState() {
  23. super.initState();
  24. }
  25. @override
  26. Widget build(BuildContext context) {
  27. return Scaffold(
  28. appBar: new AppBar(
  29. title: new Text('医院介绍',
  30. style: TextStyle(
  31. color: Colors.white,
  32. )),
  33. centerTitle: true,
  34. elevation: 0.5,
  35. backgroundColor: Global.StatusBarColor,
  36. leading: new IconButton(
  37. tooltip: '返回上一页',
  38. icon: const Icon(
  39. Icons.arrow_back_ios,
  40. color: Colors.white,
  41. ),
  42. onPressed: () {
  43. Navigator.of(context).pop();
  44. //_nextPage(-1);
  45. },
  46. ),
  47. ),
  48. body: SingleChildScrollView(
  49. child: Column(mainAxisSize: MainAxisSize.max, children: <Widget>[
  50. CachedNetworkImage(
  51. imageUrl: mHospitalDetail.data?.bannerPic1 == null
  52. ? ""
  53. : Global.ImageUrl + mHospitalDetail.data!.bannerPic1!,
  54. width: double.infinity,
  55. fit: BoxFit.fitWidth,
  56. progressIndicatorBuilder: (ctx, _, __) =>
  57. const CircularProgressIndicator(),
  58. errorWidget: (ctx, _, __) => const ImageError(
  59. size: 80,
  60. ),
  61. ),
  62. Padding(
  63. padding: const EdgeInsets.all(10),
  64. child: ListView(
  65. shrinkWrap: true,
  66. //沿竖直方向上布局
  67. scrollDirection: Axis.vertical,
  68. children: <Widget>[
  69. _getTextRow(
  70. context, "诊所名称:", mHospitalDetail.data?.clinicName ?? ""),
  71. _getTextRow(context, "医疗机构编码:",
  72. mHospitalDetail.data?.medicalInstitutionCode ?? ""),
  73. _getTextRow(
  74. context, "公司地址:", mHospitalDetail.data?.city ?? ""),
  75. _getTextRow(context, "营业时间:",
  76. mHospitalDetail.data?.clinicWorkingDays ?? ""),
  77. _getTitleText(context, "营业执照:"),
  78. CachedNetworkImage(
  79. imageUrl: Global.ImageUrl +
  80. mHospitalDetail
  81. .data!.medicalInstitutionOccupationalLicense
  82. .toString(),
  83. width: double.infinity,
  84. fit: BoxFit.fitWidth,
  85. progressIndicatorBuilder: (ctx, _, __) =>
  86. const CircularProgressIndicator(),
  87. errorWidget: (ctx, _, __) => const ImageError(
  88. size: 80,
  89. ),
  90. ),
  91. ],
  92. )
  93. /*Text(
  94. '',
  95. style: const TextStyle(fontSize: 13, color: Colors.black),
  96. ),*/
  97. ),
  98. ]),
  99. ),
  100. );
  101. }
  102. Widget _getTitleText(BuildContext context, String title) {
  103. return Text(
  104. title,
  105. style: Theme.of(context).textTheme.titleMedium,
  106. );
  107. }
  108. Widget _getContextText(BuildContext context, String content) {
  109. return Text(
  110. content,
  111. style: Theme.of(context).textTheme.bodyMedium,
  112. );
  113. }
  114. Widget _getTextRow(BuildContext context, String title, String content) {
  115. return Row(
  116. children: [
  117. _getTitleText(context, title),
  118. _getContextText(context, content),
  119. ],
  120. );
  121. }
  122. }