update shipment rate

This commit is contained in:
Thinzar Win
2020-06-25 16:19:23 +06:30
parent fd63f30cb4
commit 869142ec66
18 changed files with 797 additions and 300 deletions

View File

@@ -1,7 +1,4 @@
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/vo/pickup.dart';
import 'package:provider/provider.dart';
import 'package:fcs/widget/localization/app_translations.dart';
@@ -10,7 +7,6 @@ import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import '../theme/theme.dart';
import 'util.dart';
class ShipmentRatesCal extends StatefulWidget {
final PickUp pickUp;
@@ -31,6 +27,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
PickUp _pickUp;
bool _isLoading = false;
String cargoType;
@override
void initState() {
@@ -53,6 +50,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
@override
Widget build(BuildContext context) {
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
@@ -70,33 +68,74 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
height: 185,
child: ListView.builder(
itemCount: shipmentRateModel.rates.length,
itemBuilder: (context, index) {
return _row(
shipmentRateModel.rates[index].description +
"\n\$ " +
shipmentRateModel.rates[index].price.toString() +
" per pound",
'',
"",
input: true);
}),
padding: EdgeInsets.only(top: 5, left: 25),
child: Row(
children: <Widget>[
Expanded(
child:
Text('Cargo Type', style: TextStyle(fontSize: 15))),
Container(
width: 150.0,
child: DropdownButtonFormField(
decoration: InputDecoration(
fillColor: Colors.white,
hintText: shipmentRateModel.rates[0].description,
hintStyle: TextStyle(color: Colors.black87)),
items: shipmentRateModel.rates
.map((e) => DropdownMenuItem(
child: Text(e.description),
value: e.description))
.toList(),
onChanged: (selected) => {
setState(() {
cargoType = selected;
})
},
),
),
],
),
),
_row('Width (inches)', "", "", "10", input: true),
_row('Height', "", "", "10", input: true),
_row('Length', "", "", "10", 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),
),
],
),
],
)),
SizedBox(height: 50),
Center(
child: Text(
"Delivery fee:\$ 0",
"Delivery fee:\$ 5",
style: TextStyle(color: primaryColor, fontSize: 16),
)),
SizedBox(height: 20),
Center(
child: Text(
"Total estimated amount:\$ 95",
"Total estimated amount:\$ 41",
style: TextStyle(color: primaryColor, fontSize: 20),
))
],
@@ -106,7 +145,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
);
}
_row(String desc, String price, String unit, {bool input}) {
_row(String desc, String price, String unit, String value, {bool input}) {
return Container(
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
child: Row(
@@ -134,8 +173,9 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
width: 50,
),
Container(
width: 70,
child: TextField(
width: 150,
child: TextFormField(
initialValue: value,
textAlign: TextAlign.end,
)),
],