|
|
|
|
@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
@ -25,39 +26,35 @@ import 'package:provider/provider.dart';
|
|
|
|
|
class SelectAddressWidget extends StatefulWidget {
|
|
|
|
|
final OrderPreviewViewModel model;
|
|
|
|
|
final List<Addresses> addresses;
|
|
|
|
|
final Function changeMainState;
|
|
|
|
|
|
|
|
|
|
SelectAddressWidget(this.model, this.addresses);
|
|
|
|
|
SelectAddressWidget(this.model, this.addresses, this.changeMainState);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
|
|
|
|
|
Addresses address;
|
|
|
|
|
AddressInfo address;
|
|
|
|
|
|
|
|
|
|
_navigateToAddressPage() {
|
|
|
|
|
Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
|
|
|
|
|
.then((result) {
|
|
|
|
|
if (result != null) {
|
|
|
|
|
address = result;
|
|
|
|
|
widget.model.paymentCheckoutData.address = address;
|
|
|
|
|
widget.model.paymentCheckoutData.address =
|
|
|
|
|
Addresses.fromJson(address.toJson());
|
|
|
|
|
widget.model.getInformationsByAddress();
|
|
|
|
|
widget.changeMainState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* setState(() {
|
|
|
|
|
if (result != null) {
|
|
|
|
|
address = result;
|
|
|
|
|
widget.model.paymentCheckoutData.address = address;
|
|
|
|
|
widget.model.getInformationsByAddress();
|
|
|
|
|
}
|
|
|
|
|
})*/
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
if (widget.model.paymentCheckoutData.address != null) {
|
|
|
|
|
address = widget.model.paymentCheckoutData.address;
|
|
|
|
|
address = AddressInfo.fromJson(
|
|
|
|
|
widget.model.paymentCheckoutData.address.toJson());
|
|
|
|
|
}
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|