null safety issue fixed.

merge-update-with-lab-changes
Sultan khan 2 years ago
parent 1a5687a27c
commit c96c151f44

@ -9,7 +9,7 @@ class GetHMGLocationsModel {
String? locationName; String? locationName;
dynamic locationNameN; dynamic locationNameN;
dynamic locationType; dynamic locationType;
String? longitude; String? longitude;
int? pharmacyLocationID; int? pharmacyLocationID;
String? phoneNumber; String? phoneNumber;
int? projectID; int? projectID;

@ -30,7 +30,7 @@ class ProjectAvgERWaitingTime {
distanceInKilometers = json['DistanceInKilometers']; distanceInKilometers = json['DistanceInKilometers'];
latitude = json['Latitude']; latitude = json['Latitude'];
longitude = json['Longitude']; longitude = json['Longitude'];
phonenumber = json['Phonenum?ber']; phonenumber = json['PhoneNumber'];
projectImageURL = json['ProjectImageURL']; projectImageURL = json['ProjectImageURL'];
projectName = json['ProjectName']; projectName = json['ProjectName'];
} }
@ -44,7 +44,7 @@ class ProjectAvgERWaitingTime {
data['DistanceInKilometers'] = this.distanceInKilometers; data['DistanceInKilometers'] = this.distanceInKilometers;
data['Latitude'] = this.latitude; data['Latitude'] = this.latitude;
data['Longitude'] = this.longitude; data['Longitude'] = this.longitude;
data['Phonenum?ber'] = this.phonenumber; data['PhoneNumber'] = this.phonenumber;
data['ProjectImageURL'] = this.projectImageURL; data['ProjectImageURL'] = this.projectImageURL;
data['ProjectName'] = this.projectName; data['ProjectName'] = this.projectName;
return data; return data;

@ -112,7 +112,7 @@ class OrderPreviewViewModel extends BaseViewModel {
ShoppingCartResponse _handleGetShoppingCartResponse(Map res) { ShoppingCartResponse _handleGetShoppingCartResponse(Map res) {
cartResponse.totalAmount = 0.0; cartResponse.totalAmount = 0.0;
totalAdditionalShippingCharge = 0; totalAdditionalShippingCharge = 0;
if (res == null) { if (res.isEmpty) {
error = "response is null"; error = "response is null";
setState(ViewState.Error); setState(ViewState.Error);
return ShoppingCartResponse(); return ShoppingCartResponse();

@ -74,6 +74,7 @@ class _NearestErState extends State<NearestEr> {
location.locationName = projectAvgERWaitingTimeModelList[index].projectName; location.locationName = projectAvgERWaitingTimeModelList[index].projectName;
location.cityName = projectAvgERWaitingTimeModelList[index].projectName; location.cityName = projectAvgERWaitingTimeModelList[index].projectName;
location.projectImageURL = projectAvgERWaitingTimeModelList[index].projectImageURL; location.projectImageURL = projectAvgERWaitingTimeModelList[index].projectImageURL;
print(projectAvgERWaitingTimeModelList[index].phonenumber);
location.phoneNumber = projectAvgERWaitingTimeModelList[index].phonenumber; location.phoneNumber = projectAvgERWaitingTimeModelList[index].phonenumber;
location.latitude = projectAvgERWaitingTimeModelList[index].latitude; location.latitude = projectAvgERWaitingTimeModelList[index].latitude;
location.longitude = projectAvgERWaitingTimeModelList[index].longitude; location.longitude = projectAvgERWaitingTimeModelList[index].longitude;

@ -227,7 +227,7 @@ class OrderLogPage extends StatelessWidget {
100, 100,
), ),
), ),
Column( Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
@ -236,10 +236,10 @@ class OrderLogPage extends StatelessWidget {
), ),
Text( Text(
order.dropOffLocation!.trim().toString(), order.dropOffLocation!.trim().toString(),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), overflow: TextOverflow.ellipsis,
), ),
], ],
), )),
], ],
), ),
], ],

@ -76,7 +76,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
children: [ children: [
PharmacyPage(), PharmacyPage(),
PharmacyCategorisePage(), PharmacyCategorisePage(),
PharmacyProfilePage(moveToOrder: false, changeTab: changeCurrentTab), PharmacyProfilePage(moveToOrder: false, changeTab: (){changeCurrentTab(2);}),
CartOrderPage(changeTab: changeCurrentTab), CartOrderPage(changeTab: changeCurrentTab),
], ],
), ),

