update processing
This commit is contained in:
@@ -291,6 +291,7 @@
|
||||
"box.carton_size.title":"Carton Sizes",
|
||||
"box.carton_size_remove.confirm":"Remove this carton size?",
|
||||
"box.carton_size.name":"Name",
|
||||
"box.cargo_total_title":"Edit Total Weight",
|
||||
"Boxes End ================================================================":"",
|
||||
|
||||
"Delivery Start ================================================================":"",
|
||||
|
||||
@@ -291,6 +291,7 @@
|
||||
"box.carton_size.title":"သေတ္တာ အရွယ်အစားများ",
|
||||
"box.carton_size_remove.confirm":"Remove this carton size?",
|
||||
"box.carton_size.name":"နာမည်",
|
||||
"box.cargo_total_title":"စုစုပေါင်းအလေးချိန် ပြုပြင်မည်",
|
||||
"Boxes End ================================================================":"",
|
||||
|
||||
"Delivery Start ================================================================":"",
|
||||
|
||||
@@ -3,6 +3,7 @@ class CargoType {
|
||||
String name;
|
||||
double rate;
|
||||
double weight;
|
||||
bool isChecked;
|
||||
|
||||
double get calAmount => (calRate ?? 0) * (calWeight ?? 0);
|
||||
|
||||
@@ -19,13 +20,15 @@ class CargoType {
|
||||
calRate: map['cal_rate']?.toDouble() ?? 0,
|
||||
);
|
||||
}
|
||||
CargoType(
|
||||
{this.id,
|
||||
CargoType({
|
||||
this.id,
|
||||
this.name,
|
||||
this.rate,
|
||||
this.weight,
|
||||
this.calWeight,
|
||||
this.calRate});
|
||||
this.calRate,
|
||||
this.isChecked = false,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/domain/vo/shipment_status.dart';
|
||||
@@ -36,14 +38,17 @@ class Package {
|
||||
DateTime arrivedDate;
|
||||
DeliveryAddress deliveryAddress;
|
||||
|
||||
//for packages in processing
|
||||
List<File> photoFiles;
|
||||
|
||||
int get amount => rate != null && weight != null ? rate * weight : 0;
|
||||
|
||||
String get packageNumber =>
|
||||
shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
|
||||
double get price => rate.toDouble() * weight;
|
||||
|
||||
Package(
|
||||
{this.id,
|
||||
Package({
|
||||
this.id,
|
||||
this.trackingID,
|
||||
this.userID,
|
||||
this.userName,
|
||||
@@ -71,7 +76,9 @@ class Package {
|
||||
this.photoUrls,
|
||||
this.desc,
|
||||
this.deliveryAddress,
|
||||
this.isChecked = false});
|
||||
this.isChecked = false,
|
||||
this.photoFiles,
|
||||
});
|
||||
|
||||
factory Package.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var _currentStatusDate = (map['status_date'] as Timestamp);
|
||||
|
||||
116
lib/pages/carton/cargo_type_addtion.dart
Normal file
116
lib/pages/carton/cargo_type_addtion.dart
Normal file
@@ -0,0 +1,116 @@
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CargoTypeAddition extends StatefulWidget {
|
||||
@override
|
||||
_CargoTypeAdditionState createState() => _CargoTypeAdditionState();
|
||||
}
|
||||
|
||||
class _CargoTypeAdditionState extends State<CargoTypeAddition> {
|
||||
bool _isLoading = false;
|
||||
|
||||
List<CargoType> cargos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
cargos =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false).rate.cargoTypes;
|
||||
cargos.forEach((p) => p.isChecked = false);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
List<Widget> showcargoTypeList(BuildContext context) {
|
||||
return this.cargos.map((c) {
|
||||
return new ListTile(
|
||||
contentPadding: EdgeInsets.all(0),
|
||||
title: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
c.isChecked = c.isChecked == null ? true : !c.isChecked;
|
||||
});
|
||||
},
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Checkbox(
|
||||
value: c.isChecked == null ? false : c.isChecked,
|
||||
activeColor: primaryColor,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
c.isChecked = value;
|
||||
});
|
||||
}),
|
||||
new Text(
|
||||
c.name,
|
||||
style: TextStyle(fontSize: 15.0, color: primaryColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final saveBtn = fcsButton(
|
||||
context,
|
||||
getLocalString(context, 'box.cargo.save.btn'),
|
||||
callack: () {
|
||||
this.cargos.forEach((p) => p.weight = 0.00);
|
||||
List<CargoType> _cargos =
|
||||
this.cargos.where((c) => c.isChecked).toList();
|
||||
Navigator.pop(context, _cargos);
|
||||
},
|
||||
);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon:
|
||||
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
title: LocalText(
|
||||
context,
|
||||
"cargo.form.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
)),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: showcargoTypeList(context),
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
saveBtn,
|
||||
SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// List<CargoType> cargoTypeList() {
|
||||
// return this.privileges.where((p) => p.isChecked).map((p) => p.id).toList();
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class _CargoTypeEditorState extends State<CargoTypeEditor> {
|
||||
super.initState();
|
||||
if (widget.cargo != null) {
|
||||
_cargo = widget.cargo;
|
||||
_weightController.text = _cargo.weight.toString();
|
||||
_weightController.text = _cargo.weight.toStringAsFixed(2);
|
||||
} else {
|
||||
_loadDefalut();
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'cargo_type_editor.dart';
|
||||
import 'total_weight_edit.dart';
|
||||
|
||||
typedef OnAdd(CargoType cargoType);
|
||||
typedef OnRemove(CargoType cargoType);
|
||||
|
||||
class CargoTable extends StatelessWidget {
|
||||
class CargoTable extends StatefulWidget {
|
||||
final List<CargoType> cargoTypes;
|
||||
final OnAdd onAdd;
|
||||
final OnRemove onRemove;
|
||||
@@ -18,6 +19,12 @@ class CargoTable extends StatelessWidget {
|
||||
const CargoTable({Key key, this.cargoTypes, this.onAdd, this.onRemove})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_CargoTableState createState() => _CargoTableState();
|
||||
}
|
||||
|
||||
class _CargoTableState extends State<CargoTable> {
|
||||
double totalWeight = 0;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyDataTable(
|
||||
@@ -43,12 +50,14 @@ class CargoTable extends StatelessWidget {
|
||||
}
|
||||
|
||||
List<MyDataRow> getCargoRows(BuildContext context) {
|
||||
if (cargoTypes == null) {
|
||||
if (widget.cargoTypes == null) {
|
||||
return [];
|
||||
}
|
||||
double total = 0;
|
||||
var rows = cargoTypes.map((c) {
|
||||
total += c.weight;
|
||||
|
||||
double _total = 0;
|
||||
var rows = widget.cargoTypes.map((c) {
|
||||
_total += c.weight;
|
||||
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) async {
|
||||
CargoType cargo = await Navigator.push<CargoType>(
|
||||
@@ -57,7 +66,7 @@ class CargoTable extends StatelessWidget {
|
||||
builder: (context) => CargoTypeEditor(
|
||||
cargo: c,
|
||||
)));
|
||||
if (onAdd != null) onAdd(cargo);
|
||||
if (widget.onAdd != null) widget.onAdd(cargo);
|
||||
},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
@@ -68,9 +77,8 @@ class CargoTable extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(c.weight == null ? "0" : c.weight.toString(),
|
||||
style: textStyle),
|
||||
onRemove == null
|
||||
Text(c.weight.toStringAsFixed(2), style: textStyle),
|
||||
widget.onRemove == null
|
||||
? SizedBox(
|
||||
width: 50,
|
||||
)
|
||||
@@ -80,7 +88,93 @@ class CargoTable extends StatelessWidget {
|
||||
color: primaryColor,
|
||||
),
|
||||
onPressed: () {
|
||||
if (onRemove != null) onRemove(c);
|
||||
if (widget.onRemove != null) widget.onRemove(c);
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList();
|
||||
|
||||
var totalRow = MyDataRow(
|
||||
onSelectChanged: (bool selected) async {
|
||||
double _t = await Navigator.of(context).push<double>(CupertinoPageRoute(
|
||||
builder: (context) => TotalWeightEdit(totalWeight: totalWeight)));
|
||||
if (_t == null) return;
|
||||
setState(() {
|
||||
totalWeight = _t;
|
||||
});
|
||||
},
|
||||
cells: [
|
||||
MyDataCell(Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: LocalText(
|
||||
context,
|
||||
"shipment.cargo.total",
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)),
|
||||
MyDataCell(
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 48.0),
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(totalWeight.toStringAsFixed(2),
|
||||
style: TextStyle(fontWeight: FontWeight.bold))),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
rows.add(totalRow);
|
||||
return rows;
|
||||
}
|
||||
|
||||
double getRemainBalance(double total) {
|
||||
double _r = this.totalWeight < total ? 0 : this.totalWeight - total;
|
||||
return _r;
|
||||
}
|
||||
|
||||
List<MyDataRow> _getCargoRows(BuildContext context) {
|
||||
if (widget.cargoTypes == null) {
|
||||
return [];
|
||||
}
|
||||
double total = 0;
|
||||
var rows = widget.cargoTypes.map((c) {
|
||||
total += c.weight;
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) async {
|
||||
CargoType cargo = await Navigator.push<CargoType>(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => CargoTypeEditor(
|
||||
cargo: c,
|
||||
)));
|
||||
if (widget.onAdd != null) widget.onAdd(cargo);
|
||||
},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
c.name == null ? "" : c.name,
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2),
|
||||
style: textStyle),
|
||||
widget.onRemove == null
|
||||
? SizedBox(
|
||||
width: 50,
|
||||
)
|
||||
: IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_circle,
|
||||
color: primaryColor,
|
||||
),
|
||||
onPressed: () {
|
||||
if (widget.onRemove != null) widget.onRemove(c);
|
||||
})
|
||||
],
|
||||
),
|
||||
@@ -106,7 +200,7 @@ class CargoTable extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(right: 48.0),
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(total.toString(),
|
||||
child: Text(total.toStringAsFixed(2),
|
||||
style: TextStyle(fontWeight: FontWeight.bold))),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -3,31 +3,21 @@ import 'package:fcs/domain/entities/carton.dart';
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/carton_size.dart';
|
||||
import 'package:fcs/domain/entities/fcs_shipment.dart';
|
||||
import 'package:fcs/domain/entities/market.dart';
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/carton/carton_cargo_table.dart';
|
||||
import 'package:fcs/pages/carton/carton_mix_table.dart';
|
||||
import 'package:fcs/pages/carton/carton_package_table.dart';
|
||||
import 'package:fcs/pages/carton_size/carton_size_list.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_list.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_row.dart';
|
||||
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
|
||||
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/market/model/market_model.dart';
|
||||
import 'package:fcs/pages/package/model/package_model.dart';
|
||||
import 'package:fcs/pages/package/tracking_id_page.dart';
|
||||
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
|
||||
import 'package:fcs/pages/widgets/delivery_address_selection.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';
|
||||
@@ -36,19 +26,17 @@ import 'package:fcs/pages/widgets/local_dropdown.dart';
|
||||
import 'package:fcs/pages/widgets/local_radio_buttons.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_title.dart';
|
||||
import 'package:fcs/pages/widgets/my_data_table.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:provider/provider.dart';
|
||||
import 'cargo_type_addtion.dart';
|
||||
import 'cargo_type_editor.dart';
|
||||
import 'model/carton_model.dart';
|
||||
import '../carton_size/model/carton_size_model.dart';
|
||||
import 'widgets.dart';
|
||||
|
||||
const MANAGE_CARTONSIZE = "Manage Carton Size";
|
||||
|
||||
class CartonEditor extends StatefulWidget {
|
||||
final Carton box;
|
||||
CartonEditor({this.box});
|
||||
@@ -102,9 +90,9 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
cargoTypes: [],
|
||||
packages: [],
|
||||
);
|
||||
_lengthController.text = "12";
|
||||
_widthController.text = "12";
|
||||
_heightController.text = "12";
|
||||
_lengthController.text = "";
|
||||
_widthController.text = "";
|
||||
_heightController.text = "";
|
||||
_isNew = true;
|
||||
_selectedCartonType = carton_from_packages;
|
||||
_loadFcsShipments();
|
||||
@@ -212,7 +200,9 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
labelTextKey: "box.mix.carton",
|
||||
iconData: MaterialCommunityIcons.package,
|
||||
);
|
||||
var fcsShipmentsBox = LocalDropdown<FcsShipment>(
|
||||
var fcsShipmentsBox = Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: LocalDropdown<FcsShipment>(
|
||||
callback: (v) {
|
||||
setState(() {
|
||||
_fcsShipment = v;
|
||||
@@ -224,9 +214,11 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
display: (u) => u.shipmentNumber,
|
||||
selectedValue: _fcsShipment,
|
||||
values: _fcsShipments,
|
||||
);
|
||||
));
|
||||
|
||||
var mixCartonsBox = LocalDropdown<Carton>(
|
||||
var mixCartonsBox = Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: LocalDropdown<Carton>(
|
||||
callback: (v) {
|
||||
setState(() {
|
||||
_mixCarton = v;
|
||||
@@ -237,9 +229,11 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
display: (u) => u.cartonNumber,
|
||||
selectedValue: _mixCarton,
|
||||
values: _mixCartons,
|
||||
);
|
||||
));
|
||||
|
||||
final fcsIDBox = Row(
|
||||
final fcsIDBox = Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
@@ -250,7 +244,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
_isNew
|
||||
? IconButton(
|
||||
icon: Icon(Icons.search, color: primaryColor),
|
||||
onPressed: () => searchUser(context, callbackUserSelect: (u) {
|
||||
onPressed: () =>
|
||||
searchUser(context, callbackUserSelect: (u) {
|
||||
setState(() {
|
||||
this._user = u;
|
||||
_loadPackages();
|
||||
@@ -258,7 +253,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
}))
|
||||
: Container(),
|
||||
],
|
||||
);
|
||||
));
|
||||
|
||||
final namebox = DisplayText(
|
||||
text: _user?.name ?? "",
|
||||
@@ -269,14 +264,17 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
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(
|
||||
@@ -293,7 +291,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
);
|
||||
|
||||
final shipmentWeightBox = DisplayText(
|
||||
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(0) : "",
|
||||
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(2) : "",
|
||||
labelTextKey: "box.shipment_weight",
|
||||
iconData: MaterialCommunityIcons.weight,
|
||||
);
|
||||
@@ -326,9 +324,17 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
color: primaryColor,
|
||||
),
|
||||
onPressed: () async {
|
||||
CargoType cargo = await Navigator.push<CargoType>(context,
|
||||
CupertinoPageRoute(builder: (context) => CargoTypeEditor()));
|
||||
_addCargo(cargo);
|
||||
// CargoType cargo = await Navigator.push<CargoType>(context,
|
||||
// CupertinoPageRoute(builder: (context) => CargoTypeEditor()));
|
||||
// _addCargo(cargo);
|
||||
List<CargoType> cargos = await Navigator.push<List<CargoType>>(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => CargoTypeAddition()));
|
||||
if (cargos == null) return;
|
||||
setState(() {
|
||||
_carton.cargoTypes.clear();
|
||||
_carton.cargoTypes.addAll(cargos);
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -414,7 +420,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
? Container()
|
||||
: LocalTitle(textKey: "box.dimension"),
|
||||
isSmallBag ? Container() : cartonSizeDropdown(),
|
||||
// isSmallBag ? Container() : dimBox,
|
||||
isSmallBag ? Container() : dimBox,
|
||||
isSmallBag ? Container() : shipmentWeightBox,
|
||||
LocalTitle(textKey: "box.delivery_address"),
|
||||
DefaultDeliveryAddress(
|
||||
@@ -445,16 +451,13 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
);
|
||||
}
|
||||
|
||||
String selectedCatonSize;
|
||||
CartonSize selectedCatonSize;
|
||||
Widget cartonSizeDropdown() {
|
||||
List<CartonSize> _cartonSizes =
|
||||
Provider.of<CartonSizeModel>(context).cartonSizes;
|
||||
|
||||
List<String> cartonSizes = _cartonSizes.map((e) => e.name).toList();
|
||||
cartonSizes.insert(0, MANAGE_CARTONSIZE);
|
||||
Provider.of<CartonSizeModel>(context).getCartonSizes;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 10, bottom: 10),
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
@@ -474,7 +477,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
DropdownButton<String>(
|
||||
DropdownButton<CartonSize>(
|
||||
isDense: true,
|
||||
value: selectedCatonSize,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14),
|
||||
@@ -482,25 +485,31 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onChanged: (String newValue) {
|
||||
onChanged: (CartonSize newValue) {
|
||||
setState(() {
|
||||
if (newValue == MANAGE_CARTONSIZE) {
|
||||
if (newValue.name == MANAGE_CARTONSIZE) {
|
||||
selectedCatonSize = null;
|
||||
_manageCartonSize();
|
||||
return;
|
||||
}
|
||||
selectedCatonSize = newValue;
|
||||
_widthController.text =
|
||||
selectedCatonSize.width.toString();
|
||||
_heightController.text =
|
||||
selectedCatonSize.height.toString();
|
||||
_lengthController.text =
|
||||
selectedCatonSize.length.toString();
|
||||
});
|
||||
},
|
||||
isExpanded: true,
|
||||
items:
|
||||
cartonSizes.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
items: _cartonSizes
|
||||
.map<DropdownMenuItem<CartonSize>>((CartonSize value) {
|
||||
return DropdownMenuItem<CartonSize>(
|
||||
value: value,
|
||||
child: Text(value ?? "",
|
||||
child: Text(value.name ?? "",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: value == MANAGE_CARTONSIZE
|
||||
color: value.name == MANAGE_CARTONSIZE
|
||||
? secondaryColor
|
||||
: primaryColor)),
|
||||
);
|
||||
|
||||
@@ -177,7 +177,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
);
|
||||
|
||||
final shipmentWeightBox = DisplayText(
|
||||
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(0) : "",
|
||||
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(2) : "",
|
||||
labelTextKey: "box.shipment_weight",
|
||||
iconData: MaterialCommunityIcons.weight,
|
||||
);
|
||||
|
||||
@@ -78,7 +78,7 @@ class CartonListRow extends StatelessWidget {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
"${box.actualWeight?.toString() ?? ''} lb",
|
||||
"${box.actualWeight?.toStringAsFixed(2) ?? ''} lb",
|
||||
style:
|
||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
|
||||
86
lib/pages/carton/total_weight_edit.dart
Normal file
86
lib/pages/carton/total_weight_edit.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
|
||||
typedef void ProfileCallback();
|
||||
|
||||
class TotalWeightEdit extends StatefulWidget {
|
||||
final double totalWeight;
|
||||
|
||||
const TotalWeightEdit({Key key, this.totalWeight}) : super(key: key);
|
||||
@override
|
||||
_TotalWeightEditState createState() => _TotalWeightEditState();
|
||||
}
|
||||
|
||||
class _TotalWeightEditState extends State<TotalWeightEdit> {
|
||||
final TextEditingController totalController = new TextEditingController();
|
||||
bool _loading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
totalController.text = widget.totalWeight.toStringAsFixed(2);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final totalInputBox = InputText(
|
||||
labelTextKey: 'shipment.cargo.total',
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
textInputType: TextInputType.number,
|
||||
controller: totalController);
|
||||
|
||||
final saveBtn =
|
||||
fcsButton(context, getLocalString(context, "btn.save"), callack: _save);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _loading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: LocalText(
|
||||
context,
|
||||
"box.cargo_total_title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
CupertinoIcons.back,
|
||||
size: 35,
|
||||
color: primaryColor,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(18),
|
||||
children: <Widget>[totalInputBox, SizedBox(height: 30), saveBtn],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_save() async {
|
||||
setState(() {
|
||||
_loading = true;
|
||||
});
|
||||
try {
|
||||
double total = double.parse(totalController.text, (s) => 0);
|
||||
Navigator.pop<double>(context, total);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,12 +31,14 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
||||
|
||||
bool _isLoading = false;
|
||||
CartonSize _cartonSize;
|
||||
bool _isNew;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.cartonSize != null) {
|
||||
_cartonSize = widget.cartonSize;
|
||||
_isNew = false;
|
||||
_nameController.text = _cartonSize.name;
|
||||
_widthController.text = _cartonSize.width.toString();
|
||||
_heightController.text = _cartonSize.height.toString();
|
||||
@@ -45,6 +47,7 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
||||
_lengthController.text = "12";
|
||||
_widthController.text = "12";
|
||||
_heightController.text = "12";
|
||||
_isNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,9 +107,20 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
||||
double w = double.parse(_widthController.text, (s) => 0);
|
||||
double h = double.parse(_heightController.text, (s) => 0);
|
||||
|
||||
if (_isNew) {
|
||||
CartonSize _cartonSize = CartonSize(
|
||||
name: _nameController.text, length: l, width: w, height: h);
|
||||
await cartonSizeModel.addCartonSize(_cartonSize);
|
||||
} else {
|
||||
CartonSize _cartonSize = CartonSize(
|
||||
id: widget.cartonSize.id,
|
||||
name: _nameController.text,
|
||||
length: l,
|
||||
width: w,
|
||||
height: h);
|
||||
await cartonSizeModel.updateCartonSize(_cartonSize);
|
||||
}
|
||||
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
@@ -29,6 +29,10 @@ class _CartonSizeListState extends State<CartonSizeList> {
|
||||
BuildContext context, List<CartonSize> cartonSizes) {
|
||||
return cartonSizes.map((p) {
|
||||
return new ListTile(
|
||||
onTap: () {
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => CartonSizeEditor(cartonSize: p)));
|
||||
},
|
||||
title: new Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
|
||||
@@ -5,12 +5,19 @@ import 'package:fcs/domain/entities/carton_size.dart';
|
||||
import 'package:fcs/pages/main/model/base_model.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
const MANAGE_CARTONSIZE = "Manage Carton Size";
|
||||
|
||||
class CartonSizeModel extends BaseModel {
|
||||
List<CartonSize> cartonSizes = [];
|
||||
final log = Logger('CartonSizeModel');
|
||||
|
||||
StreamSubscription<QuerySnapshot> listener;
|
||||
|
||||
List<CartonSize> get getCartonSizes {
|
||||
var _cartonSizes = new List<CartonSize>.from(cartonSizes);
|
||||
return _cartonSizes..insert(0, CartonSize(name: MANAGE_CARTONSIZE));
|
||||
}
|
||||
|
||||
void initUser(user) {
|
||||
super.initUser(user);
|
||||
cartonSizes = [
|
||||
@@ -32,5 +39,7 @@ class CartonSizeModel extends BaseModel {
|
||||
|
||||
Future<void> addCartonSize(CartonSize cartonSize) async {}
|
||||
|
||||
Future<void> updateCartonSize(CartonSize cartonSize) async {}
|
||||
|
||||
Future<void> deleteCartonSize(String id) async {}
|
||||
}
|
||||
|
||||
@@ -24,14 +24,7 @@ class ProcessingModel extends BaseModel {
|
||||
processings = [];
|
||||
}
|
||||
|
||||
Future<void> createProcessing(Processing carton) {}
|
||||
Future<void> createProcessing(Processing processing) {}
|
||||
|
||||
Future<void> updateProcessing(Processing carton) {}
|
||||
|
||||
Future<void> createPackage(Package package, List<File> files) {}
|
||||
|
||||
Future<void> updatePackage(
|
||||
Package package, List<File> files, List<String> deletedUrls) {}
|
||||
|
||||
Future<void> deletePackage(String id) {}
|
||||
Future<void> updateProcessing(Processing processing) {}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/market/market_editor.dart';
|
||||
import 'package:fcs/pages/market/model/market_model.dart';
|
||||
import 'package:fcs/pages/package/model/package_model.dart';
|
||||
import 'package:fcs/pages/package/tracking_id_page.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/widgets/barcode_scanner.dart';
|
||||
@@ -18,8 +17,6 @@ import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'model/processing_model.dart';
|
||||
|
||||
class PackageEditor extends StatefulWidget {
|
||||
final Package package;
|
||||
PackageEditor({this.package});
|
||||
@@ -36,7 +33,7 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
bool _isLoading = false;
|
||||
bool _isNew;
|
||||
MultiImgController multiImgController = MultiImgController();
|
||||
Package _package;
|
||||
Package _package = Package();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -45,10 +42,11 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
_isNew = false;
|
||||
_package = widget.package;
|
||||
_trackingIDCtl.text = _package.trackingID;
|
||||
multiImgController.setImageUrls = _package.photoUrls;
|
||||
|
||||
selectedMarket = _package.market ?? "";
|
||||
_descCtl.text = _package.desc;
|
||||
_remarkCtl.text = _package.remark;
|
||||
multiImgController.setImageFiles = _package.photoFiles;
|
||||
} else {
|
||||
_isNew = true;
|
||||
}
|
||||
@@ -259,26 +257,20 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
}
|
||||
|
||||
_selectPackage() async {
|
||||
Package package = Package();
|
||||
package.id = _package.id;
|
||||
package.trackingID = _package.trackingID;
|
||||
package.market = selectedMarket;
|
||||
package.desc = _descCtl.text;
|
||||
package.remark = _remarkCtl.text;
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
ProcessingModel processingModel =
|
||||
Provider.of<ProcessingModel>(context, listen: false);
|
||||
|
||||
try {
|
||||
if (_isNew) {
|
||||
await processingModel.createPackage(
|
||||
package, multiImgController.getAddedFile);
|
||||
} else {
|
||||
await processingModel.updatePackage(package,
|
||||
multiImgController.getAddedFile, multiImgController.getDeletedUrl);
|
||||
}
|
||||
Navigator.pop(context, true);
|
||||
this._package.trackingID = _trackingIDCtl.text;
|
||||
this._package.market = selectedMarket;
|
||||
this._package.desc = _descCtl.text;
|
||||
this._package.remark = _remarkCtl.text;
|
||||
this._package.photoFiles = _isNew
|
||||
? multiImgController.getAddedFile
|
||||
: multiImgController.getUpdatedFile;
|
||||
|
||||
Navigator.pop<Package>(context, this._package);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:fcs/pages/package/model/package_model.dart';
|
||||
import 'package:fcs/pages/package/tracking_id_page.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
@@ -22,15 +21,15 @@ import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ProcessingEditor extends StatefulWidget {
|
||||
class ProcessingEditEditor extends StatefulWidget {
|
||||
final Package package;
|
||||
ProcessingEditor({this.package});
|
||||
ProcessingEditEditor({this.package});
|
||||
|
||||
@override
|
||||
_ProcessingEditorState createState() => _ProcessingEditorState();
|
||||
_ProcessingEditEditorState createState() => _ProcessingEditEditorState();
|
||||
}
|
||||
|
||||
class _ProcessingEditorState extends State<ProcessingEditor> {
|
||||
class _ProcessingEditEditorState extends State<ProcessingEditEditor> {
|
||||
TextEditingController _remarkCtl = new TextEditingController();
|
||||
TextEditingController _descCtl = new TextEditingController();
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/entities/processing.dart';
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/carton/carton_package_table.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/package/model/package_model.dart';
|
||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||
@@ -50,13 +46,6 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
||||
name: processing.shipperName,
|
||||
phoneNumber: processing.shipperPhoneNumber);
|
||||
packages = processing.packages;
|
||||
} else {
|
||||
packages = [
|
||||
Package(trackingID: "REC 4", market: "New Market"),
|
||||
Package(trackingID: "REC 3", market: "Macy"),
|
||||
Package(trackingID: "REC 2", market: "New Market"),
|
||||
Package(trackingID: "REC 1", market: "New Market")
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,10 +146,12 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
||||
color: primaryColor,
|
||||
),
|
||||
onPressed: () async {
|
||||
Navigator.push(
|
||||
Package _package = await Navigator.push<Package>(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => PackageEditor()),
|
||||
);
|
||||
_addPackage(_package);
|
||||
// _savePackage(_package);
|
||||
}),
|
||||
],
|
||||
),
|
||||
@@ -172,12 +163,6 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
||||
callack: _save,
|
||||
);
|
||||
|
||||
final updateButton = fcsButton(
|
||||
context,
|
||||
getLocalString(context, 'processing.edit.complete.btn'),
|
||||
callack: _save,
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -219,7 +204,7 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
_isNew ? createButton : updateButton,
|
||||
createButton,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
@@ -238,9 +223,14 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
onTap: () async {
|
||||
Package _package = await Navigator.of(context).push<Package>(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => PackageEditor(package: p)));
|
||||
// setState(() {
|
||||
// _savePackage(_package);
|
||||
// });
|
||||
_savePackage(_package);
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
@@ -276,7 +266,7 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.remove, color: primaryColor),
|
||||
onPressed: () => _remove(p),
|
||||
onPressed: () => _removePackage(p),
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -289,30 +279,22 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
_remove(Package package) {
|
||||
if (package == null) {
|
||||
showMsgDialog(context, "Esrror", "Invalid package!");
|
||||
return;
|
||||
}
|
||||
showConfirmDialog(context, "processing.package.delete_confirm",
|
||||
() => _removePackage(package));
|
||||
_addPackage(Package package) {
|
||||
if (package == null) return;
|
||||
|
||||
this.packages.add(package);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
_removePackage(Package package) async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
ProcessingModel processingModel =
|
||||
Provider.of<ProcessingModel>(context, listen: false);
|
||||
try {
|
||||
await processingModel.deletePackage(package.id);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
_savePackage(Package package) {
|
||||
if (package == null) return;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
_removePackage(Package package) {
|
||||
if (package == null) return;
|
||||
this.packages.removeWhere((p) => p.trackingID == package.trackingID);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
_save() async {
|
||||
|
||||
@@ -16,7 +16,7 @@ import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'processing_editor_old.dart';
|
||||
import 'processing_edit_editor.dart';
|
||||
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
|
||||
@@ -179,7 +179,7 @@ class _ProcessingInfoState extends State<ProcessingInfo> {
|
||||
bool deleted = await Navigator.push<bool>(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => ProcessingEditor(
|
||||
builder: (context) => ProcessingEditEditor(
|
||||
package: widget.package,
|
||||
)));
|
||||
if (deleted ?? false) {
|
||||
|
||||
@@ -82,7 +82,8 @@ class _DiscountByWeightListState extends State<DiscountByWeightList> {
|
||||
discountByWeight: discountByWeight)));
|
||||
},
|
||||
child: Container(
|
||||
child: _row("${discountByWeight.weight.toString()} lb",
|
||||
child: _row(
|
||||
"${discountByWeight.weight.toStringAsFixed(2)} lb",
|
||||
"\$ " + discountByWeight.discount.toString()),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -31,7 +31,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
super.initState();
|
||||
if (widget.discountByWeight != null) {
|
||||
_discountByWeight = widget.discountByWeight;
|
||||
_weightController.text = _discountByWeight.weight.toString();
|
||||
_weightController.text = _discountByWeight.weight.toStringAsFixed(2);
|
||||
_discountController.text = _discountByWeight.discount.toString();
|
||||
_isNew = false;
|
||||
} else {
|
||||
|
||||
@@ -196,8 +196,8 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
if (discounts == null) return [];
|
||||
return discounts.map((d) {
|
||||
return Container(
|
||||
child: _row(
|
||||
"${d.weight.toString()} lb", "\$ " + d.discount.toString(), ''),
|
||||
child: _row("${d.weight.toStringAsFixed(2)} lb",
|
||||
"\$ " + d.discount.toString(), ''),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
Rate rate = shipmentRateModel.rate;
|
||||
|
||||
_minWeight.text = rate.freeDeliveryWeight?.toString() ?? "";
|
||||
_minWeight.text = rate.freeDeliveryWeight?.toStringAsFixed(2) ?? "";
|
||||
_deliveryFee.text = rate.deliveryFee?.toString() ?? "";
|
||||
_volumetricRatio.text = rate.volumetricRatio?.toString() ?? "";
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class BoxRow extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
"Actual Weight:${box.actualWeight.toString()}lb",
|
||||
"Actual Weight:${box.actualWeight.toStringAsFixed(2)}lb",
|
||||
style: new TextStyle(fontSize: 14.0, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -232,7 +232,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(c.weight == null ? "0" : c.weight.toString(),
|
||||
Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2),
|
||||
style: textStyle),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
@@ -265,7 +265,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
padding: const EdgeInsets.only(right: 48.0),
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(total.toString(),
|
||||
child: Text(total.toStringAsFixed(2),
|
||||
style: TextStyle(fontWeight: FontWeight.bold))),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'display_image_source.dart';
|
||||
|
||||
class MultiImgController {
|
||||
List<String> imageUrls = [];
|
||||
List<File> imageFiles = [];
|
||||
List<DisplayImageSource> addedFiles = [];
|
||||
List<DisplayImageSource> removedFiles = [];
|
||||
|
||||
@@ -29,6 +30,22 @@ class MultiImgController {
|
||||
}
|
||||
}
|
||||
|
||||
set setImageFiles(List<File> imageFiles) {
|
||||
if (imageFiles == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
fileContainers.clear();
|
||||
|
||||
this.imageFiles = imageFiles;
|
||||
imageFiles.forEach((e) {
|
||||
fileContainers.add(DisplayImageSource(file: e));
|
||||
});
|
||||
if (callback != null) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
void onChange(CallBack callBack) {
|
||||
this.callback = callBack;
|
||||
}
|
||||
@@ -51,11 +68,22 @@ class MultiImgController {
|
||||
if (imageUrls.contains(fileContainer.url)) {
|
||||
removedFiles.add(fileContainer);
|
||||
}
|
||||
|
||||
if (imageFiles.contains(fileContainer.file)) {
|
||||
this.imageFiles.remove(fileContainer.file);
|
||||
}
|
||||
|
||||
if (callback != null) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
List<File> get getUpdatedFile {
|
||||
List<File> _addfiles = getAddedFile;
|
||||
this.imageFiles.addAll(_addfiles);
|
||||
return this.imageFiles;
|
||||
}
|
||||
|
||||
List<File> get getAddedFile {
|
||||
return addedFiles.map((e) => e.file).toList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user