add delivery address vo
This commit is contained in:
24
lib/data/provider/delivery_address_data_provider.dart
Normal file
24
lib/data/provider/delivery_address_data_provider.dart
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import 'package:fcs/domain/entities/fcs_shipment.dart';
|
||||||
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
|
import 'package:fcs/helpers/api_helper.dart';
|
||||||
|
import 'package:fcs/helpers/firebase_helper.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
|
class DeliveryAddressDataProvider {
|
||||||
|
final log = Logger('DeliveryAddressDataProvider');
|
||||||
|
|
||||||
|
Future<void> createDeliveryAddress(DeliveryAddress deliveryAddress) async {
|
||||||
|
return await requestAPI("/delivery_address", "POST",
|
||||||
|
payload: deliveryAddress.toMap(), token: await getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateDeliveryAddress(DeliveryAddress deliveryAddress) async {
|
||||||
|
return await requestAPI("/delivery_address", "PUT",
|
||||||
|
payload: deliveryAddress.toMap(), token: await getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteDeliveryAddress(DeliveryAddress deliveryAddress) async {
|
||||||
|
return await requestAPI("/delivery_address", "DELETE",
|
||||||
|
payload: deliveryAddress.toMap(), token: await getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
31
lib/data/services/delivery_address_imp.dart
Normal file
31
lib/data/services/delivery_address_imp.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import 'package:fcs/data/provider/delivery_address_data_provider.dart';
|
||||||
|
import 'package:fcs/domain/entities/connectivity.dart';
|
||||||
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'delivery_address_service.dart';
|
||||||
|
|
||||||
|
class DeliveryAddressImp implements DeliveryAddressService {
|
||||||
|
DeliveryAddressImp({
|
||||||
|
@required this.connectivity,
|
||||||
|
@required this.deliveryAddressDataProvider,
|
||||||
|
});
|
||||||
|
|
||||||
|
final Connectivity connectivity;
|
||||||
|
final DeliveryAddressDataProvider deliveryAddressDataProvider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> createDeliveryAddress(DeliveryAddress deliveryAddress) {
|
||||||
|
return deliveryAddressDataProvider.createDeliveryAddress(deliveryAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> updateDeliveryAddress(DeliveryAddress deliveryAddress) {
|
||||||
|
return deliveryAddressDataProvider.updateDeliveryAddress(deliveryAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> deleteDeliveryAddress(DeliveryAddress deliveryAddress) {
|
||||||
|
return deliveryAddressDataProvider.deleteDeliveryAddress(deliveryAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
lib/data/services/delivery_address_service.dart
Normal file
7
lib/data/services/delivery_address_service.dart
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
|
|
||||||
|
abstract class DeliveryAddressService {
|
||||||
|
Future<void> createDeliveryAddress(DeliveryAddress deliveryAddress);
|
||||||
|
Future<void> updateDeliveryAddress(DeliveryAddress deliveryAddress);
|
||||||
|
Future<void> deleteDeliveryAddress(DeliveryAddress deliveryAddress);
|
||||||
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
import 'package:fcs/data/provider/auth_fb.dart';
|
import 'package:fcs/data/provider/auth_fb.dart';
|
||||||
import 'package:fcs/data/provider/common_data_provider.dart';
|
import 'package:fcs/data/provider/common_data_provider.dart';
|
||||||
|
import 'package:fcs/data/provider/delivery_address_data_provider.dart';
|
||||||
import 'package:fcs/data/provider/fcs_shipment_data_provider.dart';
|
import 'package:fcs/data/provider/fcs_shipment_data_provider.dart';
|
||||||
import 'package:fcs/data/provider/package_data_provider.dart';
|
import 'package:fcs/data/provider/package_data_provider.dart';
|
||||||
import 'package:fcs/data/provider/user_data_provider.dart';
|
import 'package:fcs/data/provider/user_data_provider.dart';
|
||||||
|
import 'package:fcs/data/services/delivery_address_imp.dart';
|
||||||
|
import 'package:fcs/data/services/delivery_address_service.dart';
|
||||||
import 'package:fcs/data/services/fcs_shipment_imp.dart';
|
import 'package:fcs/data/services/fcs_shipment_imp.dart';
|
||||||
import 'package:fcs/data/services/fcs_shipment_service.dart';
|
import 'package:fcs/data/services/fcs_shipment_service.dart';
|
||||||
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
|
|
||||||
import 'auth_imp.dart';
|
import 'auth_imp.dart';
|
||||||
import 'auth_service.dart';
|
import 'auth_service.dart';
|
||||||
@@ -26,6 +30,7 @@ class Services {
|
|||||||
MessagingService _messagingService;
|
MessagingService _messagingService;
|
||||||
CommonService _commonService;
|
CommonService _commonService;
|
||||||
FcsShipmentService _fcsShipmentService;
|
FcsShipmentService _fcsShipmentService;
|
||||||
|
DeliveryAddressService _deliveryAddressService;
|
||||||
Services._() {
|
Services._() {
|
||||||
_authService = AuthServiceImp(
|
_authService = AuthServiceImp(
|
||||||
authFb: AuthFb.instance,
|
authFb: AuthFb.instance,
|
||||||
@@ -39,6 +44,9 @@ class Services {
|
|||||||
_commonService = CommonServiceImp(commonDataProvider: CommonDataProvider());
|
_commonService = CommonServiceImp(commonDataProvider: CommonDataProvider());
|
||||||
_fcsShipmentService = FcsShipmentServiceImp(
|
_fcsShipmentService = FcsShipmentServiceImp(
|
||||||
connectivity: null, shipmentDataProvider: FcsShipmentDataProvider());
|
connectivity: null, shipmentDataProvider: FcsShipmentDataProvider());
|
||||||
|
_deliveryAddressService = DeliveryAddressImp(
|
||||||
|
connectivity: null,
|
||||||
|
deliveryAddressDataProvider: DeliveryAddressDataProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthService get authService => _authService;
|
AuthService get authService => _authService;
|
||||||
@@ -47,4 +55,5 @@ class Services {
|
|||||||
PackageService get packageService => _packageService;
|
PackageService get packageService => _packageService;
|
||||||
CommonService get commonService => _commonService;
|
CommonService get commonService => _commonService;
|
||||||
FcsShipmentService get fcsShipmentService => _fcsShipmentService;
|
FcsShipmentService get fcsShipmentService => _fcsShipmentService;
|
||||||
|
DeliveryAddressService get deliveryAddressService => _deliveryAddressService;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ const markets_collection = "markets";
|
|||||||
const packages_collection = "packages";
|
const packages_collection = "packages";
|
||||||
const messages_collection = "messages";
|
const messages_collection = "messages";
|
||||||
const fcs_shipment_collection = "fcs_shipments";
|
const fcs_shipment_collection = "fcs_shipments";
|
||||||
|
const delivery_address_collection = "delivery_addresses";
|
||||||
|
|
||||||
const user_requested_status = "requested";
|
const user_requested_status = "requested";
|
||||||
const user_invited_status = "invited";
|
const user_invited_status = "invited";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:fcs/domain/vo/shipment_status.dart';
|
import 'package:fcs/domain/vo/shipment_status.dart';
|
||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
|
|
||||||
import 'cargo.dart';
|
import 'cargo.dart';
|
||||||
import 'package.dart';
|
import 'package.dart';
|
||||||
@@ -33,7 +33,7 @@ class Box {
|
|||||||
|
|
||||||
List<Cargo> cargoTypes;
|
List<Cargo> cargoTypes;
|
||||||
|
|
||||||
ShippingAddress shippingAddress;
|
DeliveryAddress shippingAddress;
|
||||||
|
|
||||||
int get amount => rate != null && weight != null ? rate * weight : 0;
|
int get amount => rate != null && weight != null ? rate * weight : 0;
|
||||||
|
|
||||||
|
|||||||
31
lib/domain/vo/delivery_address.dart
Normal file
31
lib/domain/vo/delivery_address.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
class DeliveryAddress {
|
||||||
|
String id;
|
||||||
|
String fullName;
|
||||||
|
String addressLine1;
|
||||||
|
String addressLine2;
|
||||||
|
String city;
|
||||||
|
String state;
|
||||||
|
String country;
|
||||||
|
String phoneNumber;
|
||||||
|
DeliveryAddress(
|
||||||
|
{this.fullName,
|
||||||
|
this.addressLine1,
|
||||||
|
this.addressLine2,
|
||||||
|
this.city,
|
||||||
|
this.state,
|
||||||
|
this.country,
|
||||||
|
this.phoneNumber});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"id": id,
|
||||||
|
'full_name': fullName,
|
||||||
|
'address_line1': addressLine1,
|
||||||
|
'address_line2': addressLine2,
|
||||||
|
'city': city,
|
||||||
|
'state': state,
|
||||||
|
'phone_number': phoneNumber,
|
||||||
|
'contry': country,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
class ShippingAddress {
|
|
||||||
String fullName;
|
|
||||||
String addressLine1;
|
|
||||||
String addressLine2;
|
|
||||||
String city;
|
|
||||||
String state;
|
|
||||||
String phoneNumber;
|
|
||||||
ShippingAddress(
|
|
||||||
{this.fullName,
|
|
||||||
this.addressLine1,
|
|
||||||
this.addressLine2,
|
|
||||||
this.city,
|
|
||||||
this.state,
|
|
||||||
this.phoneNumber});
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:fcs/domain/entities/box.dart';
|
import 'package:fcs/domain/entities/box.dart';
|
||||||
import 'package:fcs/domain/entities/cargo.dart';
|
import 'package:fcs/domain/entities/cargo.dart';
|
||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/pages/main/model/main_model.dart';
|
import 'package:fcs/pages/main/model/main_model.dart';
|
||||||
@@ -45,7 +45,7 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
];
|
];
|
||||||
bool isNew;
|
bool isNew;
|
||||||
bool isMixBox = false;
|
bool isMixBox = false;
|
||||||
ShippingAddress _shippingAddress = new ShippingAddress();
|
DeliveryAddress _shippingAddress = new DeliveryAddress();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -546,7 +546,7 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getAddressList(
|
List<Widget> getAddressList(
|
||||||
BuildContext context, List<ShippingAddress> addresses) {
|
BuildContext context, List<DeliveryAddress> addresses) {
|
||||||
return addresses.asMap().entries.map((s) {
|
return addresses.asMap().entries.map((s) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:fcs/domain/entities/box.dart';
|
|||||||
import 'package:fcs/domain/entities/cargo.dart';
|
import 'package:fcs/domain/entities/cargo.dart';
|
||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
import 'package:fcs/domain/vo/shipment_status.dart';
|
import 'package:fcs/domain/vo/shipment_status.dart';
|
||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/pages/main/model/base_model.dart';
|
import 'package:fcs/pages/main/model/base_model.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ class BoxModel extends BaseModel {
|
|||||||
shipmentWeight: 6,
|
shipmentWeight: 6,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
shipmentHistory: statusHistory,
|
shipmentHistory: statusHistory,
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'U Nyi Nyi',
|
fullName: 'U Nyi Nyi',
|
||||||
addressLine1: '154-19 64th Ave.',
|
addressLine1: '154-19 64th Ave.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'Flushing',
|
||||||
@@ -74,7 +74,7 @@ class BoxModel extends BaseModel {
|
|||||||
shipmentHistory: statusHistory,
|
shipmentHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'Mg Myo',
|
fullName: 'Mg Myo',
|
||||||
addressLine1: '153-154 5th Thitsar.',
|
addressLine1: '153-154 5th Thitsar.',
|
||||||
addressLine2: 'South Okkalapa Township',
|
addressLine2: 'South Okkalapa Township',
|
||||||
@@ -104,7 +104,7 @@ class BoxModel extends BaseModel {
|
|||||||
shipmentHistory: statusHistory,
|
shipmentHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'Mg Myo',
|
fullName: 'Mg Myo',
|
||||||
addressLine1: '153-154 5th Thitsar.',
|
addressLine1: '153-154 5th Thitsar.',
|
||||||
addressLine2: 'South Okkalapa Township',
|
addressLine2: 'South Okkalapa Township',
|
||||||
@@ -134,7 +134,7 @@ class BoxModel extends BaseModel {
|
|||||||
shipmentHistory: statusHistory,
|
shipmentHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'U Nyi Nyi',
|
fullName: 'U Nyi Nyi',
|
||||||
addressLine1: '154-19 64th Ave.',
|
addressLine1: '154-19 64th Ave.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'Flushing',
|
||||||
@@ -164,7 +164,7 @@ class BoxModel extends BaseModel {
|
|||||||
shipmentHistory: statusHistory,
|
shipmentHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'U Nyi Nyi',
|
fullName: 'U Nyi Nyi',
|
||||||
addressLine1: '154-19 64th Ave.',
|
addressLine1: '154-19 64th Ave.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'Flushing',
|
||||||
@@ -194,7 +194,7 @@ class BoxModel extends BaseModel {
|
|||||||
shipmentHistory: statusHistory,
|
shipmentHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'U Nyi Nyi',
|
fullName: 'U Nyi Nyi',
|
||||||
addressLine1: '154-19 64th Ave.',
|
addressLine1: '154-19 64th Ave.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'Flushing',
|
||||||
@@ -224,7 +224,7 @@ class BoxModel extends BaseModel {
|
|||||||
shipmentHistory: statusHistory,
|
shipmentHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'U Nyi Nyi',
|
fullName: 'U Nyi Nyi',
|
||||||
addressLine1: '154-19 64th Ave.',
|
addressLine1: '154-19 64th Ave.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'Flushing',
|
||||||
@@ -254,7 +254,7 @@ class BoxModel extends BaseModel {
|
|||||||
shipmentHistory: statusHistory,
|
shipmentHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'U Nyi Nyi',
|
fullName: 'U Nyi Nyi',
|
||||||
addressLine1: '154-19 64th Ave.',
|
addressLine1: '154-19 64th Ave.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'Flushing',
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
child: CountryCodePicker(
|
child: CountryCodePicker(
|
||||||
onChanged: _countryChange,
|
onChanged: _countryChange,
|
||||||
initialSelection: dialCode,
|
initialSelection: dialCode,
|
||||||
countryFilter: ['+95', '+1'],
|
countryFilter: ['mm', 'us'],
|
||||||
showCountryOnly: false,
|
showCountryOnly: false,
|
||||||
showOnlyCountryWhenClosed: false,
|
showOnlyCountryWhenClosed: false,
|
||||||
alignLeft: false,
|
alignLeft: false,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class FcsShipmentModel extends BaseModel {
|
|||||||
try {
|
try {
|
||||||
listener = Firestore.instance
|
listener = Firestore.instance
|
||||||
.collection("$path")
|
.collection("$path")
|
||||||
|
.orderBy("shipment_number", descending: true)
|
||||||
.snapshots()
|
.snapshots()
|
||||||
.listen((QuerySnapshot snapshot) {
|
.listen((QuerySnapshot snapshot) {
|
||||||
fcsShipments.clear();
|
fcsShipments.clear();
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
List<Widget> widgets = [];
|
List<Widget> widgets = [];
|
||||||
widgets.add(faqBtn);
|
widgets.add(faqBtn);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
true ? widgets.add(pickUpBtn) : "";
|
// true ? widgets.add(pickUpBtn) : "";
|
||||||
!customer ? widgets.add(fcsShipmentBtn) : "";
|
!customer ? widgets.add(fcsShipmentBtn) : "";
|
||||||
customer ? widgets.add(notiBtn) : "";
|
customer ? widgets.add(notiBtn) : "";
|
||||||
user.hasStaffs() ? widgets.add(staffBtn) : "";
|
user.hasStaffs() ? widgets.add(staffBtn) : "";
|
||||||
@@ -286,8 +286,8 @@ class _HomePageState extends State<HomePage> {
|
|||||||
true ? widgets.add(boxesBtn) : "";
|
true ? widgets.add(boxesBtn) : "";
|
||||||
true ? widgets.add(deliveryBtn) : "";
|
true ? widgets.add(deliveryBtn) : "";
|
||||||
user.hasCustomers() ? widgets.add(customersBtn) : "";
|
user.hasCustomers() ? widgets.add(customersBtn) : "";
|
||||||
true ? widgets.add(invoicesBtn) : "";
|
// true ? widgets.add(invoicesBtn) : "";
|
||||||
true ? widgets.add(discountBtn) : "";
|
// true ? widgets.add(discountBtn) : "";
|
||||||
}
|
}
|
||||||
return OfflineRedirect(
|
return OfflineRedirect(
|
||||||
child: FlavorBanner(
|
child: FlavorBanner(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:fcs/domain/entities/role.dart';
|
import 'package:fcs/domain/entities/role.dart';
|
||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/localization/transalation.dart';
|
import 'package:fcs/localization/transalation.dart';
|
||||||
import 'package:fcs/pages/main/model/language_model.dart';
|
import 'package:fcs/pages/main/model/language_model.dart';
|
||||||
@@ -60,13 +60,13 @@ class _ProfileState extends State<Profile> {
|
|||||||
}
|
}
|
||||||
final namebox = DisplayText(
|
final namebox = DisplayText(
|
||||||
text: mainModel.user.name,
|
text: mainModel.user.name,
|
||||||
labelTextKey: getLocalString(context, "profile.name"),
|
labelTextKey: "profile.name",
|
||||||
iconData: Icons.person,
|
iconData: Icons.person,
|
||||||
);
|
);
|
||||||
|
|
||||||
final phonenumberbox = DisplayText(
|
final phonenumberbox = DisplayText(
|
||||||
text: mainModel.user.phone,
|
text: mainModel.user.phone,
|
||||||
labelTextKey: getLocalString(context, "profile.phone"),
|
labelTextKey: "profile.phone",
|
||||||
iconData: Icons.phone,
|
iconData: Icons.phone,
|
||||||
);
|
);
|
||||||
final fcsIDBox = Row(
|
final fcsIDBox = Row(
|
||||||
@@ -74,7 +74,7 @@ class _ProfileState extends State<Profile> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: DisplayText(
|
child: DisplayText(
|
||||||
text: mainModel.user.fcsID,
|
text: mainModel.user.fcsID,
|
||||||
labelTextKey: getLocalString(context, "customer.fcs.id"),
|
labelTextKey: "customer.fcs.id",
|
||||||
icon: FcsIDIcon(),
|
icon: FcsIDIcon(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -90,8 +90,7 @@ class _ProfileState extends State<Profile> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: DisplayText(
|
child: DisplayText(
|
||||||
text: mainModel.setting.usaAddress,
|
text: mainModel.setting.usaAddress,
|
||||||
labelTextKey:
|
labelTextKey: "profile.usa.shipping.address",
|
||||||
getLocalString(context, "profile.usa.shipping.address"),
|
|
||||||
iconData: Icons.location_on,
|
iconData: Icons.location_on,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -151,18 +150,18 @@ class _ProfileState extends State<Profile> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// mainModel.isCustomer()
|
mainModel.isCustomer()
|
||||||
// ? Container()
|
? Container()
|
||||||
// : getPrivilegeBox(context),
|
: getPrivilegeBox(context),
|
||||||
|
getShippingAddressList(context),
|
||||||
phonenumberbox,
|
phonenumberbox,
|
||||||
fcsIDBox,
|
fcsIDBox,
|
||||||
usaShippingAddressBox,
|
usaShippingAddressBox,
|
||||||
DisplayText(
|
DisplayText(
|
||||||
text: mainModel.user.status,
|
text: mainModel.user.status,
|
||||||
labelTextKey: getLocalString(context, "customer.status"),
|
labelTextKey: "customer.status",
|
||||||
iconData: Icons.add_alarm,
|
iconData: Icons.add_alarm,
|
||||||
),
|
),
|
||||||
// getShippingAddressList(context),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -177,50 +176,47 @@ class _ProfileState extends State<Profile> {
|
|||||||
|
|
||||||
Widget getShippingAddressList(BuildContext context) {
|
Widget getShippingAddressList(BuildContext context) {
|
||||||
var shipmentModel = Provider.of<ShipmentAddressModel>(context);
|
var shipmentModel = Provider.of<ShipmentAddressModel>(context);
|
||||||
return Container(
|
return ExpansionTile(
|
||||||
padding: EdgeInsets.only(top: 5, left: 10),
|
title: Text(
|
||||||
child: ExpansionTile(
|
"My Addresses",
|
||||||
title: Text(
|
style:
|
||||||
"My Addresses",
|
TextStyle(fontWeight: FontWeight.bold, fontStyle: FontStyle.normal),
|
||||||
style: TextStyle(
|
),
|
||||||
fontWeight: FontWeight.bold, fontStyle: FontStyle.normal),
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: getAddressList(context, shipmentModel.shippingAddresses),
|
||||||
),
|
),
|
||||||
children: <Widget>[
|
Container(
|
||||||
Column(
|
padding: EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
||||||
children: getAddressList(context, shipmentModel.shippingAddresses),
|
child: Align(
|
||||||
),
|
alignment: Alignment.bottomRight,
|
||||||
Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
width: 130,
|
||||||
child: Align(
|
height: 40,
|
||||||
alignment: Alignment.bottomRight,
|
child: FloatingActionButton.extended(
|
||||||
child: Container(
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
width: 130,
|
onPressed: () {
|
||||||
height: 40,
|
Navigator.push(
|
||||||
child: FloatingActionButton.extended(
|
context,
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
BottomUpPageRoute(ShippingAddressEditor()),
|
||||||
onPressed: () {
|
);
|
||||||
Navigator.push(
|
},
|
||||||
context,
|
icon: Icon(Icons.add),
|
||||||
BottomUpPageRoute(ShippingAddressEditor()),
|
label: Text(
|
||||||
);
|
'Add New\nAddress',
|
||||||
},
|
style: TextStyle(fontSize: 12),
|
||||||
icon: Icon(Icons.add),
|
|
||||||
label: Text(
|
|
||||||
'Add New\nAddress',
|
|
||||||
style: TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
backgroundColor: primaryColor,
|
|
||||||
),
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getAddressList(
|
List<Widget> getAddressList(
|
||||||
BuildContext context, List<ShippingAddress> addresses) {
|
BuildContext context, List<DeliveryAddress> addresses) {
|
||||||
return addresses.asMap().entries.map((s) {
|
return addresses.asMap().entries.map((s) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -246,7 +242,7 @@ class _ProfileState extends State<Profile> {
|
|||||||
var languageModel = Provider.of<LanguageModel>(context);
|
var languageModel = Provider.of<LanguageModel>(context);
|
||||||
|
|
||||||
return ListTileTheme(
|
return ListTileTheme(
|
||||||
contentPadding: EdgeInsets.all(0),
|
contentPadding: EdgeInsets.all(10),
|
||||||
child: ExpansionTile(
|
child: ExpansionTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
AppTranslations.of(context).text("profile.privilege"),
|
AppTranslations.of(context).text("profile.privilege"),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:fcs/domain/entities/box.dart';
|
import 'package:fcs/domain/entities/box.dart';
|
||||||
import 'package:fcs/domain/entities/cargo.dart';
|
import 'package:fcs/domain/entities/cargo.dart';
|
||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/pages/shipment_address/model/shipment_address_model.dart';
|
import 'package:fcs/pages/shipment_address/model/shipment_address_model.dart';
|
||||||
@@ -30,7 +30,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
|||||||
bool isNew;
|
bool isNew;
|
||||||
|
|
||||||
bool isMixBox = false;
|
bool isMixBox = false;
|
||||||
ShippingAddress _shippingAddress = new ShippingAddress();
|
DeliveryAddress _shippingAddress = new DeliveryAddress();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:fcs/domain/entities/box.dart';
|
import 'package:fcs/domain/entities/box.dart';
|
||||||
import 'package:fcs/domain/entities/cargo.dart';
|
import 'package:fcs/domain/entities/cargo.dart';
|
||||||
import 'package:fcs/domain/entities/pickup.dart';
|
import 'package:fcs/domain/entities/pickup.dart';
|
||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/pages/box/model/box_model.dart';
|
import 'package:fcs/pages/box/model/box_model.dart';
|
||||||
@@ -58,7 +58,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
var now = new DateTime.now();
|
var now = new DateTime.now();
|
||||||
bool isNew;
|
bool isNew;
|
||||||
ShippingAddress _shippingAddress = new ShippingAddress();
|
DeliveryAddress _shippingAddress = new DeliveryAddress();
|
||||||
|
|
||||||
int _currVal = 1;
|
int _currVal = 1;
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
title: LocalText(context, "shipment.edit.title",
|
title: LocalText(context, "shipment.edit.title",
|
||||||
fontSize: 18, color: Colors.white),
|
fontSize: 18, color: Colors.white),
|
||||||
),
|
),
|
||||||
body: Card(
|
body: Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -310,7 +310,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
_currVal == 3
|
_currVal == 3
|
||||||
? Container(
|
? Container(
|
||||||
child: ShippingAddressRow(
|
child: ShippingAddressRow(
|
||||||
shippingAddress: ShippingAddress(
|
shippingAddress: DeliveryAddress(
|
||||||
fullName: 'FCS Office',
|
fullName: 'FCS Office',
|
||||||
addressLine1: '154-19 64th Ave.',
|
addressLine1: '154-19 64th Ave.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'Flushing',
|
||||||
@@ -689,7 +689,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
List<Box> _boxes = [boxes[0], boxes[1]];
|
List<Box> _boxes = [boxes[0], boxes[1]];
|
||||||
|
|
||||||
return _boxes.asMap().entries.map((_box) {
|
return _boxes.asMap().entries.map((_box) {
|
||||||
ShippingAddress shippingAddress = _box.value.shippingAddress;
|
DeliveryAddress shippingAddress = _box.value.shippingAddress;
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/data/services/services.dart';
|
||||||
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/pages/main/model/base_model.dart';
|
import 'package:fcs/pages/main/model/base_model.dart';
|
||||||
|
|
||||||
class ShipmentAddressModel extends BaseModel {
|
class ShipmentAddressModel extends BaseModel {
|
||||||
List<ShippingAddress> shippingAddresses = [
|
List<DeliveryAddress> shippingAddresses = [
|
||||||
ShippingAddress(
|
DeliveryAddress(
|
||||||
fullName: 'U Nyi Nyi',
|
fullName: 'U Nyi Nyi',
|
||||||
addressLine1: '154-19 64th Ave.',
|
addressLine1: '154-19 64th Ave.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'Flushing',
|
||||||
city: 'NY',
|
city: 'NY',
|
||||||
state: 'NY',
|
state: 'NY',
|
||||||
phoneNumber: '+1 (292)215-2247'),
|
phoneNumber: '+1 (292)215-2247'),
|
||||||
ShippingAddress(
|
DeliveryAddress(
|
||||||
fullName: 'Mg Myo',
|
fullName: 'Mg Myo',
|
||||||
addressLine1: '153-154 5th Thitsar.',
|
addressLine1: '153-154 5th Thitsar.',
|
||||||
addressLine2: 'South Okkalapa Township',
|
addressLine2: 'South Okkalapa Township',
|
||||||
@@ -22,4 +23,19 @@ class ShipmentAddressModel extends BaseModel {
|
|||||||
void initUser(user) {
|
void initUser(user) {
|
||||||
super.initUser(user);
|
super.initUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> createDeliveryAddress(DeliveryAddress deliveryAddress) {
|
||||||
|
return Services.instance.deliveryAddressService
|
||||||
|
.createDeliveryAddress(deliveryAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateDeliveryAddress(DeliveryAddress deliveryAddress) {
|
||||||
|
return Services.instance.deliveryAddressService
|
||||||
|
.updateDeliveryAddress(deliveryAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteDeliveryAddress(DeliveryAddress deliveryAddress) {
|
||||||
|
return Services.instance.deliveryAddressService
|
||||||
|
.deleteDeliveryAddress(deliveryAddress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
@@ -7,7 +7,7 @@ import 'package:flutter_icons/flutter_icons.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class ShippingAddressEditor extends StatefulWidget {
|
class ShippingAddressEditor extends StatefulWidget {
|
||||||
final ShippingAddress shippingAddress;
|
final DeliveryAddress shippingAddress;
|
||||||
ShippingAddressEditor({this.shippingAddress});
|
ShippingAddressEditor({this.shippingAddress});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -22,7 +22,7 @@ class _ShippingAddressEditorState extends State<ShippingAddressEditor> {
|
|||||||
TextEditingController _stateController = new TextEditingController();
|
TextEditingController _stateController = new TextEditingController();
|
||||||
TextEditingController _phoneController = new TextEditingController();
|
TextEditingController _phoneController = new TextEditingController();
|
||||||
|
|
||||||
ShippingAddress _shippingAddress = new ShippingAddress();
|
DeliveryAddress _shippingAddress = new DeliveryAddress();
|
||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
@@ -97,7 +97,7 @@ class _ShippingAddressListState extends State<ShippingAddressList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getAddressList(
|
List<Widget> getAddressList(
|
||||||
BuildContext context, List<ShippingAddress> addresses) {
|
BuildContext context, List<DeliveryAddress> addresses) {
|
||||||
return addresses.asMap().entries.map((s) {
|
return addresses.asMap().entries.map((s) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'package:fcs/domain/vo/shipping_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/pages/shipment_address/model/shipment_address_model.dart';
|
import 'package:fcs/pages/shipment_address/model/shipment_address_model.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';
|
||||||
|
|
||||||
class ShippingAddressRow extends StatelessWidget {
|
class ShippingAddressRow extends StatelessWidget {
|
||||||
final ShippingAddress shippingAddress;
|
final DeliveryAddress shippingAddress;
|
||||||
final int index;
|
final int index;
|
||||||
|
|
||||||
const ShippingAddressRow({Key key, this.shippingAddress, this.index})
|
const ShippingAddressRow({Key key, this.shippingAddress, this.index})
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class _SigninPageState extends State<SigninPage> {
|
|||||||
child: CountryCodePicker(
|
child: CountryCodePicker(
|
||||||
onChanged: _countryChange,
|
onChanged: _countryChange,
|
||||||
initialSelection: dialCode,
|
initialSelection: dialCode,
|
||||||
countryFilter: ['+95', '+1'],
|
countryFilter: ['mm', 'us'],
|
||||||
showCountryOnly: false,
|
showCountryOnly: false,
|
||||||
showOnlyCountryWhenClosed: false,
|
showOnlyCountryWhenClosed: false,
|
||||||
alignLeft: false,
|
alignLeft: false,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class FcsIDIcon extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.only(right: 12.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 25,
|
width: 25,
|
||||||
height: 25,
|
height: 25,
|
||||||
|
|||||||
Reference in New Issue
Block a user