Merge branch 'development_new_design_2.0' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into sultan_new_design

merge-update-with-lab-changes
Sultan Khan 4 years ago
commit a4ab22a4aa

@ -23,6 +23,7 @@ class NewCMCStepOnePage extends StatefulWidget {
final double latitude; final double latitude;
final double longitude; final double longitude;
const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex, this.latitude, this.longitude}) : super(key: key); const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex, this.latitude, this.longitude}) : super(key: key);
@override @override
@ -30,6 +31,7 @@ class NewCMCStepOnePage extends StatefulWidget {
} }
class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> { class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
int selectedItem=0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -60,6 +62,7 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
value: widget.model.cmcAllServicesList[index].serviceID, value: widget.model.cmcAllServicesList[index].serviceID,
activeColor: Colors.red[800], activeColor: Colors.red[800],
onChanged: (newValue) async { onChanged: (newValue) async {
selectedItem=index;
PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList(
price: widget.model.cmcAllServicesList[index].price, price: widget.model.cmcAllServicesList[index].price,
serviceID: widget.model.cmcAllServicesList[index].serviceID.toString(), serviceID: widget.model.cmcAllServicesList[index].serviceID.toString(),
@ -71,8 +74,8 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
setState(() { setState(() {
widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
}); });
CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue); // CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue);
await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel); // await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel);
}, },
groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length > 0 groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length > 0
? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList[0].serviceID) ? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList[0].serviceID)
@ -102,7 +105,10 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
return mDivider(Colors.grey); return mDivider(Colors.grey);
}, },
itemCount: widget.model.cmcAllServicesList.length), itemCount: widget.model.cmcAllServicesList.length),
Image.asset(projectViewModel.isArabic?"assets/images/cc_ar.png":"assets/images/cc_en.png",width: double.infinity,), Image.asset(
projectViewModel.isArabic ? "assets/images/cc_ar.png" : "assets/images/cc_en.png",
width: double.infinity,
),
// Card( // Card(
// shape: cardRadius(12), // shape: cardRadius(12),
// elevation: 4, // elevation: 4,
@ -158,15 +164,16 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
TranslationBase.of(context).next, TranslationBase.of(context).next,
() async { () async {
if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length != 0 || widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList == null) { if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length != 0 || widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList == null) {
int index = widget.model.cmcAllServicesList.length; // int index = widget.model.cmcAllServicesList.length;
PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList(
price: widget.model.cmcAllServicesList[index - 1].price, price: widget.model.cmcAllServicesList[selectedItem].price,
serviceID: widget.model.cmcAllServicesList[index - 1].serviceID.toString(), serviceID: widget.model.cmcAllServicesList[selectedItem].serviceID.toString(),
selectedServiceName: widget.model.cmcAllServicesList[index - 1].description, selectedServiceName: widget.model.cmcAllServicesList[selectedItem].description,
selectedServiceNameAR: widget.model.cmcAllServicesList[index - 1].descriptionN, selectedServiceNameAR: widget.model.cmcAllServicesList[selectedItem].descriptionN,
recordID: 1, recordID: 1,
totalPrice: widget.model.cmcAllServicesList[index - 1].totalPrice, totalPrice: widget.model.cmcAllServicesList[selectedItem].totalPrice,
vAT: widget.model.cmcAllServicesList[index - 1].vAT); vAT: widget.model.cmcAllServicesList[selectedItem].vAT,
);
widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
await widget.model.getCustomerInfo(); await widget.model.getCustomerInfo();
@ -174,14 +181,14 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
Utils.showErrorToast(); Utils.showErrorToast();
} else { } else {
navigateTo( navigateTo(
context, context,
NewCMCStepTowPage( NewCMCStepTowPage(
longitude: widget.longitude, longitude: widget.longitude,
latitude: widget.latitude, latitude: widget.latitude,
cmcInsertPresOrderRequestModel: widget.cMCInsertPresOrderRequestModel, cmcInsertPresOrderRequestModel: widget.cMCInsertPresOrderRequestModel,
model: widget.model, model: widget.model,
)); ),
// widget.changePageViewIndex(1); );
} }
} }
}, },

