|
|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/er/er_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/hospital_location.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -25,7 +27,7 @@ class NearestEr extends StatefulWidget {
|
|
|
|
|
class _NearestErState extends State<NearestEr> {
|
|
|
|
|
List<ProjectAvgERWaitingTime> projectAvgERWaitingTimeModelList = List();
|
|
|
|
|
|
|
|
|
|
bool isDataLoaded = false;
|
|
|
|
|
bool isDataLoaded;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
@ -45,47 +47,41 @@ class _NearestErState extends State<NearestEr> {
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).NearestEr,
|
|
|
|
|
body: isDataLoaded
|
|
|
|
|
? Container(
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(TranslationBase.of(context).NearestErDesc,
|
|
|
|
|
textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0, letterSpacing: 1.0, fontWeight: FontWeight.w900, color: new Color(0xFF60686b))),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(2.0, 10.0, 0.0, 10.0),
|
|
|
|
|
child: GridView.count(
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
childAspectRatio: (itemWidth / itemWidth),
|
|
|
|
|
crossAxisSpacing: 10,
|
|
|
|
|
mainAxisSpacing: 10,
|
|
|
|
|
controller: new ScrollController(keepScrollOffset: false),
|
|
|
|
|
body: isDataLoaded != null
|
|
|
|
|
? isDataLoaded
|
|
|
|
|
? ListView(
|
|
|
|
|
padding: EdgeInsets.all(21),
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).NearestErDesc,
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 21),
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
children: List.generate(projectAvgERWaitingTimeModelList.length, (index) {
|
|
|
|
|
return Container(
|
|
|
|
|
child: CardPosition(
|
|
|
|
|
waitingTime: projectAvgERWaitingTimeModelList[index].avgTimeInHHMM.toString(),
|
|
|
|
|
text: projectAvgERWaitingTimeModelList[index].projectName.toString(),
|
|
|
|
|
image: 'assets/images/new-design/find_us_icon.png',
|
|
|
|
|
subText: projectAvgERWaitingTimeModelList[index].distanceInKilometers.toString() + " " + TranslationBase.of(context).km,
|
|
|
|
|
type: projectAvgERWaitingTimeModelList[index].iD.toString(),
|
|
|
|
|
telephone: projectAvgERWaitingTimeModelList[index].phoneNumber.toString(),
|
|
|
|
|
networkImage: projectAvgERWaitingTimeModelList[index].projectImageURL.toString(),
|
|
|
|
|
latitude: projectAvgERWaitingTimeModelList[index].latitude,
|
|
|
|
|
longitude: projectAvgERWaitingTimeModelList[index].longitude,
|
|
|
|
|
projectname: projectAvgERWaitingTimeModelList[index].projectName,
|
|
|
|
|
cardSize: itemWidth,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
separatorBuilder: (context, index) => SizedBox(height: 14),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
GetHMGLocationsModel location = GetHMGLocationsModel();
|
|
|
|
|
location.locationName = projectAvgERWaitingTimeModelList[index].projectName;
|
|
|
|
|
location.cityName = projectAvgERWaitingTimeModelList[index].projectName;
|
|
|
|
|
location.projectImageURL = projectAvgERWaitingTimeModelList[index].projectImageURL;
|
|
|
|
|
location.phoneNumber = projectAvgERWaitingTimeModelList[index].phoneNumber;
|
|
|
|
|
location.latitude = projectAvgERWaitingTimeModelList[index].latitude;
|
|
|
|
|
location.longitude = projectAvgERWaitingTimeModelList[index].longitude;
|
|
|
|
|
location.distanceInKilometers = projectAvgERWaitingTimeModelList[index].distanceInKilometers;
|
|
|
|
|
return HospitalLocation(location, waitingTime: projectAvgERWaitingTimeModelList[index].avgTimeInHHMM.toString());
|
|
|
|
|
},
|
|
|
|
|
itemCount: projectAvgERWaitingTimeModelList.length,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: Texts('No Data'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: Texts('No Data'),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|