import 'package:hmg_patient_app/core/model/contactus/get_hmg_locations.dart';
import 'package:hmg_patient_app/widgets/hospital_location.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

class HospitalsPage extends StatefulWidget {
  final List<GetHMGLocationsModel> findusHospitalModelList;

  HospitalsPage({Key? key, required this.findusHospitalModelList});

  @override
  _HospitalsPageState createState() => _HospitalsPageState();
}

class _HospitalsPageState extends State<HospitalsPage> {
  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      physics: BouncingScrollPhysics(),
      padding: EdgeInsets.only(bottom: 21, top: 21, left: 21, right: 21),
      child: Column(
        children: [
          ListView.separated(
            physics: NeverScrollableScrollPhysics(),
            shrinkWrap: true,
            padding: EdgeInsets.zero,
            separatorBuilder: (context, index) => SizedBox(height: 14),
            itemBuilder: (context, index) => HospitalLocation(widget.findusHospitalModelList[index]),
            itemCount: widget.findusHospitalModelList.length,
          ),
          Container(
            margin: EdgeInsets.only(top: 14),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.all(
                  Radius.circular(10.0),
                ),
                boxShadow: [
                  BoxShadow(
                    color: Color(0xff000000).withOpacity(.05),
                    //spreadRadius: 5,
                    blurRadius: 27,
                    offset: Offset(0, -3),
                  ),
                ],
                color: Colors.white),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                IconButton(
                  icon: new Image.asset('assets/images/new-design/youtube.png'),
                  iconSize: 48,
                  tooltip: 'Youtube',
                  onPressed: () {
                    setState(() {
                      launch("https://www.youtube.com/c/DrsulaimanAlhabibHospitals");
                    });
                  },
                ),
                IconButton(
                  icon: new Image.asset('assets/images/new-design/linkedin.png'),
                  tooltip: 'LinkedIn',
                  iconSize: 48,
                  onPressed: () {
                    setState(() {
                      launch("https://www.linkedin.com/company/drsulaiman-alhabib-medical-group");
                    });
                  },
                ),
                IconButton(
                  icon: new Image.asset('assets/images/new-design/twitter.png'),
                  tooltip: 'Twitter',
                  iconSize: 48,
                  onPressed: () {
                    setState(() {
                      launch("https://twitter.com/HMG");
                    });
                  },
                ),
                IconButton(
                  icon: new Image.asset('assets/images/new-design/facebook.png'),
                  tooltip: 'facebook',
                  iconSize: 48,
                  onPressed: () {
                    setState(() {
                      launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn");
                    });
                  },
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
