map picker, firebase improvement and changes for v2.5

merge-requests/569/head
Sikander Saleem 4 years ago
parent 14b0c4c125
commit e3bf988df5

@ -5,12 +5,12 @@ import com.facebook.stetho.Stetho
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
FlutterFirebaseMessagingService.setPluginRegistrant(this)
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
// Stetho.initializeWithDefaults(this);
// Create an InitializerBuilder
@ -38,7 +38,7 @@ class Application : FlutterApplication(), PluginRegistrantCallback {
}
override fun registerWith(registry: PluginRegistry) {
io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
// io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}

@ -2,14 +2,14 @@
package com.ejada.hmg
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
//import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
object FirebaseCloudMessagingPluginRegistrant {
fun registerWith(registry: PluginRegistry?) {
if (alreadyRegisteredWith(registry)) {
return
}
FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"))
// FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"))
}
private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean {

@ -134,7 +134,7 @@ class BaseAppClient {
print(jsonBody);
if (await Utils.checkConnection()) {
final response = await http.post(url.trim(), body: json.encode(body), headers: headers);
final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
@ -307,7 +307,7 @@ class BaseAppClient {
print("Body : ${json.encode(body)}");
if (await Utils.checkConnection()) {
final response = await http.post(url.trim(), body: json.encode(body), headers: headers);
final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
@ -408,7 +408,7 @@ class BaseAppClient {
if (await Utils.checkConnection()) {
final response = await http.get(
url.trim(),
Uri.parse(url.trim()),
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},
);
final int statusCode = response.statusCode;
@ -450,7 +450,7 @@ class BaseAppClient {
var ss = json.encode(queryParams);
if (await Utils.checkConnection()) {
final response = await http.get(url.trim(), headers: {
final response = await http.get(Uri.parse(url.trim()), headers: {
'Content-Type': 'text/html; charset=utf-8',
'Accept': 'application/json',
'Authorization': token ?? '',
@ -494,7 +494,7 @@ class BaseAppClient {
if (await Utils.checkConnection()) {
headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
final response = await http.post(
url.trim(),
Uri.parse(url.trim()),
body: json.encode(body),
headers: headers,
);
@ -526,7 +526,7 @@ class BaseAppClient {
if (await Utils.checkConnection()) {
headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
final response = await http.get(
url.trim(),
Uri.parse(url.trim()),
headers: headers,
);
@ -551,7 +551,7 @@ class BaseAppClient {
if (await Utils.checkConnection()) {
headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
final response = await http.put(
url.trim(),
Uri.parse(url.trim()),
body: json.encode(body),
headers: headers,
);
@ -585,7 +585,7 @@ class BaseAppClient {
if (await Utils.checkConnection()) {
headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
final response = await http.delete(
url.trim(),
Uri.parse(url.trim()),
headers: headers,
);
@ -726,7 +726,7 @@ class BaseAppClient {
var ss = json.encode(body);
if (await Utils.checkConnection()) {
final response = await http.post(url.trim(), body: json.encode(body), headers: {
final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: {
// 'Content-Type': 'application/json',
// 'Accept': 'application/json',
// 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
@ -23,11 +24,17 @@ import 'core/viewModels/project_view_model.dart';
import 'locator.dart';
import 'pages/pharmacies/compare-list.dart';
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp();
print("Handling a background message: ${message.messageId}");
}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
FirebaseApp defaultApp = await Firebase.initializeApp();
await setupLocator();
// FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
await Firebase.initializeApp();
setupLocator();
runApp(MyApp());
}
@ -41,9 +48,9 @@ class _MyApp extends State<MyApp> {
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
Future<void> checkForUpdate() async {
Future<void> checkForUpdate() async { // todo need to verify 'imp'
InAppUpdate.checkForUpdate().then((info) {
if (info.updateAvailable) {
if (info.immediateUpdateAllowed) {
InAppUpdate.performImmediateUpdate().then((value) {}).catchError((e) => print(e.toString()));
}
}).catchError((e) {

@ -63,7 +63,7 @@ class _NewCMCPageState extends State<NewCMCPage> with TickerProviderStateMixin {
}
_getCurrentLocation() async {
await getLastKnownPosition().then((value) {
await Geolocator.getLastKnownPosition().then((value) {
_latitude = value.latitude;
_longitude = value.longitude;
}).catchError((e) {
@ -89,7 +89,7 @@ class _NewCMCPageState extends State<NewCMCPage> with TickerProviderStateMixin {
void showConfirmMessage(CMCViewModel model, GetCMCAllOrdersResponseModel order) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);

@ -1,14 +1,11 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/theme/colors.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/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/dragable_sheet.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/photo_view_page.dart';
@ -125,7 +122,10 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
),
margin: EdgeInsets.all(12),
child: IconButton(
icon: SvgPicture.asset("assets/images/new/ic_zoom.svg",color: Colors.white,),
icon: SvgPicture.asset(
"assets/images/new/ic_zoom.svg",
color: Colors.white,
),
padding: EdgeInsets.all(12),
onPressed: () {
showDraggableDialog(context, PhotoViewPage(projectViewModel.isArabic ? "assets/images/cc_ar.png" : "assets/images/cc_en.png"));
@ -162,9 +162,9 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
await widget.model.getCustomerInfo();
// if (widget.model.state == ViewState.ErrorLocal) {
// Utils.showErrorToast();
// } else {
if (widget.model.state == ViewState.ErrorLocal) {
Utils.showErrorToast();
} else {
navigateTo(
context,
NewCMCStepTowPage(
@ -174,7 +174,7 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
model: widget.model,
),
);
// }
}
}
},
),

@ -284,7 +284,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
void confirmSelectLocationDialog(List<AddressInfo> addresses) {
showDialog(
context: context,
child: SelectLocationDialog(
builder: (cxt) => SelectLocationDialog(
addresses: addresses,
selectedAddress: _selectedAddress,
onValueSelected: (value) {

@ -32,7 +32,7 @@ class OrdersLogDetailsPage extends StatelessWidget {
void showConfirmMessage(CMCViewModel model, GetCMCAllOrdersResponseModel order) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);

@ -238,7 +238,7 @@ class _NewEReferralStepOnePageState extends State<NewEReferralStepOnePage> {
void confirmSelectRelationTypeDialog(List<GetAllRelationshipTypeResponseModel> relations) {
showDialog(
context: context,
child: SelectRelationTypeDialog(
builder: (cxt) => SelectRelationTypeDialog(
relationTypes: relations,
selectedRelation: _selectedRelation,
onValueSelected: (value) {

@ -459,7 +459,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
void confirmSelectCityDialog(List<GetAllCitiesResponseModel> cities) {
showDialog(
context: context,
child: SelectCityDialog(
builder: (cxt) => SelectCityDialog(
cities: cities,
selectedCity: _selectedCity,
onValueSelected: (value) {

@ -270,7 +270,7 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
void confirmSelectCityDialog(List<GetAllCitiesResponseModel> cities) {
showDialog(
context: context,
child: SelectCityDialog(
builder: (cxt) => SelectCityDialog(
cities: cities,
selectedCity: _selectedCity,
onValueSelected: (value) {
@ -285,7 +285,7 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
void confirmSelectCountryTypeDialog() {
showDialog(
context: context,
child: SelectCountryDialog(
builder: (cxt) => SelectCountryDialog(
selectedCountry: _selectedCountry,
onValueSelected: (value) {
setState(() {

@ -89,7 +89,7 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
}
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: selectedCriteria.value,
onValueSelected: (index) {
@ -229,7 +229,7 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
void confirmSelectCountryTypeDialog() {
showDialog(
context: context,
child: SelectCountryDialog(
builder: (cxt) => SelectCountryDialog(
selectedCountry: _selectedCountry,
onValueSelected: (value) {
setState(() {

@ -7,7 +7,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -46,90 +46,81 @@ class _LocationPageState extends State<LocationPage> {
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<HomeHealthCareViewModel>(
onModelReady: (model) {},
builder: (_, model, widget) => AppScaffold(
appBarTitle: TranslationBase.of(context).addAddress,
isShowDecPage: false,
isShowAppBar: true,
baseViewModel: model,
showNewAppBarTitle: true,
showNewAppBar: true,
body: PlacePicker(
apiKey: GOOGLE_API_KEY,
enableMyLocationButton: true,
automaticallyImplyAppBarLeading: false,
autocompleteOnTrailingWhitespace: true,
selectInitialPosition: true,
autocompleteLanguage: projectViewModel.currentLanguage,
enableMapTypeButton: true,
searchForInitialValue: false,
onPlacePicked: (PickResult result) {
print(result.adrAddress);
},
selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
print("state: $state, isSearchBarFocused: $isSearchBarFocused");
return isSearchBarFocused
? Container()
: FloatingCard(
bottomPosition: 0.0,
leftPosition: 0.0,
rightPosition: 0.0,
width: 500,
borderRadius: BorderRadius.circular(12.0),
child: state == SearchingState.Searching
? Center(child: CircularProgressIndicator())
: Container(
margin: EdgeInsets.all(12),
child: Column(
children: [
SecondaryButton(
color: Colors.grey[800],
textColor: Colors.white,
onTap: () async {
AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel(
customer: Customer(addresses: [
Addresses(
address1: selectedPlace.formattedAddress,
address2: selectedPlace.formattedAddress,
customerAttributes: "",
city: "",
createdOnUtc: "",
id: 0,
latLong: "$latitude,$longitude",
email: "")
]),
);
onModelReady: (model) {},
builder: (_, model, widget) => AppScaffold(
appBarTitle: TranslationBase.of(context).addAddress,
isShowDecPage: false,
isShowAppBar: true,
baseViewModel: model,
showNewAppBarTitle: true,
showNewAppBar: true,
body: PlacePicker(
apiKey: GOOGLE_API_KEY,
enableMyLocationButton: true,
automaticallyImplyAppBarLeading: false,
autocompleteOnTrailingWhitespace: true,
selectInitialPosition: true,
autocompleteLanguage: projectViewModel.currentLanguage,
enableMapTypeButton: true,
searchForInitialValue: false,
onPlacePicked: (PickResult result) {
print("onPlacePickedonPlacePickedonPlacePickedonPlacePicked");
print(result.adrAddress);
},
selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
return isSearchBarFocused
? Container()
: FloatingCard(
bottomPosition: 0.0,
leftPosition: 0.0,
rightPosition: 0.0,
width: 500,
borderRadius: BorderRadius.circular(0.0),
child: state == SearchingState.Searching
? SizedBox(height: 43,child: Center(child: CircularProgressIndicator())).insideContainer
: DefaultButton(TranslationBase.of(context).addNewAddress, () async {
selectedPlace.addressComponents.forEach((e) {
if (e.types.contains("country")) {
addNewAddressRequestModel.customer.addresses[0].country = e.longName;
}
if (e.types.contains("postal_code")) {
addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName;
}
if (e.types.contains("locality")) {
addNewAddressRequestModel.customer.addresses[0].city = e.longName;
}
});
// print();
AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel(
customer: Customer(addresses: [
Addresses(
address1: selectedPlace.formattedAddress,
address2: selectedPlace.formattedAddress,
customerAttributes: "",
city: "",
createdOnUtc: "",
id: 0,
latLong: "${selectedPlace.geometry.location}",
email: "")
]),
);
await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: "Address Added Successfully");
}
Navigator.of(context).pop(addNewAddressRequestModel);
},
label: TranslationBase.of(context).addNewAddress,
),
],
),
),
);
},
initialPosition: LatLng(latitude, longitude),
useCurrentLocation: showCurrentLocation,
),
));
selectedPlace.addressComponents.forEach((e) {
if (e.types.contains("country")) {
addNewAddressRequestModel.customer.addresses[0].country = e.longName;
}
if (e.types.contains("postal_code")) {
addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName;
}
if (e.types.contains("locality")) {
addNewAddressRequestModel.customer.addresses[0].city = e.longName;
}
});
await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: "Address Added Successfully");
}
Navigator.of(context).pop(addNewAddressRequestModel);
}).insideContainer
);
},
initialPosition: LatLng(latitude, longitude),
useCurrentLocation: showCurrentLocation,
),
),
);
}
}

@ -279,7 +279,7 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
void confirmSelectLocationDialog(List<AddressInfo> addresses) {
showDialog(
context: context,
child: SelectLocationDialog(
builder: (cxt) => SelectLocationDialog(
addresses: addresses,
selectedAddress: _selectedAddress,
onValueSelected: (value) {

@ -8,7 +8,6 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
@ -41,7 +40,7 @@ class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage> with Tick
}
_getCurrentLocation() async {
await getLastKnownPosition().then((value) {
await Geolocator.getLastKnownPosition().then((value) {
_latitude = value.latitude;
_longitude = value.longitude;
}).catchError((e) {
@ -67,22 +66,22 @@ class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage> with Tick
void showConfirmMessage(HomeHealthCareViewModel model, GetCMCAllOrdersResponseModel order) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () async {
model.setState(ViewState.Busy);
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () async {
model.setState(ViewState.Busy);
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
await model.updateHHCPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getHHCAllPresOrders();
// await model.getHHCAllServices();
}
},
));
await model.updateHHCPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getHHCAllPresOrders();
// await model.getHHCAllServices();
}
},
));
}
ProjectViewModel projectViewModel = Provider.of(context);

@ -28,7 +28,7 @@ class OrdersLogDetailsPage extends StatelessWidget {
void showConfirmMessage(HomeHealthCareViewModel model, GetCMCAllOrdersResponseModel order) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);

@ -271,7 +271,7 @@ class _H2oSettingState extends State<H2oSetting> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedActiveLevel,
onValueSelected: (index) {
@ -300,7 +300,7 @@ class _H2oSettingState extends State<H2oSetting> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedRemindedTime,
onValueSelected: (index) {

@ -341,7 +341,7 @@ class _TodayPageState extends State<TodayPage> {
String title = "${TranslationBase.of(context).areyousure} $amount ${(isUnitML ? TranslationBase.of(context).ml : TranslationBase.of(context).l).toLowerCase()} ?";
await showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: title,
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);

@ -149,7 +149,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedHospitalIndex,
isScrollable: true,
@ -170,7 +170,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedGenderIndex,
onValueSelected: (index) {
@ -195,7 +195,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedBloodTypeIndex,
isScrollable: true,

@ -44,7 +44,7 @@ class ConfirmPaymentPage extends StatelessWidget {
showDialog(
context: context,
barrierDismissible: false,
child: ConfirmSMSDialog(
builder: (cxt) => ConfirmSMSDialog(
phoneNumber: patientInfoAndMobileNumber.mobileNumber,
),
).then((value) {

@ -192,7 +192,7 @@ class _NewTextFieldsState extends State<NewTextFields> {
style: Theme.of(context)
.textTheme
.body2
.bodyText2
.copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight),
inputFormatters: widget.keyboardType == TextInputType.phone
? <TextInputFormatter>[

@ -43,20 +43,20 @@ Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String
onClick: (int i) async {
if (i == 0) {
// Before 30 mints
dateTime = Jiffy(dateTime).subtract(minutes: 30);
dateTime = Jiffy(dateTime).subtract(minutes: 30).dateTime;
// dateTime.add(new Duration(minutes: -30));
} else if (i == 1) {
// Before 1 hour
// dateTime.add(new Duration(minutes: -60));
dateTime = Jiffy(dateTime).subtract(hours: 1);
dateTime = Jiffy(dateTime).subtract(hours: 1).dateTime;
} else if (i == 2) {
// Before 1 hour and 30 mints
// dateTime.add(new Duration(minutes: -90));
dateTime = Jiffy(dateTime).subtract(hours: 1, minutes: 30);
dateTime = Jiffy(dateTime).subtract(hours: 1, minutes: 30).dateTime;
} else if (i == 3) {
// Before 2 hours
// dateTime.add(new Duration(minutes: -120));
dateTime = Jiffy(dateTime).subtract(hours: 2);
dateTime = Jiffy(dateTime).subtract(hours: 2).dateTime;
}
if (onMultiDateSuccess == null) {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();

@ -300,7 +300,7 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
void confirmSelectDayDialog() {
showDialog(
context: context,
child: DayCheckBoxDialog(
builder: (cxt) => DayCheckBoxDialog(
title: 'Select Day',
selectedDaysOfWeek: widget.daysOfWeek,
onValueSelected: (value) {

@ -145,7 +145,7 @@ class VaccinationTablePage extends StatelessWidget {
//===============
showDialog(
context: context,
child: SelectGenderDialog(
builder: (cxt) => SelectGenderDialog(
okFunction: () async {
await model.getCreateVaccinationTable(babyInfo, true);
if (model.state == ViewState.Idle) {

@ -595,7 +595,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
deleteFamily(family, context) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).removeFamilyMember,
onTap: () {
removeFamily(family, context);

@ -1,9 +1,6 @@
import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart';
@ -17,9 +14,7 @@ class NotificationsDetailsPage extends StatelessWidget {
DateTime d = DateUtil.convertStringToDate(date);
String monthName = DateUtil.getMonth(d.month).toString();
TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute);
String minute = timeOfDay.minute < 10
? timeOfDay.minute.toString().padLeft(2, '0')
: timeOfDay.minute.toString();
String minute = timeOfDay.minute < 10 ? timeOfDay.minute.toString().padLeft(2, '0') : timeOfDay.minute.toString();
String hour = '${timeOfDay.hourOfPeriod}:$minute';
if (timeOfDay.period == DayPeriod.am) {
@ -39,67 +34,50 @@ class NotificationsDetailsPage extends StatelessWidget {
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).notificationDetails,
body: SingleChildScrollView(
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
children: [
SizedBox(
height: 25,
),
Container(
width: double.infinity,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + " " + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false),
style: TextStyle(
fontSize: 18.0,
color: Colors.black,
fontWeight: FontWeight.w600
),
),
),
),
SizedBox(
height: 15,
),
if (notification.messageTypeData.length != 0)
FractionallySizedBox(
widthFactor: 0.9,
child: Image.network(notification.messageTypeData,
loadingBuilder: (BuildContext context, Widget child,
ImageChunkEvent loadingProgress) {
if (loadingProgress == null) return child;
return Center(
child: SizedBox(
width: 40.0,
height: 40.0,
child: AppCircularProgressIndicator(),
),
);
},
fit: BoxFit
.fill) //Image.network(notification.messageTypeData),
),
SizedBox(
height: 15,
),
Row(
children: [
Expanded(
child: Center(
child: Text(notification.message),
),
),
],
body: ListView(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.all(21),
children: [
Text(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) +
" " +
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.64,
),
),
if (notification.messageTypeData.length != 0)
Padding(
padding: const EdgeInsets.only(top: 18),
child: Image.network(notification.messageTypeData, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) {
if (loadingProgress == null) return child;
return Center(
child: SizedBox(
width: 40.0,
height: 40.0,
child: AppCircularProgressIndicator(),
),
],
),
);
}, fit: BoxFit.fill),
),
SizedBox(height: 18),
Text(
notification.message.trim(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff575757),
letterSpacing: -0.48,
),
),
),
],
),
);
}
}

@ -8,7 +8,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
@ -36,6 +35,7 @@ class NotificationsPage extends StatelessWidget {
appBarTitle: TranslationBase.of(context).notifications,
baseViewModel: model,
body: ListView.separated(
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
if (index == model.notifications.length) {
return InkWell(
@ -47,87 +47,90 @@ class NotificationsPage extends StatelessWidget {
await model.getNotifications(getNotificationsRequestModel, context);
GifLoaderDialogUtils.hideDialog(context);
},
child: Center(
child: Padding(
padding: const EdgeInsets.only(top: 12, bottom: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Image.asset('assets/images/notf.png'),
Icon(
Icons.notifications_active,
color: CustomColors.accentColor,
size: 40,
),
Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Text(TranslationBase.of(context).moreNotifications,
style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)),
size: 24,
),
SizedBox(width: 8),
Text(TranslationBase.of(context).moreNotifications,
style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.42, decoration: TextDecoration.underline)),
],
),
),
);
}
return InkWell(
onTap: () async {
if (!model.notifications[index].isRead) {
model.markAsRead(model.notifications[index].id);
}
Navigator.push(
context,
FadePage(
page: NotificationsDetailsPage(
context,
FadePage(
page: NotificationsDetailsPage(
notification: model.notifications[index],
)));
),
),
);
},
child: Container(
width: double.infinity,
padding: EdgeInsets.all(8.0),
padding: EdgeInsets.fromLTRB(15.0, 14, 21, 12),
decoration: BoxDecoration(
color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor.withOpacity(0.05),
border: projectViewModel.isArabic
? Border(
right: BorderSide(
color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor,
width: 5.0,
width: 6.0,
),
)
: Border(
left: BorderSide(
color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor,
width: 5.0,
width: 6.0,
),
),
),
child: Row(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.notifications[index].createdOn)) +
Row(
children: [
Expanded(
child: Text(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.notifications[index].createdOn)) +
" " +
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(model.notifications[index].createdOn), false)),
SizedBox(
height: 5,
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(model.notifications[index].createdOn), false),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.64,
),
Row(
children: [
Expanded(child: Texts(model.notifications[index].message)),
if (model.notifications[index].messageType == "image")
Icon(
FontAwesomeIcons.images,
color: CustomColors.grey,
)
],
),
SizedBox(
height: 5,
),
],
),
),
if (model.notifications[index].messageType == "image")
Icon(
FontAwesomeIcons.image,
color: Color(0xffC9C9C9),
)
],
),
SizedBox(height: 4),
Text(
model.notifications[index].message.trim(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff575757),
letterSpacing: -0.48,
),
),
],
@ -139,8 +142,9 @@ class NotificationsPage extends StatelessWidget {
return Column(
children: [
Divider(
color: Colors.grey[300],
color: Color(0xffEFEFEF),
thickness: 2.0,
height: 1,
),
],
);

@ -376,7 +376,7 @@ class _AmbulanceRequestIndexPageState extends State<AmbulanceRequestIndexPage> {
void showConfirmMessage(AmRequestViewModel model, int presOrderID, BuildContext context) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () {
Future.delayed(new Duration(milliseconds: 300)).then((value) async {

@ -54,7 +54,7 @@ class _PickupLocationState extends State<PickupLocation> {
}
_getCurrentLocation() async {
await getLastKnownPosition().then((value) {
await Geolocator.getLastKnownPosition().then((value) {
_latitude = value.latitude;
_longitude = value.longitude;
}).catchError((e) {
@ -561,7 +561,7 @@ class _PickupLocationState extends State<PickupLocation> {
];
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedHospitalIndex,
isScrollable: true,

@ -26,7 +26,7 @@ class OrderLogPage extends StatelessWidget {
void showConfirmMessage(AmRequestViewModel model, int presOrderID, BuildContext context) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () {
Future.delayed(new Duration(milliseconds: 300)).then((value) async {

@ -267,7 +267,7 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
void confirmSelectLocationDialog(List<AddressInfo> addresses) {
showDialog(
context: context,
child: SelectLocationDialog(
builder: (cxt) => SelectLocationDialog(
addresses: addresses,
selectedAddress: selectedAddress,
onValueSelected: (value) {

@ -1,390 +1,390 @@
import 'dart:async';
import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart';
import 'package:diplomaticquarterapp/pages/conference/conference_button_bar.dart';
import 'package:diplomaticquarterapp/pages/conference/conference_room.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/conference/draggable_publisher.dart';
import 'package:diplomaticquarterapp/pages/conference/participant_widget.dart';
import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart';
import 'package:diplomaticquarterapp/pages/conference/widgets/platform_alert_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wakelock/wakelock.dart';
class ConferencePage extends StatefulWidget {
final RoomModel roomModel;
const ConferencePage({Key key, this.roomModel}) : super(key: key);
@override
_ConferencePageState createState() => _ConferencePageState();
}
class _ConferencePageState extends State<ConferencePage> {
final StreamController<bool> _onButtonBarVisibleStreamController = StreamController<bool>.broadcast();
final StreamController<double> _onButtonBarHeightStreamController = StreamController<double>.broadcast();
ConferenceRoom _conferenceRoom;
StreamSubscription _onConferenceRoomException;
@override
void initState() {
super.initState();
_lockInPortrait();
_connectToRoom();
_wakeLock(true);
}
void _connectToRoom() async {
try {
final conferenceRoom = ConferenceRoom(
name: widget.roomModel.name,
token: widget.roomModel.token,
identity: widget.roomModel.identity,
);
await conferenceRoom.connect();
setState(() {
_conferenceRoom = conferenceRoom;
_onConferenceRoomException = _conferenceRoom.onException.listen((err) async {
await PlatformAlertDialog(
title: err is PlatformException ? err.message : 'An error occured',
content: err is PlatformException ? err.details : err.toString(),
defaultActionText: 'OK',
).show(context);
});
_conferenceRoom.addListener(_conferenceRoomUpdated);
});
} catch (err) {
print(err);
await PlatformAlertDialog(
title: err is PlatformException ? err.message : 'An error occured',
content: err is PlatformException ? err.details : err.toString(),
defaultActionText: 'OK',
).show(context);
Navigator.of(context).pop();
}
}
Future<void> _lockInPortrait() async {
await SystemChrome.setPreferredOrientations(<DeviceOrientation>[
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
}
@override
void dispose() {
_freePortraitLock();
_wakeLock(false);
_disposeStreamsAndSubscriptions();
if (_conferenceRoom != null) _conferenceRoom.removeListener(_conferenceRoomUpdated);
super.dispose();
}
Future<void> _freePortraitLock() async {
await SystemChrome.setPreferredOrientations(<DeviceOrientation>[
DeviceOrientation.landscapeRight,
DeviceOrientation.landscapeLeft,
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
}
Future<void> _disposeStreamsAndSubscriptions() async {
if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close();
if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close();
if (_onConferenceRoomException != null) await _onConferenceRoomException.cancel();
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
child: Scaffold(
backgroundColor: Colors.white,
body: _conferenceRoom == null ? showProgress() : buildLayout(),
),
);
}
LayoutBuilder buildLayout() {
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Stack(
children: <Widget>[
_buildParticipants(context, constraints.biggest, _conferenceRoom),
ConferenceButtonBar(
audioEnabled: _conferenceRoom.onAudioEnabled,
videoEnabled: _conferenceRoom.onVideoEnabled,
onAudioEnabled: _conferenceRoom.toggleAudioEnabled,
onVideoEnabled: _conferenceRoom.toggleVideoEnabled,
onHangup: _onHangup,
onSwitchCamera: _conferenceRoom.switchCamera,
onPersonAdd: _onPersonAdd,
onPersonRemove: _onPersonRemove,
onHeight: _onHeightBar,
onShow: _onShowBar,
onHide: _onHideBar,
),
],
);
},
);
}
Widget showProgress() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center(child: CircularProgressIndicator()),
SizedBox(
height: 10,
),
Text(
'Connecting to the call...',
style: TextStyle(color: Colors.white),
),
],
);
}
Future<void> _onHangup() async {
print('onHangup');
await _conferenceRoom.disconnect();
LandingPage.isOpenCallPage = false;
Navigator.of(context).pop();
}
void _onPersonAdd() {
print('onPersonAdd');
try {
_conferenceRoom.addDummy(
child: Stack(
children: <Widget>[
const Placeholder(),
Center(
child: Text(
(_conferenceRoom.participants.length + 1).toString(),
style: const TextStyle(
shadows: <Shadow>[
Shadow(
blurRadius: 3.0,
color: Color.fromARGB(255, 0, 0, 0),
),
Shadow(
blurRadius: 8.0,
color: Color.fromARGB(255, 255, 255, 255),
),
],
fontSize: 80,
),
),
),
],
),
);
} on PlatformException catch (err) {
PlatformAlertDialog(
title: err.message,
content: err.details,
defaultActionText: 'OK',
).show(context);
}
}
void _onPersonRemove() {
print('onPersonRemove');
_conferenceRoom.removeDummy();
}
Widget _buildParticipants(BuildContext context, Size size, ConferenceRoom conferenceRoom) {
final children = <Widget>[];
final length = conferenceRoom.participants.length;
if (length <= 2) {
_buildOverlayLayout(context, size, children);
return Stack(children: children);
}
void buildInCols(bool removeLocalBeforeChunking, bool moveLastOfEachRowToNextRow, int columns) {
_buildLayoutInGrid(
context,
size,
children,
removeLocalBeforeChunking: removeLocalBeforeChunking,
moveLastOfEachRowToNextRow: moveLastOfEachRowToNextRow,
columns: columns,
);
}
// if (length <= 3) {
// buildInCols(true, false, 1);
// } else if (length == 5) {
// buildInCols(false, true, 2);
// } else if (length <= 6 || length == 8) {
// buildInCols(false, false, 2);
// } else if (length == 7 || length == 9) {
// buildInCols(true, false, 2);
// } else if (length == 10) {
// buildInCols(false, true, 3);
// } else if (length == 13 || length == 16) {
// buildInCols(true, false, 3);
// } else if (length <= 18) {
// buildInCols(false, false, 3);
// }
return Column(
children: children,
);
}
void _buildOverlayLayout(BuildContext context, Size size, List<Widget> children) {
final participants = _conferenceRoom.participants;
if (participants.length == 1) {
children.add(_buildNoiseBox());
} else {
final remoteParticipant = participants.firstWhere((ParticipantWidget participant) => participant.isRemote, orElse: () => null);
if (remoteParticipant != null) {
children.add(remoteParticipant);
}
}
final localParticipant = participants.firstWhere((ParticipantWidget participant) => !participant.isRemote, orElse: () => null);
if (localParticipant != null) {
children.add(DraggablePublisher(
key: Key('publisher'),
child: localParticipant,
availableScreenSize: size,
onButtonBarVisible: _onButtonBarVisibleStreamController.stream,
onButtonBarHeight: _onButtonBarHeightStreamController.stream,
));
}
}
void _buildLayoutInGrid(
BuildContext context,
Size size,
List<Widget> children, {
bool removeLocalBeforeChunking = false,
bool moveLastOfEachRowToNextRow = false,
int columns = 2,
}) {
final participants = _conferenceRoom.participants;
ParticipantWidget localParticipant;
if (removeLocalBeforeChunking) {
localParticipant = participants.firstWhere((ParticipantWidget participant) => !participant.isRemote, orElse: () => null);
if (localParticipant != null) {
participants.remove(localParticipant);
}
}
final chunkedParticipants = chunk(array: participants, size: columns);
if (localParticipant != null) {
chunkedParticipants.last.add(localParticipant);
participants.add(localParticipant);
}
if (moveLastOfEachRowToNextRow) {
for (var i = 0; i < chunkedParticipants.length - 1; i++) {
var participant = chunkedParticipants[i].removeLast();
chunkedParticipants[i + 1].insert(0, participant);
}
}
for (final participantChunk in chunkedParticipants) {
final rowChildren = <Widget>[];
for (final participant in participantChunk) {
rowChildren.add(
Container(
width: size.width / participantChunk.length,
height: size.height / chunkedParticipants.length,
child: participant,
),
);
}
children.add(
Container(
height: size.height / chunkedParticipants.length,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: rowChildren,
),
),
);
}
}
NoiseBox _buildNoiseBox() {
return NoiseBox(
density: NoiseBoxDensity.xLow,
backgroundColor: Colors.grey.shade900,
child: Center(
child: Container(
color: Colors.black54,
width: double.infinity,
height: 40,
child: Center(
child: Text(
'Waiting for another participant to connect to the call...',
key: Key('text-wait'),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
),
);
}
List<List<T>> chunk<T>({@required List<T> array, @required int size}) {
final result = <List<T>>[];
if (array.isEmpty || size <= 0) {
return result;
}
var first = 0;
var last = size;
final totalLoop = array.length % size == 0 ? array.length ~/ size : array.length ~/ size + 1;
for (var i = 0; i < totalLoop; i++) {
if (last > array.length) {
result.add(array.sublist(first, array.length));
} else {
result.add(array.sublist(first, last));
}
first = last;
last = last + size;
}
return result;
}
void _onHeightBar(double height) {
_onButtonBarHeightStreamController.add(height);
}
void _onShowBar() {
setState(() {
SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
});
_onButtonBarVisibleStreamController.add(true);
}
void _onHideBar() {
setState(() {
SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
});
_onButtonBarVisibleStreamController.add(false);
}
Future<void> _wakeLock(bool enable) async {
try {
return await (enable ? Wakelock.enable() : Wakelock.disable());
} catch (err) {
print('Unable to change the Wakelock and set it to $enable');
print(err);
}
}
void _conferenceRoomUpdated() {
setState(() {});
}
}
// import 'dart:async';
//
// import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart';
// import 'package:diplomaticquarterapp/pages/conference/conference_button_bar.dart';
// import 'package:diplomaticquarterapp/pages/conference/conference_room.dart';
// import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
// import 'package:diplomaticquarterapp/pages/conference/draggable_publisher.dart';
// import 'package:diplomaticquarterapp/pages/conference/participant_widget.dart';
// import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart';
// import 'package:diplomaticquarterapp/pages/conference/widgets/platform_alert_dialog.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
// import 'package:wakelock/wakelock.dart';
//
// class ConferencePage extends StatefulWidget {
// final RoomModel roomModel;
//
// const ConferencePage({Key key, this.roomModel}) : super(key: key);
//
// @override
// _ConferencePageState createState() => _ConferencePageState();
// }
//
// class _ConferencePageState extends State<ConferencePage> {
// final StreamController<bool> _onButtonBarVisibleStreamController = StreamController<bool>.broadcast();
// final StreamController<double> _onButtonBarHeightStreamController = StreamController<double>.broadcast();
// // ConferenceRoom _conferenceRoom;
// StreamSubscription _onConferenceRoomException;
//
// @override
// void initState() {
// super.initState();
// _lockInPortrait();
// _connectToRoom();
// _wakeLock(true);
// }
//
// void _connectToRoom() async {
// try {
// final conferenceRoom = ConferenceRoom(
// name: widget.roomModel.name,
// token: widget.roomModel.token,
// identity: widget.roomModel.identity,
// );
// await conferenceRoom.connect();
// setState(() {
// _conferenceRoom = conferenceRoom;
// _onConferenceRoomException = _conferenceRoom.onException.listen((err) async {
// await PlatformAlertDialog(
// title: err is PlatformException ? err.message : 'An error occured',
// content: err is PlatformException ? err.details : err.toString(),
// defaultActionText: 'OK',
// ).show(context);
// });
// _conferenceRoom.addListener(_conferenceRoomUpdated);
// });
// } catch (err) {
// print(err);
// await PlatformAlertDialog(
// title: err is PlatformException ? err.message : 'An error occured',
// content: err is PlatformException ? err.details : err.toString(),
// defaultActionText: 'OK',
// ).show(context);
//
// Navigator.of(context).pop();
// }
// }
//
// Future<void> _lockInPortrait() async {
// await SystemChrome.setPreferredOrientations(<DeviceOrientation>[
// DeviceOrientation.portraitUp,
// DeviceOrientation.portraitDown,
// ]);
// }
//
// @override
// void dispose() {
// _freePortraitLock();
// _wakeLock(false);
// _disposeStreamsAndSubscriptions();
// if (_conferenceRoom != null) _conferenceRoom.removeListener(_conferenceRoomUpdated);
// super.dispose();
// }
//
// Future<void> _freePortraitLock() async {
// await SystemChrome.setPreferredOrientations(<DeviceOrientation>[
// DeviceOrientation.landscapeRight,
// DeviceOrientation.landscapeLeft,
// DeviceOrientation.portraitUp,
// DeviceOrientation.portraitDown,
// ]);
// }
//
// Future<void> _disposeStreamsAndSubscriptions() async {
// if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close();
// if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close();
// if (_onConferenceRoomException != null) await _onConferenceRoomException.cancel();
// }
//
// @override
// Widget build(BuildContext context) {
// return WillPopScope(
// onWillPop: () async => false,
// child: Scaffold(
// backgroundColor: Colors.white,
// body: _conferenceRoom == null ? showProgress() : buildLayout(),
// ),
// );
// }
//
// LayoutBuilder buildLayout() {
// return LayoutBuilder(
// builder: (BuildContext context, BoxConstraints constraints) {
// return Stack(
// children: <Widget>[
// _buildParticipants(context, constraints.biggest, _conferenceRoom),
// ConferenceButtonBar(
// audioEnabled: _conferenceRoom.onAudioEnabled,
// videoEnabled: _conferenceRoom.onVideoEnabled,
// onAudioEnabled: _conferenceRoom.toggleAudioEnabled,
// onVideoEnabled: _conferenceRoom.toggleVideoEnabled,
// onHangup: _onHangup,
// onSwitchCamera: _conferenceRoom.switchCamera,
// onPersonAdd: _onPersonAdd,
// onPersonRemove: _onPersonRemove,
// onHeight: _onHeightBar,
// onShow: _onShowBar,
// onHide: _onHideBar,
// ),
// ],
// );
// },
// );
// }
//
// Widget showProgress() {
// return Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Center(child: CircularProgressIndicator()),
// SizedBox(
// height: 10,
// ),
// Text(
// 'Connecting to the call...',
// style: TextStyle(color: Colors.white),
// ),
// ],
// );
// }
//
// Future<void> _onHangup() async {
// print('onHangup');
// await _conferenceRoom.disconnect();
// LandingPage.isOpenCallPage = false;
// Navigator.of(context).pop();
// }
//
// void _onPersonAdd() {
// print('onPersonAdd');
// try {
// _conferenceRoom.addDummy(
// child: Stack(
// children: <Widget>[
// const Placeholder(),
// Center(
// child: Text(
// (_conferenceRoom.participants.length + 1).toString(),
// style: const TextStyle(
// shadows: <Shadow>[
// Shadow(
// blurRadius: 3.0,
// color: Color.fromARGB(255, 0, 0, 0),
// ),
// Shadow(
// blurRadius: 8.0,
// color: Color.fromARGB(255, 255, 255, 255),
// ),
// ],
// fontSize: 80,
// ),
// ),
// ),
// ],
// ),
// );
// } on PlatformException catch (err) {
// PlatformAlertDialog(
// title: err.message,
// content: err.details,
// defaultActionText: 'OK',
// ).show(context);
// }
// }
//
// void _onPersonRemove() {
// print('onPersonRemove');
// _conferenceRoom.removeDummy();
// }
//
// Widget _buildParticipants(BuildContext context, Size size, ConferenceRoom conferenceRoom) {
// final children = <Widget>[];
// final length = conferenceRoom.participants.length;
//
// if (length <= 2) {
// _buildOverlayLayout(context, size, children);
// return Stack(children: children);
// }
//
// void buildInCols(bool removeLocalBeforeChunking, bool moveLastOfEachRowToNextRow, int columns) {
// _buildLayoutInGrid(
// context,
// size,
// children,
// removeLocalBeforeChunking: removeLocalBeforeChunking,
// moveLastOfEachRowToNextRow: moveLastOfEachRowToNextRow,
// columns: columns,
// );
// }
//
// // if (length <= 3) {
// // buildInCols(true, false, 1);
// // } else if (length == 5) {
// // buildInCols(false, true, 2);
// // } else if (length <= 6 || length == 8) {
// // buildInCols(false, false, 2);
// // } else if (length == 7 || length == 9) {
// // buildInCols(true, false, 2);
// // } else if (length == 10) {
// // buildInCols(false, true, 3);
// // } else if (length == 13 || length == 16) {
// // buildInCols(true, false, 3);
// // } else if (length <= 18) {
// // buildInCols(false, false, 3);
// // }
//
// return Column(
// children: children,
// );
// }
//
// void _buildOverlayLayout(BuildContext context, Size size, List<Widget> children) {
// final participants = _conferenceRoom.participants;
// if (participants.length == 1) {
// children.add(_buildNoiseBox());
// } else {
// final remoteParticipant = participants.firstWhere((ParticipantWidget participant) => participant.isRemote, orElse: () => null);
// if (remoteParticipant != null) {
// children.add(remoteParticipant);
// }
// }
//
// final localParticipant = participants.firstWhere((ParticipantWidget participant) => !participant.isRemote, orElse: () => null);
// if (localParticipant != null) {
// children.add(DraggablePublisher(
// key: Key('publisher'),
// child: localParticipant,
// availableScreenSize: size,
// onButtonBarVisible: _onButtonBarVisibleStreamController.stream,
// onButtonBarHeight: _onButtonBarHeightStreamController.stream,
// ));
// }
// }
//
// void _buildLayoutInGrid(
// BuildContext context,
// Size size,
// List<Widget> children, {
// bool removeLocalBeforeChunking = false,
// bool moveLastOfEachRowToNextRow = false,
// int columns = 2,
// }) {
// final participants = _conferenceRoom.participants;
// ParticipantWidget localParticipant;
// if (removeLocalBeforeChunking) {
// localParticipant = participants.firstWhere((ParticipantWidget participant) => !participant.isRemote, orElse: () => null);
// if (localParticipant != null) {
// participants.remove(localParticipant);
// }
// }
// final chunkedParticipants = chunk(array: participants, size: columns);
// if (localParticipant != null) {
// chunkedParticipants.last.add(localParticipant);
// participants.add(localParticipant);
// }
//
// if (moveLastOfEachRowToNextRow) {
// for (var i = 0; i < chunkedParticipants.length - 1; i++) {
// var participant = chunkedParticipants[i].removeLast();
// chunkedParticipants[i + 1].insert(0, participant);
// }
// }
//
// for (final participantChunk in chunkedParticipants) {
// final rowChildren = <Widget>[];
// for (final participant in participantChunk) {
// rowChildren.add(
// Container(
// width: size.width / participantChunk.length,
// height: size.height / chunkedParticipants.length,
// child: participant,
// ),
// );
// }
// children.add(
// Container(
// height: size.height / chunkedParticipants.length,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: rowChildren,
// ),
// ),
// );
// }
// }
//
// NoiseBox _buildNoiseBox() {
// return NoiseBox(
// density: NoiseBoxDensity.xLow,
// backgroundColor: Colors.grey.shade900,
// child: Center(
// child: Container(
// color: Colors.black54,
// width: double.infinity,
// height: 40,
// child: Center(
// child: Text(
// 'Waiting for another participant to connect to the call...',
// key: Key('text-wait'),
// textAlign: TextAlign.center,
// style: TextStyle(color: Colors.white),
// ),
// ),
// ),
// ),
// );
// }
//
// List<List<T>> chunk<T>({@required List<T> array, @required int size}) {
// final result = <List<T>>[];
// if (array.isEmpty || size <= 0) {
// return result;
// }
// var first = 0;
// var last = size;
// final totalLoop = array.length % size == 0 ? array.length ~/ size : array.length ~/ size + 1;
// for (var i = 0; i < totalLoop; i++) {
// if (last > array.length) {
// result.add(array.sublist(first, array.length));
// } else {
// result.add(array.sublist(first, last));
// }
// first = last;
// last = last + size;
// }
// return result;
// }
//
// void _onHeightBar(double height) {
// _onButtonBarHeightStreamController.add(height);
// }
//
// void _onShowBar() {
// setState(() {
// SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
// });
// _onButtonBarVisibleStreamController.add(true);
// }
//
// void _onHideBar() {
// setState(() {
// SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
// });
// _onButtonBarVisibleStreamController.add(false);
// }
//
// Future<void> _wakeLock(bool enable) async {
// try {
// return await (enable ? Wakelock.enable() : Wakelock.disable());
// } catch (err) {
// print('Unable to change the Wakelock and set it to $enable');
// print(err);
// }
// }
//
// void _conferenceRoomUpdated() {
// setState(() {});
// }
// }

File diff suppressed because it is too large Load Diff

@ -445,7 +445,7 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: selectedStatusIndex,
onValueSelected: (index) {

@ -95,7 +95,7 @@ class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: selectedStatusIndex,
onValueSelected: (index) {

@ -352,7 +352,7 @@ class InsuranceCardUpdateDetails extends StatelessWidget {
void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo, InsuranceViewModel model}) {
showDialog(
context: context,
child: AttachInsuranceCardImageDialog(
builder: (cxt) => AttachInsuranceCardImageDialog(
fileNo: fileNo,
name: name,
image: (file, image) async {

@ -84,7 +84,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
///inject the user data
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging?.instance;
final authService = new AuthProvider();
var event = RobotProvider();
@ -264,7 +264,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
// }).checkAndConnectIfNoInternet();
if (Platform.isIOS) {
_firebaseMessaging.requestNotificationPermissions();
_firebaseMessaging.requestPermission();
}
requestPermissions().then((results) {
@ -288,113 +288,178 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
// if (results[Permission.accessMediaLocation].isGranted) ;
// if (results[Permission.calendar].isGranted) ;
});
// });
//
// //_firebase Background message handler
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
// showDialog("onMessage: $message");
print("onMessage: $message");
print(message);
print(message['name']);
print(message['appointmentdate']);
if (Platform.isIOS) {
if (message['is_call'] == "true") {
var route = ModalRoute.of(context);
if (route != null) {
print(route.settings.name);
}
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
print(myMap);
LandingPage.isOpenCallPage = true;
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
isPageNavigated = false;
});
}
} else {
print("Is Call Not Found iOS");
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
print("onMessage: $message");
print(message);
print(message.data['name']);
print(message.data['appointmentdate']);
if (Platform.isIOS) {
if (message.data['is_call'] == "true") {
var route = ModalRoute.of(context);
if (route != null) {
print(route.settings.name);
}
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message.data);
print(myMap);
LandingPage.isOpenCallPage = true;
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
isPageNavigated = false;
});
}
} else {
print("Is Call Not Found iOS");
}
} else {
print("Is Call Not Found iOS");
}
if (Platform.isAndroid) {
if (message['data'].containsKey("is_call")) {
var route = ModalRoute.of(context);
if (route != null) {
print(route.settings.name);
}
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message['data']);
print(myMap);
if (LandingPage.isOpenCallPage) {
return;
}
LandingPage.isOpenCallPage = true;
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
Future.delayed(Duration(seconds: 5), () {
isPageNavigated = false;
});
});
}
} else {
print("Is Call Not Found Android");
LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']);
if (Platform.isAndroid) {
if (message.data['data'].containsKey("is_call")) {
var route = ModalRoute.of(context);
if (route != null) {
print(route.settings.name);
}
} else {
print("Is Call Not Found Android");
}
},
onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
onLaunch: (Map<String, dynamic> message) async {
print("onLaunch: $message");
// showDialog("onLaunch: $message");
},
onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
print(message);
print(message['name']);
print(message['appointmentdate']);
// showDialog("onResume: $message");
if (Platform.isIOS) {
if (message['is_call'] == "true") {
var route = ModalRoute.of(context);
if (route != null) {
print(route.settings.name);
}
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
print(myMap);
LandingPage.isOpenCallPage = true;
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message.data);
print(myMap);
if (LandingPage.isOpenCallPage) {
return;
}
LandingPage.isOpenCallPage = true;
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) {
isPageNavigated = true;
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
Future.delayed(Duration(seconds: 5), () {
isPageNavigated = false;
});
}
} else {
print("Is Call Not Found iOS");
});
}
} else {
print("Is Call Not Found iOS");
print("Is Call Not Found Android");
LocalNotification.getInstance().showNow(title: message.data['notification']['title'], subtitle: message.data['notification']['body']);
}
},
);
} else {
print("Is Call Not Found Android");
}
});
FirebaseMessaging.onBackgroundMessage((message) {
return Platform.isIOS ? null : myBackgroundMessageHandler(message.data);
});
// todo verify all functionality
// _firebaseMessaging.configure(
// // onMessage: (Map<String, dynamic> message) async {
// // // showDialog("onMessage: $message");
// // print("onMessage: $message");
// // print(message);
// // print(message['name']);
// // print(message['appointmentdate']);
// //
// // if (Platform.isIOS) {
// // if (message['is_call'] == "true") {
// // var route = ModalRoute.of(context);
// //
// // if (route != null) {
// // print(route.settings.name);
// // }
// //
// // Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
// // print(myMap);
// // LandingPage.isOpenCallPage = true;
// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
// // if (!isPageNavigated) {
// // isPageNavigated = true;
// // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
// // isPageNavigated = false;
// // });
// // }
// // } else {
// // print("Is Call Not Found iOS");
// // }
// // } else {
// // print("Is Call Not Found iOS");
// // }
// //
// // if (Platform.isAndroid) {
// // if (message['data'].containsKey("is_call")) {
// // var route = ModalRoute.of(context);
// //
// // if (route != null) {
// // print(route.settings.name);
// // }
// //
// // Map<String, dynamic> myMap = new Map<String, dynamic>.from(message['data']);
// // print(myMap);
// // if (LandingPage.isOpenCallPage) {
// // return;
// // }
// // LandingPage.isOpenCallPage = true;
// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
// // if (!isPageNavigated) {
// // isPageNavigated = true;
// // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
// // Future.delayed(Duration(seconds: 5), () {
// // isPageNavigated = false;
// // });
// // });
// // }
// // } else {
// // print("Is Call Not Found Android");
// // LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']);
// // }
// // } else {
// // print("Is Call Not Found Android");
// // }
// // },
// onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
// onLaunch: (Map<String, dynamic> message) async {
// print("onLaunch: $message");
// // showDialog("onLaunch: $message");
// },
// onResume: (Map<String, dynamic> message) async {
// print("onResume: $message");
// print(message);
// print(message['name']);
// print(message['appointmentdate']);
//
// // showDialog("onResume: $message");
//
// if (Platform.isIOS) {
// if (message['is_call'] == "true") {
// var route = ModalRoute.of(context);
//
// if (route != null) {
// print(route.settings.name);
// }
//
// Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
// print(myMap);
// LandingPage.isOpenCallPage = true;
// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
// if (!isPageNavigated) {
// isPageNavigated = true;
// Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
// isPageNavigated = false;
// });
// }
// } else {
// print("Is Call Not Found iOS");
// }
// } else {
// print("Is Call Not Found iOS");
// }
// },
// );
}
Future<Map<Permission, PermissionStatus>> requestPermissions() async {
@ -424,8 +489,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
LandingPage.isOpenCallPage = true;
// Future.delayed(Duration(seconds: 3), () {
// Navigator.push(locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData)));
NavigationService.instance.navigateTo(INCOMING_CALL_PAGE);
// Navigator.push(locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData)));
NavigationService.instance.navigateTo(INCOMING_CALL_PAGE);
// });
// if (!isPageNavigated) {
// isPageNavigated = true;

@ -3,8 +3,6 @@ import 'dart:ui';
import 'package:camera/camera.dart';
import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart';
import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart';
import 'package:diplomaticquarterapp/pages/conference/conference_page.dart';
import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page.dart';
import 'package:diplomaticquarterapp/pages/conference/widgets/platform_exception_alert_dialog.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -350,12 +348,12 @@ class _IncomingCallState extends State<IncomingCall> with SingleTickerProviderSt
// ConferencePage(roomModel: roomModel),
// ),
// );
await Navigator.of(context).push(
MaterialPageRoute<ConferencePage>(
fullscreenDialog: true,
builder: (BuildContext context) => CallHomePage(),
),
);
// await Navigator.of(context).push( // todo temporary comment lines for call
// MaterialPageRoute<ConferencePage>(
// fullscreenDialog: true,
// builder: (BuildContext context) => CallHomePage(),
// ),
// );
} catch (err) {
print(err);
await PlatformExceptionAlertDialog(

@ -223,7 +223,7 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
openInvoice() {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: projectViewModel.user.emailAddress,
onTapSendEmail: () {
sendInvoiceEmail(context);

@ -57,7 +57,7 @@ class _LiveCarePendingRequestState extends State<LiveCarePendingRequest> {
duration: widget.pendingERRequestHistoryList.watingtimeInteger * 60,
width: MediaQuery.of(context).size.width / 2,
height: MediaQuery.of(context).size.height / 2,
color: Colors.white,
ringColor: Colors.white,
fillColor: CustomColors.green,
strokeWidth: 7.0,
textStyle: TextStyle(fontSize: 32.0, color: Color(0xff2E303A), fontWeight: FontWeight.w400),

@ -107,7 +107,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
return Scaffold(
backgroundColor: Color(0xfff8f8f8),
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(

@ -21,7 +21,7 @@ class LoginType extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xfff8f8f8),
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(

@ -281,7 +281,7 @@ class _ReminderPageState extends State<ReminderPage> {
void confirmSelectDayDialog() {
showDialog(
context: context,
child: DayCheckBoxDialog(
builder: (cxt) => DayCheckBoxDialog(
title: 'Select Day',
selectedDaysOfWeek: widget.daysOfWeek,
onValueSelected: (value) {

@ -101,7 +101,7 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
];
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex:
beneficiaryType == BeneficiaryType.MyAccount ? 0 : (beneficiaryType == BeneficiaryType.MyFamilyFiles ? 1 : (beneficiaryType == BeneficiaryType.OtherAccount ? 2 : -1)),
@ -359,7 +359,7 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
];
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedHospitalIndex,
isScrollable: true,
@ -380,7 +380,7 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
];
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
isScrollable: true,
selectedIndex: _selectedPatientIndex,
@ -404,7 +404,7 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
];
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
isScrollable: true,
selectedIndex: _selectedFamilyMemberIndex,

@ -189,7 +189,7 @@ class _NewTextFieldsState extends State<NewTextFields> {
autofocus: widget.autoFocus ?? false,
validator: widget.validator,
onSaved: widget.onSaved,
style: Theme.of(context).textTheme.body2.copyWith(
style: Theme.of(context).textTheme.bodyText2.copyWith(
fontSize: widget.fontSize, fontWeight: widget.fontWeight),
inputFormatters: widget.keyboardType == TextInputType.phone
? <TextInputFormatter>[

@ -106,7 +106,7 @@ class ClassesPage extends StatelessWidget {
void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();

@ -167,7 +167,7 @@ class ContactLensPage extends StatelessWidget {
void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();

@ -167,7 +167,7 @@ class _EyeHomePageState extends State<EyeHomePage> with SingleTickerProviderStat
void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();

@ -9,8 +9,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
@ -96,7 +94,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: weightUnit,
onValueSelected: (index) {
@ -198,7 +196,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
onTap: () {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).removeMeasure,
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);

@ -57,7 +57,7 @@ class _WeightHomePageState extends State<WeightHomePage> with SingleTickerProvid
onPressed: () {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () async {
GifLoaderDialogUtils.showMyDialog(context);

@ -106,7 +106,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: measuredArm,
onValueSelected: (index) {

@ -127,7 +127,7 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
() {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () async {
GifLoaderDialogUtils.showMyDialog(context);

@ -214,7 +214,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
onTap: () {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).removeMeasure,
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
@ -301,7 +301,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedMeasureUnitIndex,
onValueSelected: (index) {
@ -320,7 +320,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedMeasureTimeIndex,
isScrollable: true,

@ -135,7 +135,7 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage> with SingleTick
() {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () async {
GifLoaderDialogUtils.showMyDialog(context);

@ -13,12 +13,7 @@ class CurvedChartBloodPressure extends StatelessWidget {
final int indexes;
final double horizontalInterval;
CurvedChartBloodPressure(
{this.title,
this.timeSeries1,
this.indexes,
this.timeSeries2,
this.horizontalInterval = 20.0});
CurvedChartBloodPressure({this.title, this.timeSeries1, this.indexes, this.timeSeries2, this.horizontalInterval = 20.0});
List<int> xAxixs = List();
List<double> yAxixs = List();
@ -43,8 +38,7 @@ class CurvedChartBloodPressure extends StatelessWidget {
),
Text(
title,
style: TextStyle(
color: Colors.black, fontSize: 15, letterSpacing: 2),
style: TextStyle(color: Colors.black, fontSize: 15, letterSpacing: 2),
textAlign: TextAlign.center,
),
SizedBox(
@ -52,8 +46,7 @@ class CurvedChartBloodPressure extends StatelessWidget {
),
Expanded(
child: Padding(
padding:
const EdgeInsets.only(right: 18.0, left: 16.0, top: 15),
padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15),
child: LineChart(
sampleData1(context),
swapAnimationDuration: const Duration(milliseconds: 250),
@ -72,9 +65,7 @@ class CurvedChartBloodPressure extends StatelessWidget {
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Theme.of(context).primaryColor),
decoration: BoxDecoration(shape: BoxShape.rectangle, color: Theme.of(context).primaryColor),
),
SizedBox(
width: 5,
@ -90,8 +81,7 @@ class CurvedChartBloodPressure extends StatelessWidget {
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
shape: BoxShape.rectangle, color: secondaryColor),
decoration: BoxDecoration(shape: BoxShape.rectangle, color: secondaryColor),
),
SizedBox(
width: 5,
@ -124,19 +114,17 @@ class CurvedChartBloodPressure extends StatelessWidget {
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
touchCallback: (touchEvent, LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(
show: true, drawVerticalLine: true, drawHorizontalLine: true),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontSize: 10,
),
margin: 22,
getTitles: (value) {
if (timeSeries1.length < 15) {
@ -145,10 +133,8 @@ class CurvedChartBloodPressure extends StatelessWidget {
} else
return '';
} else {
if (value.toInt() == 0)
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
if (value.toInt() == timeSeries1.length - 1)
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
if (value.toInt() == 0) return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
if (value.toInt() == timeSeries1.length - 1) return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
if (xAxixs.contains(value.toInt())) {
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
}
@ -158,9 +144,12 @@ class CurvedChartBloodPressure extends StatelessWidget {
),
leftTitles: SideTitles(
showTitles: true,
interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200,
getTextStyles: (value) => const TextStyle(
interval: getMaxY() - getMinY() <= 500
? 50
: getMaxY() - getMinY() <= 1000
? 100
: 200,
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,

@ -163,14 +163,14 @@ class LineChartCurved extends StatelessWidget {
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
touchCallback: (touchEvent, LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontSize: 10,
),
@ -194,7 +194,7 @@ class LineChartCurved extends StatelessWidget {
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,

@ -113,14 +113,14 @@ class MonthCurvedChartBloodPressure extends StatelessWidget {
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
touchCallback: (touchEvent, LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontSize: 10,
),
@ -138,7 +138,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget {
? 30
: 40,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,

@ -87,7 +87,7 @@ class MonthLineChartCurved extends StatelessWidget {
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
touchCallback: (touchEvent, LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(
@ -100,7 +100,7 @@ class MonthLineChartCurved extends StatelessWidget {
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontSize: 10,
),
@ -111,7 +111,7 @@ class MonthLineChartCurved extends StatelessWidget {
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,

@ -66,7 +66,7 @@ class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
void showConfirmMessage(PatientSickLeaveViewMode model, int index) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () {
model.sendSickLeaveEmail(

@ -7,14 +7,14 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -39,6 +39,7 @@ class PrescriptionDeliveryAddressPage extends StatefulWidget {
class _PrescriptionDeliveryAddressPageState extends State<PrescriptionDeliveryAddressPage> {
AddressInfo _selectedAddress;
int _selectedAddressIndex = -1;
Completer<GoogleMapController> _controller = Completer();
CameraPosition _kGooglePlex = CameraPosition(
@ -86,55 +87,58 @@ class _PrescriptionDeliveryAddressPageState extends State<PrescriptionDeliveryAd
children: [
Expanded(
child: SingleChildScrollView(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.only(left: 12, right: 12, bottom: 12, top: 12),
decoration: cardRadius(12),
child: Container(
child: InkWell(
onTap: () => confirmSelectLocationDialog(model.addressesList),
child: Container(
padding: EdgeInsets.all(8),
width: double.infinity,
// height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
getAddressName(),
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: -0.45,
),
),
CommonDropDownView(TranslationBase.of(context).selectAddress, getAddressName(), () {
List<RadioSelectionDialogModel> list = [
for (int i = 0; i < model.addressesList.length; i++) RadioSelectionDialogModel(model.addressesList[i].address1, i),
];
showDialog(
context: context,
builder: (cxt) => RadioSelectionDialog(
listData: list,
isScrollable: true,
selectedIndex: _selectedAddressIndex,
onValueSelected: (index) {
_selectedAddressIndex = index;
_selectedAddress = model.addressesList[index];
List latLongArr = _selectedAddress.latLong.split(',');
latitude = double.parse(latLongArr[0]);
longitude = double.parse(latLongArr[1]);
markers = Set();
markers.add(
Marker(
markerId: MarkerId(
_selectedAddress.latLong.hashCode.toString(),
),
Icon(Icons.arrow_drop_down)
],
),
),
position: LatLng(latitude, longitude),
),
);
_kGooglePlex = CameraPosition(
target: LatLng(latitude, longitude),
zoom: 14.4746,
);
setState(() {});
},
),
height: 50,
width: double.infinity,
),
),
);
}).withBorderedContainer,
SizedBox(height: 12),
InkWell(
onTap: () async {
Navigator.push(
context,
FadePage(
page: LocationPage(
latitude: latitude,
longitude: longitude,
)),
page: LocationPage(
latitude: latitude,
longitude: longitude,
),
),
).then((value) {
if (value != null && value is AddNewAddressRequestModel) {
setState(() {
@ -179,140 +183,108 @@ class _PrescriptionDeliveryAddressPageState extends State<PrescriptionDeliveryAd
}
});
},
child: Padding(
padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8),
child: Row(
children: [
Icon(Icons.add_circle_outline_sharp),
mWidth(12),
Text(
TranslationBase.of(context).addNewAddress,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
),
child: Row(
children: [
Icon(Icons.add_circle_outline_sharp),
mWidth(12),
Text(
TranslationBase.of(context).addNewAddress,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
),
],
),
),
],
),
),
SizedBox(height: 12),
if (_selectedAddress != null)
Container(
decoration: cardRadius(12),
margin: EdgeInsets.all(12),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).selectAddress + ":",
fontSize: 12,
color: CustomColors.grey,
fontWeight: FontWeight.w600,
),
mHeight(12),
Container(
height: 175,
decoration: containerColorRadiusBorder(Colors.white, 12, Colors.grey),
decoration: cardRadius(15),
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).selectAddress + ":",
style: TextStyle(fontSize: 14, color: Color(0xff575757), fontWeight: FontWeight.w600, letterSpacing: -0.56),
),
mHeight(12),
Container(
height: 175,
decoration: containerColorRadiusBorder(Colors.white, 12, Color(0xffDDDDDD)),
clipBehavior: Clip.antiAlias,
child: Container(
decoration: cardRadius(10),
clipBehavior: Clip.antiAlias,
child: Container(
decoration: cardRadius(12),
clipBehavior: Clip.antiAlias,
margin: const EdgeInsets.all(0),
// child: GoogleMap(
// mapType: MapType.normal,
// markers: markers,
// initialCameraPosition: _kGooglePlex,
// onMapCreated: (GoogleMapController controller) {
// _controller.complete(controller);
// },
// ),
child: Image.network(
"https://maps.googleapis.com/maps/api/staticmap?center=" +
_kGooglePlex.target.latitude.toString() +
"," +
_kGooglePlex.target.longitude.toString() +
"&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" +
_kGooglePlex.target.latitude.toString() +
"," +
_kGooglePlex.target.longitude.toString() +
"&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8",
width: double.infinity,
height: double.infinity,
fit: BoxFit.cover,
),
margin: const EdgeInsets.all(0),
child: Image.network(
"https://maps.googleapis.com/maps/api/staticmap?center=" +
_kGooglePlex.target.latitude.toString() +
"," +
_kGooglePlex.target.longitude.toString() +
"&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" +
_kGooglePlex.target.latitude.toString() +
"," +
_kGooglePlex.target.longitude.toString() +
"&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8",
width: double.infinity,
height: double.infinity,
fit: BoxFit.cover,
),
),
SizedBox(
height: 10,
),
Texts(
TranslationBase.of(context).shippingAddresss + ":",
fontSize: 12,
color: CustomColors.grey,
fontWeight: FontWeight.w600,
),
SizedBox(
height: 2,
),
Texts(
'${model.user.firstName} ${model.user.lastName}',
fontSize: 12,
fontWeight: FontWeight.w600,
),
Texts(
_selectedAddress.address1,
fontSize: 12,
fontWeight: FontWeight.w600,
),
Texts(
_selectedAddress.address2,
fontSize: 12,
fontWeight: FontWeight.w600,
),
Texts(
_selectedAddress.city + " " + _selectedAddress.country,
fontSize: 12,
fontWeight: FontWeight.w600,
),
],
),
),
SizedBox(height: 18),
Text(
TranslationBase.of(context).shippingAddresss + ":",
style: TextStyle(fontSize: 14, color: Color(0xff575757), fontWeight: FontWeight.w600, letterSpacing: -0.56),
),
SizedBox(height: 2),
Text(
'${model.user.firstName} ${model.user.lastName}',
style: TextStyle(fontSize: 12, color: Color(0xff2B353E), fontWeight: FontWeight.w600, letterSpacing: -0.48),
),
Text(
_selectedAddress.address1,
style: TextStyle(fontSize: 12, color: Color(0xff2B353E), fontWeight: FontWeight.w600, letterSpacing: -0.48),
),
Text(
_selectedAddress.address2,
style: TextStyle(fontSize: 12, color: Color(0xff2B353E), fontWeight: FontWeight.w600, letterSpacing: -0.48),
),
Text(
_selectedAddress.city + " " + _selectedAddress.country,
style: TextStyle(fontSize: 12, color: Color(0xff2B353E), fontWeight: FontWeight.w600, letterSpacing: -0.48),
),
],
),
)
],
),
),
),
Container(
decoration: cardRadius(0),
margin: EdgeInsets.zero,
child: Container(
width: double.infinity,
padding: EdgeInsets.only(left: 16, right: 16, top: 16),
child: Button(
label: TranslationBase.of(context).continues.toUpperCase(),
disabled: _selectedAddress == null,
backgroundColor: _selectedAddress == null ? CustomColors.grey2 : CustomColors.accentColor,
onTap: () {
Navigator.push(
context,
FadePage(
page: PrescriptionOrderOverview(
latitude: latitude,
longitude: longitude,
prescriptionReportEnhList: widget.prescriptionReportEnhList,
prescriptionReportList: widget.prescriptionReportList,
prescriptions: widget.prescriptions,
selectedAddress: _selectedAddress,
DefaultButton(
TranslationBase.of(context).continues.toUpperCase(),
_selectedAddress == null
? null
: () {
Navigator.push(
context,
FadePage(
page: PrescriptionOrderOverview(
latitude: latitude,
longitude: longitude,
prescriptionReportEnhList: widget.prescriptionReportEnhList,
prescriptionReportList: widget.prescriptionReportList,
prescriptions: widget.prescriptions,
selectedAddress: _selectedAddress,
),
),
),
);
},
),
),
),
);
},
disabledColor: CustomColors.grey2,
).insideContainer,
],
),
),
@ -325,7 +297,7 @@ class _PrescriptionDeliveryAddressPageState extends State<PrescriptionDeliveryAd
) {
showDialog(
context: context,
child: SelectLocationDialog(
builder: (cxt) => SelectLocationDialog(
addresses: addresses,
selectedAddress: _selectedAddress,
onValueSelected: (value) {
@ -355,9 +327,6 @@ class _PrescriptionDeliveryAddressPageState extends State<PrescriptionDeliveryAd
}
String getAddressName() {
if (_selectedAddress != null)
return _selectedAddress.address1;
else
return TranslationBase.of(context).selectAddress;
return _selectedAddress?.address1 ?? "";
}
}

@ -184,7 +184,7 @@ class PrescriptionOrderOverview extends StatelessWidget {
() async {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).confirmPrescription,
okTitle: TranslationBase.of(context).ok,
onTap: () async {
@ -225,7 +225,7 @@ class PrescriptionOrderOverview extends StatelessWidget {
void showErrorDialog(BuildContext context, String error) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).youAlreadyHaveOrder,
okTitle: TranslationBase.of(context).orderOverview,
onTap: () {

@ -28,7 +28,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
body: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(21, 21, 21, 0),
padding: const EdgeInsets.fromLTRB(21, 21, 21, 10),
child: Container(
width: double.infinity,
padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12),
@ -50,7 +50,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
prescriptionReport.imageSRCUrl,
prescriptionReport?.imageSRCUrl ?? "",
fit: BoxFit.cover,
width: 60,
height: 70,
@ -60,7 +60,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? ''),
child: Texts((prescriptionReport?.itemDescription ?? "").isNotEmpty ? prescriptionReport?.itemDescription ?? "" : prescriptionReport?.itemDescriptionN ?? ''),
),
),
)
@ -72,7 +72,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
? Expanded(
child: ListView.builder(
scrollDirection: Axis.vertical,
padding: EdgeInsets.all(21),
padding: EdgeInsets.fromLTRB(21, 11, 21, 21),
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
GetHMGLocationsModel location = GetHMGLocationsModel();

@ -1,279 +1,216 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart';
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart';
import 'package:provider/provider.dart';
class PrescriptionDetailsPageINP extends StatelessWidget {
final PrescriptionReportINP prescriptionReport;
final Prescriptions prescriptions;
PrescriptionDetailsPageINP({Key key, this.prescriptionReport});
PrescriptionDetailsPageINP({Key key, this.prescriptionReport, this.prescriptions});
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).prescriptions,
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: double.infinity,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
prescriptionReport.imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(prescriptionReport.itemDescription.isNotEmpty
? prescriptionReport.itemDescription
: prescriptionReport.itemDescriptionN ?? ''),
),
),
)
],
),
),
Container(
margin: EdgeInsets.all(8),
child: Row(
children: [
Expanded(
child: InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PharmacyForPrescriptionsPage(
itemID: prescriptionReport.itemID,
),
),
),
child: Center(
child: Column(
children: <Widget>[
Container(
width: 50,
decoration: BoxDecoration(color: Colors.white, shape: BoxShape.rectangle),
child: Column(
children: <Widget>[
Icon(
Icons.pin_drop,
color: Colors.red[800],
size: 55,
),
],
),
),
SizedBox(
height: 5,
),
Texts(TranslationBase.of(context).availability)
],
),
)),
),
_addReminderButton(context)
],
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
DoctorHeader(
headerModel: HeaderModel(
prescriptions.doctorName,
prescriptions.doctorID,
prescriptions.doctorImageURL,
prescriptions.speciality,
"",
prescriptions.name,
DateUtil.convertStringToDate(prescriptions.appointmentDate),
DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)),
prescriptions.nationalityFlagURL,
prescriptions.doctorRate,
prescriptions.actualDoctorRate,
prescriptions.noOfPatientsRate,
"",
),
Container(
color: Colors.white,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
child: Table(
border: TableBorder.symmetric(inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)),
children: [
TableRow(
children: [
Container(
color: Colors.white,
height: 40,
width: double.infinity,
child: Center(
child: Texts(
TranslationBase.of(context).route,
fontSize: 14,
))),
Container(
color: Colors.white,
height: 40,
width: double.infinity,
child: Center(
child: Texts(
TranslationBase.of(context).frequency,
fontSize: 14,
))),
Container(
color: Colors.white,
height: 40,
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 4),
child: Center(
child: Texts(
"${TranslationBase.of(context).dailyDoses}",
fontSize: 14,
))),
Container(
color: Colors.white,
height: 40,
width: double.infinity,
child: Center(
child: Texts(
TranslationBase.of(context).duration,
fontSize: 14,
))),
isNeedToShowButton: false,
),
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.all(21),
children: [
Container(
padding: EdgeInsets.all(14),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10.0)),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
TableRow(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child: Center(child: Text(prescriptionReport.routeN ?? ''))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child: Center(child: Text(prescriptionReport.frequencyN ?? ''))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child: Center(child: Text('${prescriptionReport.doseDailyQuantity}'))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child: Center(child: Text('${prescriptionReport.days}')))
Row(
children: <Widget>[
InkWell(
child: Stack(
alignment: Alignment.center,
children: [
Container(
child: Image.network(
prescriptionReport.imageSRCUrl,
fit: BoxFit.cover,
width: 48,
height: 49,
),
margin: EdgeInsets.zero,
clipBehavior: Clip.antiAlias,
decoration: cardRadius(2000),
),
Container(
child: Icon(
Icons.search,
size: 18,
color: Colors.white,
),
padding: EdgeInsets.all(6),
decoration: containerRadius(Colors.black.withOpacity(0.3), 200),
)
],
),
onTap: () {
showZoomImageDialog(context, prescriptionReport.imageSRCUrl);
},
),
SizedBox(width: 12),
Expanded(
child: Text(
(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64),
),
)
],
),
SizedBox(height: 12),
Table(border: TableBorder(horizontalInside: BorderSide(width: 1, color: Colors.black, style: BorderStyle.solid)), children: [
TableRow(
children: [
Utils.tableColumnTitle(TranslationBase.of(context).route, showDivider: false),
Utils.tableColumnTitle(TranslationBase.of(context).frequency, showDivider: false),
Utils.tableColumnTitle(TranslationBase.of(context).dailyDoses, showDivider: false),
Utils.tableColumnTitle(TranslationBase.of(context).duration, showDivider: false)
],
),
TableRow(
children: [
Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel),
],
),
]),
Text(
TranslationBase.of(context).remarks,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48),
),
Text(
prescriptionReport.remarks,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
],
),
],
),
),
],
),
Container(
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(5),
child: Center(
child: Column(
children: <Widget>[
Texts(TranslationBase.of(context).notes),
SizedBox(
height: 5,
),
Divider(
height: 0.5,
color: Colors.grey[300],
),
SizedBox(
height: 5,
),
Texts(prescriptionReport.remarks ?? ''),
],
),
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: DefaultButton(
TranslationBase.of(context).availability,
() {
Navigator.push(
context,
FadePage(
page: PharmacyForPrescriptionsPage(
itemID: prescriptionReport.itemID,
prescriptionReport: PrescriptionReport.fromJson(prescriptionReport.toJson()),
),
),
);
},
iconData: Icons.location_on,
color: Color(0xff359846),
),
),
),
)
],
),
),
);
}
Widget _addReminderButton(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
SizedBox(width: 10),
Expanded(
child: DefaultButton(
TranslationBase.of(context).addReminder,
() {
DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days);
return GestureDetector(
onTap: () {
DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days);
print(prescriptionReport);
showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5),
transitionBuilder: (context, a1, a2, widget) {
final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
return Transform(
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity(
opacity: a1.value,
child: ReminderDialog(
eventId: prescriptionReport.itemID.toString(),
title: "Prescription Reminder",
description:
"${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
startDate: "/Date(${startDate.millisecondsSinceEpoch}+0300)/",
endDate: "/Date(${endDate.millisecondsSinceEpoch}+0300)/",
location: prescriptionReport.remarks,
showReminderDialog(
context,
endDate,
"",
prescriptionReport.itemID.toString(),
"",
"",
title: "${prescriptionReport.itemDescriptionN} Prescription Reminder",
description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
onSuccess: () {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
},
onMultiDateSuccess: (int selectedIndex) {
setCalender(context, prescriptionReport.itemID.toString(), selectedIndex);
},
);
return;
},
iconData: Icons.notifications_active,
color: Color(0xffD02127),
fontSize: 13.0,
//textColor: Color(0xff2B353E),
),
),
);
},
transitionDuration: Duration(milliseconds: 500),
barrierDismissible: true,
barrierLabel: '',
context: context,
pageBuilder: (context, animation1, animation2) {});
},
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
// height: 100.0,
margin: EdgeInsets.all(7.0),
padding: EdgeInsets.only(bottom: 4.0),
decoration: BoxDecoration(
boxShadow: [BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0)],
borderRadius: BorderRadius.circular(10),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0),
child: Text("add",
overflow: TextOverflow.clip,
style: TextStyle(color: new Color(0xffB8382C), letterSpacing: 1.0, fontSize: 18.0)),
),
Container(
margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
child: Text("reminder",
overflow: TextOverflow.clip,
style: TextStyle(color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)),
),
Container(
alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight,
margin: projectViewModel.isArabic
? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0)
: EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0),
child: Image.asset("assets/images/new-design/reminder_icon.png", width: 45.0, height: 45.0),
),
],
),
),
@ -281,4 +218,57 @@ class PrescriptionDetailsPageINP extends StatelessWidget {
),
);
}
setCalender(BuildContext context, String eventId, int reminderIndex) async {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
int frequencyNumber = int.parse(prescriptionReport?.frequency);
DateTime actualDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 8, 0); //Time will start at 8:00 AM from starting date
if (frequencyNumber == null) frequencyNumber = 1; //Some time frequency number is null so by default will be 2
int remainingDays = prescriptionReport.days - (Jiffy(DateTime.now()).diff(DateUtil.convertStringToDate(prescriptionReport.orderDate), Units.DAY));
GifLoaderDialogUtils.showMyDialog(context);
for (int i = 0; i < remainingDays; i++) {
//event for number of days.
for (int j = 0; j < frequencyNumber ?? 1; j++) {
// event for number of times per day.
if (j != 0) {
actualDate.add(new Duration(hours: 8)); // 8 hours addition for daily dose.
}
//Time subtraction from actual reminder time. like before 30, or 1 hour.
if (reminderIndex == 0) {
// Before 30 mints
actualDate = Jiffy(actualDate).subtract(minutes: 30).dateTime;
// dateTime.add(new Duration(minutes: -30));
} else if (reminderIndex == 1) {
// Before 1 hour
// dateTime.add(new Duration(minutes: -60));
actualDate = Jiffy(actualDate).subtract(hours: 1).dateTime;
} else if (reminderIndex == 2) {
// Before 1 hour and 30 mints
// dateTime.add(new Duration(minutes: -90));
actualDate = Jiffy(actualDate).subtract(hours: 1, minutes: 30).dateTime;
} else if (reminderIndex == 3) {
// Before 2 hours
// dateTime.add(new Duration(minutes: -120));
actualDate = Jiffy(actualDate).subtract(hours: 2).dateTime;
}
calendarUtils
.createOrUpdateEvent(
title: "${prescriptionReport.itemDescriptionN} Prescription Reminder",
description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
scheduleDateTime: actualDate,
eventId: eventId + (i.toString() + j.toString()), //event id with varitions
)
.then((value) {});
actualDate = DateTime(actualDate.year, actualDate.month, actualDate.day, 8, 0);
}
actualDate = Jiffy(actualDate).add(days: 1).dateTime;
print(actualDate);
}
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
GifLoaderDialogUtils.hideDialog(context);
}
}

@ -98,21 +98,6 @@ class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
children: [
Row(
children: <Widget>[
// Container(
// decoration: BoxDecoration(
// border: Border.all(width: 1.0, color: Color(0xffEBEBEB)),
// borderRadius: BorderRadius.all(Radius.circular(30.0)),
// ),
// child: ClipRRect(
// borderRadius: BorderRadius.all(Radius.circular(30)),
// child: Image.network(
// prescriptionReport.imageSRCUrl,
// fit: BoxFit.cover,
// width: 48,
// height: 48,
// ),
// ),
// ),
InkWell(
child: Stack(
alignment: Alignment.center,
@ -257,8 +242,8 @@ class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
checkIfHasReminder() async {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30);
DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120);
DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30).dateTime;
DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120).dateTime;
RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate);
@ -276,8 +261,8 @@ class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
cancelReminders() async {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30);
DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120);
DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30).dateTime;
DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120).dateTime;
RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate);
@ -313,20 +298,20 @@ class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
//Time subtraction from actual reminder time. like before 30, or 1 hour.
if (reminderIndex == 0) {
// Before 30 mints
actualDate = Jiffy(actualDate).subtract(minutes: 30);
actualDate = Jiffy(actualDate).subtract(minutes: 30).dateTime;
// dateTime.add(new Duration(minutes: -30));
} else if (reminderIndex == 1) {
// Before 1 hour
// dateTime.add(new Duration(minutes: -60));
actualDate = Jiffy(actualDate).subtract(hours: 1);
actualDate = Jiffy(actualDate).subtract(hours: 1).dateTime;
} else if (reminderIndex == 2) {
// Before 1 hour and 30 mints
// dateTime.add(new Duration(minutes: -90));
actualDate = Jiffy(actualDate).subtract(hours: 1, minutes: 30);
actualDate = Jiffy(actualDate).subtract(hours: 1, minutes: 30).dateTime;
} else if (reminderIndex == 3) {
// Before 2 hours
// dateTime.add(new Duration(minutes: -120));
actualDate = Jiffy(actualDate).subtract(hours: 2);
actualDate = Jiffy(actualDate).subtract(hours: 2).dateTime;
}
calendarUtils
.createOrUpdateEvent(
@ -338,7 +323,7 @@ class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
.then((value) {});
actualDate = DateTime(actualDate.year, actualDate.month, actualDate.day, 8, 0);
}
actualDate = Jiffy(actualDate).add(days: 1);
actualDate = Jiffy(actualDate).add(days: 1).dateTime;
print(actualDate);
}
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);

@ -79,6 +79,7 @@ class PrescriptionItemsPage extends StatelessWidget {
FadePage(
page: PrescriptionDetailsPageINP(
prescriptionReport: model.prescriptionReportListINP[index],
prescriptions: prescriptions,
),
),
);
@ -410,7 +411,7 @@ class PrescriptionItemsPage extends StatelessWidget {
void showConfirmMessage(BuildContext context, PrescriptionsViewModel model) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () {
model.sendPrescriptionEmail(

@ -110,7 +110,7 @@ class RadiologyDetailsPage extends StatelessWidget {
void showConfirmMessage({FinalRadiology finalRadiology, RadiologyViewModel model}) {
showDialog(
context: AppGlobal.context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () {
model.sendRadReportEmail(mes: TranslationBase.of(AppGlobal.context).sendSuc, finalRadiology: finalRadiology);

@ -121,7 +121,7 @@ class ReportListWidget extends StatelessWidget {
void showConfirmMessage(Reports report) {
showDialog(
context: AppGlobal.context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: emailAddress,
onTapSendEmail: () {
sendReportEmail(report);

@ -20,7 +20,7 @@ class MedicalReports extends StatelessWidget {
void confirmBox(AppointmentHistory model, ReportsViewModel reportsViewModel) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
builder: (cxt) => ConfirmWithMessageDialog(
message: TranslationBase.of(context).confirmMsgReport,
onTap: () => reportsViewModel.insertRequestForMedicalReport(model, TranslationBase.of(context).successSendReport),
),

@ -101,14 +101,14 @@ class LineChartCurved extends StatelessWidget {
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
touchCallback: (touchEvent, LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontSize: 10,
),
@ -132,7 +132,7 @@ class LineChartCurved extends StatelessWidget {
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,

@ -142,14 +142,14 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
touchCallback: (touchEvent, LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontSize: 10,
),
@ -173,7 +173,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,

@ -242,7 +242,7 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
];
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedHospitalIndex,
isScrollable: true,

@ -195,7 +195,7 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
];
showDialog(
context: context,
child: RadioSelectionDialog(
builder: (cxt) => RadioSelectionDialog(
listData: list,
selectedIndex: _selectedClinic,
isScrollable: true,

@ -1,341 +1,341 @@
import 'dart:async';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:async/async.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_animarker/lat_lng_interpolation.dart';
import 'package:flutter_animarker/models/lat_lng_delta.dart';
import 'package:flutter_animarker/models/lat_lng_info.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:location/location.dart';
class TrackDriver extends StatefulWidget {
final OrderDetailModel order;
TrackDriver({this.order});
@override
State<TrackDriver> createState() => _TrackDriverState();
}
class _TrackDriverState extends State<TrackDriver> {
OrderPreviewService _orderServices = locator<OrderPreviewService>();
OrderDetailModel _order;
Completer<GoogleMapController> _controller = Completer();
double CAMERA_ZOOM = 14;
double CAMERA_TILT = 0;
double CAMERA_BEARING = 30;
LatLng SOURCE_LOCATION = null;
LatLng DEST_LOCATION = null;
// for my drawn routes on the map
Set<Polyline> _polylines = Set<Polyline>();
List<LatLng> polylineCoordinates = [];
PolylinePoints polylinePoints;
Set<Marker> _markers = Set<Marker>();
BitmapDescriptor sourceIcon; // for my custom marker pins
BitmapDescriptor destinationIcon; // for my custom marker pins
Location location;// wrapper around the location API
int locationUpdateFreq = 2;
LatLngInterpolationStream _latLngStream;
StreamGroup<LatLngDelta> subscriptions;
@override
void initState() {
super.initState();
_order = widget.order;
DEST_LOCATION = _order.shippingAddress.getLocation();
location = new Location();
polylinePoints = PolylinePoints();
setSourceAndDestinationIcons();
initMarkerUpdateStream();
startUpdatingDriverLocation();
}
@override
void dispose() {
super.dispose();
subscriptions.close();
_latLngStream.cancel();
stopUpdatingDriverLocation();
}
initMarkerUpdateStream(){
_latLngStream = LatLngInterpolationStream(movementDuration: Duration(seconds: locationUpdateFreq+1));
subscriptions = StreamGroup<LatLngDelta>();
subscriptions.add(_latLngStream.getAnimatedPosition('sourcePin'));
subscriptions.stream.listen((LatLngDelta delta) {
//Update the marker with animation
setState(() {
//Get the marker Id for this animation
var markerId = MarkerId(delta.markerId);
Marker sourceMarker = Marker(
markerId: markerId,
// rotation: delta.rotation,
icon: sourceIcon,
position: LatLng(
delta.from.latitude,
delta.from.longitude,
),
onTap: onSourceMarkerTap
);
_markers.removeWhere((m) => m.markerId.value == 'sourcePin');
_markers.add(sourceMarker);
});
});
}
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).deliveryDriverTrack,
isShowAppBar: true,
isPharmacy: true,
showPharmacyCart: false,
showHomeAppBarIcon: false,
body: GoogleMap(
myLocationEnabled: true,
compassEnabled: true,
markers: _markers,
polylines: _polylines,
mapType: MapType.normal,
initialCameraPosition: CameraPosition(target: DEST_LOCATION, zoom: 4),
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
// showPinsOnMap();
},
),
// floatingActionButton: FloatingActionButton.extended(
// onPressed: _goToDriver,
// label: Text('To the lake!'),
// icon: Icon(Icons.directions_boat),
// ),
);
}
void setSourceAndDestinationIcons() async {
final Uint8List srcMarkerBytes = await getBytesFromAsset('assets/images/map_markers/source_map_marker.png', getMarkerIconSize());
final Uint8List destMarkerBytes = await getBytesFromAsset('assets/images/map_markers/destination_map_marker.png', getMarkerIconSize());
sourceIcon = await BitmapDescriptor.fromBytes(srcMarkerBytes);
destinationIcon = await BitmapDescriptor.fromBytes(destMarkerBytes);
}
CameraPosition _orderDeliveryLocationCamera(){
if(DEST_LOCATION != null){
final CameraPosition orderDeliveryLocCamera = CameraPosition(
bearing: CAMERA_BEARING,
target: DEST_LOCATION,
tilt: CAMERA_TILT,
zoom: CAMERA_ZOOM);
return orderDeliveryLocCamera;
}
return null;
}
CameraPosition _driverLocationCamera(){
if(DEST_LOCATION != null) {
final CameraPosition driverLocCamera = CameraPosition(
bearing: CAMERA_BEARING,
target: SOURCE_LOCATION,
tilt: CAMERA_TILT,
zoom: CAMERA_ZOOM);
return driverLocCamera;
}
return null;
}
Future<void> _goToOrderDeliveryLocation() async {
final GoogleMapController controller = await _controller.future;
final CameraPosition orderDeliveryLocCamera = _orderDeliveryLocationCamera();
controller.animateCamera(CameraUpdate.newCameraPosition(orderDeliveryLocCamera));
}
Future<void> _goToDriver() async {
final GoogleMapController controller = await _controller.future;
final CameraPosition driverLocCamera = _driverLocationCamera();
controller.animateCamera(CameraUpdate.newCameraPosition(driverLocCamera));
}
void showPinsOnMap() {
// source pin
if(SOURCE_LOCATION != null){
setState(() {
var pinPosition = SOURCE_LOCATION;
_markers.removeWhere((m) => m.markerId.value == 'sourcePin');
_markers.add(Marker(
markerId: MarkerId('sourcePin'),
position: pinPosition,
icon: sourceIcon,
infoWindow: InfoWindow(title: TranslationBase.of(context).driver),
onTap: onSourceMarkerTap
));
});
}
// destination pin
if(DEST_LOCATION != null){
setState(() {
var destPosition = DEST_LOCATION;
_markers.removeWhere((m) => m.markerId.value == 'destPin');
_markers.add(Marker(
markerId: MarkerId('destPin'),
position: destPosition,
icon: destinationIcon,
infoWindow: InfoWindow(title: TranslationBase.of(context).deliveryLocation),
onTap: onDestinationMarkerTap
));
});
}
// set the route lines on the map from source to destination
// for more info follow this tutorial
// drawRoute();
}
void updatePinOnMap() async {
_latLngStream.addLatLng(LatLngInfo(SOURCE_LOCATION.latitude, SOURCE_LOCATION.longitude, "sourcePin"));
drawRoute();
}
void drawRoute() async {
return; // Ignore draw Route
List<PointLatLng> result = await polylinePoints.getRouteBetweenCoordinates(
GOOGLE_API_KEY,
SOURCE_LOCATION.latitude,
SOURCE_LOCATION.longitude,
DEST_LOCATION.latitude,
DEST_LOCATION.longitude);
if(result.isNotEmpty){
result.forEach((PointLatLng point){
polylineCoordinates.add(
LatLng(point.latitude,point.longitude)
);
});
setState(() {
_polylines.add(Polyline(
width: 5, // set the width of the polylines
polylineId: PolylineId('poly'),
color: Color.fromARGB(255, 40, 122, 198),
points: polylineCoordinates
));
});
}
}
bool isLocationUpdating = false;
startUpdatingDriverLocation({int frequencyInSeconds = 2}) async{
isLocationUpdating = true;
int driverId = int.tryParse(_order.driverID);
Future.doWhile(() async{
if(isLocationUpdating){
await Future.delayed(Duration(seconds: frequencyInSeconds));
showLoading();
LatLng driverLocation = (await _orderServices.getDriverLocation(driverId));
hideLoading();
if(driverLocation != null){
if(SOURCE_LOCATION == null || DEST_LOCATION == null){
SOURCE_LOCATION = driverLocation;
DEST_LOCATION = _order.shippingAddress.getLocation();
showPinsOnMap();
}
SOURCE_LOCATION = driverLocation;
updatePinOnMap();
updateMapCamera();
}else{
GifLoaderDialogUtils.hideDialog(context);
}
}
return isLocationUpdating;
});
}
showLoading(){
if(SOURCE_LOCATION == null){
GifLoaderDialogUtils.showMyDialog(context);
}
}
hideLoading(){
if(SOURCE_LOCATION == null){
GifLoaderDialogUtils.hideDialog(context);
}
}
stopUpdatingDriverLocation(){
isLocationUpdating = false;
}
Future<Uint8List> getBytesFromAsset(String path, int width) async {
ByteData data = await rootBundle.load(path);
ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
ui.FrameInfo fi = await codec.getNextFrame();
return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List();
}
int getMarkerIconSize(){
return 140;
}
updateMapCamera() async{
if(SOURCE_LOCATION != null && DEST_LOCATION != null){
// 'package:google_maps_flutter_platform_interface/src/types/location.dart': Failed assertion: line 72 pos 16: 'southwest.latitude <= northeast.latitude': is not true.
LatLngBounds bound;
if(SOURCE_LOCATION.latitude <= DEST_LOCATION.latitude){
bound = LatLngBounds(southwest: SOURCE_LOCATION, northeast: DEST_LOCATION);
}else{
bound = LatLngBounds(southwest: DEST_LOCATION, northeast: SOURCE_LOCATION);
}
if(bound == null)
return;
CameraUpdate camera = CameraUpdate.newLatLngBounds(bound, 50);
final GoogleMapController controller = await _controller.future;
controller.animateCamera(camera);
}
}
bool showSrcMarkerTitle = false;
onSourceMarkerTap() async{
// showSrcMarkerTitle = !showSrcMarkerTitle;
}
bool showDestMarkerTitle = false;
onDestinationMarkerTap() async{
// showDestMarkerTitle = !showDestMarkerTitle;
// Marker m = _markers.firstWhere((m) => m.markerId.value == 'destPin');
// if(showDestMarkerTitle){
// }
}
}
// import 'dart:async';
// import 'dart:typed_data';
// import 'dart:ui' as ui;
//
// import 'package:async/async.dart';
// import 'package:diplomaticquarterapp/config/config.dart';
// import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
// import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
// import 'package:diplomaticquarterapp/locator.dart';
// import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
// import 'package:flutter_animarker/lat_lng_interpolation.dart';
// import 'package:flutter_animarker/models/lat_lng_delta.dart';
// import 'package:flutter_animarker/models/lat_lng_info.dart';
// import 'package:flutter_polyline_points/flutter_polyline_points.dart';
// import 'package:google_maps_flutter/google_maps_flutter.dart';
// import 'package:location/location.dart';
//
// class TrackDriver extends StatefulWidget {
// final OrderDetailModel order;
// TrackDriver({this.order});
//
// @override
// State<TrackDriver> createState() => _TrackDriverState();
// }
//
// class _TrackDriverState extends State<TrackDriver> {
// OrderPreviewService _orderServices = locator<OrderPreviewService>();
// OrderDetailModel _order;
//
// Completer<GoogleMapController> _controller = Completer();
//
//
// double CAMERA_ZOOM = 14;
// double CAMERA_TILT = 0;
// double CAMERA_BEARING = 30;
// LatLng SOURCE_LOCATION = null;
// LatLng DEST_LOCATION = null;
//
// // for my drawn routes on the map
// Set<Polyline> _polylines = Set<Polyline>();
// List<LatLng> polylineCoordinates = [];
// PolylinePoints polylinePoints;
//
// Set<Marker> _markers = Set<Marker>();
//
// BitmapDescriptor sourceIcon; // for my custom marker pins
// BitmapDescriptor destinationIcon; // for my custom marker pins
// Location location;// wrapper around the location API
//
//
// int locationUpdateFreq = 2;
// LatLngInterpolationStream _latLngStream;
// StreamGroup<LatLngDelta> subscriptions;
//
// @override
// void initState() {
// super.initState();
//
// _order = widget.order;
// DEST_LOCATION = _order.shippingAddress.getLocation();
// location = new Location();
// polylinePoints = PolylinePoints();
// setSourceAndDestinationIcons();
//
// initMarkerUpdateStream();
// startUpdatingDriverLocation();
//
// }
//
// @override
// void dispose() {
// super.dispose();
// subscriptions.close();
// _latLngStream.cancel();
// stopUpdatingDriverLocation();
// }
//
// initMarkerUpdateStream(){
// _latLngStream = LatLngInterpolationStream(movementDuration: Duration(seconds: locationUpdateFreq+1));
// subscriptions = StreamGroup<LatLngDelta>();
//
// subscriptions.add(_latLngStream.getAnimatedPosition('sourcePin'));
// subscriptions.stream.listen((LatLngDelta delta) {
// //Update the marker with animation
// setState(() {
// //Get the marker Id for this animation
// var markerId = MarkerId(delta.markerId);
// Marker sourceMarker = Marker(
// markerId: markerId,
// // rotation: delta.rotation,
// icon: sourceIcon,
// position: LatLng(
// delta.from.latitude,
// delta.from.longitude,
// ),
// onTap: onSourceMarkerTap
// );
//
// _markers.removeWhere((m) => m.markerId.value == 'sourcePin');
// _markers.add(sourceMarker);
// });
// });
// }
//
// @override
// Widget build(BuildContext context) {
//
// return AppScaffold(
// appBarTitle: TranslationBase.of(context).deliveryDriverTrack,
// isShowAppBar: true,
// isPharmacy: true,
// showPharmacyCart: false,
// showHomeAppBarIcon: false,
// body: GoogleMap(
// myLocationEnabled: true,
// compassEnabled: true,
// markers: _markers,
// polylines: _polylines,
// mapType: MapType.normal,
// initialCameraPosition: CameraPosition(target: DEST_LOCATION, zoom: 4),
// onMapCreated: (GoogleMapController controller) {
// _controller.complete(controller);
// // showPinsOnMap();
// },
// ),
// // floatingActionButton: FloatingActionButton.extended(
// // onPressed: _goToDriver,
// // label: Text('To the lake!'),
// // icon: Icon(Icons.directions_boat),
// // ),
// );
// }
//
//
// void setSourceAndDestinationIcons() async {
// final Uint8List srcMarkerBytes = await getBytesFromAsset('assets/images/map_markers/source_map_marker.png', getMarkerIconSize());
// final Uint8List destMarkerBytes = await getBytesFromAsset('assets/images/map_markers/destination_map_marker.png', getMarkerIconSize());
// sourceIcon = await BitmapDescriptor.fromBytes(srcMarkerBytes);
// destinationIcon = await BitmapDescriptor.fromBytes(destMarkerBytes);
// }
//
// CameraPosition _orderDeliveryLocationCamera(){
// if(DEST_LOCATION != null){
// final CameraPosition orderDeliveryLocCamera = CameraPosition(
// bearing: CAMERA_BEARING,
// target: DEST_LOCATION,
// tilt: CAMERA_TILT,
// zoom: CAMERA_ZOOM);
// return orderDeliveryLocCamera;
// }
// return null;
// }
//
// CameraPosition _driverLocationCamera(){
// if(DEST_LOCATION != null) {
// final CameraPosition driverLocCamera = CameraPosition(
// bearing: CAMERA_BEARING,
// target: SOURCE_LOCATION,
// tilt: CAMERA_TILT,
// zoom: CAMERA_ZOOM);
// return driverLocCamera;
// }
// return null;
// }
//
//
// Future<void> _goToOrderDeliveryLocation() async {
// final GoogleMapController controller = await _controller.future;
// final CameraPosition orderDeliveryLocCamera = _orderDeliveryLocationCamera();
// controller.animateCamera(CameraUpdate.newCameraPosition(orderDeliveryLocCamera));
// }
//
// Future<void> _goToDriver() async {
// final GoogleMapController controller = await _controller.future;
// final CameraPosition driverLocCamera = _driverLocationCamera();
// controller.animateCamera(CameraUpdate.newCameraPosition(driverLocCamera));
// }
//
//
// void showPinsOnMap() {
// // source pin
// if(SOURCE_LOCATION != null){
// setState(() {
// var pinPosition = SOURCE_LOCATION;
// _markers.removeWhere((m) => m.markerId.value == 'sourcePin');
// _markers.add(Marker(
// markerId: MarkerId('sourcePin'),
// position: pinPosition,
// icon: sourceIcon,
// infoWindow: InfoWindow(title: TranslationBase.of(context).driver),
// onTap: onSourceMarkerTap
// ));
// });
// }
//
// // destination pin
// if(DEST_LOCATION != null){
// setState(() {
// var destPosition = DEST_LOCATION;
// _markers.removeWhere((m) => m.markerId.value == 'destPin');
// _markers.add(Marker(
// markerId: MarkerId('destPin'),
// position: destPosition,
// icon: destinationIcon,
// infoWindow: InfoWindow(title: TranslationBase.of(context).deliveryLocation),
// onTap: onDestinationMarkerTap
// ));
// });
// }
// // set the route lines on the map from source to destination
// // for more info follow this tutorial
// // drawRoute();
// }
//
// void updatePinOnMap() async {
// _latLngStream.addLatLng(LatLngInfo(SOURCE_LOCATION.latitude, SOURCE_LOCATION.longitude, "sourcePin"));
// drawRoute();
// }
//
// void drawRoute() async {
// return; // Ignore draw Route
//
// List<PointLatLng> result = await polylinePoints.getRouteBetweenCoordinates(
// GOOGLE_API_KEY,
// SOURCE_LOCATION.latitude,
// SOURCE_LOCATION.longitude,
// DEST_LOCATION.latitude,
// DEST_LOCATION.longitude);
// if(result.isNotEmpty){
// result.forEach((PointLatLng point){
// polylineCoordinates.add(
// LatLng(point.latitude,point.longitude)
// );
// });
// setState(() {
// _polylines.add(Polyline(
// width: 5, // set the width of the polylines
// polylineId: PolylineId('poly'),
// color: Color.fromARGB(255, 40, 122, 198),
// points: polylineCoordinates
// ));
// });
// }
// }
//
// bool isLocationUpdating = false;
// startUpdatingDriverLocation({int frequencyInSeconds = 2}) async{
// isLocationUpdating = true;
// int driverId = int.tryParse(_order.driverID);
//
// Future.doWhile(() async{
// if(isLocationUpdating){
//
// await Future.delayed(Duration(seconds: frequencyInSeconds));
//
// showLoading();
// LatLng driverLocation = (await _orderServices.getDriverLocation(driverId));
// hideLoading();
//
// if(driverLocation != null){
// if(SOURCE_LOCATION == null || DEST_LOCATION == null){
// SOURCE_LOCATION = driverLocation;
// DEST_LOCATION = _order.shippingAddress.getLocation();
// showPinsOnMap();
// }
// SOURCE_LOCATION = driverLocation;
// updatePinOnMap();
// updateMapCamera();
// }else{
// GifLoaderDialogUtils.hideDialog(context);
// }
// }
// return isLocationUpdating;
//
// });
// }
//
// showLoading(){
// if(SOURCE_LOCATION == null){
// GifLoaderDialogUtils.showMyDialog(context);
// }
// }
//
// hideLoading(){
// if(SOURCE_LOCATION == null){
// GifLoaderDialogUtils.hideDialog(context);
// }
// }
//
// stopUpdatingDriverLocation(){
// isLocationUpdating = false;
// }
//
// Future<Uint8List> getBytesFromAsset(String path, int width) async {
// ByteData data = await rootBundle.load(path);
// ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
// ui.FrameInfo fi = await codec.getNextFrame();
// return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List();
// }
//
// int getMarkerIconSize(){
// return 140;
// }
//
// updateMapCamera() async{
// if(SOURCE_LOCATION != null && DEST_LOCATION != null){
//
// // 'package:google_maps_flutter_platform_interface/src/types/location.dart': Failed assertion: line 72 pos 16: 'southwest.latitude <= northeast.latitude': is not true.
// LatLngBounds bound;
// if(SOURCE_LOCATION.latitude <= DEST_LOCATION.latitude){
// bound = LatLngBounds(southwest: SOURCE_LOCATION, northeast: DEST_LOCATION);
// }else{
// bound = LatLngBounds(southwest: DEST_LOCATION, northeast: SOURCE_LOCATION);
// }
//
// if(bound == null)
// return;
//
// CameraUpdate camera = CameraUpdate.newLatLngBounds(bound, 50);
// final GoogleMapController controller = await _controller.future;
// controller.animateCamera(camera);
// }
// }
//
// bool showSrcMarkerTitle = false;
// onSourceMarkerTap() async{
// // showSrcMarkerTitle = !showSrcMarkerTitle;
// }
//
// bool showDestMarkerTitle = false;
// onDestinationMarkerTap() async{
// // showDestMarkerTitle = !showDestMarkerTitle;
// // Marker m = _markers.firstWhere((m) => m.markerId.value == 'destPin');
// // if(showDestMarkerTitle){
// // }
// }
// }

@ -431,7 +431,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: PharmacyAddressesPage()));
Navigator.push(context, FadePage(page: PharmacyAddressesPage()));
},
child: Row(
children: <Widget>[

@ -96,7 +96,7 @@ class _MyVaccinesState extends State<MyVaccines> {
() {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: projectViewModel.user.emailAddress,
onTapSendEmail: () {
model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);

@ -1,7 +1,6 @@
import 'dart:io';
import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart';
import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -49,10 +48,9 @@ class _CallPageState extends State<CallPage> {
super.dispose();
}
@override
Widget build(BuildContext context) {
FirebaseMessaging().getToken().then((value){
FirebaseMessaging.instance.getToken().then((value) {
print('FCM_TOKEN: $value');
});
@ -123,10 +121,9 @@ class _CallPageState extends State<CallPage> {
],
),
);
}
dummyCall() async{
dummyCall() async {
final json = {
"callerID": "12345",
"receiverID": "54321",
@ -146,7 +143,8 @@ class _CallPageState extends State<CallPage> {
"appointmentdate": "Sun, 15th Dec, 2019",
"appointmenttime": "09:00",
"type": "video",
"session_id": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk",
"session_id":
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk",
"identity": "Haroon1",
"name": "SmallDailyStandup",
"videoUrl": "video",
@ -154,26 +152,19 @@ class _CallPageState extends State<CallPage> {
"is_call": "true"
};
IncomingCallData incomingCallData = IncomingCallData.fromJson(json);
IncomingCallData incomingCallData = IncomingCallData.fromJson(json);
final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData)));
}
fcmConfigure(){
FirebaseMessaging().configure(
onMessage: (message) async{
print(message.toString());
fcmConfigure() {
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
print(message.toString());
IncomingCallData incomingCallData;
if(Platform.isAndroid)
incomingCallData = IncomingCallData.fromJson(message['data']);
else if(Platform.isIOS)
incomingCallData = IncomingCallData.fromJson(message);
if(incomingCallData != null)
final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData)));
}
);
IncomingCallData incomingCallData;
if (Platform.isAndroid)
incomingCallData = IncomingCallData.fromJson(message.data['data']);
else if (Platform.isIOS) incomingCallData = IncomingCallData.fromJson(message.data);
if (incomingCallData != null) final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData)));
});
}
}

@ -31,7 +31,7 @@ class LocalNotification {
_initialize() {
var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon');
var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null);
var initializationSettings = InitializationSettings(initializationSettingsAndroid, initializationSettingsIOS);
var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS);
flutterLocalNotificationsPlugin.initialize(initializationSettings, onSelectNotification: _onNotificationClick);
}
@ -53,10 +53,10 @@ class LocalNotification {
Future showNow({@required String title, @required String subtitle, String payload}) {
Future.delayed(Duration(seconds: 1)).then((result) async {
var androidPlatformChannelSpecifics =
AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern());
var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG',
channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern());
var iOSPlatformChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) {
print(err);
});
@ -71,7 +71,8 @@ class LocalNotification {
vibrationPattern[2] = 5000;
vibrationPattern[3] = 2000;
var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', 'ActivePrescriptionsDescription',
var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions',
channelDescription: 'ActivePrescriptionsDescription',
// icon: 'secondary_icon',
sound: RawResourceAndroidNotificationSound('slow_spring_board'),
@ -86,14 +87,14 @@ class LocalNotification {
var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff');
// /change it to be as ionic
var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics);
}
///Repeat notification every day at approximately 10:00:00 am
Future showDailyAtTime() async {
var time = Time(10, 0, 0);
var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', 'repeatDailyAtTime description');
var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description');
var iOSPlatformChannelSpecifics = IOSNotificationDetails();
// var platformChannelSpecifics = NotificationDetails(
// androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
@ -108,7 +109,7 @@ class LocalNotification {
///Repeat notification weekly on Monday at approximately 10:00:00 am
Future showWeeklyAtDayAndTime() async {
var time = Time(10, 0, 0);
var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', 'show weekly description');
var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description');
var iOSPlatformChannelSpecifics = IOSNotificationDetails();
// var platformChannelSpecifics = NotificationDetails(
// androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);

@ -4,13 +4,13 @@ import '../widgets/Loader/gif_loader_container.dart';
class GifLoaderDialogUtils {
static showMyDialog(BuildContext context) {
showDialog(context: context, child: GifLoaderContainer());
showDialog(context: context, builder: (cxt) => GifLoaderContainer());
}
static hideDialog(BuildContext context) {
try{
try {
Navigator.of(context).pop();
}catch(error){
} catch (error) {
Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context).pop());
}
}

@ -23,7 +23,7 @@ class ImageOptions {
icon: Icons.image,
onTap: () async {
File _image =
await ImagePicker.pickImage(source: ImageSource.gallery, imageQuality: 20);
File((await ImagePicker.platform.pickImage(source: ImageSource.gallery, imageQuality: 20)).path);
String fileName = _image.path;
final bytes = File(fileName).readAsBytesSync();
String base64Encode = base64.encode(bytes);
@ -37,7 +37,7 @@ class ImageOptions {
icon: Icons.camera_alt,
onTap: () async {
File _image =
await ImagePicker.pickImage(source: ImageSource.camera, imageQuality: 20);
File((await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20)).path);
String fileName = _image.path;
final bytes = File(fileName).readAsBytesSync();
String base64Encode = base64.encode(bytes);

@ -1,5 +1,3 @@
import 'dart:math' as math;
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
@ -13,6 +11,7 @@ class LineChartModel {
class CustomLineChart extends StatefulWidget {
final List<LineChartModel> list;
final bool isArabic;
CustomLineChart(this.list, this.isArabic);
@override
@ -81,7 +80,7 @@ class _CustomLineChartState extends State<CustomLineChart> {
SideTitles left = SideTitles(
showTitles: true,
interval: 1,
getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0),
getTextStyles: (cxt, value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0),
getTitles: (value) {
if (widget.list.isEmpty) {
return (value).toInt().toString();
@ -110,7 +109,7 @@ class _CustomLineChartState extends State<CustomLineChart> {
showTitles: true,
reservedSize: 22,
interval: 1,
getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0),
getTextStyles: (cxt, value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0),
getTitles: (value) {
String _title = list[value.toInt()].title;
return (_title.length > 3 ? (widget.isArabic ? _title : _title.substring(0, 3)) : _title).toUpperCase();

@ -102,21 +102,21 @@ class ShowChart extends StatelessWidget {
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
touchCallback: (touchEvent, LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontSize: 10,
),
rotateAngle: -65,
margin: 22,
getTitles: (value) {
if(isWeeklyOrMonthly) {
if (isWeeklyOrMonthly) {
return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.month}';
} else {
if (timeSeries.length < 15) {
@ -137,7 +137,7 @@ class ShowChart extends StatelessWidget {
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
getTextStyles: (cxt, value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 10,

@ -132,7 +132,7 @@ class LabResultWidget extends StatelessWidget {
void showConfirmMessage(BuildContext context, String email, String isOutsideKSA) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
generateCovidCertificate(context, isOutsideKSA);

@ -76,14 +76,14 @@ class LineChartCurvedState extends State<LineChartCurved> {
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
touchCallback: (touchEvent, LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(show: true, drawVerticalLine: false, drawHorizontalLine: true),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12),
getTextStyles: (cxt, value) => TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12),
margin: 8,
rotateAngle: -0,
getTitles: (value) {
@ -107,7 +107,7 @@ class LineChartCurvedState extends State<LineChartCurved> {
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12),
getTextStyles: (cxt, value) => TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12),
getTitles: (value) {
return '${value}';

@ -77,27 +77,38 @@ class RadioSelectionDialogState extends State<RadioSelectionDialog> {
shrinkWrap: !widget.isScrollable,
padding: EdgeInsets.only(bottom: widget.isScrollable ? 21 : 42, top: 10),
itemBuilder: (context, index) {
return Row(
children: [
SizedBox(
width: 22,
height: 22,
child: Radio(
value: widget.listData[index].value,
groupValue: selectedIndex,
onChanged: (value) {
setState(() {
selectedIndex = value;
});
},
return InkWell(
onTap: () {
setState(() {
selectedIndex = widget.listData[index].value;
});
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 22,
height: 22,
child: Radio(
value: widget.listData[index].value,
groupValue: selectedIndex,
onChanged: (value) {
setState(() {
selectedIndex = value;
});
},
),
),
),
SizedBox(width: 8),
Text(
widget.listData[index].title,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56),
),
],
SizedBox(width: 8),
Expanded(
child: Text(
widget.listData[index].title,
// maxLines: 2,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56),
),
),
],
),
);
},
separatorBuilder: (context, index) => SizedBox(height: 10),
@ -110,7 +121,7 @@ class RadioSelectionDialogState extends State<RadioSelectionDialog> {
Expanded(
child: DefaultButton(
TranslationBase.of(context).save,
(){
() {
Navigator.pop(context);
widget.onValueSelected(selectedIndex);
},

@ -22,19 +22,17 @@ var _InAppBrowserOptions = InAppBrowserClassOptions(
inAppWebViewGroupOptions: InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true)),
crossPlatform: InAppBrowserOptions(hideUrlBar: true),
ios: IOSInAppBrowserOptions(
toolbarBottom: false,
hideToolbarBottom: false,
));
class MyInAppBrowser extends InAppBrowser {
_PAYMENT_TYPE paymentType;
static String SERVICE_URL =
'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
static String PREAUTH_SERVICE_URL =
'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT
static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT
// static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store
@ -77,17 +75,17 @@ class MyInAppBrowser extends InAppBrowser {
}
@override
Future onLoadStart(String url) async {
Future onLoadStart(Uri url) async {
if (onLoadStartCallback != null) onLoadStartCallback(url);
}
@override
Future onLoadStop(String url) async {
Future onLoadStop(Uri url) async {
print("\n\nStopped $url\n\n");
}
@override
void onLoadError(String url, int code, String message) {
void onLoadError(Uri url, int code, String message) {
print("Can't load $url.. Error: $message");
}
@ -100,18 +98,18 @@ class MyInAppBrowser extends InAppBrowser {
if (onExitCallback != null) onExitCallback(appo, isPaymentDone);
}
@override
Future<ShouldOverrideUrlLoadingAction> shouldOverrideUrlLoading(ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async {
var url = shouldOverrideUrlLoadingRequest.url;
debugPrint("redirecting/overriding to: $url");
if (paymentType == _PAYMENT_TYPE.PACKAGES && [PACKAGES_PAYMENT_SUCCESS_URL, PACKAGES_PAYMENT_FAIL_URL].contains(url)) {
isPaymentDone = (url == PACKAGES_PAYMENT_SUCCESS_URL);
close();
}
return ShouldOverrideUrlLoadingAction.ALLOW;
}
// @override
// Future<ShouldOverrideUrlLoadingAction> shouldOverrideUrlLoading(ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async {
// var url = shouldOverrideUrlLoadingRequest.url;
// debugPrint("redirecting/overriding to: $url");
//
// if (paymentType == _PAYMENT_TYPE.PACKAGES && [PACKAGES_PAYMENT_SUCCESS_URL, PACKAGES_PAYMENT_FAIL_URL].contains(url)) {
// isPaymentDone = (url == PACKAGES_PAYMENT_SUCCESS_URL);
// close();
// }
//
// return ShouldOverrideUrlLoadingAction.ALLOW;
// }
getLanguageID() async {
return await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
@ -136,7 +134,7 @@ class MyInAppBrowser extends InAppBrowser {
openPackagesPaymentBrowser({@required int customer_id, @required int order_id}) {
paymentType = _PAYMENT_TYPE.PACKAGES;
var full_url = '$PACKAGES_REQUEST_PAYMENT_URL?customer_id=$customer_id&order_id=$order_id';
this.openUrl(url: full_url, options: _InAppBrowserOptions);
this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(full_url)), options: _InAppBrowserOptions);
}
openPaymentBrowser(double amount, String orderDesc, String transactionID, String projId, String emailId, String paymentMethod, dynamic patientType, String patientName, dynamic patientID,
@ -182,9 +180,8 @@ class MyInAppBrowser extends InAppBrowser {
service.applePayInsertRequest(applePayInsertRequest, context).then((res) {
if (context != null) GifLoaderDialogUtils.hideDialog(context);
var url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result'];
print(url);
safariBrowser.open(url: url);
String url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result'];
safariBrowser.open(url: Uri.parse(url));
// this.browser.openUrl(url: url, options: _InAppBrowserOptions);
}).catchError((err) {
print(err);
@ -196,7 +193,7 @@ class MyInAppBrowser extends InAppBrowser {
clinicID, doctorID)
.then((value) {
paymentType = _PAYMENT_TYPE.PATIENT;
this.browser.openUrl(url: value, options: _InAppBrowserOptions);
this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value)), options: _InAppBrowserOptions);
});
}
}
@ -206,13 +203,13 @@ class MyInAppBrowser extends InAppBrowser {
this.browser = browser;
getPatientData();
generatePharmacyURL(order, amount, orderDesc, transactionID, emailId, paymentMethod, patientName, patientID, authenticatedUser).then((value) {
this.browser.openUrl(url: value);
this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value)));
});
}
openBrowser(String url) {
this.browser = browser;
this.browser.openUrl(url: url, options: _InAppBrowserOptions);
this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(url)), options: _InAppBrowserOptions);
}
Future<String> generateURL(double amount, String orderDesc, String transactionID, String projId, String emailId, String paymentMethod, dynamic patientType, String patientName, dynamic patientID,
@ -351,7 +348,7 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser {
final Function onLoadStartCallback;
AppoitmentAllHistoryResultList appo;
MyChromeSafariBrowser(browserFallback, {@required this.onExitCallback, @required this.onLoadStartCallback, @required this.appo}) : super(bFallback: browserFallback);
MyChromeSafariBrowser(browserFallback, {@required this.onExitCallback, @required this.onLoadStartCallback, @required this.appo});
@override
void onOpened() {

@ -176,7 +176,7 @@ class DoctorHeader extends StatelessWidget {
void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
builder: (cxt) => ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();

@ -104,7 +104,7 @@ class _OffersAndPackagesWidgetState extends State<OffersAndPackagesWidget> {
return Container(
child: CarouselSlider.builder(
itemCount: widget.models.length,
itemBuilder: (BuildContext context, int itemIndex) {
itemBuilder: (BuildContext context, int itemIndex,int realIndex) {
var item = widget.models[itemIndex];
return OfferPackagesItemWidget(model: item);
},

@ -269,7 +269,7 @@ class _FloatingSearchButton extends State<FloatingSearchButton> with TickerProvi
}
requestPermissions() async {
if (await Permission.microphone.isDenied || await Permission.microphone.isUndetermined) {
if (await Permission.microphone.isDenied || await Permission.microphone.isPermanentlyDenied) {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();

@ -125,7 +125,7 @@ class _NotAutPageState extends State<NotAutPage> {
Scaffold(
backgroundColor: Color(0xfff8f8f8),
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
@ -6,7 +7,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:sms_otp_auto_verify/sms_otp_auto_verify.dart';
import 'package:sms_retriever/sms_retriever.dart';
import '../otp_widget.dart';
@ -58,6 +59,7 @@ class SMSOTP {
String _code;
dynamic setState;
static String signature;
displayDialog(BuildContext context) async {
return showDialog(
context: context,
@ -84,7 +86,7 @@ class SMSOTP {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SvgPicture.asset(
type == 1 ?"assets/images/new/verify_sms.svg":"assets/images/new/verify_whatsapp.svg",
type == 1 ? "assets/images/new/verify_sms.svg" : "assets/images/new/verify_whatsapp.svg",
height: 50,
width: 50,
),
@ -236,6 +238,10 @@ class SMSOTP {
}
static getSignature() async {
return await SmsRetrieved.getAppSignature();
if (Platform.isAndroid) {
return await SmsRetriever.getAppSignature();
} else {
return null;
}
}
}

@ -5,7 +5,7 @@ description: A new Flutter application.
version: 4.3.5+1
environment:
sdk: ">=2.9.0 <3.0.0"
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
@ -14,58 +14,58 @@ dependencies:
# Localizations
flutter_localizations:
sdk: flutter
intl: ^0.16.0
intl: ^0.17.0
# web view
webview_flutter: ^1.0.7
webview_flutter: ^2.3.1
# http client
http: ^0.12.1
connectivity: ^0.4.9+3
async: ^2.4.2
http: ^0.13.4
connectivity: ^3.0.6
async: ^2.8.1
audio_wave: ^0.0.3
audio_wave: ^0.1.2
# State Management
provider: ^4.3.2+2
provider: ^6.0.1
#Dependency Injection
get_it: ^4.0.2
get_it: ^7.2.0
#Google Fit & Apple HealthKit
fit_kit: ^1.1.2
#chart
fl_chart: ^0.12.3
fl_chart: ^0.40.2
#Camera Preview
camera: ^0.7.0+4
camera: ^0.9.4+5
# Permissions
permission_handler: ^5.1.0+2
permission_handler: ^8.3.0
# Flutter Html View
flutter_html: ^1.2.0
flutter_html: ^2.1.5
# Pagnation
pull_to_refresh: 1.6.2
pull_to_refresh: ^2.0.0
# Native
local_auth: ^0.6.2+3
localstorage: ^3.0.3+6
maps_launcher: ^1.2.1
url_launcher: ^5.5.0
shared_preferences: ^0.5.8
local_auth: ^1.1.8
localstorage: ^4.0.0+1
maps_launcher: ^2.0.1
url_launcher: ^6.0.15
shared_preferences: ^2.0.9
flutter_flexible_toast: ^0.1.4
firebase_messaging: ^7.0.3
firebase_analytics: ^6.3.0
firebase_messaging: ^11.1.0
firebase_analytics: ^8.3.4
# Progress bar
progress_hud_v2: ^2.0.0
percent_indicator: ^2.1.5
percent_indicator: ^3.4.0
# Icons
font_awesome_flutter: any
cupertino_icons: ^1.0.0
# Image Attachments
image_picker: ^0.6.7+1
image_picker: ^0.8.4+4
#GIF image
flutter_gifimage: ^1.0.1
@ -81,15 +81,15 @@ dependencies:
# flutter_local_notifications:
# charts
charts_flutter: ^0.9.0
charts_flutter: ^0.12.0
google_maps_flutter: ^1.0.3
huawei_map: ^5.0.3+303
google_maps_flutter: ^2.1.1
huawei_map: ^6.0.1+304
# Qr code Scanner TODO fix it
# barcode_scanner: ^1.0.1
flutter_polyline_points: ^0.1.0
location: ^2.3.5
flutter_polyline_points: ^1.0.0
location: ^4.3.0
# Qr code Scanner
barcode_scan_fix: ^1.0.2
@ -97,66 +97,62 @@ dependencies:
rating_bar: ^0.2.0
# Calendar
syncfusion_flutter_calendar: ^18.4.49
syncfusion_flutter_calendar: ^19.3.55
# SVG Images
flutter_svg: ^0.19.0
flutter_svg: ^0.23.0+1
#Calendar Events
manage_calendar_events: ^1.0.2
manage_calendar_events: ^2.0.1
#InAppBrowser
flutter_inappwebview: ^4.0.0+4
flutter_inappwebview: ^5.3.2
#Circular progress bar for reverse timer
circular_countdown_timer: ^0.0.5
circular_countdown_timer: ^0.2.0
#Just Audio to play ringing for incoming video call
just_audio: ^0.3.4
just_audio: ^0.9.18
#hijri
hijri: ^2.0.3
#datetime_picker
flutter_datetime_picker: ^1.4.0
flutter_datetime_picker: ^1.5.1
# Carousel
carousel_pro: ^1.0.0
#local_notifications
flutter_local_notifications: ^1.5.0
#rxdart
rxdart: ^0.24.1
flutter_local_notifications: ^9.1.4
#device_calendar
device_calendar: ^3.1.0
#Handle Geolocation
geolocator: ^6.1.10
geolocator: ^7.7.1
jiffy: ^3.0.0
jiffy: ^4.1.0
#Flutter WebRTC
flutter_webrtc: ^0.5.9
flutter_webrtc: ^0.7.1
screen: ^0.0.5
#google maps places
google_maps_place_picker: ^1.0.0
google_maps_place_picker: ^2.1.0-nullsafety.3
#countdown timer for Upcoming List
flutter_countdown_timer: ^1.6.0
flutter_countdown_timer: ^4.1.0
#Dependencies for video call implementation
native_device_orientation: ^0.3.0
enum_to_string: ^1.0.9
wakelock: ^0.2.1+1
after_layout: ^1.0.7
twilio_programmable_video: ^0.6.2
cached_network_image: ^2.4.1
native_device_orientation: ^1.0.0
wakelock: ^0.5.6
after_layout: ^1.1.0
# twilio_programmable_video: ^0.11.0+1
cached_network_image: ^3.1.0+1
flutter_tts:
path: flutter_tts-voice_enhancement
sms_otp_auto_verify: ^1.2.2
wifi: ^0.1.5
vibration: ^1.7.3
@ -165,42 +161,43 @@ dependencies:
speech_to_text:
path: speech_to_text
in_app_update: ^1.1.15
in_app_update: ^2.0.0
in_app_review: ^1.0.4
in_app_review: ^2.0.3
badges: ^1.1.4
syncfusion_flutter_sliders: ^18.4.49-beta
badges: ^2.0.1
syncfusion_flutter_sliders: ^19.3.55
searchable_dropdown: ^1.1.3
dropdown_search: 0.4.9
# Dep by Zohaib
shimmer: ^1.1.2
carousel_slider: ^2.3.1
flutter_material_pickers: 1.7.4
flutter_staggered_grid_view: 0.3.4
flutter_hms_gms_availability: ^1.0.0
shimmer: ^2.0.0
carousel_slider: ^4.0.0
flutter_material_pickers: ^3.1.2
flutter_staggered_grid_view: ^0.4.1
flutter_hms_gms_availability: ^2.0.0
huawei_location:
path: ./hms-plugins/flutter-hms-location
# Marker Animation
flutter_animarker: ^1.0.0
auto_size_text: ^2.0.1
equatable: ^1.2.5
signalr_core: ^1.0.8
wave: ^0.1.0
flutter_animarker: ^3.2.0
auto_size_text: ^3.0.0
equatable: ^2.0.3
signalr_core: ^1.1.1
wave: ^0.2.0
sms_retriever: ^1.0.0
dependency_overrides:
provider : ^5.0.0
permission_handler : ^6.0.1+1
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: any
build_runner: ^2.1.5
flutter:
uses-material-design: true
# assets:
assets:
- assets/images/

@ -10,15 +10,15 @@ environment:
dependencies:
flutter:
sdk: flutter
json_annotation: ^3.0.0
clock: ^1.0.1
json_annotation: ^4.3.0
clock: ^1.1.0
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
json_serializable: ^3.0.0
fake_async: ^1.0.1
build_runner: ^2.1.5
json_serializable: ^6.0.1
fake_async: ^1.2.0
flutter:
plugin:

Loading…
Cancel
Save