Merge branch 'sultan_new_design' into 'development_new_design_2.0'

Sultan new design

See merge request Cloud_Solution/diplomatic-quarter!404
merge-update-with-lab-changes
haroon amjad 5 years ago
commit 13debe83f0

@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products';
const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_ORDERS = '/api/orders';
const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/'; const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs // Pharmacy UAT URLs
// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';

@ -66,7 +66,9 @@ class _NewHomeHealthCareStepOnePageState extends State<NewHomeHealthCareStepOneP
setState(() { setState(() {
if (!isServiceSelected(service.serviceID)) if (!isServiceSelected(service.serviceID))
widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add(PatientERHHCInsertServicesList( widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add(PatientERHHCInsertServicesList(
recordID: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, serviceID: service.serviceID, serviceName: service.description)); recordID: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length,
serviceID: service.serviceID,
serviceName: projectViewModel.isArabic ? service.descriptionN : service.description));
else else
removeSelected(service.serviceID); removeSelected(service.serviceID);
// widget.patientERInsertPresOrderRequestModel // widget.patientERInsertPresOrderRequestModel

@ -17,8 +17,9 @@ import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart';
import 'location_page.dart'; import 'location_page.dart';
import 'package:geolocator/geolocator.dart';
class NewHomeHealthCareStepTowPage extends StatefulWidget { class NewHomeHealthCareStepTowPage extends StatefulWidget {
final Function(PickResult) onPick; final Function(PickResult) onPick;
@ -39,35 +40,47 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
double longitude = 0; double longitude = 0;
AddressInfo _selectedAddress; AddressInfo _selectedAddress;
bool showCurrentLocation = false; bool showCurrentLocation = false;
Completer<GoogleMapController> _controller = Completer();
GoogleMapController googleMapController;
final Set<Marker> markers = new Set(); final Set<Marker> markers = new Set();
AppMap appMap;
static CameraPosition _kGooglePlex = CameraPosition( static CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962), target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746, zoom: 14.4746,
); );
LatLng currentPostion;
Completer<GoogleMapController> mapController = Completer();
@override @override
void initState() { void initState() {
if (widget.patientERInsertPresOrderRequestModel.latitude == null) { appMap = AppMap(
setLatitudeAndLongitude(); _kGooglePlex.toMap(),
} else { onCameraMove: (camera) {
latitude = widget.patientERInsertPresOrderRequestModel.latitude; _updatePosition(camera);
longitude = widget.patientERInsertPresOrderRequestModel.longitude; },
} onMapCreated: () {
goToCurrentLocation();
markers.clear(); setState(() {});
markers.add( },
Marker(
markerId: MarkerId(
latitude.hashCode.toString(),
),
position: LatLng(latitude, longitude)),
); );
// if (widget.patientERInsertPresOrderRequestModel.latitude == null) {
// setLatitudeAndLongitude();
// } else {
// latitude = widget.patientERInsertPresOrderRequestModel.latitude;
// longitude = widget.patientERInsertPresOrderRequestModel.longitude;
// }
// markers.clear();
// markers.add(
// Marker(
// markerId: MarkerId(
// latitude.hashCode.toString(),
// ),
// position: LatLng(latitude, longitude)),
// );
// _kGooglePlex = CameraPosition(
// target: LatLng(latitude, longitude),
// zoom: 14.4746,
// );
_kGooglePlex = CameraPosition(
target: LatLng(latitude, longitude),
zoom: 14.4746,
);
super.initState(); super.initState();
} }
@ -87,9 +100,21 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
latitude = double.parse(latLongArr[0]); latitude = double.parse(latLongArr[0]);
longitude = double.parse(latLongArr[1]); longitude = double.parse(latLongArr[1]);
currentPostion = LatLng(latitude, longitude);
setMap();
} }
} }
setMap() {
setState(() {
_kGooglePlex = CameraPosition(
target: currentPostion,
zoom: 14.4746,
);
appMap.moveTo(cameraPostion: _kGooglePlex);
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -168,22 +193,35 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
), ),
), ),
), ),
// Expanded(
// child: Stack(
// alignment: Alignment.center,
// children: [
// GoogleMap(
// mapType: MapType.normal,
// zoomControlsEnabled: false,
// myLocationButtonEnabled: true,
// myLocationEnabled: true,
// initialCameraPosition: _kGooglePlex,
// onCameraMove: ((_position) => _updatePosition(_position)),
// onMapCreated: (GoogleMapController controller) {
// googleMapController = controller;
// _controller.complete(controller);
// },
// ),
// Icon(
// Icons.place,
// color: CustomColors.accentColor,
// size: 50,
// ),
// ],
// ),
// ),
Expanded( Expanded(
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
GoogleMap( if (appMap != null) appMap,
mapType: MapType.normal,
zoomControlsEnabled: false,
myLocationButtonEnabled: true,
myLocationEnabled: true,
initialCameraPosition: _kGooglePlex,
onCameraMove: ((_position) => _updatePosition(_position)),
onMapCreated: (GoogleMapController controller) {
googleMapController = controller;
_controller.complete(controller);
},
),
Icon( Icon(
Icons.place, Icons.place,
color: CustomColors.accentColor, color: CustomColors.accentColor,
@ -246,4 +284,27 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
else else
return TranslationBase.of(context).selectAddress; return TranslationBase.of(context).selectAddress;
} }
goToCurrentLocation() {
Geolocator.getCurrentPosition().then((value) {
_selectedAddress = AddressInfo(latLong: '${value.latitude},${value.longitude}');
moveToLocation(LatLng(value.latitude, value.longitude));
});
}
moveToLocation(LatLng location, {bool animate = true}) async {
await Future.delayed(Duration(milliseconds: 200));
_kGooglePlex = CameraPosition(
target: location,
zoom: 16.4746,
);
if (animate)
(await mapController.future).animateCamera(
CameraUpdate.newCameraPosition(_kGooglePlex),
);
else
(await mapController.future).moveCamera(
CameraUpdate.newCameraPosition(_kGooglePlex),
);
}
} }

