add delivery address vo

This commit is contained in:
Sai Naw Wun
2020-10-08 11:38:05 +06:30
parent 6105b45cb8
commit 7ae74275cd
22 changed files with 202 additions and 101 deletions

View File

@@ -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"),