@ -56,29 +56,47 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) {
var lat = await this.sharedPref.getDouble(USER_LAT); var lat = await this.sharedPref.getDouble(USER_LAT);
var long = await this.sharedPref.getDouble(USER_LONG); var long = await this.sharedPref.getDouble(USER_LONG);
latitude = lat;
longitude = long;
currentPostion = LatLng(lat, long); currentPostion = LatLng(lat, long);
setMap(); setMap();
} else { } else {
if (await Permission.location.request().isGranted) { if (await Permission.location.request().isGranted) {
var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
currentPostion = LatLng(position.latitude, position.longitude); currentPostion = LatLng(position.latitude, position.longitude);
latitude = position.latitude;
longitude = position.longitude;
setMap(); setMap();
} else { } else {
requestPermissions().then((value) async { requestPermissions().then(
if (value[Permission.location].isGranted) { (value) async {
var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); if (value[Permission.location].isGranted) {
currentPostion = LatLng(position.latitude, position.longitude); var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
setMap(); currentPostion = LatLng(position.latitude, position.longitude);
} latitude = position.latitude;
}); longitude = position.longitude;
setMap();
}
},
);
} }
} }
} }
@override @override
void initState() { void initState() {
_getUserLocation();
super.initState(); super.initState();
appMap = AppMap(
cameraPosition.toMap(),
onCameraMove: (camera) {
setState(() {});
_updatePosition(camera);
},
onMapCreated: () {
print("_getUserLocation");
_getUserLocation();
},
);
} }
setMap() { setMap() {
@ -87,7 +105,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
target: currentPostion, target: currentPostion,
zoom: 14.4746, zoom: 14.4746,
); );
appMap.moveTo(cameraPostion: cameraPosition); if (appMap != null) appMap.moveTo(cameraPostion: cameraPosition);
}); });
} }
@ -125,6 +143,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
} }
AppMap appMap; AppMap appMap;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -181,23 +200,22 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
), ),
InkWell( InkWell(
onTap: () async { onTap: () async {
bool isNeedToUpdate = false;
bool isNeedToUpdate=false;
await Navigator.of(context).push(new MaterialPageRoute<dynamic>( await Navigator.of(context).push(new MaterialPageRoute<dynamic>(
builder: (BuildContext context) { builder: (BuildContext context) {
return CMCLocationPage( return CMCLocationPage(
latitude: latitude, latitude: latitude,
longitude: longitude, longitude: longitude,
onPick: (){ onPick: () {
isNeedToUpdate=true; isNeedToUpdate = true;
print("onPickonPick1"); print("onPickonPick1");
}, },
); );
}, },
)); ));
if(isNeedToUpdate){ if (isNeedToUpdate) {
print("onPickonPick2"); print("onPickonPick2");
_selectedAddress=new AddressInfo(); _selectedAddress = new AddressInfo();
_selectedAddress.address1 = widget.model.addressesList.last.address1; _selectedAddress.address1 = widget.model.addressesList.last.address1;
showCurrentLocation = false; showCurrentLocation = false;
setLatitudeAndLongitude(); setLatitudeAndLongitude();
@ -225,9 +243,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
appMap = AppMap(cameraPosition.toMap(), onCameraMove: (camera){ if (appMap != null) appMap,
_updatePosition(camera);
}),
Icon( Icon(
Icons.place, Icons.place,
color: CustomColors.accentColor, color: CustomColors.accentColor,

@ -11,8 +11,9 @@ class AppMap extends StatefulWidget {
Map initialCamera; Map initialCamera;
AppMapState _state; AppMapState _state;
Function onMapCreated;
AppMap(this.initialCamera, {this.onCameraMove}); AppMap(this.initialCamera, {this.onCameraMove, this.onMapCreated});
@override @override
State<StatefulWidget> createState() => _state = AppMapState(); State<StatefulWidget> createState() => _state = AppMapState();
@ -29,7 +30,7 @@ class AppMap extends StatefulWidget {
} }
class AppMapState extends State<AppMap> { class AppMapState extends State<AppMap> {
bool isHuawei; bool isHuawei = false;
Completer<GoogleMapController> _googleMapControllerComp = Completer(); Completer<GoogleMapController> _googleMapControllerComp = Completer();
GoogleMapController googleMapController; GoogleMapController googleMapController;
@ -55,7 +56,7 @@ class AppMapState extends State<AppMap> {
Widget map() => isHuawei ? huaweiMap() : googleMap(); Widget map() => isHuawei ? huaweiMap() : googleMap();
googleMap() { Widget googleMap() {
return GoogleMap( return GoogleMap(
mapType: MapType.normal, mapType: MapType.normal,
zoomControlsEnabled: false, zoomControlsEnabled: false,
@ -66,6 +67,7 @@ class AppMapState extends State<AppMap> {
onMapCreated: (GoogleMapController controller) { onMapCreated: (GoogleMapController controller) {
googleMapController = controller; googleMapController = controller;
_googleMapControllerComp.complete(controller); _googleMapControllerComp.complete(controller);
widget.onMapCreated();
}, },
); );
} }
@ -81,6 +83,7 @@ class AppMapState extends State<AppMap> {
onMapCreated: (controller) { onMapCreated: (controller) {
_huaweiMapController = controller; _huaweiMapController = controller;
_huaweiMapControllerComp.complete(controller); _huaweiMapControllerComp.complete(controller);
widget.onMapCreated();
}, },
); );
} }

Loading…
Cancel
Save