|
|
|
@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:maps_launcher/maps_launcher.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
|
|
|
|
|
|
|
|
|
|
import 'covid-dirvethru-questions.dart';
|
|
|
|
|
|
|
|
|
@ -34,15 +33,14 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
String projectID = "";
|
|
|
|
|
List<ImagesInfo> imagesInfo = List();
|
|
|
|
|
|
|
|
|
|
DriveThroughTestingCenterModel selectedProject;
|
|
|
|
|
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
imagesInfo.add(
|
|
|
|
|
ImagesInfo(
|
|
|
|
|
imageEn: 'https://hmgwebservices.com/Images/MobileApp/covid/en/0.png',
|
|
|
|
|
imageAr:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/covid/ar/0.png'),
|
|
|
|
|
ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/covid/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/covid/ar/0.png'),
|
|
|
|
|
);
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
if (projectViewModel.isLogin) {
|
|
|
|
@ -56,9 +54,7 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
imagesInfo.add(ImagesInfo(
|
|
|
|
|
imageEn: 'https://hmgwebservices.com/Images/MobileApp/covid/en/0.png',
|
|
|
|
|
imageAr: 'https://hmgwebservices.com/Images/MobileApp/covid/ar/0.png'));
|
|
|
|
|
imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/covid/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/covid/ar/0.png'));
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).covidTest,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
@ -72,31 +68,17 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
alignment: projectViewModel.isArabic
|
|
|
|
|
? Alignment.centerRight
|
|
|
|
|
: Alignment.centerLeft,
|
|
|
|
|
child: Text(TranslationBase.of(context).resultHeader,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 22.0,
|
|
|
|
|
color: Colors.black)),
|
|
|
|
|
alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft,
|
|
|
|
|
child: Text(TranslationBase.of(context).resultHeader, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 22.0, color: Colors.black)),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 10.0),
|
|
|
|
|
child: Text(TranslationBase.of(context).covidInfo,
|
|
|
|
|
style: TextStyle(fontSize: 16.0, color: Colors.black)),
|
|
|
|
|
child: Text(TranslationBase.of(context).covidInfo, style: TextStyle(fontSize: 16.0, color: Colors.black)),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 20.0),
|
|
|
|
|
alignment: projectViewModel.isArabic
|
|
|
|
|
? Alignment.centerRight
|
|
|
|
|
: Alignment.centerLeft,
|
|
|
|
|
child: Text(TranslationBase.of(context).selectLocation,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 18.0,
|
|
|
|
|
letterSpacing: 0.8,
|
|
|
|
|
color: Colors.grey[700])),
|
|
|
|
|
alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft,
|
|
|
|
|
child: Text(TranslationBase.of(context).selectLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0, letterSpacing: 0.8, color: Colors.grey[700])),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: 60.0,
|
|
|
|
@ -112,18 +94,18 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
margin: EdgeInsets.only(top: 15.0),
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton<String>(
|
|
|
|
|
child: DropdownButton<DriveThroughTestingCenterModel>(
|
|
|
|
|
hint: new Text(TranslationBase.of(context).selectAddress),
|
|
|
|
|
value: projectDropdownValue,
|
|
|
|
|
items: projectsList.map((item) {
|
|
|
|
|
return new DropdownMenuItem<String>(
|
|
|
|
|
value: item.iD.toString(),
|
|
|
|
|
value: selectedProject,
|
|
|
|
|
items: projectsList.map((DriveThroughTestingCenterModel item) {
|
|
|
|
|
return new DropdownMenuItem<DriveThroughTestingCenterModel>(
|
|
|
|
|
value: item,
|
|
|
|
|
child: new Text(item.projectName),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: (newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
projectDropdownValue = newValue;
|
|
|
|
|
selectedProject = newValue;
|
|
|
|
|
setProjectLocation(newValue);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
@ -132,15 +114,8 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
isLocationSelected
|
|
|
|
|
? Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 15.0),
|
|
|
|
|
alignment: projectViewModel.isArabic
|
|
|
|
|
? Alignment.centerRight
|
|
|
|
|
: Alignment.centerLeft,
|
|
|
|
|
child: Text(TranslationBase.of(context).selectLocation,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 18.0,
|
|
|
|
|
letterSpacing: 0.8,
|
|
|
|
|
color: Colors.black)),
|
|
|
|
|
alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft,
|
|
|
|
|
child: Text(TranslationBase.of(context).selectLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0, letterSpacing: 0.8, color: Colors.black)),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
isLocationSelected
|
|
|
|
@ -149,8 +124,7 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(color: Colors.grey[400], width: 1.0),
|
|
|
|
|
),
|
|
|
|
|
child: Image.network(
|
|
|
|
|
"https://maps.googleapis.com/maps/api/staticmap?center=" +
|
|
|
|
|
child: Image.network("https://maps.googleapis.com/maps/api/staticmap?center=" +
|
|
|
|
|
this.projectLat +
|
|
|
|
|
"," +
|
|
|
|
|
this.projectLong +
|
|
|
|
@ -184,8 +158,7 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
onPressed: () {
|
|
|
|
|
getDirections();
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).getDirections,
|
|
|
|
|
style: TextStyle(fontSize: 18.0)),
|
|
|
|
|
child: Text(TranslationBase.of(context).getDirections, style: TextStyle(fontSize: 18.0)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -202,8 +175,7 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
|
|
|
),
|
|
|
|
|
minWidth:
|
|
|
|
|
MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
minWidth: MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
height: 45.0,
|
|
|
|
|
child: RaisedButton(
|
|
|
|
|
color: new Color(0xFF60686b),
|
|
|
|
@ -213,8 +185,7 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
onPressed: () {
|
|
|
|
|
back();
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).back,
|
|
|
|
|
style: TextStyle(fontSize: 18.0)),
|
|
|
|
|
child: Text(TranslationBase.of(context).back, style: TextStyle(fontSize: 18.0)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -227,8 +198,7 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
|
|
|
),
|
|
|
|
|
minWidth:
|
|
|
|
|
MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
minWidth: MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
height: 45.0,
|
|
|
|
|
child: RaisedButton(
|
|
|
|
|
color: new Color(0xFF60686b),
|
|
|
|
@ -238,8 +208,7 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
onPressed: () {
|
|
|
|
|
next();
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).next,
|
|
|
|
|
style: TextStyle(fontSize: 18.0)),
|
|
|
|
|
child: Text(TranslationBase.of(context).next, style: TextStyle(fontSize: 18.0)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -259,22 +228,17 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
|
|
|
|
|
getDirections() {
|
|
|
|
|
if (isLocationSelected) {
|
|
|
|
|
MapsLauncher.launchCoordinates(double.parse(projectLat),
|
|
|
|
|
double.parse(projectLong), this.projectName);
|
|
|
|
|
MapsLauncher.launchCoordinates(double.parse(projectLat), double.parse(projectLong), this.projectName);
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showErrorToast(
|
|
|
|
|
"Please select address from the dropdown menu to get directions");
|
|
|
|
|
Utils.showErrorToast("Please select address from the dropdown menu to get directions");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
next() {
|
|
|
|
|
if (isLocationSelected) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(page: CovidDirveThruQuestions(projectId: projectID, proceduresList: proceduresList,)));
|
|
|
|
|
Navigator.push(context, FadePage(page: CovidDirveThruQuestions(projectId: projectID, proceduresList: proceduresList)));
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showErrorToast(
|
|
|
|
|
"Please select address from the dropdown menu to continue");
|
|
|
|
|
Utils.showErrorToast("Please select address from the dropdown menu to continue");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -282,34 +246,25 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
Navigator.of(context).popAndPushNamed(HOME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setProjectLocation(newValue) {
|
|
|
|
|
print(newValue);
|
|
|
|
|
setProjectLocation(DriveThroughTestingCenterModel newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
this.projectLat =
|
|
|
|
|
projectsList[(int.parse(newValue) - 1)].latitude.toString();
|
|
|
|
|
this.projectLong =
|
|
|
|
|
projectsList[(int.parse(newValue) - 1)].longitude.toString();
|
|
|
|
|
this.projectName = projectsList[(int.parse(newValue) - 1)].projectName;
|
|
|
|
|
this.projectID =
|
|
|
|
|
projectsList[(int.parse(newValue) - 1)].projectID.toString();
|
|
|
|
|
this.projectLat = newValue.latitude.toString();
|
|
|
|
|
this.projectLong = newValue.longitude.toString();
|
|
|
|
|
this.projectName = newValue.projectName;
|
|
|
|
|
this.projectID = newValue.projectID.toString();
|
|
|
|
|
isLocationSelected = true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPaymentInfo(BuildContext context, String projectID) {
|
|
|
|
|
CovidDriveThruService service = new CovidDriveThruService();
|
|
|
|
|
CovidPaymentInfoResponse covidPaymentInfoResponse =
|
|
|
|
|
new CovidPaymentInfoResponse();
|
|
|
|
|
CovidPaymentInfoResponse covidPaymentInfoResponse = new CovidPaymentInfoResponse();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service
|
|
|
|
|
.getCovidPaymentInformation(
|
|
|
|
|
context, int.parse(projectID), proceduresList[0].procedureID)
|
|
|
|
|
.then((res) {
|
|
|
|
|
service.getCovidPaymentInformation(context, int.parse(projectID), proceduresList[0].procedureID).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
setState(() {
|
|
|
|
|
covidPaymentInfoResponse =
|
|
|
|
|
CovidPaymentInfoResponse.fromJson(res['COVID19_PatientShare']);
|
|
|
|
|
covidPaymentInfoResponse = CovidPaymentInfoResponse.fromJson(res['COVID19_PatientShare']);
|
|
|
|
|
});
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
@ -329,8 +284,7 @@ class _CovidDrivethruLocationState extends State<CovidDrivethruLocation> {
|
|
|
|
|
CovidDriveThruService service = new CovidDriveThruService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
CovidTestProceduresResponse covidTestProceduresResponse =
|
|
|
|
|
new CovidTestProceduresResponse();
|
|
|
|
|
CovidTestProceduresResponse covidTestProceduresResponse = new CovidTestProceduresResponse();
|
|
|
|
|
|
|
|
|
|
service.getCovidTestProceduresList(context).then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|