update ui

This commit is contained in:
tzw
2025-04-02 15:02:49 +06:30
parent 17ca3e2a3f
commit f1c5342ae4
16 changed files with 253 additions and 245 deletions

View File

@@ -99,20 +99,20 @@ class Package {
return Package( return Package(
id: docID, id: docID,
userID: map['user_id'], userID: map['user_id'] ?? "",
fcsID: map['fcs_id'], fcsID: map['fcs_id'],
trackingID: map['tracking_id'], trackingID: map['tracking_id'],
market: map['market'], market: map['market'] ?? "",
userName: map['user_name'] ?? "", userName: map['user_name'] ?? "",
phoneNumber: map['phone_number'] ?? "", phoneNumber: map['phone_number'] ?? "",
remark: map['remark'], remark: map['remark'] ?? "",
desc: map['desc'], desc: map['desc'] ?? "",
status: map['status'], status: map['status'],
senderFCSID: map['sender_fcs_id'], senderFCSID: map['sender_fcs_id'] ?? "",
senderName: map['sender_name'] ?? "", senderName: map['sender_name'] ?? "",
senderPhoneNumber: map['sender_phone_number'] ?? "", senderPhoneNumber: map['sender_phone_number'] ?? "",
fcsShipmentId: map['fcs_shipment_id'], fcsShipmentId: map['fcs_shipment_id'] ?? "",
fcsShipmentNumber: map['fcs_shipment_number'], fcsShipmentNumber: map['fcs_shipment_number'] ?? "",
deliveryAddress: da, deliveryAddress: da,
currentStatusDate: currentStatusDate?.toDate().toLocal(), currentStatusDate: currentStatusDate?.toDate().toLocal(),
photoUrls: photoUrls, photoUrls: photoUrls,
@@ -132,7 +132,7 @@ class Package {
'id': id, 'id': id,
'fcs_id': fcsID, 'fcs_id': fcsID,
'sender_fcs_id': senderFCSID, 'sender_fcs_id': senderFCSID,
'fcs_shipment_id' : fcsShipmentId, 'fcs_shipment_id': fcsShipmentId,
'tracking_id': trackingID, 'tracking_id': trackingID,
'market': market, 'market': market,
"desc": desc, "desc": desc,

View File

@@ -1,16 +1,16 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
const primaryColor = const Color(0xff272262); const primaryColor = Color(0xff272262);
const secondaryColor = const Color(0xffff4400); const secondaryColor = Color(0xffff4400);
const thirdColor = const Color(0xf0ff4444); const thirdColor = Color(0xf0ff4444);
const nextColor = const Color(0xFFfa833d); const nextColor = Color(0xFFfa833d);
const buttonColor = const Color(0xFFFFFFFF); const buttonColor = Color(0xFFFFFFFF);
const buttonBkColor = const Color(0xFF268944); const buttonBkColor = Color(0xFF268944);
const labelColor = const Color(0xFF757575); const labelColor = Color(0xFF757575);
var dividerColor = Colors.grey.shade400; var dividerColor = Colors.grey.shade400;
const dangerColor = const Color(0xffff0606); const dangerColor = Color(0xffff0606);
const hintTextColor = Color.fromARGB(255, 187, 187, 187); const hintTextColor = Color.fromARGB(255, 187, 187, 187);
const linkColor= Color(0xff0000EE); const linkColor = Color(0xff0000EE);
const oddColor = Color(0xffECF1F7); const oddColor = Color(0xffECF1F7);
const TextStyle labelStyle = const TextStyle labelStyle =
@@ -21,16 +21,7 @@ const TextStyle labelStyleMM = TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
height: 1, height: 1,
fontFamily: "Myanmar3"); fontFamily: "Myanmar3");
const TextStyle subMenuStyle =
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500);
const TextStyle subMenuStyleMM = TextStyle(
fontSize: 14,
color: Colors.white,
fontWeight: FontWeight.w500,
fontFamily: "Myanmar3");
const TextStyle welcomeLabelStyle =
TextStyle(fontSize: 23, color: primaryColor, fontWeight: FontWeight.w500);
const TextStyle welcomeSubLabelStyle = const TextStyle welcomeSubLabelStyle =
TextStyle(fontSize: 18, color: primaryColor, fontWeight: FontWeight.w500); TextStyle(fontSize: 18, color: primaryColor, fontWeight: FontWeight.w500);
const TextStyle siginButtonStyle = const TextStyle siginButtonStyle =
@@ -42,9 +33,9 @@ TextStyle newLabelStyle(
FontWeight? fontWeight, FontWeight? fontWeight,
bool underline = false}) { bool underline = false}) {
return TextStyle( return TextStyle(
fontSize: fontSize == null ? 14 : fontSize, fontSize: fontSize ?? 14,
color: color == null ? secondaryColor : color, color: color ?? secondaryColor,
fontWeight: fontWeight == null ? FontWeight.w500 : fontWeight, fontWeight: fontWeight ?? FontWeight.w500,
decoration: underline ? TextDecoration.underline : TextDecoration.none); decoration: underline ? TextDecoration.underline : TextDecoration.none);
} }
@@ -54,66 +45,14 @@ TextStyle newLabelStyleMM(
FontWeight? fontWeight, FontWeight? fontWeight,
bool underline = false}) { bool underline = false}) {
return TextStyle( return TextStyle(
fontSize: fontSize == null ? 13 : fontSize, fontSize: fontSize ?? 13,
color: color == null ? secondaryColor : color, color: color ?? secondaryColor,
fontWeight: fontWeight == null ? FontWeight.w500 : fontWeight, fontWeight: fontWeight ?? FontWeight.w500,
decoration: underline ? TextDecoration.underline : TextDecoration.none, decoration: underline ? TextDecoration.underline : TextDecoration.none,
fontFamily: "Myanmar3"); fontFamily: "Myanmar3");
} }
const TextStyle photoLabelStyle = const TextStyle textStyle = TextStyle(fontSize: 14, color: Colors.black);
TextStyle(color: Colors.black, fontSize: 13.0);
const TextStyle photoLabelStyleMM =
TextStyle(color: Colors.black, fontSize: 13.0, fontFamily: "Myanmar3");
const TextStyle textStyle =
TextStyle(fontSize: 14, color: Colors.black87, fontWeight: FontWeight.w500);
const TextStyle textStyleOdd = TextStyle(
fontSize: 15, color: Colors.blueAccent, fontWeight: FontWeight.w500);
const TextStyle textStrikeStyle = TextStyle(
fontSize: 15,
color: Colors.black87,
fontWeight: FontWeight.w500,
decoration: TextDecoration.lineThrough,
);
const TextStyle textHighlightRedStyle = TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.w500,
backgroundColor: Colors.red,
);
const TextStyle textHighlightGreenStyle = TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.w500,
backgroundColor: Colors.green,
);
const TextStyle textHighlightBlueStyle = TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.w500,
backgroundColor: Colors.blue,
);
const TextStyle subTitleStyle = const TextStyle subTitleStyle =
TextStyle(fontSize: 12, color: Colors.black45, fontWeight: FontWeight.w500); TextStyle(fontSize: 12, color: Colors.black45, fontWeight: FontWeight.w500);
final BoxDecoration tableRowOdd = BoxDecoration(
color: Color(0x1F000000),
);
final BoxDecoration tableRowEven = BoxDecoration(
color: Colors.white54,
);
class LoginColors {
const LoginColors();
static const Color loginGradientStart = const Color(0xfff00a21);
static const Color loginGradientEnd = const Color(0xfff00a21);
static const primaryGradient = const LinearGradient(
colors: const [loginGradientStart, loginGradientEnd],
stops: const [0.0, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
);
}

View File

@@ -334,7 +334,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
isDense: true, isDense: true,
value: _selectStandardSize, value: _selectStandardSize,
style: TextStyle(color: Colors.black, fontSize: 14), style: TextStyle(color: Colors.black, fontSize: 14),
underline: Container(height: 1, color: Colors.grey), underline: Container(height: 1, color: isStandardSize? primaryColor: Colors.grey),
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
if (newValue?.name == MANAGE_CARTONSIZE) { if (newValue?.name == MANAGE_CARTONSIZE) {

View File

@@ -451,8 +451,11 @@ class CartonSubmit extends StatelessWidget {
// packages.isNotEmpty ? packagesBox : const SizedBox(), // packages.isNotEmpty ? packagesBox : const SizedBox(),
// const SizedBox(height: 10), // const SizedBox(height: 10),
cargoTypes.isNotEmpty ? cargosBox : const SizedBox(), cargoTypes.isNotEmpty ? cargosBox : const SizedBox(),
const SizedBox(height: 10), surchareItems.isNotEmpty
surchareItems.isNotEmpty ? surChargeItemsBox : const SizedBox(), ? Padding(
padding: EdgeInsets.only(top: 10),
child: surChargeItemsBox)
: const SizedBox(),
const SizedBox(height: 20), const SizedBox(height: 20),
], ],
), ),

