update ui
This commit is contained in:
@@ -334,7 +334,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
isDense: true,
|
||||
value: _selectStandardSize,
|
||||
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) {
|
||||
setState(() {
|
||||
if (newValue?.name == MANAGE_CARTONSIZE) {
|
||||
|
||||
@@ -451,8 +451,11 @@ class CartonSubmit extends StatelessWidget {
|
||||
// packages.isNotEmpty ? packagesBox : const SizedBox(),
|
||||
// const SizedBox(height: 10),
|
||||
cargoTypes.isNotEmpty ? cargosBox : const SizedBox(),
|
||||
const SizedBox(height: 10),
|
||||
surchareItems.isNotEmpty ? surChargeItemsBox : const SizedBox(),
|
||||
surchareItems.isNotEmpty
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: surChargeItemsBox)
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../domain/entities/carton.dart';
|
||||
import '../../../helpers/theme.dart';
|
||||
import '../../main/util.dart';
|
||||
import '../model/carton_selection_model.dart';
|
||||
|
||||
typedef OnAction = Future<void> Function();
|
||||
@@ -72,20 +73,20 @@ class CartonSelectionResult extends StatelessWidget {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0),
|
||||
child: new Column(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(carton.cartonNumber ?? "",
|
||||
style: new TextStyle(
|
||||
Text(carton.cartonNumber ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.black)),
|
||||
new Text(
|
||||
"${carton.cartonWeight.toStringAsFixed(2)} lb",
|
||||
style: new TextStyle(
|
||||
Text(
|
||||
"${twoDecimalFormatted(carton.cartonWeight)} lb",
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.grey),
|
||||
),
|
||||
|
||||
@@ -29,7 +29,7 @@ class MixCartonSubmit extends StatefulWidget {
|
||||
final OnCreateMixCarton? onCreate;
|
||||
final OnPrevious? onPrevious;
|
||||
const MixCartonSubmit(
|
||||
{Key? key,
|
||||
{super.key,
|
||||
this.onCreate,
|
||||
this.onPrevious,
|
||||
required this.shipment,
|
||||
@@ -39,8 +39,7 @@ class MixCartonSubmit extends StatefulWidget {
|
||||
this.length = 0,
|
||||
this.width = 0,
|
||||
this.height = 0,
|
||||
this.isNew = true})
|
||||
: super(key: key);
|
||||
this.isNew = true});
|
||||
|
||||
@override
|
||||
State<MixCartonSubmit> createState() => _MixCartonSubmitState();
|
||||
@@ -48,8 +47,8 @@ class MixCartonSubmit extends StatefulWidget {
|
||||
|
||||
class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
||||
final NumberFormat numberFormatter = NumberFormat("#,###");
|
||||
Map<String?, double> _mapCargos = {};
|
||||
Map<String?, double> _mapSurchargeItems = {};
|
||||
final Map<String?, double> _mapCargos = {};
|
||||
final Map<String?, double> _mapSurchargeItems = {};
|
||||
double totalWeight = 0;
|
||||
|
||||
@override
|
||||
@@ -60,15 +59,15 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
||||
|
||||
_init() {
|
||||
// get cargos by weight
|
||||
List<CargoType> _cargoTypes = [];
|
||||
List<CargoType> cargoTypes = [];
|
||||
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);
|
||||
_cargosByWeight.forEach((key, value) {
|
||||
Map<String?, List<CargoType>> cargosByWeight = groupCargos(cargoTypes);
|
||||
cargosByWeight.forEach((key, value) {
|
||||
double total = value.fold(0, (sum, item) => sum + item.weight);
|
||||
_mapCargos[key] = total;
|
||||
});
|
||||
@@ -77,17 +76,17 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
||||
|
||||
// get surcharge items
|
||||
|
||||
List<CargoType> _surchargeItems = [];
|
||||
List<CargoType> surchargeItems = [];
|
||||
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 =
|
||||
groupCargos(_surchargeItems);
|
||||
Map<String?, List<CargoType>> cargosByCustomDutyFee =
|
||||
groupCargos(surchargeItems);
|
||||
|
||||
_cargosByCustomDutyFee.forEach((key, value) {
|
||||
cargosByCustomDutyFee.forEach((key, value) {
|
||||
double total = value.fold(0, (sum, item) => sum + item.qty);
|
||||
_mapSurchargeItems[key] = total;
|
||||
});
|
||||
@@ -99,8 +98,8 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
||||
|
||||
Map<String?, List<CargoType>> groupCargos(List<CargoType> cargos) {
|
||||
var groups = groupBy(cargos, (CargoType e) {
|
||||
String? _categoryName = e.name;
|
||||
return _categoryName;
|
||||
String? categoryName = e.name;
|
||||
return categoryName;
|
||||
});
|
||||
|
||||
return groups;
|
||||
@@ -220,22 +219,80 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
|
||||
),
|
||||
);
|
||||
}).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(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: _mapSurchargeItems.entries.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
e.key ?? "",
|
||||
style: TextStyle(color: labelColor, fontSize: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
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),
|
||||
widget.cartons.isNotEmpty ? cartonsBox : const SizedBox(),
|
||||
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),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -172,7 +172,8 @@ class _TypeWidgetState extends State<TypeWidget> {
|
||||
isDense: true,
|
||||
value: _selectStandardSize,
|
||||
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) {
|
||||
setState(() {
|
||||
if (newValue?.name == MANAGE_CARTONSIZE) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
@@ -13,21 +15,21 @@ import 'package:provider/provider.dart';
|
||||
class DeliveryAddressEditor extends StatefulWidget {
|
||||
final DeliveryAddress? deliveryAddress;
|
||||
final User? user;
|
||||
DeliveryAddressEditor({this.deliveryAddress, this.user});
|
||||
const DeliveryAddressEditor({super.key, this.deliveryAddress, this.user});
|
||||
|
||||
@override
|
||||
_DeliveryAddressEditorState createState() => _DeliveryAddressEditorState();
|
||||
}
|
||||
|
||||
class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
TextEditingController _nameController = new TextEditingController();
|
||||
TextEditingController _address1Controller = new TextEditingController();
|
||||
TextEditingController _address2Controller = new TextEditingController();
|
||||
TextEditingController _cityController = new TextEditingController();
|
||||
TextEditingController _stateController = new TextEditingController();
|
||||
TextEditingController _phoneController = new TextEditingController();
|
||||
final TextEditingController _nameController = TextEditingController();
|
||||
final TextEditingController _address1Controller = TextEditingController();
|
||||
final TextEditingController _address2Controller = TextEditingController();
|
||||
final TextEditingController _cityController = TextEditingController();
|
||||
final TextEditingController _stateController = TextEditingController();
|
||||
final TextEditingController _phoneController = TextEditingController();
|
||||
|
||||
DeliveryAddress _deliveryAddress = new DeliveryAddress();
|
||||
DeliveryAddress _deliveryAddress = DeliveryAddress();
|
||||
|
||||
bool _isLoading = false;
|
||||
bool _isNew = true;
|
||||
@@ -180,9 +182,9 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
cityBox,
|
||||
SizedBox(height: 5),
|
||||
regionBox,
|
||||
SizedBox(height: 5),
|
||||
SizedBox(height: 20),
|
||||
_isNew ? createBtn : updateBtn,
|
||||
SizedBox(height: 10)
|
||||
SizedBox(height: 20)
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -15,17 +15,17 @@ import 'package:provider/provider.dart';
|
||||
class DiscountEditor extends StatefulWidget {
|
||||
final Discount? discount;
|
||||
|
||||
const DiscountEditor({Key? key, this.discount}) : super(key: key);
|
||||
const DiscountEditor({super.key, this.discount});
|
||||
@override
|
||||
_DiscountEditorState createState() => _DiscountEditorState();
|
||||
}
|
||||
|
||||
class _DiscountEditorState extends State<DiscountEditor> {
|
||||
bool _isLoading = false;
|
||||
Discount _discount = new Discount();
|
||||
TextEditingController _codeController = new TextEditingController();
|
||||
TextEditingController _amountController = new TextEditingController();
|
||||
TextEditingController _statusController = new TextEditingController();
|
||||
Discount _discount = Discount();
|
||||
final TextEditingController _codeController = TextEditingController();
|
||||
final TextEditingController _amountController = TextEditingController();
|
||||
final TextEditingController _statusController = TextEditingController();
|
||||
|
||||
bool _isNew = false;
|
||||
String customerName = '';
|
||||
@@ -51,7 +51,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
Widget build(BuildContext context) {
|
||||
final codeBox = InputText(
|
||||
labelTextKey: 'discount.code',
|
||||
iconData: FontAwesomeIcons.algolia,
|
||||
iconData: Ionicons.code_slash,
|
||||
controller: _codeController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
@@ -128,13 +128,12 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
children: <Widget>[
|
||||
codeBox,
|
||||
amountBox,
|
||||
SizedBox(height: 7),
|
||||
SizedBox(height: 15),
|
||||
customerBox,
|
||||
SizedBox(height: 7),
|
||||
widget.discount == null
|
||||
? Container()
|
||||
: Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: statusBox,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -64,7 +64,7 @@ class _DiscountListState extends State<DiscountList> {
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (context, index) =>
|
||||
Divider(color: Colors.black, height: 1),
|
||||
Divider(color: dividerColor, height: 1),
|
||||
controller: _controller,
|
||||
itemCount: discountModel.discounts.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import '../main/util.dart';
|
||||
|
||||
class FcsShipmentEditor extends StatefulWidget {
|
||||
final FcsShipment? shipment;
|
||||
FcsShipmentEditor({this.shipment});
|
||||
const FcsShipmentEditor({super.key, this.shipment});
|
||||
|
||||
@override
|
||||
_FcsShipmentEditorState createState() => _FcsShipmentEditorState();
|
||||
@@ -29,14 +29,14 @@ class FcsShipmentEditor extends StatefulWidget {
|
||||
|
||||
class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
TextEditingController _shipmentNumberController = new TextEditingController();
|
||||
TextEditingController _cutoffDateController = new TextEditingController();
|
||||
TextEditingController _etaDateController = new TextEditingController();
|
||||
var dateFormatter = DateFormat('dd MMM yyyy');
|
||||
final _shipmentNumberController = TextEditingController();
|
||||
final _cutoffDateController = TextEditingController();
|
||||
final _etaDateController = TextEditingController();
|
||||
|
||||
TextEditingController _statusController = new TextEditingController();
|
||||
final _statusController = TextEditingController();
|
||||
|
||||
FcsShipment _shipment = new FcsShipment();
|
||||
FcsShipment _shipment = FcsShipment();
|
||||
bool _isLoading = false;
|
||||
ShipmentType? _currentShipmentType;
|
||||
ShipmentConsignee? _currentConsignee;
|
||||
@@ -52,11 +52,13 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
if (widget.shipment != null) {
|
||||
_shipment = widget.shipment!;
|
||||
_shipmentNumberController.text = _shipment.shipmentNumber ?? "";
|
||||
if (_shipment.cutoffDate != null)
|
||||
if (_shipment.cutoffDate != null) {
|
||||
_cutoffDateController.text =
|
||||
dateFormatter.format(_shipment.cutoffDate!);
|
||||
if (_shipment.etaDate != null)
|
||||
}
|
||||
if (_shipment.etaDate != null) {
|
||||
_etaDateController.text = dateFormatter.format(_shipment.etaDate!);
|
||||
}
|
||||
|
||||
_statusController.text = _shipment.status ?? "";
|
||||
|
||||
@@ -111,6 +113,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
|
||||
final shipmentTypeBox = DropdownButtonFormField(
|
||||
value: _currentShipmentType == "" ? null : _currentShipmentType,
|
||||
style: TextStyle(fontSize: 14, color: Colors.black),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
enabledBorder:
|
||||
@@ -125,7 +128,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
AppTranslations.of(context)!.text('FCSshipment.shipment_type'),
|
||||
icon: Icon(Ionicons.ios_airplane, color: primaryColor)),
|
||||
items: shipmentTypes
|
||||
.map((e) => DropdownMenuItem(child: Text(e.name), value: e))
|
||||
.map((e) => DropdownMenuItem(value: e, child: Text(e.name)))
|
||||
.toList(),
|
||||
onChanged: (selected) => {
|
||||
setState(() {
|
||||
@@ -136,6 +139,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
|
||||
final consigneeBox = DropdownButtonFormField(
|
||||
value: _currentConsignee == "" ? null : _currentConsignee,
|
||||
style: TextStyle(fontSize: 14, color: Colors.black),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
enabledBorder:
|
||||
@@ -160,6 +164,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
|
||||
final loadingPortBox = DropdownButtonFormField(
|
||||
value: _currentLoadingPort == "" ? null : _currentLoadingPort,
|
||||
style: TextStyle(fontSize: 14, color: Colors.black),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
enabledBorder:
|
||||
@@ -185,6 +190,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
|
||||
final destinationBox = DropdownButtonFormField(
|
||||
value: _currentDestination == "" ? null : _currentDestination,
|
||||
style: TextStyle(fontSize: 14, color: Colors.black),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
enabledBorder:
|
||||
@@ -293,7 +299,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
destinationBox,
|
||||
SizedBox(height: 30),
|
||||
_isNew ? createBtn : updateBtn,
|
||||
SizedBox(height: 15)
|
||||
SizedBox(height: 30)
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:fcs/constants.dart';
|
||||
import 'package:fcs/domain/entities/fcs_shipment.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),
|
||||
child: ListView(children: <Widget>[
|
||||
statusBox,
|
||||
const SizedBox(height: 5),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
||||
Expanded(
|
||||
child: cutoffDateDBox,
|
||||
@@ -255,6 +258,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
),
|
||||
Flexible(child: etaBox),
|
||||
]),
|
||||
const SizedBox(height: 5),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -264,9 +268,13 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
Flexible(child: packageBox)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
shipTypeBox,
|
||||
const SizedBox(height: 5),
|
||||
consigneeBox,
|
||||
const SizedBox(height: 5),
|
||||
portBox,
|
||||
const SizedBox(height: 5),
|
||||
destinationBox,
|
||||
const SizedBox(height: 30),
|
||||
_fcsShipment.status == fcs_shipment_pending_status
|
||||
|
||||
@@ -147,19 +147,15 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
),
|
||||
img,
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
marketDropdown(),
|
||||
SizedBox(height: 5),
|
||||
descBox,
|
||||
SizedBox(height: 5),
|
||||
remarkBox,
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
selectBtn,
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
SizedBox(height: 20)
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -179,7 +175,7 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
return Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 0, right: 10),
|
||||
padding: const EdgeInsets.only(right: 15),
|
||||
child: Icon(Icons.store, color: primaryColor),
|
||||
),
|
||||
Expanded(
|
||||
@@ -199,10 +195,7 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
isDense: true,
|
||||
value: selectedMarket,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14),
|
||||
underline: Container(
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
underline: Container(height: 1, color: primaryColor),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
if (newValue == MANAGE_MARKET) {
|
||||
@@ -222,7 +215,7 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
style: TextStyle(
|
||||
color: value == MANAGE_MARKET
|
||||
? secondaryColor
|
||||
: primaryColor)),
|
||||
: Colors.black)),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
@@ -36,8 +36,8 @@ class ProcessingEditEditor extends StatefulWidget {
|
||||
class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
|
||||
TextEditingController _remarkCtl = TextEditingController();
|
||||
TextEditingController _descCtl = TextEditingController();
|
||||
final TextEditingController _remarkCtl = TextEditingController();
|
||||
final TextEditingController _descCtl = TextEditingController();
|
||||
|
||||
Package? _package;
|
||||
User? _consignee;
|
||||
@@ -72,9 +72,10 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
||||
var fcsShipments =
|
||||
await context.read<FcsShipmentModel>().getActiveFcsShipments();
|
||||
_shipments = fcsShipments;
|
||||
|
||||
|
||||
var s = FcsShipment(
|
||||
id: widget.package.fcsShipmentId, shipmentNumber: widget.package.fcsShipmentNumber);
|
||||
id: widget.package.fcsShipmentId,
|
||||
shipmentNumber: widget.package.fcsShipmentNumber);
|
||||
|
||||
if (_shipments.contains(s)) {
|
||||
_shipment = s;
|
||||
@@ -183,10 +184,13 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
fcsShipmentsBox,
|
||||
SizedBox(height: 10),
|
||||
marketDropdown(),
|
||||
SizedBox(height: 5),
|
||||
descBox,
|
||||
SizedBox(height: 5),
|
||||
remarkBox,
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 15),
|
||||
img,
|
||||
SizedBox(height: 20),
|
||||
completeProcessingBtn,
|
||||
@@ -207,63 +211,57 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
||||
markets.insert(0, selectedMarket);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 5.0, right: 0, top: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 0, right: 10),
|
||||
child: Icon(Icons.store, color: primaryColor),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 18.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"processing.market",
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
),
|
||||
return Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 0, right: 15),
|
||||
child: Icon(Icons.store, color: primaryColor),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 18.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"processing.market",
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
),
|
||||
DropdownButton<String>(
|
||||
isDense: true,
|
||||
value: selectedMarket,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14),
|
||||
underline: Container(
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
if (newValue == MANAGE_MARKET) {
|
||||
selectedMarket = null;
|
||||
_manageMarket();
|
||||
return;
|
||||
}
|
||||
selectedMarket = newValue;
|
||||
});
|
||||
},
|
||||
isExpanded: true,
|
||||
items: markets.map<DropdownMenuItem<String>>((String? value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value ?? "",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: value == MANAGE_MARKET
|
||||
? secondaryColor
|
||||
: primaryColor)),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
DropdownButton<String>(
|
||||
isDense: true,
|
||||
value: selectedMarket,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14),
|
||||
underline: Container(height: 1, color: primaryColor),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
if (newValue == MANAGE_MARKET) {
|
||||
selectedMarket = null;
|
||||
_manageMarket();
|
||||
return;
|
||||
}
|
||||
selectedMarket = newValue;
|
||||
});
|
||||
},
|
||||
isExpanded: true,
|
||||
items: markets.map<DropdownMenuItem<String>>((String? value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value ?? "",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: value == MANAGE_MARKET
|
||||
? secondaryColor
|
||||
: Colors.black)),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -293,7 +291,7 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
||||
_package!.fcsShipmentId = _shipment?.id;
|
||||
await packageModel.updateProcessing(_package!,
|
||||
multiImgController.getAddedFile, multiImgController.getDeletedUrl);
|
||||
Navigator.pop(context,true);
|
||||
Navigator.pop(context, true);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
@@ -311,7 +309,7 @@ class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
||||
desc: _descCtl.text,
|
||||
remark: _remarkCtl.text,
|
||||
photoUrls: widget.package.photoUrls,
|
||||
fcsShipmentId: _shipment?.id);
|
||||
fcsShipmentId: _shipment?.id ?? "");
|
||||
return widget.package.isChangedForEditProcessing(package) ||
|
||||
multiImgController.getAddedFile.isNotEmpty ||
|
||||
multiImgController.getDeletedUrl.isNotEmpty;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
@@ -27,9 +29,9 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
late bool _isNew;
|
||||
User? _consignee;
|
||||
final _receiveFormKey = GlobalKey<FormState>();
|
||||
TextEditingController _trackingIDCtl = new TextEditingController();
|
||||
TextEditingController _remarkCtl = new TextEditingController();
|
||||
MultiImgController _multiImgController = MultiImgController();
|
||||
final _trackingIDCtl = TextEditingController();
|
||||
final _remarkCtl = TextEditingController();
|
||||
final _multiImgController = MultiImgController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -156,9 +158,7 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
trackingIDBox,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
remarkBox,
|
||||
Divider(),
|
||||
img,
|
||||
|
||||
@@ -12,14 +12,13 @@ class LocalDropdown<T> extends StatelessWidget {
|
||||
final String? labelKey;
|
||||
|
||||
const LocalDropdown(
|
||||
{Key? key,
|
||||
{super.key,
|
||||
this.callback,
|
||||
this.iconData,
|
||||
this.selectedValue,
|
||||
this.values,
|
||||
this.labelKey,
|
||||
this.display})
|
||||
: super(key: key);
|
||||
this.display});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -50,10 +49,7 @@ class LocalDropdown<T> extends StatelessWidget {
|
||||
isDense: true,
|
||||
value: selectedValue,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14),
|
||||
underline: Container(
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
underline: Container(height: 1, color: primaryColor),
|
||||
onChanged: (T? newValue) {
|
||||
callback!(newValue!);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user