add rate service
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import 'package:fcs/domain/entities/box.dart';
|
||||
import 'package:fcs/domain/entities/cargo.dart';
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/box/cargo_type_editor.dart';
|
||||
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/rates/model/shipment_rate_model.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';
|
||||
@@ -39,14 +40,15 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
DeliveryAddress _deliveryAddress;
|
||||
double volumetricRatio = 0;
|
||||
double shipmentWeight = 0;
|
||||
List<Cargo> cargos = [];
|
||||
List<CargoType> cargos = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
volumetricRatio =
|
||||
Provider.of<MainModel>(context, listen: false).setting.volumetricRatio;
|
||||
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
|
||||
.rate
|
||||
.volumetricRatio;
|
||||
|
||||
if (widget.box != null) {
|
||||
_box = widget.box;
|
||||
@@ -145,7 +147,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
color: primaryColor,
|
||||
),
|
||||
onPressed: () async {
|
||||
Cargo cargo = await Navigator.push<Cargo>(
|
||||
CargoType cargo = await Navigator.push<CargoType>(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => CargoTypeEditor()));
|
||||
@@ -212,7 +214,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
total += c.weight;
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) async {
|
||||
Cargo cargo = await Navigator.push<Cargo>(
|
||||
CargoType cargo = await Navigator.push<CargoType>(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => CargoTypeEditor(
|
||||
@@ -222,7 +224,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
c.type == null ? "" : c.type,
|
||||
c.name == null ? "" : c.name,
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(
|
||||
@@ -270,7 +272,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
return rows;
|
||||
}
|
||||
|
||||
_addCargo(Cargo cargo) {
|
||||
_addCargo(CargoType cargo) {
|
||||
if (cargo == null) return;
|
||||
setState(() {
|
||||
cargos.remove(cargo);
|
||||
@@ -278,7 +280,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
});
|
||||
}
|
||||
|
||||
_removeCargo(Cargo cargo) {
|
||||
_removeCargo(CargoType cargo) {
|
||||
setState(() {
|
||||
cargos.remove(cargo);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user