2020-05-31 15:00:11 +06:30
|
|
|
import 'package:fcs/model/shipment_rate_model.dart';
|
|
|
|
|
import 'package:fcs/vo/pickup.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
|
|
2020-09-04 15:30:10 +06:30
|
|
|
import '../fcs/common/helpers/theme.dart';
|
2020-05-31 15:00:11 +06:30
|
|
|
|
|
|
|
|
class ShipmentRatesCal extends StatefulWidget {
|
|
|
|
|
final PickUp pickUp;
|
|
|
|
|
ShipmentRatesCal({this.pickUp});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_ShipmentRatesCalState createState() => _ShipmentRatesCalState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
|
|
|
|
TextEditingController _addressEditingController = new TextEditingController();
|
|
|
|
|
TextEditingController _fromTimeEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _toTimeEditingController = new TextEditingController();
|
|
|
|
|
TextEditingController _noOfPackageEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _weightEditingController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
PickUp _pickUp;
|
|
|
|
|
bool _isLoading = false;
|
2020-06-25 16:19:23 +06:30
|
|
|
String cargoType;
|
2020-05-31 15:00:11 +06:30
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
if (widget.pickUp != null) {
|
|
|
|
|
_pickUp = widget.pickUp;
|
|
|
|
|
_addressEditingController.text = _pickUp.address;
|
|
|
|
|
_fromTimeEditingController.text = _pickUp.fromTime;
|
|
|
|
|
_toTimeEditingController.text = _pickUp.toTime;
|
|
|
|
|
_noOfPackageEditingController.text = _pickUp.numberOfPackage.toString();
|
|
|
|
|
_weightEditingController.text = _pickUp.weight.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
2020-06-25 16:19:23 +06:30
|
|
|
|
2020-05-31 15:00:11 +06:30
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
centerTitle: true,
|
2020-06-02 15:21:26 +06:30
|
|
|
leading: new IconButton(
|
|
|
|
|
icon: new Icon(
|
|
|
|
|
Icons.close,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
backgroundColor: primaryColor,
|
2020-06-02 15:21:26 +06:30
|
|
|
title: Text(AppTranslations.of(context).text("rate.cal.title")),
|
2020-05-31 15:00:11 +06:30
|
|
|
),
|
|
|
|
|
body: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
2020-06-25 16:19:23 +06:30
|
|
|
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;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
),
|
2020-06-25 16:19:23 +06:30
|
|
|
_row('Width (inches)', "", "", "10", input: true),
|
2020-07-02 16:16:21 +06:30
|
|
|
_row('Height (inches)', "", "", "10", input: true),
|
|
|
|
|
_row('Length (inches)', "", "", "10", input: true),
|
|
|
|
|
_row('Actual Weight (pounds)', "", "", "0", input: true),
|
2020-06-25 16:19:23 +06:30
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
2020-05-31 15:00:11 +06:30
|
|
|
SizedBox(height: 50),
|
2020-06-02 15:21:26 +06:30
|
|
|
Center(
|
|
|
|
|
child: Text(
|
2020-06-25 16:19:23 +06:30
|
|
|
"Delivery fee:\$ 5",
|
2020-06-02 15:21:26 +06:30
|
|
|
style: TextStyle(color: primaryColor, fontSize: 16),
|
|
|
|
|
)),
|
2020-05-31 15:00:11 +06:30
|
|
|
SizedBox(height: 20),
|
2020-06-02 15:21:26 +06:30
|
|
|
Center(
|
|
|
|
|
child: Text(
|
2020-06-25 16:19:23 +06:30
|
|
|
"Total estimated amount:\$ 41",
|
2020-06-02 15:21:26 +06:30
|
|
|
style: TextStyle(color: primaryColor, fontSize: 20),
|
|
|
|
|
))
|
2020-05-31 15:00:11 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-25 16:19:23 +06:30
|
|
|
_row(String desc, String price, String unit, String value, {bool input}) {
|
2020-05-31 15:00:11 +06:30
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text('$desc ', style: TextStyle(fontSize: 15)),
|
|
|
|
|
Spacer(),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 3.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
'$price',
|
|
|
|
|
style: TextStyle(color: primaryColor, fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'$unit',
|
|
|
|
|
style: TextStyle(color: Colors.grey, fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
// TextFormField(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 50,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
2020-07-02 16:16:21 +06:30
|
|
|
width: 50,
|
2020-06-25 16:19:23 +06:30
|
|
|
child: TextFormField(
|
|
|
|
|
initialValue: value,
|
2020-06-02 15:21:26 +06:30
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
)),
|
2020-05-31 15:00:11 +06:30
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|