View File

@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
import '../../../domain/entities/carton.dart'; import '../../../domain/entities/carton.dart';
import '../../../helpers/theme.dart'; import '../../../helpers/theme.dart';
import '../../main/util.dart';
import '../model/carton_selection_model.dart'; import '../model/carton_selection_model.dart';
typedef OnAction = Future<void> Function(); typedef OnAction = Future<void> Function();
@@ -72,20 +73,20 @@ class CartonSelectionResult extends StatelessWidget {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: new Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 8.0), vertical: 8.0),
child: new Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
new Text(carton.cartonNumber ?? "", Text(carton.cartonNumber ?? "",
style: new TextStyle( style: TextStyle(
fontSize: 15.0, fontSize: 15.0,
color: Colors.black)), color: Colors.black)),
new Text( Text(
"${carton.cartonWeight.toStringAsFixed(2)} lb", "${twoDecimalFormatted(carton.cartonWeight)} lb",
style: new TextStyle( style: TextStyle(
fontSize: 15.0, fontSize: 15.0,
color: Colors.grey), color: Colors.grey),
), ),

View File

@@ -29,7 +29,7 @@ class MixCartonSubmit extends StatefulWidget {
final OnCreateMixCarton? onCreate; final OnCreateMixCarton? onCreate;
final OnPrevious? onPrevious; final OnPrevious? onPrevious;
const MixCartonSubmit( const MixCartonSubmit(
{Key? key, {super.key,
this.onCreate, this.onCreate,
this.onPrevious, this.onPrevious,
required this.shipment, required this.shipment,
@@ -39,8 +39,7 @@ class MixCartonSubmit extends StatefulWidget {
this.length = 0, this.length = 0,
this.width = 0, this.width = 0,
this.height = 0, this.height = 0,
this.isNew = true}) this.isNew = true});
: super(key: key);
@override @override
State<MixCartonSubmit> createState() => _MixCartonSubmitState(); State<MixCartonSubmit> createState() => _MixCartonSubmitState();
@@ -48,8 +47,8 @@ class MixCartonSubmit extends StatefulWidget {
class _MixCartonSubmitState extends State<MixCartonSubmit> { class _MixCartonSubmitState extends State<MixCartonSubmit> {
final NumberFormat numberFormatter = NumberFormat("#,###"); final NumberFormat numberFormatter = NumberFormat("#,###");
Map<String?, double> _mapCargos = {}; final Map<String?, double> _mapCargos = {};
Map<String?, double> _mapSurchargeItems = {}; final Map<String?, double> _mapSurchargeItems = {};
double totalWeight = 0; double totalWeight = 0;
@override @override
@@ -60,15 +59,15 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
_init() { _init() {
// get cargos by weight // get cargos by weight
List<CargoType> _cargoTypes = []; List<CargoType> cargoTypes = [];
for (var c in widget.cartons) { for (var c in widget.cartons) {
_cargoTypes.addAll(c.cargoTypes); cargoTypes.addAll(c.cargoTypes);
} }
_cargoTypes.sort((a, b) => a.name!.compareTo(b.name!)); cargoTypes.sort((a, b) => a.name!.compareTo(b.name!));
Map<String?, List<CargoType>> _cargosByWeight = groupCargos(_cargoTypes); Map<String?, List<CargoType>> cargosByWeight = groupCargos(cargoTypes);
_cargosByWeight.forEach((key, value) { cargosByWeight.forEach((key, value) {
double total = value.fold(0, (sum, item) => sum + item.weight); double total = value.fold(0, (sum, item) => sum + item.weight);
_mapCargos[key] = total; _mapCargos[key] = total;
}); });
@@ -77,17 +76,17 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
// get surcharge items // get surcharge items
List<CargoType> _surchargeItems = []; List<CargoType> surchargeItems = [];
for (var c in widget.cartons) { for (var c in widget.cartons) {
_surchargeItems.addAll(c.surchareItems); surchargeItems.addAll(c.surchareItems);
} }
_surchargeItems.sort((a, b) => a.name!.compareTo(b.name!)); surchargeItems.sort((a, b) => a.name!.compareTo(b.name!));
Map<String?, List<CargoType>> _cargosByCustomDutyFee = Map<String?, List<CargoType>> cargosByCustomDutyFee =
groupCargos(_surchargeItems); groupCargos(surchargeItems);
_cargosByCustomDutyFee.forEach((key, value) { cargosByCustomDutyFee.forEach((key, value) {
double total = value.fold(0, (sum, item) => sum + item.qty); double total = value.fold(0, (sum, item) => sum + item.qty);
_mapSurchargeItems[key] = total; _mapSurchargeItems[key] = total;
}); });
@@ -99,8 +98,8 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
Map<String?, List<CargoType>> groupCargos(List<CargoType> cargos) { Map<String?, List<CargoType>> groupCargos(List<CargoType> cargos) {
var groups = groupBy(cargos, (CargoType e) { var groups = groupBy(cargos, (CargoType e) {
String? _categoryName = e.name; String? categoryName = e.name;
return _categoryName; return categoryName;
}); });
return groups; return groups;
@@ -220,22 +219,80 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
), ),
); );
}).toList()), }).toList()),
const SizedBox(height: 10), // const SizedBox(height: 10),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: _mapSurchargeItems.entries.map((e) {
// return Padding(
// padding: const EdgeInsets.symmetric(vertical: 3),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// e.key ?? "",
// style: TextStyle(color: labelColor, fontSize: 15),
// ),
// Text("${numberFormatter.format(e.value)} pc",
// style:
// TextStyle(color: labelColor, fontSize: 15))
// ],
// ),
// );
// }).toList()),
],
),
),
),
]),
);
final surChargeItemsBox = Padding(
padding: const EdgeInsets.only(top: 10),
child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
Padding(
padding: const EdgeInsets.only(left: 5, bottom: 5, right: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocalText(context, 'box.input_surcharge_item',
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.normal),
],
),
),
Container(
decoration: BoxDecoration(
border: Border.all(color: primaryColor),
borderRadius: BorderRadius.circular(5),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: _mapSurchargeItems.entries.map((e) { children: _mapSurchargeItems.entries.map((e) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 3), padding: const EdgeInsets.symmetric(vertical: 3),
child: Row( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Row(
e.key ?? "", mainAxisAlignment: MainAxisAlignment.spaceBetween,
style: TextStyle(color: labelColor, fontSize: 15), children: [
Text(
e.key ?? "",
style: TextStyle(
color: Colors.black, fontSize: 15),
),
Text(
"${removeTrailingZeros((e.value).toDouble())} pc",
textAlign: TextAlign.end,
style: TextStyle(
color: Colors.black, fontSize: 15))
],
), ),
Text("${numberFormatter.format(e.value)} pc",
style:
TextStyle(color: labelColor, fontSize: 15))
], ],
), ),
); );
@@ -302,7 +359,12 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
const SizedBox(height: 10), const SizedBox(height: 10),
widget.cartons.isNotEmpty ? cartonsBox : const SizedBox(), widget.cartons.isNotEmpty ? cartonsBox : const SizedBox(),
const SizedBox(height: 10), const SizedBox(height: 10),
cargosBox, _mapCargos.isNotEmpty ? cargosBox : const SizedBox(),
_mapSurchargeItems.isNotEmpty
? Padding(
padding: EdgeInsets.only(top: 10),
child: surChargeItemsBox)
: const SizedBox(),
const SizedBox(height: 20), const SizedBox(height: 20),
], ],
), ),

