2020-05-29 15:54:26 +06:30
|
|
|
import 'package:fcs/model/pickup_model.dart';
|
|
|
|
|
import 'package:fcs/model/shipment_rate_model.dart';
|
2020-05-31 15:00:11 +06:30
|
|
|
import 'package:fcs/pages/shipment_rates_calculate.dart';
|
|
|
|
|
import 'package:fcs/pages/shipment_rates_edit.dart';
|
2020-06-02 15:21:26 +06:30
|
|
|
import 'package:fcs/pages/term.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
import 'package:fcs/vo/pickup.dart';
|
2020-06-02 15:30:11 +06:30
|
|
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
|
|
|
|
|
|
import '../theme/theme.dart';
|
2020-05-31 15:00:11 +06:30
|
|
|
import 'util.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
|
|
|
|
|
class ShipmentRates extends StatefulWidget {
|
|
|
|
|
final PickUp pickUp;
|
|
|
|
|
ShipmentRates({this.pickUp});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_ShipmentRatesState createState() => _ShipmentRatesState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ShipmentRatesState extends State<ShipmentRates> {
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
@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);
|
|
|
|
|
|
|
|
|
|
final usaAddress = Container(
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
maxLines: null,
|
|
|
|
|
controller: _addressEditingController,
|
|
|
|
|
cursorColor: primaryColor,
|
|
|
|
|
style: textStyle,
|
|
|
|
|
decoration: new InputDecoration(
|
|
|
|
|
labelText: 'USA Delivery Address',
|
|
|
|
|
enabledBorder: UnderlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
|
|
|
focusedBorder: UnderlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
2020-05-31 15:00:11 +06:30
|
|
|
centerTitle: true,
|
|
|
|
|
leading: new IconButton(
|
|
|
|
|
icon: new Icon(
|
|
|
|
|
Icons.close,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
),
|
2020-05-29 15:54:26 +06:30
|
|
|
backgroundColor: primaryColor,
|
2020-05-31 15:00:11 +06:30
|
|
|
title: Text(AppTranslations.of(context).text("rate.title")),
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
body: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: ListView(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
2020-05-29 15:54:26 +06:30
|
|
|
children: <Widget>[
|
2020-05-31 15:00:11 +06:30
|
|
|
Container(
|
|
|
|
|
height: 135,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
itemCount: shipmentRateModel.rates.length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return _row(
|
|
|
|
|
shipmentRateModel.rates[index].description,
|
2020-06-02 15:30:11 +06:30
|
|
|
"\$ " +
|
|
|
|
|
shipmentRateModel.rates[index].price.toString(),
|
2020-05-31 15:00:11 +06:30
|
|
|
'per pound');
|
|
|
|
|
}),
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
2020-06-02 15:30:11 +06:30
|
|
|
_row("Free delivery within Yangon \nfor shipments over", "10",
|
|
|
|
|
"pounds"),
|
|
|
|
|
_row("Delivery fees", "\$ 5", "below 10 pounds"),
|
2020-06-25 16:19:23 +06:30
|
|
|
_row("Volumetric Ratio", "\$ 166.36", "per pound"),
|
2020-06-02 15:21:26 +06:30
|
|
|
fcsButton(context, "Terms & Conditions", callack: () {
|
2020-06-02 15:23:09 +06:30
|
|
|
Navigator.of(context)
|
|
|
|
|
.push(MaterialPageRoute(builder: (_) => Term()));
|
2020-06-02 15:21:26 +06:30
|
|
|
}),
|
2020-06-04 01:36:49 +06:30
|
|
|
fcsButton(context, "Estimate shipping cost", callack: () {
|
2020-06-02 15:30:11 +06:30
|
|
|
Navigator.of(context)
|
|
|
|
|
.push(BottomUpPageRoute(ShipmentRatesCal()));
|
2020-05-31 15:00:11 +06:30
|
|
|
}),
|
|
|
|
|
fcsButton(context, "Edit", callack: () {
|
2020-06-02 15:30:11 +06:30
|
|
|
Navigator.of(context)
|
|
|
|
|
.push(BottomUpPageRoute(ShipmentRatesEdit()));
|
2020-05-31 15:00:11 +06:30
|
|
|
}),
|
2020-06-02 15:30:11 +06:30
|
|
|
SizedBox(height: 10)
|
2020-05-29 15:54:26 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-05-31 15:00:11 +06:30
|
|
|
|
|
|
|
|
_row(String desc, String price, String unit) {
|
|
|
|
|
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>[
|
2020-06-02 15:30:11 +06:30
|
|
|
Padding(
|
2020-05-31 15:00:11 +06:30
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 50,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
}
|
2020-05-29 15:54:26 +06:30
|
|
|
}
|