add mix carton

This commit is contained in:
Sai Naw Wun
2020-10-21 02:59:10 +06:30
parent b87703c693
commit 9aefc585ec
23 changed files with 393 additions and 519 deletions

View File

@@ -1,25 +1,21 @@
import 'package:fcs/domain/entities/cargo_type.dart';
import 'package:fcs/domain/entities/custom_duty.dart';
import 'package:fcs/domain/entities/discount.dart';
import 'package:fcs/domain/entities/discount_by_weight.dart';
import 'package:fcs/domain/entities/rate.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.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/input_text.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:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:flutter/material.dart';
import '../main/util.dart';
import 'cargo_editor.dart';
import 'custom_editor.dart';
import 'discount_by_weight_editor.dart';
class ShipmentRatesEdit extends StatefulWidget {
ShipmentRatesEdit();
@@ -34,14 +30,16 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
TextEditingController _deliveryFee = new TextEditingController();
TextEditingController _volumetricRatio = new TextEditingController();
bool _isNew = false;
@override
void initState() {
super.initState();
_minWeight.text = "10";
_deliveryFee.text = "5";
_volumetricRatio.text = "166.36";
var shipmentRateModel =
Provider.of<ShipmentRateModel>(context, listen: false);
Rate rate = shipmentRateModel.rate;
_minWeight.text = rate.freeDeliveryWeight?.toString() ?? "";
_deliveryFee.text = rate.deliveryFee?.toString() ?? "";
_volumetricRatio.text = rate.volumetricRatio?.toString() ?? "";
}
@override
@@ -91,202 +89,6 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
feeBox,
ratioBox,
SizedBox(height: 10),
// ExpansionTile(
// title: Text(
// 'Cargo Types',
// style: TextStyle(
// color: primaryColor, fontWeight: FontWeight.bold),
// ),
// children: <Widget>[
// Container(
// child: SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child: MyDataTable(
// headingRowHeight: 40,
// columnSpacing: 50,
// columns: [
// MyDataColumn(
// label: Text("Cargo Type",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// MyDataColumn(
// label: Text("Rate",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// MyDataColumn(
// label: Text("Delete",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// ],
// rows: getCargoRows(
// shipmentRateModel.rate.cargoTypes),
// ),
// ),
// ),
// Container(
// padding:
// EdgeInsets.only(top: 20, bottom: 15, right: 15),
// child: Align(
// alignment: Alignment.bottomRight,
// child: Container(
// width: 120,
// height: 40,
// child: FloatingActionButton.extended(
// materialTapTargetSize:
// MaterialTapTargetSize.shrinkWrap,
// icon: Icon(Icons.add),
// onPressed: () {
// Navigator.push(
// context,
// CupertinoPageRoute(
// builder: (context) => CargoEditor()),
// );
// },
// label: Text(
// 'Add Cargo',
// style: TextStyle(fontSize: 12),
// ),
// backgroundColor: primaryColor,
// ),
// ),
// ),
// )
// ],
// ),
// ExpansionTile(
// title: Text(
// 'Custom Duties',
// style: TextStyle(
// color: primaryColor, fontWeight: FontWeight.bold),
// ),
// children: <Widget>[
// Container(
// child: SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child: MyDataTable(
// headingRowHeight: 40,
// columnSpacing: 50,
// columns: [
// MyDataColumn(
// label: Text("Produt Type",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// MyDataColumn(
// label: Text("Fee",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// MyDataColumn(
// label: Text("Delete",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// ],
// rows: getCustomsRows(
// shipmentRateModel.rate.customDuties),
// ),
// ),
// ),
// Container(
// padding:
// EdgeInsets.only(top: 20, bottom: 15, right: 15),
// child: Align(
// alignment: Alignment.bottomRight,
// child: Container(
// width: 120,
// height: 40,
// child: FloatingActionButton.extended(
// materialTapTargetSize:
// MaterialTapTargetSize.shrinkWrap,
// icon: Icon(Icons.add),
// onPressed: () {
// Navigator.push(
// context,
// CupertinoPageRoute(
// builder: (context) => CustomEditor()),
// );
// },
// label: Text(
// 'Add Custom\nDuty',
// style: TextStyle(fontSize: 12),
// ),
// backgroundColor: primaryColor,
// ),
// ),
// ),
// )
// ],
// ),
// ExpansionTile(
// title: Text(
// 'Discounts by weight',
// style: TextStyle(
// color: primaryColor, fontWeight: FontWeight.bold),
// ),
// children: <Widget>[
// Container(
// child: SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child: MyDataTable(
// headingRowHeight: 40,
// columnSpacing: 30,
// columns: [
// MyDataColumn(
// label: Text("Weight",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// MyDataColumn(
// label: Text("Discount Rate",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// MyDataColumn(
// label: Text("Delete",
// style: TextStyle(
// fontSize: 15,
// color: Colors.grey[600]))),
// ],
// rows: getDiscounts(
// shipmentRateModel.rate.discountByWeights),
// ),
// ),
// ),
// Container(
// padding:
// EdgeInsets.only(top: 20, bottom: 15, right: 15),
// child: Align(
// alignment: Alignment.bottomRight,
// child: Container(
// width: 130,
// height: 40,
// child: FloatingActionButton.extended(
// materialTapTargetSize:
// MaterialTapTargetSize.shrinkWrap,
// icon: Icon(Icons.add),
// onPressed: () {
// Navigator.push(
// context,
// CupertinoPageRoute(
// builder: (context) =>
// DiscountByWeightEditor()),
// );
// },
// label: Text(
// 'Add Discount',
// style: TextStyle(fontSize: 12),
// ),
// backgroundColor: primaryColor,
// ),
// ),
// ),
// )
// ],
// ),
],
),
),
@@ -311,7 +113,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
deliveryFee: double.parse(_deliveryFee.text),
freeDeliveryWeight: double.parse(_minWeight.text),
volumetricRatio: double.parse(_volumetricRatio.text));
Rate r = new Rate();
Rate r = new Rate();
print('_rate =>$r');
await shipmentRateModel.updateRate(_rate);
Navigator.pop(context);