Merge branch 'development_new_design_2.0' into haroon-new-design

merge-update-with-lab-changes
haroon amjad 4 years ago
commit 879ce4ee06

@ -23,6 +23,7 @@ class NewCMCStepOnePage extends StatefulWidget {
final double latitude;
final double longitude;
const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex, this.latitude, this.longitude}) : super(key: key);
@override
@ -30,6 +31,7 @@ class NewCMCStepOnePage extends StatefulWidget {
}
class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
int selectedItem=0;
@override
void initState() {
super.initState();
@ -60,6 +62,7 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
value: widget.model.cmcAllServicesList[index].serviceID,
activeColor: Colors.red[800],
onChanged: (newValue) async {
selectedItem=index;
PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList(
price: widget.model.cmcAllServicesList[index].price,
serviceID: widget.model.cmcAllServicesList[index].serviceID.toString(),
@ -71,8 +74,8 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
setState(() {
widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
});
CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue);
await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel);
// CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue);
// await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel);
},
groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length > 0
? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList[0].serviceID)
@ -102,7 +105,10 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
return mDivider(Colors.grey);
},
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(
// shape: cardRadius(12),
// elevation: 4,
@ -158,15 +164,16 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
TranslationBase.of(context).next,
() async {
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(
price: widget.model.cmcAllServicesList[index - 1].price,
serviceID: widget.model.cmcAllServicesList[index - 1].serviceID.toString(),
selectedServiceName: widget.model.cmcAllServicesList[index - 1].description,
selectedServiceNameAR: widget.model.cmcAllServicesList[index - 1].descriptionN,
price: widget.model.cmcAllServicesList[selectedItem].price,
serviceID: widget.model.cmcAllServicesList[selectedItem].serviceID.toString(),
selectedServiceName: widget.model.cmcAllServicesList[selectedItem].description,
selectedServiceNameAR: widget.model.cmcAllServicesList[selectedItem].descriptionN,
recordID: 1,
totalPrice: widget.model.cmcAllServicesList[index - 1].totalPrice,
vAT: widget.model.cmcAllServicesList[index - 1].vAT);
totalPrice: widget.model.cmcAllServicesList[selectedItem].totalPrice,
vAT: widget.model.cmcAllServicesList[selectedItem].vAT,
);
widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
await widget.model.getCustomerInfo();
@ -180,8 +187,8 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
latitude: widget.latitude,
cmcInsertPresOrderRequestModel: widget.cMCInsertPresOrderRequestModel,
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) {
var lat = await this.sharedPref.getDouble(USER_LAT);
var long = await this.sharedPref.getDouble(USER_LONG);
latitude = lat;
longitude = long;
currentPostion = LatLng(lat, long);
setMap();
} else {
if (await Permission.location.request().isGranted) {
var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
currentPostion = LatLng(position.latitude, position.longitude);
latitude = position.latitude;
longitude = position.longitude;
setMap();
} else {
requestPermissions().then((value) async {
requestPermissions().then(
(value) async {
if (value[Permission.location].isGranted) {
var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
currentPostion = LatLng(position.latitude, position.longitude);
latitude = position.latitude;
longitude = position.longitude;
setMap();
}
});
},
);
}
}
}
@override
void initState() {
_getUserLocation();
super.initState();
appMap = AppMap(
cameraPosition.toMap(),
onCameraMove: (camera) {
setState(() {});
_updatePosition(camera);
},
onMapCreated: () {
print("_getUserLocation");
_getUserLocation();
},
);
}
setMap() {
@ -87,7 +105,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
target: currentPostion,
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;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
@ -181,23 +200,22 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
),
InkWell(
onTap: () async {
bool isNeedToUpdate=false;
bool isNeedToUpdate = false;
await Navigator.of(context).push(new MaterialPageRoute<dynamic>(
builder: (BuildContext context) {
return CMCLocationPage(
latitude: latitude,
longitude: longitude,
onPick: (){
isNeedToUpdate=true;
onPick: () {
isNeedToUpdate = true;
print("onPickonPick1");
},
);
},
));
if(isNeedToUpdate){
if (isNeedToUpdate) {
print("onPickonPick2");
_selectedAddress=new AddressInfo();
_selectedAddress = new AddressInfo();
_selectedAddress.address1 = widget.model.addressesList.last.address1;
showCurrentLocation = false;
setLatitudeAndLongitude();
@ -225,9 +243,7 @@ class _NewCMCStepTowPageState extends State<NewCMCStepTowPage> {
child: Stack(
alignment: Alignment.center,
children: [
appMap = AppMap(cameraPosition.toMap(), onCameraMove: (camera){
_updatePosition(camera);
}),
if (appMap != null) appMap,
Icon(
Icons.place,
color: CustomColors.accentColor,

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
@ -7,33 +6,31 @@ import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:huawei_map/map.dart' as hmsMap;
class AppMap extends StatefulWidget{
class AppMap extends StatefulWidget {
CameraPositionCallback onCameraMove;
Map initialCamera;
AppMapState _state;
Function onMapCreated;
AppMap(this.initialCamera, {this.onCameraMove});
AppMap(this.initialCamera, {this.onCameraMove, this.onMapCreated});
@override
State<StatefulWidget> createState() => _state = AppMapState();
moveTo({@required CameraPosition cameraPostion}){
if(_state.isHuawei){
moveTo({@required CameraPosition cameraPostion}) {
if (_state.isHuawei) {
final cameraJson = cameraPostion.toMap();
final camera = hmsMap.CameraPosition.fromMap(cameraJson);
_state._huaweiMapController.animateCamera(hmsMap.CameraUpdate.newCameraPosition(camera));
}else{
} else {
_state.googleMapController.animateCamera(CameraUpdate.newCameraPosition(cameraPostion));
}
}
}
class AppMapState extends State<AppMap>{
bool isHuawei;
class AppMapState extends State<AppMap> {
bool isHuawei = false;
Completer<GoogleMapController> _googleMapControllerComp = Completer();
GoogleMapController googleMapController;
@ -41,10 +38,11 @@ class AppMapState extends State<AppMap>{
Completer<hmsMap.HuaweiMapController> _huaweiMapControllerComp = Completer();
hmsMap.HuaweiMapController _huaweiMapController;
checkIsHuawei() async{
checkIsHuawei() async {
isHuawei = await FlutterHmsGmsAvailability.isHmsAvailable;
setState(() {});
}
@override
void initState() {
checkIsHuawei();
@ -52,17 +50,14 @@ class AppMapState extends State<AppMap>{
@override
Widget build(BuildContext context) {
if(isHuawei == null)
return CircularProgressIndicator();
if (isHuawei == null) return CircularProgressIndicator();
return map();
}
Widget map() => isHuawei ? huaweiMap() : googleMap();
googleMap(){
return
GoogleMap(
Widget googleMap() {
return GoogleMap(
mapType: MapType.normal,
zoomControlsEnabled: false,
myLocationButtonEnabled: true,
@ -72,11 +67,12 @@ class AppMapState extends State<AppMap>{
onMapCreated: (GoogleMapController controller) {
googleMapController = controller;
_googleMapControllerComp.complete(controller);
widget.onMapCreated();
},
);
}
Widget huaweiMap(){
Widget huaweiMap() {
return hmsMap.HuaweiMap(
mapType: hmsMap.MapType.normal,
zoomControlsEnabled: false,
@ -84,11 +80,11 @@ class AppMapState extends State<AppMap>{
myLocationEnabled: true,
initialCameraPosition: hmsMap.CameraPosition.fromMap(widget.initialCamera),
onCameraMove: (camera) => widget.onCameraMove(CameraPosition.fromMap(camera.toMap())),
onMapCreated: (controller){
onMapCreated: (controller) {
_huaweiMapController = controller;
_huaweiMapControllerComp .complete(controller);
_huaweiMapControllerComp.complete(controller);
widget.onMapCreated();
},
);
}
}
Loading…
Cancel
Save