update
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -3,14 +3,13 @@ import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'delivery_info.dart';
|
||||
|
||||
class DeliveryListRow extends StatelessWidget {
|
||||
final Carton box;
|
||||
DeliveryListRow({Key key, this.box}) : super(key: key);
|
||||
final Carton? box;
|
||||
DeliveryListRow({Key? key, this.box}) : super(key: key);
|
||||
|
||||
final double dotSize = 15.0;
|
||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||
@@ -19,10 +18,11 @@ class DeliveryListRow extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box)),
|
||||
);
|
||||
if (box != null)
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box!)),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
@@ -48,7 +48,7 @@ class DeliveryListRow extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
box.cartonNumber ?? "",
|
||||
box?.cartonNumber ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
@@ -56,7 +56,7 @@ class DeliveryListRow extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||
child: new Text(
|
||||
box.userName ?? "",
|
||||
box?.userName ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
@@ -72,14 +72,14 @@ class DeliveryListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: getStatus(box.status == null ? "" : box.status),
|
||||
child: getStatus(box?.status ?? ''),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
"${box.actualWeight?.toString() ?? ''} lb",
|
||||
"${box?.actualWeight.toString() ?? ''} lb",
|
||||
style:
|
||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user