@ -6,47 +6,40 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class RRTLogPage extends StatefulWidget {
class RRTLogPage extends StatefulWidget{ final List<PrescriptionsOrder> orders;
final List<PrescriptionsOrder> orders;
const RRTLogPage({this.orders}); const RRTLogPage({this.orders});
@override @override
State<StatefulWidget> createState() => RRTLogPageState(); State<StatefulWidget> createState() => RRTLogPageState();
} }
class RRTLogPageState extends State<RRTLogPage>{
class RRTLogPageState extends State<RRTLogPage> {
RRTViewModel viewModel; RRTViewModel viewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<RRTViewModel>( return BaseView<RRTViewModel>(
onModelReady: (vm) => viewModel = vm, onModelReady: (vm) => viewModel = vm,
builder: (ctx, vm, widgetState){ builder: (ctx, vm, widgetState) {
return ListView.builder( return ListView.builder(
itemCount: widget.orders.length, itemCount: widget.orders.length,
itemBuilder: (ctx, idx) { padding: EdgeInsets.all(21),
var order = widget.orders[idx]; itemBuilder: (ctx, idx) {
return RRTLogListItem(order, onCancel: deleteOrder); var order = widget.orders[idx];
} return RRTLogListItem(order, onCancel: deleteOrder);
); });
} });
);
} }
deleteOrder(PrescriptionsOrder order) async { deleteOrder(PrescriptionsOrder order) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
var success = await viewModel.cancelOrder(order); var success = await viewModel.cancelOrder(order);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if(success) if (success)
setState(() { setState(() {
widget.orders.remove(order); widget.orders.remove(order);
}); });
} }
} }

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5)); final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5));
@ -22,59 +23,188 @@ class RRTLogListItem extends StatelessWidget {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
_context = context; _context = context;
localize = TranslationBase.of(context); localize = TranslationBase.of(context);
int status = order.status;
String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description;
Color _color;
if (status == 1) {
//pending
_color = Color(0xffCC9B14);
} else if (status == 2) {
//processing
_color = Color(0xff2E303A);
} else if (status == 3) {
//completed
_color = Color(0xff359846);
} else if (status == 4) {
//cancel // Rejected
_color = Color(0xffD02127);
}
return Container( return Container(
padding: EdgeInsets.all(15), margin: EdgeInsets.all(5),
margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10), decoration: BoxDecoration(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15), boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]), color: _color,
child: Column( borderRadius: BorderRadius.all(
crossAxisAlignment: CrossAxisAlignment.stretch, Radius.circular(10.0),
children: [ ),
_contentItem(label: localize.reqId, value: order.iD.toString()), boxShadow: [
_item_content_seperator, BoxShadow(
_contentItem(label: localize.status, value: projectViewModel.isArabic ? order.descriptionN.toString() : order.description.toString()), //order.getStatusName(localize)), color: Color(0xff000000).withOpacity(.05),
_item_content_seperator, blurRadius: 27,
_contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()), offset: Offset(0, -3),
_item_content_seperator, ),
_contentItem(label: localize.location, value: order.getNearestProjectDescription()),
_item_content_seperator,
SizedBox(height: 10),
if (onCancel != null && order.status == 1 && order.status == 2) FractionallySizedBox(child: cancelButton())
], ],
), ),
); child: Container(
} // decoration: containerColorRadiusLeft(Colors.white, 12),
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
Widget _contentItem({@required String label, String value}) { padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
return Container( decoration: BoxDecoration(
padding: EdgeInsets.symmetric(vertical: 10), color: Colors.white,
child: Column( border: Border.all(color: Colors.white, width: 1),
crossAxisAlignment: CrossAxisAlignment.start, borderRadius: BorderRadius.only(
children: [ bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
Text( topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
label, bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1), topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
),
SizedBox(
height: 5,
), ),
Text( ),
value, // clipBehavior: Clip.antiAlias,
style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontWeight: FontWeight.bold, fontSize: 14), child: Row(
), crossAxisAlignment: CrossAxisAlignment.start,
], children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_statusDisp,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
),
SizedBox(height: 6),
Text(
'${TranslationBase.of(context).requestID}: ${order.iD}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).location + ": ",
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
Expanded(
child: Text(
!projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
localize.pickupDate + ": ",
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
Expanded(
child: Text(
order.getFormattedDateTime(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
),
),
],
),
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
DateUtil.formatDateToDate(order.createdOn, projectViewModel.isArabic),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
),
SizedBox(height: 12),
if (order.status == 1 || order.status == 2)
InkWell(
onTap: () {
onCancel(order);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14),
decoration: BoxDecoration(
color: Color(0xffD02127),
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.circular(10),
),
child: Text(
TranslationBase.of(context).cancel_nocaps,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4),
),
),
),
],
),
],
),
), ),
); );
// return Container(
// padding: EdgeInsets.all(15),
// margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
// decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15), boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.stretch,
// children: [
// _contentItem(label: localize.reqId, value: order.iD.toString()),
// _item_content_seperator,
// _contentItem(label: localize.status, value: projectViewModel.isArabic ? order.descriptionN.toString() : order.description.toString()), //order.getStatusName(localize)),
// _item_content_seperator,
// _contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()),
// _item_content_seperator,
// _contentItem(label: localize.location, value: order.getNearestProjectDescription()),
// _item_content_seperator,
// SizedBox(height: 10),
// if (order.status == 1 || order.status == 2) Container(child: cancelButton())
// ],
// ),
// );
} }
Widget cancelButton() => MaterialButton( // Widget _contentItem({@required String label, String value}) {
height: 45, // return Container(
color: Color(0xFFc5272d), // padding: EdgeInsets.symmetric(vertical: 10),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), // child: Column(
onPressed: () => onCancel(order), // crossAxisAlignment: CrossAxisAlignment.start,
child: Text( // children: [
localize.cancel, // Text(
style: TextStyle(color: Colors.white, fontSize: 13), // label,
), // style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1),
); // ),
// SizedBox(
// height: 5,
// ),
// Text(
// value,
// style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontWeight: FontWeight.bold, fontSize: 14),
// ),
// ],
// ),
// );
// }
// Widget cancelButton() => MaterialButton(
// height: 45,
// color: Color(0xFFc5272d),
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
// onPressed: () => onCancel(order),
// child: Text(
// localize.cancel,
// style: TextStyle(color: Colors.white, fontSize: 13),
// ),
// );
} }

