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