This commit is contained in:
Phaung Phaung
2021-09-10 12:02:08 +06:30
parent a144c945b6
commit c06ae00b68
35 changed files with 190 additions and 223 deletions

View File

@@ -22,14 +22,13 @@ import 'package:fcs/pages/widgets/local_title.dart';
import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
final DateFormat dateFormat = DateFormat("d MMM yyyy");
class DeliveryInfo extends StatefulWidget {
final Carton box;
final Carton? box;
DeliveryInfo({this.box});
@override
@@ -38,8 +37,8 @@ class DeliveryInfo extends StatefulWidget {
class _DeliveryInfoState extends State<DeliveryInfo> {
bool _isLoading = false;
Carton _box;
String _selectedCartonType;
late Carton _box;
late String _selectedCartonType;
List<Package> _packages = [];
List<Carton> _mixBoxes = [];
Carton _selectedShipmentBox = new Carton();
@@ -51,16 +50,17 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
double volumetricRatio = 0;
double shipmentWeight = 0;
bool isMixBox;
bool isFromShipments;
bool isFromPackages;
bool isSmallBag;
bool isEdiable;
late bool isMixBox;
late bool isFromShipments;
late bool isFromPackages;
late bool isSmallBag;
late bool isEdiable;
@override
void initState() {
super.initState();
_box = widget.box;
if(widget.box != null)
_box = widget.box!;
_selectedCartonType = _box.cartonType;
//for shipment weight
@@ -143,13 +143,13 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
iconData: Ionicons.ios_airplane,
);
final fcsIDBox = DisplayText(
text: _box.fcsID == null ? "" : _box.fcsID,
text: _box.fcsID,
labelTextKey: "box.fcs.id",
icon: FcsIDIcon(),
);
final customerNameBox = DisplayText(
text: _box.userName == null ? "" : _box.userName,
text: _box.userName,
labelTextKey: "box.name",
iconData: Icons.person,
);
@@ -173,13 +173,11 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
children: <Widget>[
Expanded(
child: new Text(
_selectedShipmentBox.shipmentNumber == null
? ""
: _selectedShipmentBox.shipmentNumber,
_selectedShipmentBox.shipmentNumber,
style: textStyle,
)),
new Text(
_selectedShipmentBox.desc == null ? "" : _selectedShipmentBox.desc,
_selectedShipmentBox.desc,
style: textStyle,
),
],
@@ -216,7 +214,7 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
);
final shipmentWeightBox = DisplayText(
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(0) : "",
text: shipmentWeight.toStringAsFixed(0) : "",
labelTextKey: "box.shipment_weight",
iconData: MaterialCommunityIcons.weight,
);
@@ -302,7 +300,7 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
});
try {
var deliveryModel = Provider.of<DeliveryModel>(context, listen: false);
await deliveryModel.deliver(widget.box);
await deliveryModel.deliver(this._box);
Navigator.pop(context, true);
} catch (e) {
showMsgDialog(context, "Error", e.toString());