import 'package:cached_network_image/cached_network_image.dart'; import 'package:eitc_erm_app/utils/Constants.dart'; import 'package:eitc_erm_app/utils/logger.dart'; import 'package:eitc_erm_app/widget/image_error.dart'; import 'package:flutter/material.dart'; import 'bean/hospital_detail.dart'; /*void main() { WidgetsFlutterBinding.ensureInitialized(); runApp(Introduce()); }*/ HospitalDetail mHospitalDetail = new HospitalDetail(); class Introduce extends StatefulWidget { Introduce({required Key key, required hospitalDetail}) : super(key: key) { mHospitalDetail = hospitalDetail; logd(mHospitalDetail.data?.bannerPic); } @override State createState() => IntroduceState(); } class IntroduceState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Scaffold( appBar: new AppBar( title: new Text('医院介绍', style: TextStyle( color: Colors.white, )), centerTitle: true, elevation: 0.5, backgroundColor: Global.StatusBarColor, leading: new IconButton( tooltip: '返回上一页', icon: const Icon( Icons.arrow_back_ios, color: Colors.white, ), onPressed: () { Navigator.of(context).pop(); //_nextPage(-1); }, ), ), body: SingleChildScrollView( child: Column(mainAxisSize: MainAxisSize.max, children: [ CachedNetworkImage( imageUrl: mHospitalDetail.data?.bannerPic1 == null ? "" : Global.ImageUrl + mHospitalDetail.data!.bannerPic1!, width: double.infinity, fit: BoxFit.fitWidth, progressIndicatorBuilder: (ctx, _, __) => const CircularProgressIndicator(), errorWidget: (ctx, _, __) => const ImageError( size: 80, ), ), Padding( padding: const EdgeInsets.all(10), child: ListView( shrinkWrap: true, //沿竖直方向上布局 scrollDirection: Axis.vertical, children: [ _getTextRow( context, "诊所名称:", mHospitalDetail.data?.clinicName ?? ""), _getTextRow(context, "医疗机构编码:", mHospitalDetail.data?.medicalInstitutionCode ?? ""), _getTextRow( context, "公司地址:", mHospitalDetail.data?.city ?? ""), _getTextRow(context, "营业时间:", mHospitalDetail.data?.clinicWorkingDays ?? ""), _getTitleText(context, "营业执照:"), CachedNetworkImage( imageUrl: Global.ImageUrl + mHospitalDetail .data!.medicalInstitutionOccupationalLicense .toString(), width: double.infinity, fit: BoxFit.fitWidth, progressIndicatorBuilder: (ctx, _, __) => const CircularProgressIndicator(), errorWidget: (ctx, _, __) => const ImageError( size: 80, ), ), ], ) /*Text( '', style: const TextStyle(fontSize: 13, color: Colors.black), ),*/ ), ]), ), ); } Widget _getTitleText(BuildContext context, String title) { return Text( title, style: Theme.of(context).textTheme.titleMedium, ); } Widget _getContextText(BuildContext context, String content) { return Text( content, style: Theme.of(context).textTheme.bodyMedium, ); } Widget _getTextRow(BuildContext context, String title, String content) { return Row( children: [ _getTitleText(context, title), _getContextText(context, content), ], ); } }