import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';

import 'package:eitc_erm_app/utils/Component.dart';
import 'package:eitc_erm_app/utils/Constants.dart';
import 'package:eitc_erm_app/widget/loading.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:http/http.dart' as http;

import 'bean/hospital_detail.dart';
import 'bean/message_box_s_list_entity.dart';
import 'bean/pda_patrol_time_list.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;
    print(mHospitalDetail.data?.bannerPic);
  }
  @override
  State<StatefulWidget> createState() => IntroduceState();
}

class IntroduceState extends State<Introduce> {

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: 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: <Widget>[
            Image(
              image: AssetImage('assets/images/banner1.png'),
              fit: BoxFit.fitWidth,
            ),
            Padding(
              padding: const EdgeInsets.all(10),
              child: ListView(
                shrinkWrap: true,
                //沿竖直方向上布局
                scrollDirection: Axis.vertical,
                children: <Widget>[
                  Text(
                    '诊所名称：${mHospitalDetail.data?.clinicName}',
                    style: const TextStyle(fontSize: 15, color: Colors.black),
                  ),
                  Text(
                    '医疗机构编码：${mHospitalDetail.data?.medicalInstitutionCode}',
                    style: const TextStyle(fontSize: 15, color: Colors.black),
                  ),
                  Text(
                    '公司地址：${mHospitalDetail.data?.city}',
                    style: const TextStyle(fontSize: 15, color: Colors.black),
                  ),
                  Text(
                    '营业时间：${mHospitalDetail.data?.clinicWorkingDays}',
                    style: const TextStyle(fontSize: 15, color: Colors.black),
                  ),
                  Text('营业执照'),
                  Image.network(
                    Global.ImageUrl + mHospitalDetail.data!.medicalInstitutionOccupationalLicense.toString(),
                    width: double.infinity,
                    fit: BoxFit.fitWidth,
                    excludeFromSemantics: true,
                    errorBuilder: (context, error, stackTrace) {
                      return Icon(
                        Icons.image,
                        size: 80,
                        color: Colors.grey,
                      ); // 显示一个进度指示器作为错误占位
                    },
                  ),
                ],
              )

              /*Text(
                '',
                style: const TextStyle(fontSize: 13, color: Colors.black),
              ),*/
            ),
          ]),
        ),
      ),
    );
  }
}
