file updated

dev_v3.13.6_voipcall
Sultan khan 1 year ago
parent b26f535749
commit aa605a2e47

@ -79,7 +79,7 @@ var routes = {
PACKAGES_ORDER_COMPLETED: (_) => PackageOrderCompletedPage(),
TEST_PAGE: (_) => TestPage(),
HEALTH_WEATHER: (_) => HealthWeatherIndicator(),
APP_UPDATE: (_) => AppUpdatePage(),
APP_UPDATE: (_) => AppUpdatePage(appUpdateText: '',),
SETTINGS: (_) => Settings(),
CART_ORDER_PAGE: (_) => CartOrderPage(),
// CALL_PAGE: (_) => CallPage(),

@ -7,9 +7,9 @@ import 'package:timezone/timezone.dart';
final DeviceCalendarPlugin deviceCalendarPlugin = DeviceCalendarPlugin();
class CalendarUtils {
static Completer<CalendarUtils> _completer;
static Completer<CalendarUtils>? _completer;
Calendar get writableCalendars => calendars?.firstWhere((c) => !c.isReadOnly);
Calendar? get writableCalendars => calendars?.firstWhere((c) => !c.isReadOnly!);
List<Calendar> calendars;
CalendarUtils._(this.calendars);
@ -19,15 +19,15 @@ class CalendarUtils {
_completer = Completer<CalendarUtils>();
try {
final calendarsResult = await deviceCalendarPlugin.retrieveCalendars();
_completer.complete(CalendarUtils._(calendarsResult?.data));
_completer?.complete(CalendarUtils._(calendarsResult?.data!));
} on Exception catch (e) {
_completer.completeError(e);
final Future<CalendarUtils> sharedPrefsFuture = _completer.future;
_completer!.completeError(e);
final Future<CalendarUtils> sharedPrefsFuture = _completer!.future;
_completer = null;
return sharedPrefsFuture;
}
}
return _completer.future;
return _completer!.future;
}
Future createOrUpdateEvents({List<DateTime> scheduleList, String title, String description, List<DateTime> scheduleDateTime, List<DayOfWeek> daysOfWeek}) async {

@ -13,27 +13,27 @@ import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:wifi/wifi.dart';
// import 'package:wifi/wifi.dart';
import 'gif_loader_dialog_utils.dart';
class HMGNetworkConnectivity {
final _platformBridge = PlatformBridge.shared();
final BuildContext context;
Function callBack;
late Function callBack;
final String GUEST_SSID = "HMG-MobileApp";
final String PATIENT_SSID = "GUEST-POC";
HMGNetworkConnectivity(this.context);
AuthenticatedUser userData;
late AuthenticatedUser userData;
start() {
getUserData().then((value) {
userData = value;
checkAndConnectIfNoInternet();
});
// getUserData().then((value) {
// userData = value;
// checkAndConnectIfNoInternet();
// });
}
void checkAndConnectIfNoInternet() async {
@ -46,22 +46,22 @@ class HMGNetworkConnectivity {
String pingUrl = "$BASE_URL$PING_SERVICE";
// pingUrl = "https://captive.apple.com";
String ssid = await Wifi.ssid.catchError((error) {
log(error.toString());
});
// String ssid = await Wifi.ssid.catchError((error) {
// log(error.toString());
// });
bool alreadyConnected = ssid == GUEST_SSID;
// bool alreadyConnected = ssid == GUEST_SSID;
BaseAppClient().simpleGet(pingUrl, onSuccess: (dynamic response, int statusCode) {
log("Having internet with status code: $statusCode");
}, onFailure: (String error, int statusCode) {
if (alreadyConnected)
showFailDailog(TranslationBase.of(context).failedToAccessHmgServices);
else {
confirmFromUser(connectForLocalAccess);
}
});
}
// BaseAppClient().simpleGet(pingUrl, onSuccess: (dynamic response, int statusCode) {
// log("Having internet with status code: $statusCode");
// }, onFailure: (String error, int statusCode) {
// if (alreadyConnected)
// showFailDailog(TranslationBase.of(context).failedToAccessHmgServices);
// else {
// confirmFromUser(connectForLocalAccess);
// }
// });
// }
void confirmFromUser(VoidCallback confirmCallback) {
TranslationBase translator = TranslationBase.of(context);
@ -81,12 +81,12 @@ class HMGNetworkConnectivity {
}).showAlertDialog(context);
}
if (Platform.isAndroid)
Wifi.list(GUEST_SSID).then((value) {
if (!value.indexWhere((element) => element.ssid == GUEST_SSID).isNegative) doIt();
});
else
doIt();
// if (Platform.isAndroid)
// Wifi.list(GUEST_SSID).then((value) {
// if (!value.indexWhere((element) => element.ssid == GUEST_SSID).isNegative) doIt();
// });
// else
// doIt();
}
void showFailDailog(String message) {
@ -101,7 +101,8 @@ class HMGNetworkConnectivity {
}
Future<AuthenticatedUser> getUserData() async {
var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER));
var userData = AuthenticatedUser.fromJson(
await AppSharedPreferences().getObject(MAIN_USER));
return userData;
}
@ -112,76 +113,36 @@ class HMGNetworkConnectivity {
if (value == 0) {
GifLoaderDialogUtils.hideDialog(context);
} else {
getPatientWifiCredentials(patientID, (username, password) async {
final result = await _platformBridge.connectHMGInternetWifi(PATIENT_SSID, username, password).catchError((err) => print(err.toString()));
GifLoaderDialogUtils.hideDialog(context);
if (result == 1) {
// Success
}
});
// getPatientWifiCredentials(patientID, (username, password) async {
// final result = await _platformBridge.connectHMGInternetWifi(PATIENT_SSID, username, password).catchError((err) => print(err.toString()));
// GifLoaderDialogUtils.hideDialog(context);
// if (result == 1) {
// // Success
// }
// });
}
});
}
getPatientWifiCredentials(String patientID, Function(String username, String password) successCallback) {
final body = <String, dynamic>{"PatientID": patientID};
locator<BaseAppClient>().post(WIFI_CREDENTIALS, body: body, onSuccess: (dynamic response, int statusCode) {
print(response);
var data = response["Hmg_SMS_Get_By_ProjectID_And_PatientIDList"];
if (data is List && data.first != null) {
final username = data.first['UserName'];
final password = data.first['Password'];
if (username != null && password != null && username.isNotEmpty && password.isNotEmpty) {
successCallback(username, password);
}
}
}, onFailure: (String error, int statusCode) {
print(error);
}, bypassConnectionCheck: true);
}
// void next() {
// if (Platform.isIOS) {
// confirmFromUser_iOS();
// } else if (Platform.isAndroid) {
// confirmFromUser();
//
// getPatientWifiCredentials(String patientID, Function(String username, String password) successCallback) {
// final body = <String, dynamic>{"PatientID": patientID};
// locator<BaseAppClient>().post(WIFI_CREDENTIALS, body: body, onSuccess: (dynamic response, int statusCode) {
// print(response);
// var data = response["Hmg_SMS_Get_By_ProjectID_And_PatientIDList"];
// if (data is List && data.first != null) {
// final username = data.first['UserName'];
// final password = data.first['Password'];
// if (username != null && password != null && username.isNotEmpty && password.isNotEmpty) {
// successCallback(username, password);
// }
// }
// void confirmFromUser_iOS() {
// String message = "You don't have internet access, Do you want to connect with HMG Network to use App.\n\nMake sure you are in HMG Network range";
// ConfirmDialog(
// context: context,
// confirmMessage: message,
// okText: "Yes",
// okFunction: () {
// ConfirmDialog.closeAlertDialog(context);
// callBack();
// },
// cancelText: "No",
// cancelFunction: () {
// ConfirmDialog.closeAlertDialog(context);
// }).showAlertDialog(context);
// }, onFailure: (String error, int statusCode) {
// print(error);
// }, bypassConnectionCheck: true);
// }
//
// void connect_Android() {
// // enable the Wifi if its off
// PlatformBridge()
// .enableWifiIfNot()
// .then((value) => {
// if (value == true)
// {
// callBack()
// // Wifi.list(SSID)
// // .then((value1) => {
// // if (value1.length > 0) {callBack()} else {log("No HMG network in range")}
// // })
// // .catchError((e) {
// // log(e);
// // })
// }
// })
// .catchError((error) {
// showFailDailog(error);
// });
// }
}
///Commeneted code need to reimplement
}

