cleanup code

This commit is contained in:
tzw
2024-01-23 16:28:08 +06:30
parent a1e87cdbf6
commit f3f75a80c6
96 changed files with 232 additions and 439 deletions

View File

@@ -1,5 +1,4 @@
import 'package:fcs/domain/constants.dart';
import 'package:fcs/domain/entities/cargo_type.dart';
import 'package:fcs/domain/entities/carton.dart';
import 'package:fcs/domain/entities/package.dart';
import 'package:fcs/domain/vo/delivery_address.dart';
@@ -14,7 +13,6 @@ import 'package:fcs/pages/rates/model/shipment_rate_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/length_picker.dart';
import 'package:fcs/pages/widgets/local_button.dart';
import 'package:fcs/pages/widgets/local_radio_buttons.dart';
import 'package:fcs/pages/widgets/local_text.dart';
@@ -39,11 +37,8 @@ class DeliveryInfo extends StatefulWidget {
class _DeliveryInfoState extends State<DeliveryInfo> {
bool _isLoading = false;
late Carton _box;
late String _selectedCartonType;
List<Package> _packages = [];
List<Carton> _mixBoxes = [];
Carton _selectedShipmentBox = new Carton();
List<CargoType> _cargoTypes = [];
// List<CargoType> _cargoTypes = [];
DeliveryAddress _deliveryAddress = new DeliveryAddress();
TextEditingController _widthController = new TextEditingController();
TextEditingController _heightController = new TextEditingController();
@@ -61,7 +56,6 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
void initState() {
super.initState();
if (widget.box != null) _box = widget.box!;
_selectedCartonType = _box.cartonType ?? '';
//for shipment weight
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
@@ -79,7 +73,7 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
_widthController.text = _box.width.toString();
_heightController.text = _box.height.toString();
_lengthController.text = _box.length.toString();
_cargoTypes = _box.cargoTypes;
// _cargoTypes = _box.cargoTypes;
_deliveryAddress = _box.deliveryAddress!;
isMixBox = _box.cartonType == carton_mix_box;
isFromShipments = _box.cartonType == carton_from_shipments;
@@ -155,70 +149,70 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
iconData: Icons.person,
);
final shipmentBoxTitle = Container(
padding: EdgeInsets.only(left: 15, right: 10.0, top: 20),
child: Row(
children: <Widget>[
Expanded(
child:
LocalText(context, 'box.shipment_number', color: Colors.grey),
),
LocalText(context, 'box.shipment.desc', color: Colors.grey),
],
),
);
// final shipmentBoxTitle = Container(
// padding: EdgeInsets.only(left: 15, right: 10.0, top: 20),
// child: Row(
// children: <Widget>[
// Expanded(
// child:
// LocalText(context, 'box.shipment_number', color: Colors.grey),
// ),
// LocalText(context, 'box.shipment.desc', color: Colors.grey),
// ],
// ),
// );
final shipmentBoxRow = Container(
padding: EdgeInsets.only(left: 15.0, right: 10.0, top: 5.0, bottom: 5.0),
child: Row(
children: <Widget>[
Expanded(
child: new Text(
_selectedShipmentBox.shipmentNumber ?? "",
style: textStyle,
)),
new Text(
_selectedShipmentBox.desc ?? "",
style: textStyle,
),
],
),
);
// final shipmentBoxRow = Container(
// padding: EdgeInsets.only(left: 15.0, right: 10.0, top: 5.0, bottom: 5.0),
// child: Row(
// children: <Widget>[
// Expanded(
// child: new Text(
// _selectedShipmentBox.shipmentNumber ?? "",
// style: textStyle,
// )),
// new Text(
// _selectedShipmentBox.desc ?? "",
// style: textStyle,
// ),
// ],
// ),
// );
final lengthBox = LengthPicker(
controller: _lengthController,
lableKey: "box.length",
isReadOnly: true,
);
final widthBox = LengthPicker(
controller: _widthController,
lableKey: "box.width",
isReadOnly: true,
);
final heightBox = LengthPicker(
controller: _heightController,
lableKey: "box.height",
isReadOnly: true,
);
// final lengthBox = LengthPicker(
// controller: _lengthController,
// lableKey: "box.length",
// isReadOnly: true,
// );
// final widthBox = LengthPicker(
// controller: _widthController,
// lableKey: "box.width",
// isReadOnly: true,
// );
// final heightBox = LengthPicker(
// controller: _heightController,
// lableKey: "box.height",
// isReadOnly: true,
// );
final dimBox = Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Icon(FontAwesome.arrow_circle_right, color: primaryColor),
),
SizedBox(child: lengthBox, width: 80),
SizedBox(child: widthBox, width: 80),
SizedBox(child: heightBox, width: 80),
],
);
// final dimBox = Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Padding(
// padding: const EdgeInsets.only(right: 8.0),
// child: Icon(FontAwesome.arrow_circle_right, color: primaryColor),
// ),
// SizedBox(child: lengthBox, width: 80),
// SizedBox(child: widthBox, width: 80),
// SizedBox(child: heightBox, width: 80),
// ],
// );
final shipmentWeightBox = DisplayText(
text: shipmentWeight.toStringAsFixed(0),
labelTextKey: "box.shipment_weight",
iconData: MaterialCommunityIcons.weight,
);
// final shipmentWeightBox = DisplayText(
// text: shipmentWeight.toStringAsFixed(0),
// labelTextKey: "box.shipment_weight",
// iconData: MaterialCommunityIcons.weight,
// );
final mixCartonNumberBox = DisplayText(
text: _box.mixCartonNumber,
labelTextKey: "box.mix.carton",