View File

@@ -172,7 +172,8 @@ class _TypeWidgetState extends State<TypeWidget> {
isDense: true, isDense: true,
value: _selectStandardSize, value: _selectStandardSize,
style: TextStyle(color: Colors.black, fontSize: 14), style: TextStyle(color: Colors.black, fontSize: 14),
underline: Container(height: 1, color: Colors.grey), underline: Container(
height: 1, color: isStandardSize ? primaryColor : Colors.grey),
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
if (newValue?.name == MANAGE_CARTONSIZE) { if (newValue?.name == MANAGE_CARTONSIZE) {

View File

@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/domain/entities/user.dart';
import 'package:fcs/domain/vo/delivery_address.dart'; import 'package:fcs/domain/vo/delivery_address.dart';
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
@@ -13,21 +15,21 @@ import 'package:provider/provider.dart';
class DeliveryAddressEditor extends StatefulWidget { class DeliveryAddressEditor extends StatefulWidget {
final DeliveryAddress? deliveryAddress; final DeliveryAddress? deliveryAddress;
final User? user; final User? user;
DeliveryAddressEditor({this.deliveryAddress, this.user}); const DeliveryAddressEditor({super.key, this.deliveryAddress, this.user});
@override @override
_DeliveryAddressEditorState createState() => _DeliveryAddressEditorState(); _DeliveryAddressEditorState createState() => _DeliveryAddressEditorState();
} }
class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> { class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
TextEditingController _nameController = new TextEditingController(); final TextEditingController _nameController = TextEditingController();
TextEditingController _address1Controller = new TextEditingController(); final TextEditingController _address1Controller = TextEditingController();
TextEditingController _address2Controller = new TextEditingController(); final TextEditingController _address2Controller = TextEditingController();
TextEditingController _cityController = new TextEditingController(); final TextEditingController _cityController = TextEditingController();
TextEditingController _stateController = new TextEditingController(); final TextEditingController _stateController = TextEditingController();
TextEditingController _phoneController = new TextEditingController(); final TextEditingController _phoneController = TextEditingController();
DeliveryAddress _deliveryAddress = new DeliveryAddress(); DeliveryAddress _deliveryAddress = DeliveryAddress();
bool _isLoading = false; bool _isLoading = false;
bool _isNew = true; bool _isNew = true;
@@ -180,9 +182,9 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
cityBox, cityBox,
SizedBox(height: 5), SizedBox(height: 5),
regionBox, regionBox,
SizedBox(height: 5), SizedBox(height: 20),
_isNew ? createBtn : updateBtn, _isNew ? createBtn : updateBtn,
SizedBox(height: 10) SizedBox(height: 20)
]), ]),
), ),
), ),