@ -22,7 +22,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class CartOrderPage extends StatefulWidget { class CartOrderPage extends StatefulWidget {
final dynamic? changeTab; final void Function(int)? changeTab;
CartOrderPage({Key? key, this.changeTab}) : super(key: key); CartOrderPage({Key? key, this.changeTab}) : super(key: key);
@ -57,8 +57,10 @@ class _CartOrderPageState extends State<CartOrderPage> {
isMainPharmacyPages: true, isMainPharmacyPages: true,
showPharmacyCart: false, showPharmacyCart: false,
baseViewModel: model, baseViewModel: model,
backButtonTab: backButtonTab:(){
widget.changeTab!, widget.changeTab!;
}
,
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: NetworkBaseView( body: NetworkBaseView(

@ -132,13 +132,13 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
), ),
), ),
if (model.isStockAvailable != null && !model.isStockAvailable) if (model.isStockAvailable && !model.isStockAvailable)
Container( Container(
height: MediaQuery.of(context).size.height * .40, height: MediaQuery.of(context).size.height * .40,
color: Colors.white.withOpacity(0.6), color: Colors.white.withOpacity(0.6),
// child: AppText("Out of Stock"), // child: AppText("Out of Stock"),
), ),
if (model.isStockAvailable != null && !model.isStockAvailable) if (model.isStockAvailable && !model.isStockAvailable)
Positioned( Positioned(
// bottom: 10, // bottom: 10,
top: MediaQuery.of(context).size.height * .088, top: MediaQuery.of(context).size.height * .088,

@ -30,7 +30,8 @@ dynamic languageID;
class PharmacyProfilePage extends StatefulWidget { class PharmacyProfilePage extends StatefulWidget {
final bool moveToOrder; final bool moveToOrder;
final dynamic changeTab;
final void Function()? changeTab;
PharmacyProfilePage({required this.moveToOrder, this.changeTab}); PharmacyProfilePage({required this.moveToOrder, this.changeTab});
@ -55,8 +56,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
} }
getCustomer() async { getCustomer() async {
String custID; String? custID;
String custGUID; String? custGUID;
custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID); custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
custGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); custGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID);
setState(() { setState(() {

@ -10,7 +10,7 @@ import 'avatar/large_avatar.dart';
import 'my_rich_text.dart'; import 'my_rich_text.dart';
class HospitalLocation extends StatelessWidget { class HospitalLocation extends StatelessWidget {
final GetHMGLocationsModel location; final GetHMGLocationsModel? location;
final bool showCity; final bool showCity;
final String? waitingTime; final String? waitingTime;
@ -41,7 +41,7 @@ class HospitalLocation extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
location.locationName!.trim(), location!.locationName!.trim(),
style: TextStyle(fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600, color: Color(0xff2E303A)), style: TextStyle(fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600, color: Color(0xff2E303A)),
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -60,8 +60,8 @@ class HospitalLocation extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (showCity) MyRichText(TranslationBase.of(context).city + ":", location.cityName!.trim().toString(), projectViewModel.isArabic), if (showCity) MyRichText(TranslationBase.of(context).city + ":", location!.cityName!.trim().toString(), projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).distance + ":", location.distanceInKilometers.toString() + " " + TranslationBase.of(context).km_ ?? "", projectViewModel.isArabic), MyRichText(TranslationBase.of(context).distance + ":", location!.distanceInKilometers.toString() + " " + TranslationBase.of(context).km_ ?? "", projectViewModel.isArabic),
if (waitingTime != null) MyRichText(TranslationBase.of(context).waitingTime, waitingTime!, projectViewModel.isArabic), if (waitingTime != null) MyRichText(TranslationBase.of(context).waitingTime, waitingTime!, projectViewModel.isArabic),
], ],
), ),
@ -79,14 +79,15 @@ class HospitalLocation extends StatelessWidget {
() async { () async {
await MapLauncher.showMarker( await MapLauncher.showMarker(
mapType: MapType.google, mapType: MapType.google,
coords: Coords(double.parse(location.latitude!), double.parse(location.longitude!)), coords: Coords(double.parse(location!.latitude!), double.parse(location!.longitude!)),
title: location.locationName!, title: location!.locationName!,
); );
}, },
), ),
SizedBox(height: 10), SizedBox(height: 10),
contactButton(Icons.call, TranslationBase.of(context).callNow, () { contactButton(Icons.call, TranslationBase.of(context).callNow, () async{
launchUrl(Uri.parse("tel://" + location.phoneNumber!));
await launchUrl(Uri.parse("tel://" + location!.phoneNumber.toString()));
}), }),
], ],
), ),

@ -285,7 +285,7 @@ class _AppScaffoldState extends State<AppScaffold> {
bottomNavigationBar: widget.isBottomBar bottomNavigationBar: widget.isBottomBar
? BottomNavPharmacyBar( ? BottomNavPharmacyBar(
changeIndex: changeCurrentTab, changeIndex: changeCurrentTab,
index: widget.currentTab!, index: widget.currentTab==null ? 0: widget.currentTab!,
) )
: null, : null,
floatingActionButton: widget.floatingActionButton, floatingActionButton: widget.floatingActionButton,
@ -508,7 +508,7 @@ class AppBarWidgetState extends State<AppBarWidget> {
? IconButton( ? IconButton(
icon: badge_import.Badge( icon: badge_import.Badge(
badgeContent: Text( badgeContent: Text(
orderPreviewViewModel.cartResponse.quantityCount.toString(), orderPreviewViewModel.cartResponse.quantityCount !=null? orderPreviewViewModel.cartResponse.quantityCount.toString() :"",
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
child: Icon(Icons.shopping_cart)), child: Icon(Icons.shopping_cart)),

@ -87,7 +87,7 @@ class BottomNavPharmacyItem extends StatelessWidget {
), ),
), ),
), ),
if (currentIndex == 3 && Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount != 0) if (currentIndex == 3 && Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount!=null && Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount!=0)
Positioned( Positioned(
top: 11.5, top: 11.5,
right: -3.5, right: -3.5,

Loading…
Cancel
Save