@ -53,7 +53,7 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
Stream<int> addressStream; Stream<int> addressStream;
StreamController<int> addressLoadingStreamController = StreamController(); StreamController<int> addressLoadingStreamController = StreamController();
Stream<int> addressLoadingStream; Stream<int> addressLoadingStream;
AddressInfo _selectedAddress; // AddressInfo _selectedAddress;
double latitude = 0; double latitude = 0;
double longitude = 0; double longitude = 0;
AppMap appMap; AppMap appMap;
@ -61,13 +61,23 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
@override @override
void initState() { void initState() {
super.initState(); super.initState();
goToCurrentLocation();
appMap = AppMap(
cameraPosition.toMap(),
onCameraMove: (camera) {
_updatePosition(camera);
},
onMapCreated: () {
goToCurrentLocation();
setState(() {});
},
);
// addressStream = addressStreamController.stream; // addressStream = addressStreamController.stream;
// addressLoadingStream = addressLoadingStreamController.stream; // addressLoadingStream = addressLoadingStreamController.stream;
} }
setLatitudeAndLongitude({bool isSetState = false, String latLong}) async { setLatitudeAndLongitude({bool isSetState = false, String latLong}) async {
print("latLong " + latLong.toString());
if (latLong == null) { if (latLong == null) {
if (myAddresses.isEmpty) { if (myAddresses.isEmpty) {
setState(() { setState(() {
@ -86,7 +96,6 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
print("sssss1 " + latitude.toString()); print("sssss1 " + latitude.toString());
print("sssss2 " + longitude.toString()); print("sssss2 " + longitude.toString());
currentPostion = LatLng(latitude, longitude); currentPostion = LatLng(latitude, longitude);
selectedAddress = AddressInfo(latLong: '${latitude},${longitude}', address1: "", address2: "");
setMap(); setMap();
} }
} }
@ -204,9 +213,7 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
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,
@ -220,67 +227,12 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
child: continueButton(), child: continueButton(),
), ),
], ],
) )));
// Column(
// crossAxisAlignment: CrossAxisAlignment.stretch,
// children: [
// StreamBuilder<Object>(
// stream: addressStream,
// builder: (context, snapshot) {
// return selectAddressField();
// }),
// StreamBuilder<Object>(
// stream: addressLoadingStream,
// builder: (context, snapshot) {
// return snapshot.hasData
// ? LinearProgressIndicator(backgroundColor: Colors.transparent)
// : Container(
// height: 4,
// );
// }),
// Expanded(
// child: PlacePicker(
// apiKey: GOOGLE_API_KEY,
// enableMyLocationButton: true,
// automaticallyImplyAppBarLeading: false,
// autocompleteOnTrailingWhitespace: true,
// selectInitialPosition: true,
// autocompleteLanguage: projectViewModel.currentLanguage,
// enableMapTypeButton: true,
// searchForInitialValue: false,
// selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
// if (state == SearchingState.Idle) {
// addressLoadingStreamController.sink.add(null);
// if (selectedPlace != null) {
// var loc = selectedPlace.geometry.location;
// var address1 = selectedPlace.addressComponents.first.longName;
// var address2 = "";
// if (selectedPlace.addressComponents.length > 1) address2 = selectedPlace.addressComponents[1].longName;
// selectedAddress = Addresses(latLong: '${loc.lat},${loc.lng}', address1: address1, address2: address2);
// addressStreamController.sink.add(0);
// }
// } else {
// addressLoadingStreamController.sink.add(0);
// }
// return Container();
// },
// initialPosition: LatLng(24.7114693, 46.67469582),
// useCurrentLocation: false,
// ),
// ),
// continueButton()
// ],
// )
));
} }
void _updatePosition(CameraPosition _position) { void _updatePosition(CameraPosition _position) {
latitude = _position.target.latitude; latitude = _position.target.latitude;
longitude = _position.target.longitude; longitude = _position.target.longitude;
selectedAddress = AddressInfo(latLong: '${latitude},${longitude}', address1: "", address2: "");
} }
Widget centerTargetPoint() { Widget centerTargetPoint() {
@ -296,30 +248,6 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
); );
} }
// Widget selectAddressField() {
// var text = selectedAddress == null ? localize.selectAddress : selectedAddress.toString();
// return Container(
// margin: EdgeInsets.all(10),
// height: 50,
// child: MaterialButton(
// height: 50,
// color: Colors.white,
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
// onPressed: openAddressSelectDialog,
// child: Row(
// children: [
// Expanded(child: Text(text, style: TextStyle(color: Colors.grey, fontSize: 13, letterSpacing: 1))),
// Icon(
// Icons.keyboard_arrow_down,
// size: 20,
// color: Colors.grey,
// )
// ],
// ),
// ),
// );
// }
Widget continueButton() { Widget continueButton() {
return Padding( return Padding(
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
@ -335,52 +263,18 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
); );
} }
// openAddressSelectDialog() {
// showMaterialResponsiveDialog(
// hideButtons: true,
// context: context,
// title: localize.selectAddress,
// child: ListView.separated(
// shrinkWrap: true,
// padding: EdgeInsets.all(10),
// itemCount: myAddresses.length,
// itemBuilder: (ctx, idx) {
// var itm = myAddresses[idx];
// return ListTile(
// title: Text(itm.toString()),
// onTap: () {
// setState(() {
// selectedAddress = itm;
// Navigator.pop(context);
// if (itm.latLong != null && itm.latLong.isNotEmpty && itm.latLong.split(',').length > 1) {
// var cordinates = itm.latLong.split(',');
// var latlng = LatLng(double.parse(cordinates.first), double.parse(cordinates.last));
// //moveToLocation(latlng);
// } else {
// AppToast.showErrorToast(message: 'Invalid address coordinates');
// }
// });
// },
// );
// },
// separatorBuilder: (ctx, idx) => Container(
// height: 0.25,
// color: Colors.grey.withOpacity(0.7),
// )));
// }
void confirmSelectLocationDialog(List<AddressInfo> addresses) { void confirmSelectLocationDialog(List<AddressInfo> addresses) {
showDialog( showDialog(
context: context, context: context,
child: SelectLocationDialog( child: SelectLocationDialog(
addresses: addresses, addresses: addresses,
selectedAddress: _selectedAddress, selectedAddress: selectedAddress,
onValueSelected: (value) { onValueSelected: (value) {
showCurrentLocation = false; showCurrentLocation = false;
setLatitudeAndLongitude(latLong: value.latLong); setLatitudeAndLongitude(latLong: value.latLong);
setState(() { setState(() {
_selectedAddress = value; selectedAddress = value;
}); });
}, },
), ),
@ -388,8 +282,8 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
} }
String getAddressName() { String getAddressName() {
if (_selectedAddress != null) if (selectedAddress != null && selectedAddress.address1 != null)
return _selectedAddress.address1; return selectedAddress.address1;
else else
return TranslationBase.of(context).selectAddress; return TranslationBase.of(context).selectAddress;
} }
@ -411,13 +305,10 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
} }
goToCurrentLocation() async { goToCurrentLocation() async {
var location = await Geolocator.getLastKnownPosition(); Geolocator.getCurrentPosition().then((value) {
if (location == null) { selectedAddress = AddressInfo(latLong: '${value.latitude},${value.longitude}');
Geolocator.getCurrentPosition().then((value) { moveToLocation(LatLng(value.latitude, value.longitude));
moveToLocation(LatLng(value.latitude, value.longitude)); });
});
return;
}
} }
// moveToLocation(LatLng(location.latitude, location.longitude), animate: false); // moveToLocation(LatLng(location.latitude, location.longitude), animate: false);

