update disount
This commit is contained in:
@@ -337,6 +337,7 @@
|
|||||||
"rate.cal.title":"Calculate Shipping Cost",
|
"rate.cal.title":"Calculate Shipping Cost",
|
||||||
"rate.min_weight":"Min weight for free delivery within yangon",
|
"rate.min_weight":"Min weight for free delivery within yangon",
|
||||||
"rate.delivery_fee":"Delivery fees",
|
"rate.delivery_fee":"Delivery fees",
|
||||||
|
"rate.total_estimated_amount":"Total estimated amount",
|
||||||
"rate.volumetric_ratio":"Volumetric ratio",
|
"rate.volumetric_ratio":"Volumetric ratio",
|
||||||
"rate.custom.form.title":"CUSTOM",
|
"rate.custom.form.title":"CUSTOM",
|
||||||
"rate.cutom.product_type":"Product type",
|
"rate.cutom.product_type":"Product type",
|
||||||
@@ -345,6 +346,7 @@
|
|||||||
"rate.discount.rate":"Discount rate",
|
"rate.discount.rate":"Discount rate",
|
||||||
"rate.custom_duty.title":"Custom Duties",
|
"rate.custom_duty.title":"Custom Duties",
|
||||||
"rate.custom_duty":"Custom Duty",
|
"rate.custom_duty":"Custom Duty",
|
||||||
|
"rate.cargo.type":"Cargo Types",
|
||||||
"rate.discount_by_weight":"Discounts by weight",
|
"rate.discount_by_weight":"Discounts by weight",
|
||||||
"rate.discount_by_weight.edit.delete.confirm":"Delete this discount by weight?",
|
"rate.discount_by_weight.edit.delete.confirm":"Delete this discount by weight?",
|
||||||
"rate.custom.edit.delete.confirm":"Delete this custom duty?",
|
"rate.custom.edit.delete.confirm":"Delete this custom duty?",
|
||||||
@@ -361,9 +363,9 @@
|
|||||||
|
|
||||||
"Invoices Start ================================================================":"",
|
"Invoices Start ================================================================":"",
|
||||||
"invoices.btn": "Invoices",
|
"invoices.btn": "Invoices",
|
||||||
"invoices.title": "INVOICES",
|
"invoices.title": "Invoices",
|
||||||
"invoices.add":"New invoice",
|
"invoices.add":"New invoice",
|
||||||
"invoice.form.title":"INVOICE",
|
"invoice.form.title":"Invoice",
|
||||||
"invoice.payment":"Payment receipt",
|
"invoice.payment":"Payment receipt",
|
||||||
"invoice.add_box":"Add carton",
|
"invoice.add_box":"Add carton",
|
||||||
"invoice.add_package":"Add package",
|
"invoice.add_package":"Add package",
|
||||||
@@ -412,6 +414,7 @@
|
|||||||
"discount.name":"Customer name",
|
"discount.name":"Customer name",
|
||||||
"discount.amount":"Amount",
|
"discount.amount":"Amount",
|
||||||
"discount.status":"Status",
|
"discount.status":"Status",
|
||||||
|
"discount.edit.delete.confirm":"Delete this discount?",
|
||||||
"Discount End ================================================================":"",
|
"Discount End ================================================================":"",
|
||||||
|
|
||||||
"delivery_addresses Start ================================================================":"",
|
"delivery_addresses Start ================================================================":"",
|
||||||
|
|||||||
@@ -336,16 +336,18 @@
|
|||||||
"rate.edit.title":"စျေးနှုန်းများပြုပြင်ရန်",
|
"rate.edit.title":"စျေးနှုန်းများပြုပြင်ရန်",
|
||||||
"rate.cal.title":"စျေးနှုန်းများတွက်ချက်ရန်",
|
"rate.cal.title":"စျေးနှုန်းများတွက်ချက်ရန်",
|
||||||
"rate.min_weight":"Min Weight for Free delivery within Yangon",
|
"rate.min_weight":"Min Weight for Free delivery within Yangon",
|
||||||
"rate.delivery_fee":"Delivery fees",
|
"rate.delivery_fee":"ပို့ဆောင်ခ",
|
||||||
|
"rate.total_estimated_amount":"စုစုပေါင်းခန့်မှန်းပမာဏ",
|
||||||
"rate.volumetric_ratio":"Volumetric Ratio",
|
"rate.volumetric_ratio":"Volumetric Ratio",
|
||||||
"rate.custom.form.title":"အကောက်ခွန်",
|
"rate.custom.form.title":"အကောက်ခွန်",
|
||||||
"rate.cutom.product_type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
"rate.cutom.product_type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||||
"rate.custom.fee":"အခကြေးငွေ",
|
"rate.custom.fee":"အခကြေးငွေ",
|
||||||
"rate.discount.weight":"အလေးချိန်",
|
"rate.discount.weight":"အလေးချိန်",
|
||||||
"rate.discount.rate":"လျှော့စျေးနှုန်း",
|
"rate.discount.rate":"လျှော့စျေးနှုန်း",
|
||||||
"rate.custom_duty.title":"Custom Duties",
|
"rate.custom_duty.title":"အကောက်ခွန်များ",
|
||||||
"rate.custom_duty":"Custom Duty",
|
"rate.custom_duty":"အကောက်ခွန်",
|
||||||
"rate.discount_by_weight":"Discounts by weight",
|
"rate.cargo.type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||||
|
"rate.discount_by_weight":"အထူးလျှော့စျေး",
|
||||||
"rate.discount_by_weight.edit.delete.confirm":"Delete this discount by weight?",
|
"rate.discount_by_weight.edit.delete.confirm":"Delete this discount by weight?",
|
||||||
"rate.custom.edit.delete.confirm":"Delete this custom duty?",
|
"rate.custom.edit.delete.confirm":"Delete this custom duty?",
|
||||||
"Rate End ================================================================":"",
|
"Rate End ================================================================":"",
|
||||||
@@ -411,6 +413,7 @@
|
|||||||
"discount.name":"ဝယ်ယူသူအမည်",
|
"discount.name":"ဝယ်ယူသူအမည်",
|
||||||
"discount.amount":"ပမာဏ",
|
"discount.amount":"ပမာဏ",
|
||||||
"discount.status":"အခြေအနေ",
|
"discount.status":"အခြေအနေ",
|
||||||
|
"discount.edit.delete.confirm":"Delete this discount?",
|
||||||
"Discount End ================================================================":"",
|
"Discount End ================================================================":"",
|
||||||
|
|
||||||
"delivery_addresses Start ================================================================":"",
|
"delivery_addresses Start ================================================================":"",
|
||||||
|
|||||||
@@ -6,16 +6,6 @@ class Discount {
|
|||||||
String status;
|
String status;
|
||||||
double amount;
|
double amount;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
Discount(
|
|
||||||
{this.id,
|
|
||||||
this.code,
|
|
||||||
this.customer,
|
|
||||||
this.amount,
|
|
||||||
this.status,
|
|
||||||
this.weight,
|
|
||||||
this.discountRate});
|
|
||||||
=======
|
|
||||||
Discount({
|
Discount({
|
||||||
this.id,
|
this.id,
|
||||||
this.code,
|
this.code,
|
||||||
@@ -45,5 +35,4 @@ class Discount {
|
|||||||
status: map['status'],
|
status: map['status'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
>>>>>>> upstream/master
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import 'package:fcs/domain/entities/discount.dart';
|
import 'package:fcs/domain/entities/discount.dart';
|
||||||
|
import 'package:fcs/domain/entities/user.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/pages/discount/model/discount_model.dart';
|
import 'package:fcs/pages/discount/model/discount_model.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.dart';
|
||||||
import 'package:fcs/pages/rates/model/shipment_rate_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/display_text.dart';
|
import 'package:fcs/pages/widgets/display_text.dart';
|
||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
@@ -27,9 +29,10 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
TextEditingController _codeController = new TextEditingController();
|
TextEditingController _codeController = new TextEditingController();
|
||||||
TextEditingController _amountController = new TextEditingController();
|
TextEditingController _amountController = new TextEditingController();
|
||||||
TextEditingController _statusController = new TextEditingController();
|
TextEditingController _statusController = new TextEditingController();
|
||||||
TextEditingController _customerController = new TextEditingController();
|
|
||||||
|
|
||||||
bool _isNew = false;
|
bool _isNew = false;
|
||||||
|
String customerName = '';
|
||||||
|
String customerId = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -39,10 +42,10 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
_codeController.text = _discount.code;
|
_codeController.text = _discount.code;
|
||||||
_amountController.text = _discount.amount.toString();
|
_amountController.text = _discount.amount.toString();
|
||||||
_statusController.text = _discount.status;
|
_statusController.text = _discount.status;
|
||||||
_customerController.text = 'Ko Nyi';
|
customerName = widget.discount.customerName;
|
||||||
|
customerId = widget.discount.customerId;
|
||||||
} else {
|
} else {
|
||||||
_isNew = true;
|
_isNew = true;
|
||||||
_customerController.text = '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +56,6 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
iconData: FontAwesomeIcons.algolia,
|
iconData: FontAwesomeIcons.algolia,
|
||||||
controller: _codeController);
|
controller: _codeController);
|
||||||
|
|
||||||
final nameBox = InputText(
|
|
||||||
labelTextKey: 'discount.name',
|
|
||||||
iconData: Feather.user,
|
|
||||||
controller: _customerController);
|
|
||||||
|
|
||||||
final amountBox = InputText(
|
final amountBox = InputText(
|
||||||
labelTextKey: 'discount.amount',
|
labelTextKey: 'discount.amount',
|
||||||
iconData: FontAwesomeIcons.moneyBill,
|
iconData: FontAwesomeIcons.moneyBill,
|
||||||
@@ -69,6 +67,25 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
iconData: Icons.av_timer,
|
iconData: Icons.av_timer,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final customerBox = Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: DisplayText(
|
||||||
|
text: customerName != null ? customerName : "",
|
||||||
|
labelTextKey: "discount.name",
|
||||||
|
iconData: Feather.user,
|
||||||
|
)),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.search, color: primaryColor),
|
||||||
|
onPressed: () => searchUser(context, callbackUserSelect: (u) {
|
||||||
|
setState(() {
|
||||||
|
customerId = u.id;
|
||||||
|
customerName = u.name;
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -98,8 +115,10 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
codeBox,
|
codeBox,
|
||||||
nameBox,
|
|
||||||
amountBox,
|
amountBox,
|
||||||
|
SizedBox(height: 7),
|
||||||
|
customerBox,
|
||||||
|
SizedBox(height: 7),
|
||||||
widget.discount == null
|
widget.discount == null
|
||||||
? Container()
|
? Container()
|
||||||
: Container(
|
: Container(
|
||||||
@@ -129,7 +148,8 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
Provider.of<DiscountModel>(context, listen: false);
|
Provider.of<DiscountModel>(context, listen: false);
|
||||||
Discount _discount = Discount(
|
Discount _discount = Discount(
|
||||||
code: _codeController.text,
|
code: _codeController.text,
|
||||||
customer: _customerController.text,
|
customerName: customerName,
|
||||||
|
customerId: customerId,
|
||||||
amount: double.parse(_amountController.text));
|
amount: double.parse(_amountController.text));
|
||||||
if (_isNew) {
|
if (_isNew) {
|
||||||
await discountModel.addDiscount(_discount);
|
await discountModel.addDiscount(_discount);
|
||||||
@@ -149,7 +169,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
|
|
||||||
_delete() {
|
_delete() {
|
||||||
showConfirmDialog(
|
showConfirmDialog(
|
||||||
context, "cargo_type.edit.delete.confirm", _deleteCargoType);
|
context, "discount.edit.delete.confirm", _deleteCargoType);
|
||||||
}
|
}
|
||||||
|
|
||||||
_deleteCargoType() async {
|
_deleteCargoType() async {
|
||||||
@@ -158,7 +178,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
var discountModel = Provider.of<DiscountModel>(context, listen: false);
|
var discountModel = Provider.of<DiscountModel>(context, listen: false);
|
||||||
await discountModel.deleteCargoType(widget.discount.id);
|
await discountModel.deleteDiscount(widget.discount);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showMsgDialog(context, "Error", e.toString());
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:fcs/helpers/theme.dart';
|
|||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/pages/discount/model/discount_model.dart';
|
import 'package:fcs/pages/discount/model/discount_model.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
import 'package:fcs/pages/main/util.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -138,7 +139,11 @@ class _DiscountListState extends State<DiscountList> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
icon: Icon(Icons.add),
|
icon: Icon(Icons.add),
|
||||||
label: Text(AppTranslations.of(context).text("discount.new")),
|
label: LocalText(
|
||||||
|
context,
|
||||||
|
'discount.new',
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
import 'dart:ffi';
|
|
||||||
|
|
||||||
=======
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
>>>>>>> upstream/master
|
|
||||||
import 'package:fcs/data/services/services.dart';
|
import 'package:fcs/data/services/services.dart';
|
||||||
import 'package:fcs/domain/entities/discount.dart';
|
import 'package:fcs/domain/entities/discount.dart';
|
||||||
import 'package:fcs/pages/main/model/base_model.dart';
|
import 'package:fcs/pages/main/model/base_model.dart';
|
||||||
@@ -16,11 +11,8 @@ class DiscountModel extends BaseModel {
|
|||||||
|
|
||||||
StreamSubscription<QuerySnapshot> listener;
|
StreamSubscription<QuerySnapshot> listener;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
List<Discount> discounts = [];
|
List<Discount> discounts = [];
|
||||||
|
|
||||||
>>>>>>> upstream/master
|
|
||||||
void initUser(user) {
|
void initUser(user) {
|
||||||
super.initUser(user);
|
super.initUser(user);
|
||||||
_load();
|
_load();
|
||||||
@@ -61,10 +53,4 @@ class DiscountModel extends BaseModel {
|
|||||||
Future<void> deleteDiscount(Discount discount) async {
|
Future<void> deleteDiscount(Discount discount) async {
|
||||||
return Services.instance.commonService.deleteDiscount(discount.id);
|
return Services.instance.commonService.deleteDiscount(discount.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addDiscount(Discount discount) {}
|
|
||||||
|
|
||||||
Future<void> updateDiscount(Discount discount) {}
|
|
||||||
|
|
||||||
Future<void> deleteCargoType(String id) {}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,9 @@ class _PaymentPDFScreenState extends State<PaymentPDFScreen>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
print(' widget.path => ${widget.path}');
|
|
||||||
print(' pages => ${pages}');
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
title: LocalText(context, 'invoice.pdf',
|
title: LocalText(context, 'invoice.pdf',
|
||||||
color: Colors.white, fontSize: 20),
|
color: Colors.white, fontSize: 20),
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
|||||||
child: ListView(
|
child: ListView(
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
fcsButton(context, "Calculate shipping cost", callack: () {
|
fcsButton(context, getLocalString(context, "rate.cal.title"), callack: () {
|
||||||
Navigator.of(context).push(CupertinoPageRoute(
|
Navigator.of(context).push(CupertinoPageRoute(
|
||||||
builder: (context) => ShipmentRatesCal()));
|
builder: (context) => ShipmentRatesCal()));
|
||||||
}),
|
}),
|
||||||
@@ -88,13 +88,10 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
|||||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
LocalText(context, "rate.cargo.type",
|
||||||
"Cargo Types",
|
color: primaryColor,
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
color: primaryColor,
|
fontSize: 15),
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 15),
|
|
||||||
),
|
|
||||||
Spacer(),
|
Spacer(),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.edit, color: primaryColor),
|
icon: Icon(Icons.edit, color: primaryColor),
|
||||||
@@ -115,13 +112,10 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
|||||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
LocalText(context, "rate.discount_by_weight",
|
||||||
"Discounts by weight",
|
color: primaryColor,
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
color: primaryColor,
|
fontSize: 15),
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 15),
|
|
||||||
),
|
|
||||||
Spacer(),
|
Spacer(),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.edit, color: primaryColor),
|
icon: Icon(Icons.edit, color: primaryColor),
|
||||||
@@ -152,13 +146,10 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
|||||||
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
padding: EdgeInsets.only(left: 25, top: 10, right: 25),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
LocalText(context, "rate.custom_duty",
|
||||||
"Custom Duties",
|
color: primaryColor,
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
color: primaryColor,
|
fontSize: 15),
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 15),
|
|
||||||
),
|
|
||||||
Spacer(),
|
Spacer(),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.edit, color: primaryColor),
|
icon: Icon(Icons.edit, color: primaryColor),
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/localization/app_translations.dart';
|
import 'package:fcs/localization/app_translations.dart';
|
||||||
import 'package:fcs/pages/rates/model/shipment_rate_model.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_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_title.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -18,10 +22,26 @@ class ShipmentRatesCal extends StatefulWidget {
|
|||||||
class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
String cargoType;
|
String cargoType;
|
||||||
|
TextEditingController _widthController = new TextEditingController();
|
||||||
|
TextEditingController _heightController = new TextEditingController();
|
||||||
|
TextEditingController _lengthController = new TextEditingController();
|
||||||
|
double shipmentWeight = 0;
|
||||||
|
double volumetricRatio = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.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
|
@override
|
||||||
@@ -33,6 +53,44 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var shipmentRateModel = Provider.of<ShipmentRateModel>(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(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -56,8 +114,8 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child:
|
child: LocalText(context, 'rate.cargo.type',
|
||||||
Text('Cargo Type', style: TextStyle(fontSize: 15))),
|
color: Colors.grey, fontSize: 15)),
|
||||||
Container(
|
Container(
|
||||||
width: 150.0,
|
width: 150.0,
|
||||||
child: DropdownButtonFormField(
|
child: DropdownButtonFormField(
|
||||||
@@ -79,46 +137,50 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_row('Width (inches)', "", "", "10", input: true),
|
// LocalTitle(textKey: "box.dimension"),
|
||||||
_row('Height (inches)', "", "", "10", input: true),
|
dimBox,
|
||||||
_row('Length (inches)', "", "", "10", input: true),
|
shipmentWeightBox,
|
||||||
_row('Actual Weight (pounds)', "", "", "0", input: true),
|
actualWeightBox,
|
||||||
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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
SizedBox(height: 50),
|
SizedBox(height: 50),
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Container(
|
||||||
"Delivery fee:\$ 5",
|
alignment: Alignment.center,
|
||||||
style: TextStyle(color: primaryColor, fontSize: 16),
|
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),
|
SizedBox(height: 20),
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Container(
|
||||||
"Total estimated amount:\$ 41",
|
width: 220,
|
||||||
style: TextStyle(color: primaryColor, fontSize: 20),
|
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),
|
deliveryFee: double.parse(_deliveryFee.text),
|
||||||
freeDeliveryWeight: double.parse(_minWeight.text),
|
freeDeliveryWeight: double.parse(_minWeight.text),
|
||||||
volumetricRatio: double.parse(_volumetricRatio.text));
|
volumetricRatio: double.parse(_volumetricRatio.text));
|
||||||
|
|
||||||
await shipmentRateModel.updateRate(_rate);
|
await shipmentRateModel.updateRate(_rate);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user