update rate
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import 'package:fcs/model/pickup_model.dart';
|
||||
import 'package:fcs/model/shipment_rate_model.dart';
|
||||
import 'package:fcs/pages/shipment_rates_calculate.dart';
|
||||
import 'package:fcs/pages/shipment_rates_edit.dart';
|
||||
import 'package:fcs/pages/term.dart';
|
||||
import 'package:fcs/vo/custom.dart';
|
||||
import 'package:fcs/vo/discount.dart';
|
||||
import 'package:fcs/vo/pickup.dart';
|
||||
import 'package:fcs/vo/rate.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
@@ -90,26 +91,72 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
child: ListView(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 10),
|
||||
child: Text(
|
||||
"Cargo Types",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 135,
|
||||
child: ListView.builder(
|
||||
itemCount: shipmentRateModel.rates.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _row(
|
||||
shipmentRateModel.rates[index].description,
|
||||
"\$ " +
|
||||
shipmentRateModel.rates[index].price.toString(),
|
||||
'per pound');
|
||||
}),
|
||||
child: Column(
|
||||
children: getCargoWidget(shipmentRateModel.rates),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: Colors.grey,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 10),
|
||||
child: Text(
|
||||
"Custom Duties",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 100,
|
||||
child: Column(
|
||||
children: getCustonWidget(shipmentRateModel.customs),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: Colors.grey,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 10),
|
||||
child: Text(
|
||||
"Discounts by weight",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 100,
|
||||
child: Column(
|
||||
children:
|
||||
getDiscountWidget(shipmentRateModel.discountsByWeight),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: Colors.grey,
|
||||
),
|
||||
_row("Free delivery within Yangon \nfor shipments over", "10",
|
||||
"pounds"),
|
||||
_row("Delivery fees", "\$ 5", "below 10 pounds"),
|
||||
_row("Volumetric Ratio", "\$ 166.36", "per pound"),
|
||||
fcsButton(context, "Terms & Conditions", callack: () {
|
||||
Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (_) => Term()));
|
||||
}),
|
||||
_row("Volumetric Ratio", "166.36", "in3 per pound"),
|
||||
// fcsButton(context, "Terms & Conditions", callack: () {
|
||||
// Navigator.of(context)
|
||||
// .push(MaterialPageRoute(builder: (_) => Term()));
|
||||
// }),
|
||||
fcsButton(context, "Estimate shipping cost", callack: () {
|
||||
Navigator.of(context)
|
||||
.push(BottomUpPageRoute(ShipmentRatesCal()));
|
||||
@@ -126,6 +173,32 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> getCargoWidget(List<Rate> rates) {
|
||||
return rates.map((cargo) {
|
||||
return Container(
|
||||
child: _row(
|
||||
cargo.description, "\$ " + cargo.price.toString(), 'per pound'),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<Widget> getCustonWidget(List<Custom> customs) {
|
||||
return customs.map((c) {
|
||||
return Container(
|
||||
child: _row(c.productType, "\$ " + c.fee.toString(), ''),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<Widget> getDiscountWidget(List<Discount> discounts) {
|
||||
return discounts.map((d) {
|
||||
return Container(
|
||||
child: _row(
|
||||
"${d.weight.toString()} lb", "\$ " + d.discountRate.toString(), ''),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
_row(String desc, String price, String unit) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
|
||||
|
||||
Reference in New Issue
Block a user