@ -123,25 +123,27 @@ class RRTPlaceOrderPage extends StatelessWidget {
Widget selectedAddressField() { Widget selectedAddressField() {
var address = "${selectedAddress.address1 ?? ''} ${selectedAddress.address2 ?? ''}"; var address = "${selectedAddress.address1 ?? ''} ${selectedAddress.address2 ?? ''}";
return Container( return selectedAddress.address1 != null
margin: EdgeInsets.symmetric(vertical: 10), ? Container(
child: MaterialButton( margin: EdgeInsets.symmetric(vertical: 10),
height: 50, child: MaterialButton(
color: Colors.white, height: 50,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), color: Colors.white,
onPressed: () {}, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
child: Row( onPressed: () {},
children: [ child: Row(
Expanded(child: Text(address, style: TextStyle(color: Colors.black87, fontSize: 15, letterSpacing: 1))), children: [
Icon( Expanded(child: Text(address, style: TextStyle(color: Colors.black87, fontSize: 12, letterSpacing: 1))),
Icons.location_on_rounded, Icon(
size: 30, Icons.location_on_rounded,
color: Colors.black, size: 30,
) color: Colors.black,
], )
), ],
), ),
); ),
)
: SizedBox();
} }
Widget submitButton(BuildContext context) { Widget submitButton(BuildContext context) {

@ -76,6 +76,7 @@ class RRTRequestPageState extends State<RRTRequestPage> {
var orders = widget.pendingOrders; var orders = widget.pendingOrders;
return ListView.builder( return ListView.builder(
itemCount: orders.length, itemCount: orders.length,
padding: EdgeInsets.all(21),
itemBuilder: (ctx, idx) { itemBuilder: (ctx, idx) {
var order = orders[idx]; var order = orders[idx];
return RRTLogListItem(order, onCancel: deleteOrder); return RRTLogListItem(order, onCancel: deleteOrder);

@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
class SchedulePage extends StatefulWidget { class SchedulePage extends StatefulWidget {
DoctorList doctorList; DoctorList doctorList;
@ -61,11 +62,14 @@ class _SchedulePageState extends State<SchedulePage> {
onModelReady: (model2) => model2.getFreeSlots(doctorList), onModelReady: (model2) => model2.getFreeSlots(doctorList),
allowAny: true, allowAny: true,
builder: (_, model2, widget2) { builder: (_, model2, widget2) {
if (model.freeSlots.length > 0 && isPageChange == false) { if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) {
this.freeSlots = model.freeSlots; this.freeSlots = model2.freeSlots;
this.doctorScheduleResponse = model.getDoctorScheduleList; this.doctorScheduleResponse = model.getDoctorScheduleList;
this.generateWeeksSchedules(); this.generateWeeksSchedules();
} else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) {
AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule);
Navigator.pop(context);
} }
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).schedule, appBarTitle: TranslationBase.of(context).schedule,

Loading…
Cancel
Save