add fcs shipment in processing,update cargo types for carton

This commit is contained in:
tzw
2025-03-21 18:19:52 +06:30
parent e208734dfa
commit 3bfbca35fc
34 changed files with 1227 additions and 665 deletions

View File

@@ -2,6 +2,7 @@ import 'package:fcs/domain/entities/user.dart';
import 'package:fcs/domain/vo/privilege.dart';
import 'package:fcs/localization/transalation.dart';
import 'package:fcs/pages/delivery_address/delivery_address_list.dart';
import 'package:fcs/pages/delivery_address/delivery_address_row.dart';
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
import 'package:fcs/pages/main/model/language_model.dart';
import 'package:fcs/pages/main/model/main_model.dart';
@@ -9,7 +10,6 @@ import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/profile/profile_currency_edit.dart';
import 'package:fcs/pages/profile/profile_edit.dart';
import 'package:fcs/pages/staff/model/staff_model.dart';
import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
import 'package:fcs/pages/widgets/display_text.dart';
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
import 'package:fcs/pages/widgets/local_app_bar.dart';
@@ -78,112 +78,110 @@ class _ProfileState extends State<Profile> {
buildLanguage(languageModel);
var deliveryAddressModel = Provider.of<DeliveryAddressModel>(context);
final currencyBox = Row(
children: <Widget>[
Expanded(
final currencyBox = settingRow(
context,
label: 'profile.currency',
iconData: FontAwesome5Solid.money_bill_wave,
text: user.preferCurrency ?? "",
onTap: () {
_editCurrency();
},
);
final fcsIDBox = Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
Expanded(
child: DisplayText(
text: user.preferCurrency ?? "",
labelTextKey: "profile.currency",
iconData: FontAwesome5Regular.money_bill_alt,
)),
Padding(
padding: const EdgeInsets.only(right: 0),
child: IconButton(
icon: Icon(Icons.edit, color: Colors.grey),
onPressed: _editCurrency),
)
],
);
final deleteAccountBox = DisplayText(
labelTextKey: "profile.delete.title",
iconData: MaterialCommunityIcons.account_remove,
);
final fcsIDBox = Row(
children: [
Expanded(
child: DisplayText(
text: user.fcsID ?? "",
labelTextKey: "customer.fcs.id",
icon: FcsIDIcon(),
text: user.fcsID ?? "",
labelTextKey: "customer.fcs.id",
icon: FcsIDIcon(),
),
),
),
IconButton(
icon: Icon(Icons.content_copy, color: Colors.grey),
onPressed: () => _copy(
getLocalString(context, "customer.fcs.id"), user.fcsID ?? ""),
)
],
IconButton(
icon: Icon(Icons.content_copy, color: Colors.grey),
onPressed: () => _copy(
getLocalString(context, "customer.fcs.id"), user.fcsID ?? ""),
)
],
),
);
final usaShippingAddressBox = Row(
children: [
Expanded(
child: DisplayText(
text: mainModel.setting!.usaAddress ?? "",
labelTextKey: "profile.usa.shipping.address",
iconData: Icons.location_on,
final usaShippingAddressBox = Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
Expanded(
child: DisplayText(
text: mainModel.setting!.usaAddress ?? "",
labelTextKey: "profile.usa.shipping.address",
iconData: Icons.location_on,
),
),
),
IconButton(
icon: Icon(Icons.content_copy, color: Colors.grey),
onPressed: () => _copy(
getLocalString(context, "profile.usa.shipping.address"),
mainModel.setting!.usaAddress ?? ""),
)
],
IconButton(
icon: Icon(Icons.content_copy, color: Colors.grey),
onPressed: () => _copy(
getLocalString(context, "profile.usa.shipping.address"),
mainModel.setting!.usaAddress ?? ""),
)
],
),
);
final logoutbutton =
fcsButton(context, getLocalString(context, "profile.logout"),
callack: mainModel.isPinLogin
? null
: () {
showConfirmDialog(context, "profile.logout.confirm",
() async {
await _logout();
});
},
iconData: Icons.exit_to_app);
final logoutbutton = Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: fcsButton(context, getLocalString(context, "profile.logout"),
callack: mainModel.isPinLogin
? null
: () {
showConfirmDialog(context, "profile.logout.confirm",
() async {
await _logout();
});
},
iconData: Icons.exit_to_app),
);
final emailBox = Row(
children: [
Expanded(
child: DisplayText(
text: user.recoveryEmail,
labelTextKey: "profile.recovery.email",
iconData: Icons.email_outlined,
),
),
IconButton(
icon: Icon(Icons.edit, color: Colors.grey),
onPressed: () {
Navigator.of(context, rootNavigator: true).push(
CupertinoPageRoute(
builder: (context) => AddRecoveryEmail(user: user)));
})
],
final recoveryEmailBox = settingRow(
context,
label: 'profile.recovery.email',
iconData: Icons.email_outlined,
text: user.recoveryEmail,
onTap: () {
Navigator.of(context, rootNavigator: true).push(CupertinoPageRoute(
builder: (context) => AddRecoveryEmail(user: user)));
},
);
final phoneNumberBox = settingRow(
context,
label: 'profile.change.phone',
iconData: Icons.phone,
onTap: () {
Navigator.of(context, rootNavigator: true).push(CupertinoPageRoute(
builder: (context) => ChangePhoneNumber(user: user)));
},
);
final titleBox = Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
user.name ?? "",
style: TextStyle(fontSize: 18, color: Colors.black),
),
const SizedBox(width: 5),
InkResponse(
radius: 20,
onTap: _editName,
child: Icon(Icons.edit, color: Colors.grey, size: 23))
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
user.name ?? "",
style: TextStyle(fontSize: 18, color: Colors.black),
),
const SizedBox(width: 5),
InkResponse(
radius: 20,
onTap: _editName,
child: Icon(Icons.edit, color: Colors.grey, size: 23))
],
),
const SizedBox(height: 1),
Text(
user.phone,
@@ -192,60 +190,79 @@ class _ProfileState extends State<Profile> {
],
);
final deleteAccountBox = settingRow(
context,
label: 'profile.delete.title',
iconData: MaterialCommunityIcons.account_remove,
onTap: () {
_editDelete();
},
);
final deliverAddressBox = Padding(
padding: const EdgeInsets.only(bottom: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
settingRow(
context,
label: 'profile.default.delivery.address',
iconData: MaterialCommunityIcons.truck_fast,
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => DeliveryAddressList()));
},
),
Padding(
padding: const EdgeInsets.only(left: 35),
child: DeliveryAddressRow(
key: ValueKey(deliveryAddressModel.defalutAddress.id),
deliveryAddress: deliveryAddressModel.defalutAddress),
),
],
),
);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
key: key,
appBar: LocalAppBar(
backgroundColor: Colors.white,
labelColor: primaryColor,
arrowColor: primaryColor,
titleWidget: titleBox
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
children: <Widget>[
const SizedBox(height: 5),
fcsIDBox,
usaShippingAddressBox,
currencyBox,
// emailBox,
DefaultDeliveryAddress(
labelKey: "profile.default.delivery.address",
deliveryAddress: deliveryAddressModel.defalutAddress,
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => DeliveryAddressList()));
},
),
buildLanguageWidget(
context: context,
text: "profile.language",
iconData: Icons.language,
isEng: languageModel.isEng,
),
Row(
children: <Widget>[
Expanded(
child: deleteAccountBox,
),
Padding(
padding: const EdgeInsets.only(right: 0),
child: IconButton(
icon: Icon(Icons.edit, color: Colors.grey),
onPressed: _editDelete),
)
],
),
getPrivilegeBox(context),
SizedBox(height: 15),
logoutbutton,
SizedBox(height: 25)
],
),
backgroundColor: Colors.white,
labelColor: primaryColor,
arrowColor: primaryColor,
titleWidget: titleBox),
body: ListView(
children: <Widget>[
const SizedBox(height: 5),
fcsIDBox,
usaShippingAddressBox,
currencyBox,
deliverAddressBox,
// recoveryEmailBox,
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 100,),
// child: Divider(thickness: 2),
// ),
// phoneNumberBox,
buildLanguageWidget(
context: context,
text: "profile.language",
iconData: Icons.language,
isEng: languageModel.isEng,
),
deleteAccountBox,
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 100,),
// child: Divider(thickness: 2),
// ),
getPrivilegeBox(context),
SizedBox(height: 15),
logoutbutton,
SizedBox(height: 30)
],
),
),
);
@@ -256,53 +273,56 @@ class _ProfileState extends State<Profile> {
required BuildContext context,
IconData? iconData,
required bool isEng}) {
return Row(
children: <Widget>[
Icon(iconData, color: primaryColor),
const SizedBox(width: 15),
Expanded(
child: LocalText(
context,
text,
fontSize: 15.0,
color: Colors.black54,
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: <Widget>[
Icon(iconData, color: primaryColor),
const SizedBox(width: 15),
Expanded(
child: LocalText(
context,
text,
fontSize: 15.0,
color: Colors.black54,
),
),
),
Row(
children: [
isEng
? Image.asset(
'icons/flags/png100px/us.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,
)
: Image.asset(
'icons/flags/png100px/mm.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,
),
Container(
width: 100,
padding: const EdgeInsets.only(left: 15),
child: DropdownButton(
value: selectedLanguage,
underline: const SizedBox(),
isExpanded: true,
items: languagesList
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: const TextStyle(fontSize: 14),
));
}).toList(),
onChanged: _selectedDropdown)),
],
)
],
Row(
children: [
isEng
? Image.asset(
'icons/flags/png100px/us.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,
)
: Image.asset(
'icons/flags/png100px/mm.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,
),
Container(
width: 100,
padding: const EdgeInsets.only(left: 15),
child: DropdownButton(
value: selectedLanguage,
underline: const SizedBox(),
isExpanded: true,
items: languagesList
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: const TextStyle(fontSize: 14),
));
}).toList(),
onChanged: _selectedDropdown)),
],
)
],
),
);
}
@@ -332,19 +352,22 @@ class _ProfileState extends State<Profile> {
return privileges.isEmpty
? const SizedBox()
: Column(
children: <Widget>[
DisplayText(
labelTextKey: "profile.privileges",
iconData: MaterialCommunityIcons.clipboard_check_outline,
),
Padding(
padding: const EdgeInsets.only(left: 30.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: getRowPrivilegeWidget(privileges)),
)
],
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
children: <Widget>[
DisplayText(
labelTextKey: "profile.privileges",
iconData: MaterialCommunityIcons.clipboard_check_outline,
),
Padding(
padding: const EdgeInsets.only(left: 30.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: getRowPrivilegeWidget(privileges)),
)
],
),
);
}
@@ -368,9 +391,9 @@ class _ProfileState extends State<Profile> {
children: [
Text("${p.name}",
style: TextStyle(
fontSize: 16.0,
fontSize: 15.0,
fontStyle: FontStyle.normal,
color: primaryColor)),
color: Colors.black)),
Text(
"${p.desc}",
style: TextStyle(