|
|
|
|
@ -4,6 +4,7 @@ import 'package:auto_size_text/auto_size_text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/analytics/google-analytics.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
|
|
|
|
@ -37,8 +38,10 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/location_util.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/penguin_method_channel.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/covid_consent_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
@ -57,8 +60,9 @@ class ServicesView extends StatelessWidget {
|
|
|
|
|
late LocationUtils locationUtils;
|
|
|
|
|
bool isHomePage;
|
|
|
|
|
late ProjectViewModel projectViewModel;
|
|
|
|
|
bool isLocked;
|
|
|
|
|
|
|
|
|
|
ServicesView(this.hmgServices, this.index, this.isHomePage, this.projectViewModel);
|
|
|
|
|
ServicesView(this.hmgServices, this.index, this.isHomePage, this.projectViewModel, {this.isLocked = false});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -164,13 +168,48 @@ class ServicesView extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
isLocked
|
|
|
|
|
? Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
decoration: containerRadiusWithGradientServices(20, lightColor: Colors.grey.withOpacity(0.6), darkColor: Colors.grey.withOpacity(0.6)),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.lock_outline,
|
|
|
|
|
size: 40,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initPenguinSDK() async {
|
|
|
|
|
openNavigationProjectSelection(BuildContext context) {
|
|
|
|
|
int _selectedHospitalIndex = 0;
|
|
|
|
|
List<HospitalsModel> projectsListLocal = [];
|
|
|
|
|
Utils.navigationProjectsList.forEach((v) {
|
|
|
|
|
projectsListLocal.add(new HospitalsModel.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
List<RadioSelectionDialogModel> list = [
|
|
|
|
|
for (int i = 0; i < projectsListLocal.length; i++) RadioSelectionDialogModel(projectsListLocal[i].name! + ' ${projectsListLocal[i].distanceInKilometers} ' + TranslationBase.of(context).km, i),
|
|
|
|
|
];
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (cxt) => RadioSelectionDialog(
|
|
|
|
|
buttonText: TranslationBase.of(context).confirm,
|
|
|
|
|
listData: list,
|
|
|
|
|
selectedIndex: _selectedHospitalIndex,
|
|
|
|
|
isScrollable: true,
|
|
|
|
|
onValueSelected: (index) {
|
|
|
|
|
_selectedHospitalIndex = index;
|
|
|
|
|
initPenguinSDK(projectsListLocal[index].iD);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initPenguinSDK(int projectID) async {
|
|
|
|
|
final bool permited = await AppPermission.askPenguinPermissions();
|
|
|
|
|
if (!permited) {
|
|
|
|
|
Map<Permission, PermissionStatus> statuses = await [
|
|
|
|
|
@ -182,7 +221,7 @@ class ServicesView extends StatelessWidget {
|
|
|
|
|
].request().whenComplete(() {
|
|
|
|
|
PenguinMethodChannel.launch("penguin", projectViewModel.isArabic ? "ar" : "en", "1231755");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} //
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleHomePageServices(HmgServices hmgServices, BuildContext context) {
|
|
|
|
|
@ -192,7 +231,8 @@ class ServicesView extends StatelessWidget {
|
|
|
|
|
} else if (hmgServices.action == 1) {
|
|
|
|
|
openLiveCare(context);
|
|
|
|
|
} else if (hmgServices.action == 2) {
|
|
|
|
|
initPenguinSDK();
|
|
|
|
|
// initPenguinSDK();
|
|
|
|
|
if (!isLocked) openNavigationProjectSelection(context);
|
|
|
|
|
// Navigator.push(context, FadePage(page: ErOptions(isAppbar: true)));
|
|
|
|
|
// locator<GAnalytics>().hmgServices.logServiceName('emergency service');
|
|
|
|
|
} else if (hmgServices.action == 3) {
|
|
|
|
|
|