add page of fcs
This commit is contained in:
305
lib/pages/shipment_rates.dart
Normal file
305
lib/pages/shipment_rates.dart
Normal file
@@ -0,0 +1,305 @@
|
||||
import 'package:fcs/model/pickup_model.dart';
|
||||
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';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
|
||||
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)),
|
||||
),
|
||||
));
|
||||
|
||||
final mmAddress = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('Yangon, Myanmar Office'),
|
||||
),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
controller: _noOfPackageEditingController,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(10.0),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey[300], width: 2),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: primaryColor, width: 2.0),
|
||||
),
|
||||
),
|
||||
)),
|
||||
]),
|
||||
);
|
||||
|
||||
final contactNumber = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('USA contact number'),
|
||||
),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
controller: _weightEditingController,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(10.0),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey[300], width: 2),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: primaryColor, width: 2.0),
|
||||
),
|
||||
),
|
||||
)),
|
||||
]),
|
||||
);
|
||||
|
||||
final mmContactNumber = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('Myanmar contact number'),
|
||||
),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
controller: _weightEditingController,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(10.0),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey[300], width: 2),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: primaryColor, width: 2.0),
|
||||
),
|
||||
),
|
||||
)),
|
||||
]),
|
||||
);
|
||||
|
||||
final mailBox = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('Email Address'),
|
||||
),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
controller: _weightEditingController,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(10.0),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey[300], width: 2),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: primaryColor, width: 2.0),
|
||||
),
|
||||
),
|
||||
)),
|
||||
]),
|
||||
);
|
||||
|
||||
final fbLinkBox = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('Facebook Link'),
|
||||
),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
controller: _weightEditingController,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(10.0),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey[300], width: 2),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: primaryColor, width: 2.0),
|
||||
),
|
||||
),
|
||||
)),
|
||||
]),
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("pickup.edit.title")),
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 250,
|
||||
// child: Image.asset(
|
||||
// 'assets/logo.jpg',
|
||||
// ),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Text('Rates',
|
||||
style:
|
||||
TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Text('Most affortable rate',
|
||||
style: TextStyle(fontSize: 14.0)),
|
||||
),
|
||||
Container(
|
||||
height: 100,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: ListView.builder(
|
||||
itemCount: shipmentRateModel.rates.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${shipmentRateModel.rates[index].description} - '),
|
||||
Text(
|
||||
'\$${shipmentRateModel.rates[index].price} per lb',
|
||||
style: TextStyle(color: Colors.blueAccent),
|
||||
)
|
||||
],
|
||||
));
|
||||
})),
|
||||
),
|
||||
widget.pickUp == null
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
shape: new RoundedRectangleBorder(
|
||||
borderRadius: new BorderRadius.circular(10)),
|
||||
child: Text('Calculate my packages'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
shape: new RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
new BorderRadius.circular(10)),
|
||||
child: Text('Pickuped'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
shape: new RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
new BorderRadius.circular(10)),
|
||||
child: Text('Cancel'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user