update disount
This commit is contained in:
@@ -77,7 +77,7 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
child: ListView(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
fcsButton(context, "Calculate shipping cost", callack: () {
|
||||
fcsButton(context, getLocalString(context, "rate.cal.title"), callack: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => ShipmentRatesCal()));
|
||||
}),
|
||||
@@ -88,13 +88,10 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Cargo Types",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
LocalText(context, "rate.cargo.type",
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
@@ -115,13 +112,10 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Discounts by weight",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
LocalText(context, "rate.discount_by_weight",
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
@@ -152,13 +146,10 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Custom Duties",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
),
|
||||
LocalText(context, "rate.custom_duty",
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
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/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/length_picker.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_title.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -18,10 +22,26 @@ class ShipmentRatesCal extends StatefulWidget {
|
||||
class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
bool _isLoading = false;
|
||||
String cargoType;
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
TextEditingController _heightController = new TextEditingController();
|
||||
TextEditingController _lengthController = new TextEditingController();
|
||||
double shipmentWeight = 0;
|
||||
double volumetricRatio = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
//for shipment weight
|
||||
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
|
||||
.rate
|
||||
.volumetricRatio;
|
||||
// _lengthController.addListener(_calShipmentWeight);
|
||||
// _widthController.addListener(_calShipmentWeight);
|
||||
// _heightController.addListener(_calShipmentWeight);
|
||||
_lengthController.text = '10';
|
||||
_widthController.text = '10';
|
||||
_heightController.text = '10';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -33,6 +53,44 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
Widget build(BuildContext context) {
|
||||
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
||||
|
||||
final lengthBox = LengthPicker(
|
||||
controller: _lengthController,
|
||||
lableKey: "box.length",
|
||||
);
|
||||
final widthBox = LengthPicker(
|
||||
controller: _widthController,
|
||||
lableKey: "box.width",
|
||||
);
|
||||
final heightBox = LengthPicker(
|
||||
controller: _heightController,
|
||||
lableKey: "box.height",
|
||||
);
|
||||
|
||||
final dimBox = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(FontAwesome.arrow_circle_right, color: primaryColor),
|
||||
),
|
||||
SizedBox(child: lengthBox, width: 80),
|
||||
SizedBox(child: widthBox, width: 80),
|
||||
SizedBox(child: heightBox, width: 80),
|
||||
],
|
||||
);
|
||||
|
||||
final shipmentWeightBox = DisplayText(
|
||||
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(0) : "6",
|
||||
labelTextKey: "box.shipment_weight",
|
||||
iconData: MaterialCommunityIcons.weight,
|
||||
);
|
||||
|
||||
final actualWeightBox = DisplayText(
|
||||
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(0) : "",
|
||||
labelTextKey: "box.actual_weight",
|
||||
iconData: MaterialCommunityIcons.weight,
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -56,8 +114,8 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child:
|
||||
Text('Cargo Type', style: TextStyle(fontSize: 15))),
|
||||
child: LocalText(context, 'rate.cargo.type',
|
||||
color: Colors.grey, fontSize: 15)),
|
||||
Container(
|
||||
width: 150.0,
|
||||
child: DropdownButtonFormField(
|
||||
@@ -79,46 +137,50 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
],
|
||||
),
|
||||
),
|
||||
_row('Width (inches)', "", "", "10", input: true),
|
||||
_row('Height (inches)', "", "", "10", input: true),
|
||||
_row('Length (inches)', "", "", "10", input: true),
|
||||
_row('Actual Weight (pounds)', "", "", "0", input: true),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 15, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text('Shipment Weight', style: TextStyle(fontSize: 15)),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 3.0),
|
||||
child: Text(
|
||||
'6',
|
||||
style:
|
||||
TextStyle(color: primaryColor, fontSize: 16),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'pounds',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
// LocalTitle(textKey: "box.dimension"),
|
||||
dimBox,
|
||||
shipmentWeightBox,
|
||||
actualWeightBox,
|
||||
|
||||
SizedBox(height: 50),
|
||||
Center(
|
||||
child: Text(
|
||||
"Delivery fee:\$ 5",
|
||||
style: TextStyle(color: primaryColor, fontSize: 16),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 150,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
LocalText(context, "rate.delivery_fee",
|
||||
color: primaryColor, fontSize: 16),
|
||||
Text(
|
||||
':\$ 5',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(height: 20),
|
||||
Center(
|
||||
child: Text(
|
||||
"Total estimated amount:\$ 41",
|
||||
style: TextStyle(color: primaryColor, fontSize: 20),
|
||||
child: Container(
|
||||
width: 220,
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
LocalText(context, "rate.total_estimated_amount",
|
||||
color: primaryColor, fontSize: 16),
|
||||
Text(
|
||||
':\$ 41',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
|
||||
@@ -311,7 +311,6 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
deliveryFee: double.parse(_deliveryFee.text),
|
||||
freeDeliveryWeight: double.parse(_minWeight.text),
|
||||
volumetricRatio: double.parse(_volumetricRatio.text));
|
||||
|
||||
await shipmentRateModel.updateRate(_rate);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user