@ -8,18 +8,18 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
class LocalNotification {
Function(String payload) _onNotificationClick;
static LocalNotification _instance;
Function(String payload)? _onNotificationClick;
static LocalNotification? _instance;
static LocalNotification getInstance() {
static LocalNotification? getInstance() {
return _instance;
}
static init({Function(String payload) onNotificationClick}) {
static init({required Function(String payload) onNotificationClick}) {
if (_instance == null) {
_instance = LocalNotification();
_instance._onNotificationClick = onNotificationClick;
_instance._initialize();
_instance?._onNotificationClick = onNotificationClick;
_instance?._initialize();
} else {
// assert(false,(){
// //TODO fix it
@ -95,7 +95,7 @@ class LocalNotification {
return vibrationPattern;
}
Future showNow({@required String title, @required String subtitle, String payload}) {
Future? showNow({required String title, required String subtitle, required String payload}) {
// Future.delayed(Duration(seconds: 1)).then((result) async {
// var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG',
// channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern());
@ -107,7 +107,7 @@ class LocalNotification {
// });
}
Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async {
Future scheduleNotification({required DateTime scheduledNotificationDateTime, required String title, required String description}) async {
///vibrationPattern
var vibrationPattern = Int64List(4);
vibrationPattern[0] = 0;

@ -7,8 +7,8 @@ import 'package:flutter/services.dart';
class PlatformBridge {
static const platform = const MethodChannel("HMG-Platform-Bridge");
static PlatformBridge _shared;
static BuildContext _context;
static late PlatformBridge _shared;
static late BuildContext _context;
// // Singleton
// static final PlatformBridge _singleton = PlatformBridge._internal();
@ -54,10 +54,10 @@ class PlatformBridge {
//---------------------------------
// Incoming below
//---------------------------------
static Future<String> localizedValue(String forKey) async {
static Future<String?> localizedValue(String forKey) async {
String currentLanguage = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
Object localized = platformLocalizedValues[forKey][currentLanguage];
return (localized != null || (localized is String)) ? localized : forKey;
dynamic localized = platformLocalizedValues[forKey][currentLanguage];
return (localized! != null || (localized! is String)) ? localized! : forKey!;
}
static Future<String> getGeoZones() async {
@ -92,16 +92,16 @@ class PlatformBridge {
static const ASK_DRAW_OVER_APPS_PERMISSION = "askDrawOverAppsPermission";
static const GET_INTENT = "getIntent";
Future<Object> connectHMGInternetWifi(String ssid, username, password) {
Future connectHMGInternetWifi(String ssid, username, password) {
try {
return platform.invokeMethod(hmg_internet_wifi_connect_method, [ssid, username,password]);
return platform!.invokeMethod(hmg_internet_wifi_connect_method!, [ssid!, username!,password!]);
} on PlatformException catch (e) {
print(e);
return Future.error(e);
}
}
Future<Object> connectHMGGuestWifi(String ssid) {
Future connectHMGGuestWifi(String ssid) {
try {
return platform.invokeMethod(hmg_guest_wifi_connect_method, ssid);
} on PlatformException catch (e) {
@ -110,7 +110,7 @@ class PlatformBridge {
}
}
Future<Object> isHMGNetworkAvailable(String ssid) {
Future isHMGNetworkAvailable(String ssid) {
try {
return platform.invokeMethod(is_hmg_network_available_method, ssid);
} on PlatformException catch (e) {

@ -22,20 +22,20 @@ class CupertinoPickerUtils {
/// [backgroundColor] background color
showCupertinoPicker(
{BuildContext context,
List items,
String decKey,
Function onSelectFun,
{BuildContext? context,
List? items,
String? decKey,
Function? onSelectFun,
bool isDismissible = false,
double itemExtent = 25,
bool looping = true,
Color backgroundColor = const Color(0xfff7f7f7)}) {
showModalBottomSheet(
isDismissible: isDismissible,
context: context,
context: context!,
builder: (BuildContext builder) {
return Container(
height: SizeConfig.realScreenHeight * 0.4,
height: SizeConfig.realScreenHeight! * 0.4,
color: backgroundColor,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
@ -60,22 +60,22 @@ class CupertinoPickerUtils {
),
onPressed: () {
Navigator.pop(context);
onSelectFun(cupertinoPickerIndex);
onSelectFun!(cupertinoPickerIndex);
},
),
],
),
),
Container(
height: SizeConfig.realScreenHeight * 0.3,
height: SizeConfig.realScreenHeight! * 0.3,
color: backgroundColor,
child: buildPickerItems(
context: context,
decKey: decKey,
decKey: decKey!,
itemExtent: itemExtent,
items: items,
items: items!,
looping: looping,
onSelectFun: onSelectFun))
onSelectFun: onSelectFun!))
],
),
);
@ -89,24 +89,24 @@ class CupertinoPickerUtils {
/// [onSelectFun] the call function on select event
/// [decKey] the key we show for user
buildPickerItems(
{BuildContext context,
List items,
String decKey,
Function onSelectFun,
double itemExtent,
bool looping}) {
{BuildContext? context,
List? items,
String? decKey,
Function? onSelectFun,
double? itemExtent,
bool? looping}) {
return CupertinoPicker(
magnification: 1.5,
scrollController:
FixedExtentScrollController(initialItem: cupertinoPickerIndex),
children: items.map((item) {
children: items!.map((item) {
return Text(
'${item["$decKey"]}',
style: TextStyle(fontSize: SizeConfig.textMultiplier * 2),
style: TextStyle(fontSize: SizeConfig.textMultiplier! * 2),
);
}).toList(),
itemExtent: itemExtent,
looping: looping,
itemExtent: itemExtent!,
looping: looping!,
onSelectedItemChanged: (int index) {
cupertinoPickerIndex = index;
},

@ -238,7 +238,7 @@ class DateUtil {
}
static getMonthDateTime(String month, yearName) {
DateTime date;
DateTime? date;
try {
date = DateTime(int.parse(yearName), getMonthByName(month));
} catch (e) {

@ -102,29 +102,29 @@ class LaserBodyParts {
"61": imagePng("assets/images/new/body_parts/female/bikini_line.png")
};
Widget getCategoryImage(bool isMale, int category, String mappingCode) {
Widget? getCategoryImage(bool isMale, int category, String mappingCode) {
if (isMale) {
if (category == 1) {
return maleBodyMap[mappingCode];
return maleBodyMap![mappingCode]!;
}
if (category == 2) {
return maleFaceMap[mappingCode];
return maleFaceMap![mappingCode]!;
}
if (category == 11) {
return maleBodyRetouchMap[mappingCode];
return maleBodyRetouchMap![mappingCode]!;
}
} else {
if (category == 1) {
return femaleBodyMap[mappingCode];
return femaleBodyMap![mappingCode]!;
}
if (category == 2) {
return femaleFaceMap[mappingCode];
return femaleFaceMap![mappingCode]!;
}
if (category == 10) {
return femaleBodyBikiniMap[mappingCode];
return femaleBodyBikiniMap![mappingCode]!;
}
if (category == 11) {
return femaleBodyRetouchMap[mappingCode];
return femaleBodyRetouchMap![mappingCode]!;
}
}
return null;

@ -26,9 +26,9 @@ class LocationUtils {
bool isHuawei;
final GeolocatorPlatform _geolocatorPlatform = GeolocatorPlatform.instance;
LocationUtils({@required this.isShowConfirmDialog, @required this.context, this.isHuawei = false});
LocationUtils({required this.isShowConfirmDialog, required this.context, this.isHuawei = false});
void getCurrentLocation({Function(LatLng) callBack}) async {
void getCurrentLocation({required Function(LatLng) callBack}) async {
if (Platform.isAndroid && isHuawei) {
_getHMSCurrentLocation(callBack);
} else {
@ -99,7 +99,7 @@ class LocationUtils {
return true;
}
LocationCallback _locationCallback;
late LocationCallback _locationCallback;
_getHMSCurrentLocation(Function(LatLng) callBack) async {
PermissionHandler permissionHandler = PermissionHandler();
@ -117,10 +117,10 @@ class LocationUtils {
_locationUpdateCbId = await locationService.requestLocationUpdatesCb(
locationRequest,
LocationCallback(onLocationResult: (locationResult) {
Location location = locationResult.lastLocation;
Location location = locationResult.lastLocation!;
locationService.removeLocationUpdatesCb(_locationUpdateCbId);
callBack(LatLng(location.latitude, location.longitude));
setLocation(Position(latitude: location.latitude, longitude: location.longitude, altitude: location.altitude));
callBack(LatLng(location.latitude!, location.longitude!));
setLocation(Position(latitude: location.latitude!, longitude: location.longitude!, altitude: location.altitude!,timestamp: null, accuracy: 1.0, heading: 0.0, speed: 0.0, speedAccuracy: 1));
}, onLocationAvailability: (locationAvailability) {
print("onLocationAvailability: $locationAvailability");
}));
@ -168,6 +168,6 @@ class LocationUtils {
var result = await [
Permission.location,
].request();
return (result[Permission.location].isGranted || result[Permission.locationAlways].isGranted);
return (result[Permission.location]!.isGranted || result[Permission.locationAlways]!.isGranted);
}
}

@ -10,21 +10,21 @@ class NavigationService {
static Future<dynamic> navigateTo(String routeName) {
final key = locator<NavigationService>().navigatorKey;
return key.currentState.pushNamed(routeName);
return key.currentState!.pushNamed(routeName);
}
static Future<dynamic> navigateToPage(Widget page) {
final key = locator<NavigationService>().navigatorKey;
final pageRoute = MaterialPageRoute(builder: (context) => page);
return Navigator.push(key.currentContext, pageRoute);
return Navigator.push(key.currentContext!, pageRoute);
}
}
class Navigate{
static to({@required Widget page}){
static to({required Widget page}){
final context = locator<NavigationService>().navigatorKey.currentContext;
Navigator.of(context).push(_pageRoute(page));
Navigator.of(context!).push(_pageRoute(page));
}
}
BuildContext get currentContext => locator<NavigationService>().navigatorKey.currentContext;
BuildContext? get currentContext => locator<NavigationService>().navigatorKey.currentContext;

@ -57,34 +57,34 @@ Future<dynamic> backgroundMessageHandler(dynamic message) async {
// Push Notification Background <--|
RemoteMessage toFirebaseRemoteMessage(h_push.RemoteMessage message) {
final payload_data = jsonDecode(message.data);
final payload_data = jsonDecode(message.data!);
final fire_message = RemoteMessage(
from: message.from,
collapseKey: message.collapseKey,
data: payload_data['data'],
messageId: message.messageId,
sentTime: DateTime.fromMillisecondsSinceEpoch(message.sentTime * 1000),
sentTime: DateTime.fromMillisecondsSinceEpoch(message.sentTime! * 1000),
ttl: message.ttl,
category: null,
messageType: message.type,
notification: RemoteNotification(
title: message.notification.title,
titleLocArgs: (message.notification.titleLocalizationArgs ?? []).map((e) => e.toString()).toList(),
titleLocKey: message.notification.titleLocalizationKey,
body: message.notification.body,
bodyLocArgs: (message.notification.bodyLocalizationArgs ?? []).map((e) => e.toString()).toList(),
bodyLocKey: message.notification.bodyLocalizationKey,
title: message.notification!.title!,
titleLocArgs: (message.notification!.titleLocalizationArgs! ?? []).map((e) => e.toString()).toList(),
titleLocKey: message.notification!.titleLocalizationKey!,
body: message.notification!.body!,
bodyLocArgs: (message.notification!.bodyLocalizationArgs ?? []).map((e) => e.toString()).toList(),
bodyLocKey: message.notification!.bodyLocalizationKey,
android: AndroidNotification(
channelId: message.notification.channelId,
clickAction: message.notification.clickAction,
color: message.notification.color,
channelId: message.notification!.channelId,
clickAction: message.notification!.clickAction,
color: message.notification!.color,
count: null,
imageUrl: message.notification.imageUrl.path,
link: message.notification.link.path,
smallIcon: message.notification.icon,
sound: message.notification.sound,
ticker: message.notification.ticker,
tag: message.notification.tag,
imageUrl: message.notification!.imageUrl!.path,
link: message.notification!.link!.path,
smallIcon: message.notification!.icon,
sound: message.notification!.sound,
ticker: message.notification!.ticker,
tag: message.notification!.tag,
),
));
return fire_message;
@ -102,11 +102,11 @@ callPage(String sessionID, String token) async {
// }
}
_incomingCall(Map data) async {
_incomingCall(Map<String, dynamic> data) async {
LandingPage.incomingCallData = IncomingCallData.fromJson(data);
if (LandingPage.isOpenCallPage == false) {
LandingPage.isOpenCallPage = true;
final permited = await AppPermission.askVideoCallPermission(currentContext);
final permited = await AppPermission.askVideoCallPermission(currentContext!);
if (permited) await NavigationService.navigateToPage(IncomingCall(incomingCallData: LandingPage.incomingCallData));
LandingPage.isOpenCallPage = false;
}
@ -116,11 +116,11 @@ _incomingCall(Map data) async {
class PushNotificationHandler {
final BuildContext context;
static PushNotificationHandler _instance;
static late PushNotificationHandler _instance;
final voIPKit = FlutterIOSVoIPKit.instance;
HmsApiAvailability hmsApiAvailability;
late HmsApiAvailability hmsApiAvailability;
Timer timeOutTimer;
late Timer timeOutTimer;
bool isTalking = false;
var data = {
@ -167,7 +167,7 @@ class PushNotificationHandler {
// VoIP Callbacks
voIPKit.getVoIPToken().then((value) {
print('🎈 example: getVoIPToken: $value');
AppSharedPreferences().setString(APNS_TOKEN, value);
AppSharedPreferences().setString(APNS_TOKEN, value!);
});
voIPKit.onDidUpdatePushToken = (
@ -241,7 +241,7 @@ class PushNotificationHandler {
h_push.Push.getTokenStream.listen((token) {
onToken(token);
}, onError: (e) => print(e.toString()));
await h_push.Push.getToken('');
h_push.Push.getToken('');
h_push.Push.registerBackgroundMessageHandler(backgroundMessageHandler);
} else {
@ -262,13 +262,13 @@ class PushNotificationHandler {
} else {}
try {
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage message) async {
if (message != null) {
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage? message) async {
if (message! != null) {
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
if (message != null) newMessage(message);
if (message! != null) newMessage(message!);
});
else if (message != null) newMessage(message);
else if (message! != null) newMessage(message!);
}
});
} catch (ex) {}
@ -298,9 +298,9 @@ class PushNotificationHandler {
onToken(fcm_token);
});
FirebaseMessaging.instance.getToken(vapidKey: 'BHRJG8sIzcysWxPw3B6xQjz_85nUuCfU6EAmpH18kyUTmB2cj35IdFwCyWSab80SA1v6oBSWVh-p6PcHPw_y00Y').then((String token) {
print("Push Notification getToken: " + token);
onToken(token);
FirebaseMessaging.instance.getToken(vapidKey: 'BHRJG8sIzcysWxPw3B6xQjz_85nUuCfU6EAmpH18kyUTmB2cj35IdFwCyWSab80SA1v6oBSWVh-p6PcHPw_y00Y').then((String? token) {
print("Push Notification getToken: " + token!);
onToken(token!);
});
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
@ -359,8 +359,8 @@ class PushNotificationHandler {
} else if (Platform.isAndroid) {
Permission.notification.request();
}
} catch (err) {
debugPrint(err);
} catch (_) {
debugPrint(_.toString());
}
}
}

@ -10,7 +10,7 @@ class TranslationBase {
final Locale locale;
static TranslationBase of(BuildContext context) {
return Localizations.of<TranslationBase>(context, TranslationBase);
return Localizations.of<TranslationBase>(context, TranslationBase)!;
}
String by(String key) {

@ -64,7 +64,7 @@ class Utils {
///show custom Error Toast
/// [message] to show for user
static showErrorToast([String message]) {
static showErrorToast([String? message]) {
String localMsg = generateContactAdminMessage();
if (message != null) {
localMsg = message.toString();
@ -98,14 +98,14 @@ class Utils {
FocusScope.of(context).unfocus();
}
static showPermissionConsentDialog(BuildContext context, String message, Function onTap) {
static showPermissionConsentDialog(BuildContext context, String message, VoidCallback? onTap) {
showDialog(
context: context,
builder: (cxt) => CovidConsentDialog(
okTitle: TranslationBase.of(context).acceptLbl,
title: TranslationBase.of(context).covidConsentHeader,
message: message,
onTap: onTap,
onTap: onTap!,
));
}
@ -160,7 +160,7 @@ class Utils {
}
bool validateIDBox(String value, type) {
Pattern pattern = loginIDPattern(type); //r'^\d+(?:\.\d+)?$';
String pattern = loginIDPattern(type).toString(); //r'^\d+(?:\.\d+)?$';
RegExp regex = new RegExp(pattern);
return regex.hasMatch(value);
@ -219,25 +219,25 @@ class Utils {
return RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email);
}
static List<Widget> myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) {
static List<Widget> myMedicalList({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count}) {
List<Widget> medical =[];
medical.add(InkWell(
onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null,
child: isLogin
onTap: () => projectViewModel!.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null,
child: isLogin!
? Stack(children: [
Container(
width: double.infinity,
height: double.infinity,
child: MedicalProfileItem(
title: TranslationBase.of(context).myAppointments,
title: TranslationBase.of(context!).myAppointments,
imagePath: 'appointment_list.svg',
subTitle: TranslationBase.of(context).myAppointmentsList,
subTitle: TranslationBase.of(context!).myAppointmentsList,
hasBadge: true,
isEnable: projectViewModel.havePrivilege(5)),
isEnable: projectViewModel!.havePrivilege(5)),
),
projectViewModel.isArabic
? !projectViewModel.user.isFamily
? !projectViewModel.user!.isFamily
? Positioned(
left: 8,
top: 4,
@ -246,7 +246,7 @@ class Utils {
elevation: 0,
position: badge_import.BadgePosition.topEnd(),
shape: badge_import.BadgeShape.circle,
badgeColor: secondaryColor.withOpacity(1.0),
badgeColor: secondaryColor!.withOpacity(1.0),
borderRadius: BorderRadius.circular(8),
badgeContent: Container(
padding: EdgeInsets.all(2.0),
@ -255,7 +255,7 @@ class Utils {
),
)
: Container()
: !projectViewModel.user.isFamily
: !projectViewModel.user!.isFamily
? Positioned(
right: 8,
top: 4,
@ -264,7 +264,7 @@ class Utils {
elevation: 0,
position: badge_import.BadgePosition.topEnd(),
shape: badge_import.BadgeShape.circle,
badgeColor: secondaryColor.withOpacity(1.0),
badgeColor: secondaryColor!.withOpacity(1.0),
borderRadius: BorderRadius.circular(8),
badgeContent: Container(
padding: EdgeInsets.all(2.0),
@ -275,11 +275,11 @@ class Utils {
: Container(),
])
: MedicalProfileItem(
title: TranslationBase.of(context).myAppointments,
title: TranslationBase.of(context!).myAppointments,
imagePath: 'appointment_list.svg',
subTitle: TranslationBase.of(context).myAppointmentsList,
subTitle: TranslationBase.of(context!).myAppointmentsList,
hasBadge: true,
isEnable: projectViewModel.havePrivilege(5),
isEnable: projectViewModel!.havePrivilege(5),
),
));
@ -596,20 +596,20 @@ class Utils {
});
}
static List<Widget> myMedicalListHomePage({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) {
static List<Widget> myMedicalListHomePage({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count}) {
List<Widget> medical =[];
medical.add(InkWell(
onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null,
child: isLogin
onTap: () => projectViewModel!.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null,
child: isLogin!
? Stack(children: [
MedicalProfileItem(
title: TranslationBase.of(context).myAppointments,
title: TranslationBase.of(context!).myAppointments,
imagePath: 'appointment_list.svg',
subTitle: TranslationBase.of(context).myAppointmentsList,
subTitle: TranslationBase.of(context!).myAppointmentsList,
hasBadge: true,
isEnable: projectViewModel.havePrivilege(5)),
projectViewModel.isArabic
isEnable: projectViewModel!.havePrivilege(5)),
projectViewModel.isArabic!
? !projectViewModel.isLoginChild
? Positioned(
left: 8,
@ -619,7 +619,7 @@ class Utils {
elevation: 0,
position: badge_import.BadgePosition.topEnd(),
shape: badge_import.BadgeShape.circle,
badgeColor: secondaryColor.withOpacity(1.0),
badgeColor: secondaryColor!.withOpacity(1.0),
borderRadius: BorderRadius.circular(8),
badgeContent: Container(
padding: EdgeInsets.all(2.0),
@ -637,7 +637,7 @@ class Utils {
elevation: 0,
position: badge_import.BadgePosition.topEnd(),
shape: badge_import.BadgeShape.circle,
badgeColor: secondaryColor.withOpacity(1.0),
badgeColor: secondaryColor!.withOpacity(1.0),
borderRadius: BorderRadius.circular(8),
badgeContent: Container(
padding: EdgeInsets.all(2.0),
@ -648,11 +648,11 @@ class Utils {
: Container(),
])
: MedicalProfileItem(
title: TranslationBase.of(context).myAppointments,
title: TranslationBase.of(context!).myAppointments,
imagePath: 'appointment_list.svg',
subTitle: TranslationBase.of(context).myAppointmentsList,
subTitle: TranslationBase.of(context!).myAppointmentsList,
hasBadge: true,
isEnable: projectViewModel.havePrivilege(5),
isEnable: projectViewModel!.havePrivilege(5),
),
));
@ -702,7 +702,7 @@ class Utils {
return medical;
}
static Widget loadNetworkImage({@required String url, BoxFit fitting = BoxFit.cover}) {
static Widget loadNetworkImage({required String url, BoxFit fitting = BoxFit.cover}) {
return CachedNetworkImage(
placeholderFadeInDuration: Duration(milliseconds: 250),
fit: fitting,
@ -717,7 +717,7 @@ class Utils {
});
}
static bool route(Route route, {@required Type equalsTo}) {
static bool route(Route route, {required Type equalsTo}) {
if ((route is FadePage)) {
return route.page.runtimeType == equalsTo;
}
@ -725,7 +725,7 @@ class Utils {
}
static navigateToCartPage() {
Navigator.pushAndRemoveUntil(locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 3)), (Route<dynamic> r) => false);
Navigator.pushAndRemoveUntil(locator<NavigationService>()!.navigatorKey!.currentContext!, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 3)), (Route<dynamic> r) => false);
}
static Widget tableColumnTitle(String text, {bool showDivider = true}) {
@ -749,7 +749,7 @@ class Utils {
);
}
static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true, ProjectViewModel mProjectViewModel}) {
static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true, ProjectViewModel? mProjectViewModel}) {
ProjectViewModel projectViewModel = mProjectViewModel ?? Provider.of(AppGlobal.context);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -820,13 +820,13 @@ class Utils {
return isVidaPlus;
}
static String generateSignature() {
}
// static String generateSignature() {
//
// }
}
Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) {
Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), required Widget child}) {
return Container(
decoration: BoxDecoration(
boxShadow: [
@ -855,7 +855,7 @@ extension IndexedIterable<E> on Iterable<E> {
}
}
openAppStore({String androidPackageName, String iOSAppID, bool isHuawei = false}) async {
openAppStore({String? androidPackageName, String? iOSAppID, bool isHuawei = false}) async {
if (Platform.isAndroid) {
assert(!(androidPackageName == null), "Should have valid value in androidPackageName parameter");
if (isHuawei) {
@ -869,7 +869,7 @@ openAppStore({String androidPackageName, String iOSAppID, bool isHuawei = false}
}
}
String labelFrom({@required String className}) {
String labelFrom({required String className}) {
RegExp exp = RegExp(r'(?<=[a-z])[A-Z]');
String result = className.replaceAllMapped(exp, (m) {

@ -133,11 +133,11 @@ InputDecoration txtFieldSearch(String label) {
Widget circularAviator(
double s, {
Color bcColor,
Color brColor,
Color iconColor,
int borderWidth,
IconData icon,
Color? bcColor,
Color? brColor,
Color? iconColor,
double? borderWidth,
IconData? icon,
double elevation = 4,
}) {
return Card(
@ -148,10 +148,10 @@ Widget circularAviator(
width: s,
height: s,
decoration: containerColorRadiusBorderWidth(
bcColor == null ? Colors.grey[200] : bcColor,
bcColor! == null ? Colors.grey[200]! : bcColor,
2000,
brColor == null ? Colors.blueGrey[800] : brColor,
borderWidth == null ? 2 : borderWidth),
brColor == null ? Colors.blueGrey[800]! : brColor,
borderWidth! == null ? 2 : borderWidth!),
child: Icon(
icon == null ? Icons.person : icon,
size: s / 1.7,
@ -234,7 +234,7 @@ RoundedRectangleBorder buttonShape() {
}
Decoration containerRadiusWithGradient(double radius,
{Color color1, Color color2}) {
{Color? color1, Color? color2}) {
return BoxDecoration(
borderRadius: BorderRadius.circular(radius),
gradient: LinearGradient(
@ -249,7 +249,7 @@ Decoration containerRadiusWithGradient(double radius,
}
Decoration containerBottomRightRadiusWithGradient(double radius,
{Color darkColor, Color lightColor}) {
{Color? darkColor, Color? lightColor}) {
return BoxDecoration(
borderRadius: BorderRadius.only(bottomRight: Radius.circular(radius)),
gradient: LinearGradient(
@ -264,7 +264,7 @@ Decoration containerBottomRightRadiusWithGradient(double radius,
}
Decoration containerBottomRightRadiusWithGradientForAr(double radius,
{Color darkColor, Color lightColor}) {
{Color? darkColor, Color? lightColor}) {
return BoxDecoration(
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius)),
gradient: LinearGradient(
@ -280,8 +280,8 @@ Decoration containerBottomRightRadiusWithGradientForAr(double radius,
Decoration containerRadiusWithGradientServices(
double radius, {
Color darkColor,
Color lightColor,
Color? darkColor,
Color? lightColor,
bool isProduct = false,
bool prescriptionRequired = false,
bool isEnglish = true,
@ -308,8 +308,8 @@ Decoration containerRadiusWithGradientServices(
}
Decoration containerBottomRightRadiusWithGradientBorder(double radius,
{Color darkColor,
Color lightColor,
{Color? darkColor,
Color? lightColor,
Color borderColor = Colors.transparent,
double w = 0}) {
return BoxDecoration(
@ -453,7 +453,7 @@ Decoration containerColorRadiusLeftBorder(
);
}
BoxDecoration cardRadius(double radius, {Color color, double elevation}) {
BoxDecoration cardRadius(double radius, {Color? color, double? elevation}) {
return BoxDecoration(
shape: BoxShape.rectangle,
color: color ?? Colors.white,

@ -9,17 +9,18 @@ import 'package:google_maps_flutter/google_maps_flutter.dart' as googlemap;
import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
import 'package:huawei_map/components/callbacks.dart';
import 'package:huawei_map/components/cameraPosition.dart' as cameraposition;
import 'package:huawei_map/components/cameraPosition.dart';
import 'package:huawei_map/map.dart' as hmsMap;
class AppMap extends StatefulWidget {
late CameraPositionCallback? onCameraMove;
late VoidCallback onCameraMove;
late Map initialCamera;
AppMapState? _state;
late Function? onMapCreated;
late Function? onCameraIdle;
AppMap(this.initialCamera, { this.onCameraMove, this.onMapCreated, this.onCameraIdle});
AppMap(this.initialCamera, { required this.onCameraMove, this.onMapCreated, this.onCameraIdle});
@override
State<StatefulWidget> createState() => _state = AppMapState();
@ -76,8 +77,10 @@ class AppMapState extends State<AppMap> {
zoomControlsEnabled: true,
myLocationButtonEnabled: true,
myLocationEnabled: true,
initialCameraPosition: googlemap.CameraPosition.fromMap(widget.initialCamera),
onCameraMove: widget.onCameraMove,
initialCameraPosition: googlemap.CameraPosition.fromMap!(widget.initialCamera)!,
onCameraMove: (camera) {
widget.onCameraMove;
},
onMapCreated: (googlemap.GoogleMapController controller) {
googleMapController = controller;
_googleMapControllerComp.complete(controller);
@ -97,7 +100,7 @@ class AppMapState extends State<AppMap> {
myLocationButtonEnabled: true,
myLocationEnabled: true,
initialCameraPosition: hmsMap.CameraPosition.fromMap(widget.initialCamera),
onCameraMove: (camera) => widget.onCameraMove!(CameraPosition.fromMap(camera.toMap())),
onCameraMove: (camera) => widget.onCameraMove!,
onMapCreated: (controller) {
_huaweiMapController = controller;
_huaweiMapControllerComp.complete(controller);

@ -14,19 +14,19 @@ import '../show_zoom_image_dialog.dart';
/// [height] the avatar height
/// [onTap] on tap function
class LargeAvatar extends StatelessWidget {
LargeAvatar({Key key, @required this.name, this.url, this.disableProfileView: false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar: false}) : super(key: key);
LargeAvatar({Key? key, required this.name, this.url, this.disableProfileView= false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar= false}) : super(key: key);
final String name;
final String url;
final String? name;
final String? url;
final bool disableProfileView;
final bool isAppointmentAvatar;
final double radius;
final double width;
final double height;
final GestureTapCallback onTap;
final GestureTapCallback? onTap;
Widget _getAvatar() {
if (url != null && url.isNotEmpty && Uri.parse(url).isAbsolute) {
if (url != null && url!.isNotEmpty && Uri.parse(url!).isAbsolute) {
return Center(
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(radius)),
@ -34,7 +34,7 @@ class LargeAvatar extends StatelessWidget {
alignment: Alignment.center,
children: [
Image.network(
url.trim(),
url!.trim(),
fit: BoxFit.fill,
width: width,
height: height,
@ -52,7 +52,7 @@ class LargeAvatar extends StatelessWidget {
} else
return Center(
child: Texts(
name[0].toUpperCase(),
name![0].toUpperCase(),
color: Colors.white,
fontSize: 18,
));
@ -64,8 +64,8 @@ class LargeAvatar extends StatelessWidget {
onTap: disableProfileView
? null
: isAppointmentAvatar ? onTap : () {
print("ssssss " + url.trim());
showZoomImageDialog(context, url.trim() ?? "");
print("ssssss " + url!.trim());
showZoomImageDialog(context, url!.trim() ?? "");
},
child: Container(
decoration: BoxDecoration(

@ -13,10 +13,10 @@ import '../../d_q_icons_icons.dart';
import 'bottom_navigation_item.dart';
class BottomNavBar extends StatefulWidget {
final ValueChanged<int> changeIndex;
final int index;
final ValueChanged<int>? changeIndex;
final int? index;
final bool showHomeIcon;
BottomNavBar({Key key, this.changeIndex, this.index, this.showHomeIcon = false}) : super(key: key);
BottomNavBar({Key? key, this.changeIndex, this.index, this.showHomeIcon = false}) : super(key: key);
@override
_BottomNavBarState createState() => _BottomNavBarState();
@ -24,10 +24,10 @@ class BottomNavBar extends StatefulWidget {
class _BottomNavBarState extends State<BottomNavBar> {
int _index = 0;
ToDoCountProviderModel model;
ToDoCountProviderModel? model;
var event = RobotProvider();
_changeIndex(int index) async {
widget.changeIndex(index);
widget.changeIndex!(index);
if (index == 5) {
event.setValue({'isRobotVisible': 'true'});
}

@ -12,13 +12,13 @@ import 'package:provider/provider.dart';
import '../../Constants.dart';
class BottomNavigationItem extends StatelessWidget {
final String icon;
final String activeIcon;
final ValueChanged<int> changeIndex;
final int index;
final int currentIndex;
final String name;
final bool isDisabled;
final String? icon;
final String? activeIcon;
final ValueChanged<int>? changeIndex;
final int? index;
final int? currentIndex;
final String? name;
final bool? isDisabled;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
@ -37,7 +37,7 @@ class BottomNavigationItem extends StatelessWidget {
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () {
if (!isDisabled) changeIndex(currentIndex);
if (!isDisabled!) changeIndex!(currentIndex!);
},
child: currentIndex != 4
? Column(
@ -48,9 +48,9 @@ class BottomNavigationItem extends StatelessWidget {
height: 15,
),
icon == "assets/images/new/bottom_nav/help.svg" ? Container(
child: SvgPicture.asset(icon, height: 20, width: 20, fit: BoxFit.cover),
child: SvgPicture.asset(icon!, height: 20, width: 20, fit: BoxFit.cover),
) : Container(
child: SvgPicture.asset(icon, height: 20, width: 20, fit: BoxFit.cover, color: currentIndex == index
child: SvgPicture.asset(icon!, height: 20, width: 20, fit: BoxFit.cover, color: currentIndex == index
? Color(0xff333c45)
: Color(0xff989898)),
),
@ -62,7 +62,7 @@ class BottomNavigationItem extends StatelessWidget {
textAlign: TextAlign.center,
color: currentIndex == index
? Color(0xff333c45)
: isDisabled
: isDisabled!
? Colors.grey[300]
: Colors.grey,
fontSize: 11,
@ -84,7 +84,7 @@ class BottomNavigationItem extends StatelessWidget {
height: 15,
),
Container(
child: SvgPicture.asset(icon, height: 20, width: 20, fit: BoxFit.cover, color: currentIndex == index
child: SvgPicture.asset(icon!, height: 20, width: 20, fit: BoxFit.cover, color: currentIndex == index
? Color(0xff333c45)
: Color(0xff989898)),
// Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? secondaryColor : Theme.of(context).dividerColor, size: 22.0),
@ -110,7 +110,7 @@ class BottomNavigationItem extends StatelessWidget {
toAnimate: false,
position: badge_import.BadgePosition.topEnd(),
shape: badge_import.BadgeShape.circle,
badgeColor: secondaryColor.withOpacity(1.0),
badgeColor: secondaryColor!.withOpacity(1.0),
borderRadius: BorderRadius.circular(8),
badgeContent: Container(
padding: EdgeInsets.all(2.0),
@ -128,7 +128,7 @@ class BottomNavigationItem extends StatelessWidget {
height: 15,
),
Container(
child: SvgPicture.asset(icon, height: 20, width: 20, fit: BoxFit.cover),
child: SvgPicture.asset(icon!, height: 20, width: 20, fit: BoxFit.cover),
),
SizedBox(
height: 2,
@ -138,7 +138,7 @@ class BottomNavigationItem extends StatelessWidget {
textAlign: TextAlign.center,
color: currentIndex == index
? Color(0xff333c45)
: isDisabled
: isDisabled!
? Colors.grey[300]
: Colors.grey,
fontSize: 11,

@ -32,7 +32,7 @@ class ImageOptions {
if (Platform.isAndroid) {
galleryImageAndroid(image);
} else {
File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.gallery, imageQuality: 20)).path);
File _image = 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);
@ -49,7 +49,7 @@ class ImageOptions {
if (Platform.isAndroid) {
cameraImageAndroid(image);
} else {
File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20)).path);
File _image = 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);
@ -71,7 +71,7 @@ class ImageOptions {
galleryImageAndroid(Function(String, File) image) async {
if(await PermissionService.isExternalStorageEnabled()) {
File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.gallery, imageQuality: 20)).path);
File _image = 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);
@ -80,7 +80,7 @@ galleryImageAndroid(Function(String, File) image) async {
}
} else {
Utils.showPermissionConsentDialog(AppGlobal.context, TranslationBase.of(AppGlobal.context).galleryPermission, () async {
File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.gallery, imageQuality: 20)).path);
File _image = 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);
@ -93,7 +93,7 @@ galleryImageAndroid(Function(String, File) image) async {
cameraImageAndroid(Function(String, File) image) async {
if (await PermissionService.isCameraEnabled()) {
File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20)).path);
File _image = 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);
@ -102,7 +102,7 @@ cameraImageAndroid(Function(String, File) image) async {
}
} else {
Utils.showPermissionConsentDialog(AppGlobal.context, TranslationBase.of(AppGlobal.context).cameraPermissionDialog, () async {
File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20)).path);
File _image = 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);
@ -116,7 +116,7 @@ cameraImageAndroid(Function(String, File) image) async {
class _BottomSheet extends StatelessWidget {
final List<Widget> children;
_BottomSheet({Key key, @required this.children}) : super(key: key);
_BottomSheet({Key? key, required this.children}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -142,12 +142,12 @@ class _BottomSheet extends StatelessWidget {
}
class _BottomSheetItem extends StatelessWidget {
final Function onTap;
final IconData icon;
final Function? onTap;
final IconData? icon;
final String title;
final ITEM_COLOR color;
_BottomSheetItem({Key key, this.onTap, @required this.title, this.icon, this.color = ITEM_COLOR.primary}) : super(key: key);
_BottomSheetItem({Key? key, this.onTap, required this.title, this.icon, this.color = ITEM_COLOR.primary}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -155,7 +155,7 @@ class _BottomSheetItem extends StatelessWidget {
onTap: () {
if (onTap != null) {
Navigator.pop(context);
onTap();
onTap!();
}
},
child: Padding(

@ -14,17 +14,17 @@ import 'package:flutter/material.dart';
class BottomButton extends StatelessWidget {
final bool loading;
final bool disabled;
final String label;
final Widget icon;
final Color color;
final Color textColor;
final Color borderColor;
final Function onTap;
final Widget child;
final String? label;
final Widget? icon;
final Color? color;
final Color? textColor;
final Color? borderColor;
final Function? onTap;
final Widget? child;
final bool disabledPadding;
BottomButton(
{Key key,
{Key? key,
this.loading = false,
this.disabled = false,
this.label,
@ -121,11 +121,11 @@ class BottomButton extends StatelessWidget {
child: SecondaryButton(
borderColor: borderColor,
onTap: () {
if (onTap != null) onTap();
if (onTap != null) onTap!();
},
loading: loading,
disabled: disabled,
label: label,
label: label!,
icon: icon,
color: color,
textColor: textColor),

@ -29,7 +29,7 @@ class _GestureIconButtonState extends State<GestureIconButton> {
setState(() {
_buttonLongPress = !_buttonLongPress;
});
widget.onTap();
widget.onTap!();
},
// onLongPressStart: (_) =>
@ -39,9 +39,9 @@ class _GestureIconButtonState extends State<GestureIconButton> {
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: widget.backgroundColor != null
? widget.backgroundColor
: Colors.grey[200],
color: widget.backgroundColor! != null
? widget.backgroundColor!
: Colors.grey[200]!,
),
color: widget.backgroundColor != null
? widget.backgroundColor

@ -2,12 +2,12 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:flutter/material.dart';
class BorderedButton extends StatelessWidget {
final String text;
final Function handler;
final Color textColor;
final String? text;
final Function? handler;
final Color? textColor;
final bool hasBorder;
final Color borderColor;
final Color backgroundColor;
final Color? borderColor;
final Color? backgroundColor;
final double vPadding;
final double hPadding;
final double radius;
@ -16,8 +16,8 @@ class BorderedButton extends StatelessWidget {
final double rPadding;
final double bPadding;
final double fontSize;
final Widget icon;
final FontWeight fontWeight;
final Widget? icon;
final FontWeight? fontWeight;
final bool hasShadow;
BorderedButton(
@ -44,7 +44,7 @@ class BorderedButton extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
handler();
handler!();
},
child: Container(
decoration: BoxDecoration(
@ -52,7 +52,7 @@ class BorderedButton extends StatelessWidget {
color: backgroundColor ?? Colors.white,
borderRadius: BorderRadius.circular(radius),
border: Border.fromBorderSide(BorderSide(
color: hasBorder ? borderColor : Colors.white,
color: hasBorder! ? borderColor! : Colors.white,
width: 0.8,
)),
boxShadow: [
@ -67,7 +67,7 @@ class BorderedButton extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
icon != null ? icon : Container(),
icon != null ? icon! : Container(),
Container(
padding: (hPadding > 0 || vPadding > 0)
? EdgeInsets.symmetric(
@ -75,11 +75,11 @@ class BorderedButton extends StatelessWidget {
: EdgeInsets.fromLTRB(
lPadding, tPadding, rPadding, bPadding),
child: Text(
text,
text!,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: fontSize == 0
? SizeConfig.textMultiplier * 1.6
? SizeConfig.textMultiplier! * 1.6
: fontSize,
fontWeight:
fontWeight != null ? fontWeight : FontWeight.normal,

@ -10,14 +10,14 @@ import 'package:provider/provider.dart';
/// [loading] show the progress indicator
/// [elevation] color elevation value
class Button extends StatefulWidget {
Button({Key key, this.label: "", this.icon, this.onTap, this.backgroundColor, this.loading: false, this.elevation: true, this.disabled = false}) : super(key: key);
Button({Key? key, this.label= "", this.icon, this.onTap, this.backgroundColor, this.loading= false, this.elevation= true, this.disabled = false}) : super(key: key);
final String label;
final Widget icon;
final VoidCallback onTap;
final Widget? icon;
final VoidCallback? onTap;
final bool loading;
final bool elevation;
final Color backgroundColor;
final Color? backgroundColor;
final bool disabled;
@override
@ -26,17 +26,17 @@ class Button extends StatefulWidget {
class _ButtonState extends State<Button> with TickerProviderStateMixin {
double _buttonSize = 1.0;
AnimationController _animationController;
Animation _animation;
AnimationController? _animationController;
Animation? _animation;
PermissionService permission = new PermissionService();
@override
void initState() {
_animationController = AnimationController(vsync: this, lowerBound: 0.7, upperBound: 1.0, duration: Duration(milliseconds: 120));
_animation = CurvedAnimation(parent: _animationController, curve: Curves.easeOutQuad, reverseCurve: Curves.easeOutQuad);
_animation.addListener(() {
_animation = CurvedAnimation(parent: _animationController!, curve: Curves.easeOutQuad, reverseCurve: Curves.easeOutQuad);
_animation!.addListener!(() {
setState(() {
_buttonSize = _animation.value;
_buttonSize = _animation!.value!;
});
});
super.initState();
@ -44,7 +44,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
@override
void dispose() {
_animationController.dispose();
_animationController!.dispose();
super.dispose();
}
@ -69,16 +69,16 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
ignoring: widget.disabled,
child: GestureDetector(
onTapDown: (TapDownDetails tap) {
_animationController.reverse(from: 1.0);
_animationController!.reverse(from: 1.0);
},
onTapUp: (TapUpDetails tap) {
_animationController.forward();
_animationController!.forward();
},
onTapCancel: () {
_animationController.forward();
_animationController!.forward();
},
onTap: () => {
widget.disabled ? null : widget.onTap(),
widget.disabled ? null : widget.onTap!(),
},
behavior: HitTestBehavior.opaque,
child: Transform.scale(
@ -105,7 +105,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[300],
Colors.grey[300]!,
),
),
),

@ -1,20 +1,20 @@
import 'package:flutter/material.dart';
class CustomTextButton extends StatelessWidget {
final Color backgroundColor;
final Color disabledColor;
final void Function() onPressed;
final void Function() onLongPress;
final void Function(bool) onHover;
final Widget child;
final OutlinedBorder shape;
final double elevation;
final BorderSide side;
final Color? backgroundColor;
final Color? disabledColor;
final void Function()? onPressed;
final void Function()? onLongPress;
final void Function(bool)? onHover;
final Widget? child;
final OutlinedBorder? shape;
final double? elevation;
final BorderSide? side;
final Color disabledForegroundColor;
final Color disabledBackgroundColor;
const CustomTextButton({
Key key,
Key? key,
this.backgroundColor,
this.disabledColor,
this.onPressed,
@ -40,7 +40,7 @@ class CustomTextButton extends StatelessWidget {
side: side,
),
onPressed: onPressed,
child: child,
child: child!,
);
}
}

@ -11,15 +11,15 @@ extension WithContainer on Widget {
class DefaultButton extends StatelessWidget {
final String text;
final VoidCallback? onPress;
final Color? textColor;
final VoidCallback onPress;
final Color textColor;
final Color? color;
final Color? disabledColor;
final IconData? iconData;
final String? svgIcon;
final double? fontSize;
final bool isTextExpanded;
final int? count;
final int count;
DefaultButton(this.text, this.onPress, {this.color, this.isTextExpanded = true, this.svgIcon, this.disabledColor, this.count = 0, this.textColor = Colors.white, this.iconData, this.fontSize});
@ -52,7 +52,7 @@ class DefaultButton extends StatelessWidget {
style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48),
),
),
if (count! > 0)
if (count > 0)
Align(
alignment: Alignment.topCenter,
child: Container(

@ -7,9 +7,9 @@ import 'package:provider/provider.dart';
/// [onTap] button function
/// [elevation] color elevation value
class FloatingButton extends StatefulWidget {
FloatingButton({Key key, this.onTap, this.elevation: true}) : super(key: key);
FloatingButton({Key? key, this.onTap, this.elevation= true}) : super(key: key);
final VoidCallback onTap;
final VoidCallback? onTap;
final bool elevation;
@override
@ -19,8 +19,8 @@ class FloatingButton extends StatefulWidget {
class _FloatingButtonState extends State<FloatingButton>
with TickerProviderStateMixin {
double _buttonSize = 1.0;
AnimationController _animationController;
Animation _animation;
late AnimationController _animationController;
late Animation _animation;
PermissionService permission = new PermissionService();
@override

@ -40,16 +40,16 @@ class _PhoneNumberSelectorWidgetState extends State<PhoneNumberSelectorWidget> {
@override
Widget build(BuildContext context) {
projectProvider = Provider.of(context);
String countryName = "";
String? countryName = "";
for (var element in counties) {
if (element.code == countryCode) {
countryName = projectProvider?.isArabic == true ? element.nameAr : element.name;
countryName = projectProvider!.isArabic == true ? element.nameAr : element.name;
}
}
return Column(
children: [
inputWidget(TranslationBase.of(context).country, countryName, isEnable: false, hasSelection: true),
inputWidget(TranslationBase.of(context).country, countryName!, isEnable: false, hasSelection: true),
SizedBox(height: 12),
Directionality(textDirection: TextDirection.ltr, child: inputWidget(TranslationBase.of(context).phoneNumber, widget.mobileNo ?? "5xxxxxxxx", prefix: countryCode)),
],
@ -135,7 +135,7 @@ class _PhoneNumberSelectorWidgetState extends State<PhoneNumberSelectorWidget> {
),
itemBuilder: (_) => <PopupMenuItem<String>>[
if (hasSelection)
for (var country in counties) PopupMenuItem<String>(child: Text(projectProvider!.isArabic == true ? country.nameAr : country.name), value: country.code)
for (var country in counties) PopupMenuItem<String>(child: Text(projectProvider!.isArabic == true ? country.nameAr! : country.name!), value: country.code)
],
onSelected: (countryCode) {
setState(() {
@ -218,7 +218,7 @@ class _MobileNo extends State<MobileNo> {
items: counties.map<DropdownMenuItem<String>>((Countries value) {
return DropdownMenuItem<String>(
value: value.code,
child: Text(projectProvider!.isArabic == true ? value.nameAr : value.name),
child: Text(projectProvider!.isArabic == true ? value.nameAr! : value.name!),
);
}).toList()),
),

@ -138,7 +138,7 @@ class DoctorHeader extends StatelessWidget {
// emptyIcon: Icons.star_border,
// ),
RatingBar(
initialRating: headerModel.actualDoctorRate + 0.0,
initialRating: headerModel.actualDoctorRate! + 0.0,
//size: 15.0,
// filledColor: ,
// emptyColor: ,
@ -275,7 +275,7 @@ class DoctorHeader extends StatelessWidget {
children: [
Container(
margin: EdgeInsets.symmetric(horizontal: 20.0),
child: Text(this.headerModel.decimalDoctorRate != null ? this.headerModel.decimalDoctorRate : this.headerModel.actualDoctorRate.ceilToDouble().toString(),
child: Text(this.headerModel.decimalDoctorRate != null ? this.headerModel.decimalDoctorRate : this.headerModel.actualDoctorRate!.ceilToDouble().toString(),
style: TextStyle(fontSize: 32.0, color: Colors.black, letterSpacing: -0.64, fontWeight: FontWeight.bold))),
Container(
margin: EdgeInsets.symmetric(horizontal: 20.0),

@ -58,8 +58,8 @@ class _PickupLocationFromMapState extends State<PickupLocationFromMap> {
appMap = AppMap(
kGooglePlex.toMap(),
onCameraMove: (camera) {
_updatePosition(camera);
onCameraMove: () {
_updatePosition(kGooglePlex);
},
onMapCreated: () {
currentPostion = LatLng(widget.latitude!, widget.longitude!);

Loading…
Cancel
Save