View File

@@ -15,17 +15,17 @@ import 'package:provider/provider.dart';
class DiscountEditor extends StatefulWidget { class DiscountEditor extends StatefulWidget {
final Discount? discount; final Discount? discount;
const DiscountEditor({Key? key, this.discount}) : super(key: key); const DiscountEditor({super.key, this.discount});
@override @override
_DiscountEditorState createState() => _DiscountEditorState(); _DiscountEditorState createState() => _DiscountEditorState();
} }
class _DiscountEditorState extends State<DiscountEditor> { class _DiscountEditorState extends State<DiscountEditor> {
bool _isLoading = false; bool _isLoading = false;
Discount _discount = new Discount(); Discount _discount = Discount();
TextEditingController _codeController = new TextEditingController(); final TextEditingController _codeController = TextEditingController();
TextEditingController _amountController = new TextEditingController(); final TextEditingController _amountController = TextEditingController();
TextEditingController _statusController = new TextEditingController(); final TextEditingController _statusController = TextEditingController();
bool _isNew = false; bool _isNew = false;
String customerName = ''; String customerName = '';
@@ -51,7 +51,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final codeBox = InputText( final codeBox = InputText(
labelTextKey: 'discount.code', labelTextKey: 'discount.code',
iconData: FontAwesomeIcons.algolia, iconData: Ionicons.code_slash,
controller: _codeController, controller: _codeController,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) { validator: (value) {
@@ -128,13 +128,12 @@ class _DiscountEditorState extends State<DiscountEditor> {
children: <Widget>[ children: <Widget>[
codeBox, codeBox,
amountBox, amountBox,
SizedBox(height: 7), SizedBox(height: 15),
customerBox, customerBox,
SizedBox(height: 7),
widget.discount == null widget.discount == null
? Container() ? Container()
: Container( : Container(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 10),
child: statusBox, child: statusBox,
), ),
], ],

View File

@@ -64,7 +64,7 @@ class _DiscountListState extends State<DiscountList> {
Expanded( Expanded(
child: ListView.separated( child: ListView.separated(
separatorBuilder: (context, index) => separatorBuilder: (context, index) =>
Divider(color: Colors.black, height: 1), Divider(color: dividerColor, height: 1),
controller: _controller, controller: _controller,
itemCount: discountModel.discounts.length, itemCount: discountModel.discounts.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {

View File

@@ -21,7 +21,7 @@ import '../main/util.dart';
class FcsShipmentEditor extends StatefulWidget { class FcsShipmentEditor extends StatefulWidget {
final FcsShipment? shipment; final FcsShipment? shipment;
FcsShipmentEditor({this.shipment}); const FcsShipmentEditor({super.key, this.shipment});
@override @override
_FcsShipmentEditorState createState() => _FcsShipmentEditorState(); _FcsShipmentEditorState createState() => _FcsShipmentEditorState();
@@ -29,14 +29,14 @@ class FcsShipmentEditor extends StatefulWidget {
class _FcsShipmentEditorState extends State<FcsShipmentEditor> { class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
var dateFormatter = new DateFormat('dd MMM yyyy'); var dateFormatter = DateFormat('dd MMM yyyy');
TextEditingController _shipmentNumberController = new TextEditingController(); final _shipmentNumberController = TextEditingController();
TextEditingController _cutoffDateController = new TextEditingController(); final _cutoffDateController = TextEditingController();
TextEditingController _etaDateController = new TextEditingController(); final _etaDateController = TextEditingController();
TextEditingController _statusController = new TextEditingController(); final _statusController = TextEditingController();
FcsShipment _shipment = new FcsShipment(); FcsShipment _shipment = FcsShipment();
bool _isLoading = false; bool _isLoading = false;
ShipmentType? _currentShipmentType; ShipmentType? _currentShipmentType;
ShipmentConsignee? _currentConsignee; ShipmentConsignee? _currentConsignee;
@@ -52,11 +52,13 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
if (widget.shipment != null) { if (widget.shipment != null) {
_shipment = widget.shipment!; _shipment = widget.shipment!;
_shipmentNumberController.text = _shipment.shipmentNumber ?? ""; _shipmentNumberController.text = _shipment.shipmentNumber ?? "";
if (_shipment.cutoffDate != null) if (_shipment.cutoffDate != null) {
_cutoffDateController.text = _cutoffDateController.text =
dateFormatter.format(_shipment.cutoffDate!); dateFormatter.format(_shipment.cutoffDate!);
if (_shipment.etaDate != null) }
if (_shipment.etaDate != null) {
_etaDateController.text = dateFormatter.format(_shipment.etaDate!); _etaDateController.text = dateFormatter.format(_shipment.etaDate!);
}
_statusController.text = _shipment.status ?? ""; _statusController.text = _shipment.status ?? "";
@@ -111,6 +113,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final shipmentTypeBox = DropdownButtonFormField( final shipmentTypeBox = DropdownButtonFormField(
value: _currentShipmentType == "" ? null : _currentShipmentType, value: _currentShipmentType == "" ? null : _currentShipmentType,
style: TextStyle(fontSize: 14, color: Colors.black),
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
enabledBorder: enabledBorder:
@@ -125,7 +128,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
AppTranslations.of(context)!.text('FCSshipment.shipment_type'), AppTranslations.of(context)!.text('FCSshipment.shipment_type'),
icon: Icon(Ionicons.ios_airplane, color: primaryColor)), icon: Icon(Ionicons.ios_airplane, color: primaryColor)),
items: shipmentTypes items: shipmentTypes
.map((e) => DropdownMenuItem(child: Text(e.name), value: e)) .map((e) => DropdownMenuItem(value: e, child: Text(e.name)))
.toList(), .toList(),
onChanged: (selected) => { onChanged: (selected) => {
setState(() { setState(() {
@@ -136,6 +139,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final consigneeBox = DropdownButtonFormField( final consigneeBox = DropdownButtonFormField(
value: _currentConsignee == "" ? null : _currentConsignee, value: _currentConsignee == "" ? null : _currentConsignee,
style: TextStyle(fontSize: 14, color: Colors.black),
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
enabledBorder: enabledBorder:
@@ -160,6 +164,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final loadingPortBox = DropdownButtonFormField( final loadingPortBox = DropdownButtonFormField(
value: _currentLoadingPort == "" ? null : _currentLoadingPort, value: _currentLoadingPort == "" ? null : _currentLoadingPort,
style: TextStyle(fontSize: 14, color: Colors.black),
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
enabledBorder: enabledBorder:
@@ -185,6 +190,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final destinationBox = DropdownButtonFormField( final destinationBox = DropdownButtonFormField(
value: _currentDestination == "" ? null : _currentDestination, value: _currentDestination == "" ? null : _currentDestination,
style: TextStyle(fontSize: 14, color: Colors.black),
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
enabledBorder: enabledBorder:
@@ -293,7 +299,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
destinationBox, destinationBox,
SizedBox(height: 30), SizedBox(height: 30),
_isNew ? createBtn : updateBtn, _isNew ? createBtn : updateBtn,
SizedBox(height: 15) SizedBox(height: 30)
]), ]),
), ),
), ),

View File

@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:fcs/constants.dart'; import 'package:fcs/constants.dart';
import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/domain/entities/fcs_shipment.dart';
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
@@ -248,6 +250,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
padding: const EdgeInsets.only(left: 12.0, right: 12), padding: const EdgeInsets.only(left: 12.0, right: 12),
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
statusBox, statusBox,
const SizedBox(height: 5),
Row(mainAxisAlignment: MainAxisAlignment.end, children: [ Row(mainAxisAlignment: MainAxisAlignment.end, children: [
Expanded( Expanded(
child: cutoffDateDBox, child: cutoffDateDBox,
@@ -255,6 +258,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
), ),
Flexible(child: etaBox), Flexible(child: etaBox),
]), ]),
const SizedBox(height: 5),
Row( Row(
children: [ children: [
Expanded( Expanded(
@@ -264,9 +268,13 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
Flexible(child: packageBox) Flexible(child: packageBox)
], ],
), ),
const SizedBox(height: 5),
shipTypeBox, shipTypeBox,
const SizedBox(height: 5),
consigneeBox, consigneeBox,
const SizedBox(height: 5),
portBox, portBox,
const SizedBox(height: 5),
destinationBox, destinationBox,
const SizedBox(height: 30), const SizedBox(height: 30),
_fcsShipment.status == fcs_shipment_pending_status _fcsShipment.status == fcs_shipment_pending_status

View File

@@ -147,19 +147,15 @@ class _PackageEditorState extends State<PackageEditor> {
), ),
img, img,
Divider(), Divider(),
SizedBox( SizedBox(height: 15),
height: 15,
),
marketDropdown(), marketDropdown(),
SizedBox(height: 5),
descBox, descBox,
SizedBox(height: 5),
remarkBox, remarkBox,
SizedBox( SizedBox(height: 20),
height: 20,
),
selectBtn, selectBtn,
SizedBox( SizedBox(height: 20)
height: 20,
)
], ],
), ),
), ),
@@ -179,7 +175,7 @@ class _PackageEditorState extends State<PackageEditor> {
return Row( return Row(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.only(left: 0, right: 10), padding: const EdgeInsets.only(right: 15),
child: Icon(Icons.store, color: primaryColor), child: Icon(Icons.store, color: primaryColor),
), ),
Expanded( Expanded(
@@ -199,10 +195,7 @@ class _PackageEditorState extends State<PackageEditor> {
isDense: true, isDense: true,
value: selectedMarket, value: selectedMarket,
style: TextStyle(color: Colors.black, fontSize: 14), style: TextStyle(color: Colors.black, fontSize: 14),
underline: Container( underline: Container(height: 1, color: primaryColor),
height: 1,
color: Colors.grey,
),
onChanged: (String? newValue) { onChanged: (String? newValue) {
setState(() { setState(() {
if (newValue == MANAGE_MARKET) { if (newValue == MANAGE_MARKET) {
@@ -222,7 +215,7 @@ class _PackageEditorState extends State<PackageEditor> {
style: TextStyle( style: TextStyle(
color: value == MANAGE_MARKET color: value == MANAGE_MARKET
? secondaryColor ? secondaryColor
: primaryColor)), : Colors.black)),
); );
}).toList(), }).toList(),
), ),

View File

@@ -36,8 +36,8 @@ class ProcessingEditEditor extends StatefulWidget {
class _ProcessingEditEditorState extends State<ProcessingEditEditor> { class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
final DateFormat dateFormat = DateFormat("d MMM yyyy"); final DateFormat dateFormat = DateFormat("d MMM yyyy");
TextEditingController _remarkCtl = TextEditingController(); final TextEditingController _remarkCtl = TextEditingController();
TextEditingController _descCtl = TextEditingController(); final TextEditingController _descCtl = TextEditingController();
Package? _package; Package? _package;
User? _consignee; User? _consignee;
@@ -72,9 +72,10 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
var fcsShipments = var fcsShipments =
await context.read<FcsShipmentModel>().getActiveFcsShipments(); await context.read<FcsShipmentModel>().getActiveFcsShipments();
_shipments = fcsShipments; _shipments = fcsShipments;
var s = FcsShipment( var s = FcsShipment(
id: widget.package.fcsShipmentId, shipmentNumber: widget.package.fcsShipmentNumber); id: widget.package.fcsShipmentId,
shipmentNumber: widget.package.fcsShipmentNumber);
if (_shipments.contains(s)) { if (_shipments.contains(s)) {
_shipment = s; _shipment = s;
@@ -183,10 +184,13 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
fcsShipmentsBox, fcsShipmentsBox,
SizedBox(height: 10),
marketDropdown(), marketDropdown(),
SizedBox(height: 5),
descBox, descBox,
SizedBox(height: 5),
remarkBox, remarkBox,
const SizedBox(height: 10), const SizedBox(height: 15),
img, img,
SizedBox(height: 20), SizedBox(height: 20),
completeProcessingBtn, completeProcessingBtn,
@@ -207,63 +211,57 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
markets.insert(0, selectedMarket); markets.insert(0, selectedMarket);
} }
return Padding( return Row(
padding: const EdgeInsets.only(left: 5.0, right: 0, top: 10), children: [
child: Row( Padding(
children: [ padding: const EdgeInsets.only(left: 0, right: 15),
Padding( child: Icon(Icons.store, color: primaryColor),
padding: const EdgeInsets.only(left: 0, right: 10), ),
child: Icon(Icons.store, color: primaryColor), Expanded(
), child: Column(
Expanded( crossAxisAlignment: CrossAxisAlignment.start,
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Padding(
children: [ padding: const EdgeInsets.only(right: 18.0),
Padding( child: LocalText(
padding: const EdgeInsets.only(right: 18.0), context,
child: LocalText( "processing.market",
context, color: Colors.black54,
"processing.market", fontSize: 16,
color: Colors.black54,
fontSize: 16,
),
), ),
DropdownButton<String>( ),
isDense: true, DropdownButton<String>(
value: selectedMarket, isDense: true,
style: TextStyle(color: Colors.black, fontSize: 14), value: selectedMarket,
underline: Container( style: TextStyle(color: Colors.black, fontSize: 14),
height: 1, underline: Container(height: 1, color: primaryColor),
color: Colors.grey, onChanged: (String? newValue) {
), setState(() {
onChanged: (String? newValue) { if (newValue == MANAGE_MARKET) {
setState(() { selectedMarket = null;
if (newValue == MANAGE_MARKET) { _manageMarket();
selectedMarket = null; return;
_manageMarket(); }
return; selectedMarket = newValue;
} });
selectedMarket = newValue; },
}); isExpanded: true,
}, items: markets.map<DropdownMenuItem<String>>((String? value) {
isExpanded: true, return DropdownMenuItem<String>(
items: markets.map<DropdownMenuItem<String>>((String? value) { value: value,
return DropdownMenuItem<String>( child: Text(value ?? "",
value: value, overflow: TextOverflow.ellipsis,
child: Text(value ?? "", style: TextStyle(
overflow: TextOverflow.ellipsis, color: value == MANAGE_MARKET
style: TextStyle( ? secondaryColor
color: value == MANAGE_MARKET : Colors.black)),
? secondaryColor );
: primaryColor)), }).toList(),
); ),
}).toList(), ],
),
],
),
), ),
], ),
), ],
); );
} }
@@ -293,7 +291,7 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
_package!.fcsShipmentId = _shipment?.id; _package!.fcsShipmentId = _shipment?.id;
await packageModel.updateProcessing(_package!, await packageModel.updateProcessing(_package!,
multiImgController.getAddedFile, multiImgController.getDeletedUrl); multiImgController.getAddedFile, multiImgController.getDeletedUrl);
Navigator.pop(context,true); Navigator.pop(context, true);
} catch (e) { } catch (e) {
showMsgDialog(context, "Error", e.toString()); showMsgDialog(context, "Error", e.toString());
} finally { } finally {
@@ -311,7 +309,7 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
desc: _descCtl.text, desc: _descCtl.text,
remark: _remarkCtl.text, remark: _remarkCtl.text,
photoUrls: widget.package.photoUrls, photoUrls: widget.package.photoUrls,
fcsShipmentId: _shipment?.id); fcsShipmentId: _shipment?.id ?? "");
return widget.package.isChangedForEditProcessing(package) || return widget.package.isChangedForEditProcessing(package) ||
multiImgController.getAddedFile.isNotEmpty || multiImgController.getAddedFile.isNotEmpty ||
multiImgController.getDeletedUrl.isNotEmpty; multiImgController.getDeletedUrl.isNotEmpty;

View File

@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/entities/package.dart';
import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/domain/entities/user.dart';
import 'package:fcs/helpers/theme.dart'; import 'package:fcs/helpers/theme.dart';
@@ -27,9 +29,9 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
late bool _isNew; late bool _isNew;
User? _consignee; User? _consignee;
final _receiveFormKey = GlobalKey<FormState>(); final _receiveFormKey = GlobalKey<FormState>();
TextEditingController _trackingIDCtl = new TextEditingController(); final _trackingIDCtl = TextEditingController();
TextEditingController _remarkCtl = new TextEditingController(); final _remarkCtl = TextEditingController();
MultiImgController _multiImgController = MultiImgController(); final _multiImgController = MultiImgController();
@override @override
void initState() { void initState() {
@@ -156,9 +158,7 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
trackingIDBox, trackingIDBox,
SizedBox( SizedBox(height: 5),
height: 10,
),
remarkBox, remarkBox,
Divider(), Divider(),
img, img,

View File

@@ -12,14 +12,13 @@ class LocalDropdown<T> extends StatelessWidget {
final String? labelKey; final String? labelKey;
const LocalDropdown( const LocalDropdown(
{Key? key, {super.key,
this.callback, this.callback,
this.iconData, this.iconData,
this.selectedValue, this.selectedValue,
this.values, this.values,
this.labelKey, this.labelKey,
this.display}) this.display});
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -50,10 +49,7 @@ class LocalDropdown<T> extends StatelessWidget {
isDense: true, isDense: true,
value: selectedValue, value: selectedValue,
style: TextStyle(color: Colors.black, fontSize: 14), style: TextStyle(color: Colors.black, fontSize: 14),
underline: Container( underline: Container(height: 1, color: primaryColor),
height: 1,
color: Colors.grey,
),
onChanged: (T? newValue) { onChanged: (T? newValue) {
callback!(newValue!); callback!(newValue!);
}, },