add rate service

This commit is contained in:
Sai Naw Wun
2020-10-15 03:06:13 +06:30
parent 7b88658893
commit 47c07a6c88
45 changed files with 870 additions and 496 deletions

View File

@@ -1,6 +1,6 @@
import 'package:fcs/domain/constants.dart';
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/entities/package.dart';
import 'package:fcs/domain/entities/user.dart';
import 'package:fcs/domain/vo/delivery_address.dart';
@@ -12,6 +12,7 @@ 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/package/model/package_model.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';
@@ -54,7 +55,7 @@ class _BoxEditorState extends State<BoxEditor> {
List<Package> _packages = [];
List<Box> _shipmentBoxes = [];
List<Box> _mixBoxes = [];
List<Cargo> _cargoTypes = [];
List<CargoType> _cargoTypes = [];
double volumetricRatio = 0;
double shipmentWeight = 0;
Box _selectedShipmentBox;
@@ -83,8 +84,9 @@ class _BoxEditorState extends State<BoxEditor> {
});
//for shipment weight
volumetricRatio =
Provider.of<MainModel>(context, listen: false).setting.volumetricRatio;
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
.rate
.volumetricRatio;
_lengthController.addListener(_calShipmentWeight);
_widthController.addListener(_calShipmentWeight);
_heightController.addListener(_calShipmentWeight);
@@ -101,9 +103,9 @@ class _BoxEditorState extends State<BoxEditor> {
isNew = false;
} else {
_cargoTypes = [
Cargo(type: 'General', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous', weight: 30)
CargoType(id: "1", name: 'General', weight: 25),
CargoType(id: "2", name: 'Medicine', weight: 20),
CargoType(id: "3", name: 'Dangerous', weight: 30)
];
var shipmentModel =
@@ -401,7 +403,7 @@ class _BoxEditorState extends State<BoxEditor> {
total += c.value.weight;
return InkWell(
onTap: () async {
Cargo cargo = await Navigator.push<Cargo>(
CargoType cargo = await Navigator.push<CargoType>(
context,
CupertinoPageRoute(
builder: (context) => CargoTypeEditor(cargo: c.value)),
@@ -422,7 +424,7 @@ class _BoxEditorState extends State<BoxEditor> {
children: <Widget>[
Expanded(
child: new Text(
c.value.type,
c.value.name,
style: textStyle,
)),
Row(
@@ -630,7 +632,7 @@ class _BoxEditorState extends State<BoxEditor> {
color: primaryColor,
),
onPressed: () async {
Cargo cargo = await Navigator.push<Cargo>(
CargoType cargo = await Navigator.push<CargoType>(
context,
CupertinoPageRoute(
builder: (context) => CargoTypeEditor()),
@@ -700,7 +702,7 @@ class _BoxEditorState extends State<BoxEditor> {
}).toList();
}
_addCargo(Cargo cargo) {
_addCargo(CargoType cargo) {
if (cargo == null) return;
setState(() {
_cargoTypes.remove(cargo);