update box
This commit is contained in:
@@ -234,6 +234,26 @@
|
||||
"box.length":"Length",
|
||||
"box.width":"Width",
|
||||
"box.height":"Height",
|
||||
"box.shipment_info":"Shipment Information",
|
||||
"box.cargo_type":"Cargo Types",
|
||||
"box.dimension":"Box Dimension",
|
||||
"box.delivery_address":"Delivery Address",
|
||||
"box.fcs_shipment_num":"FCS Shipment Number",
|
||||
"box.fcs.id":"FCS ID",
|
||||
"box.name":"Customer Name",
|
||||
"box.phone":"Phone Number",
|
||||
"box.actual_weight":"Actual Weight",
|
||||
"box.add_cargo":"Add Cargo",
|
||||
"box.shipment_weight":"Shipment Weight",
|
||||
"box.change_address":"Change\nAddress",
|
||||
"box.status":"Status",
|
||||
"box.create.btn":"Create New Box",
|
||||
"box.complete.btn":"Complete packing",
|
||||
"box.deliver.btn":"Deliver",
|
||||
"box.packages":"Packages",
|
||||
"box.tracking.id":"Tracking ID",
|
||||
"box.market":"Market",
|
||||
"box.cargo.save.btn":"Save",
|
||||
"Boxes End ================================================================":"",
|
||||
|
||||
"Delivery Start ================================================================":"",
|
||||
@@ -293,7 +313,7 @@
|
||||
"Rate End ================================================================":"",
|
||||
|
||||
"Cargo Start ================================================================":"",
|
||||
"cargo.form.title":"CARGO",
|
||||
"cargo.form.title":"Cargo",
|
||||
"cargo.type":"Cargo Type",
|
||||
"cargo.weight":"Weight",
|
||||
"cargo.rate":"Rate",
|
||||
|
||||
@@ -222,18 +222,38 @@
|
||||
"Message End ================================================================":"",
|
||||
|
||||
"Boxes Start ================================================================":"",
|
||||
"boxes.name":"Boxes",
|
||||
"boxes.name":"သေတ္တာများ",
|
||||
"boxes.title":"Boxes",
|
||||
"boxes.new":"New Box",
|
||||
"box.edit.title":"Edit Box",
|
||||
"boxes.new":"သေတ္တာအသစ်",
|
||||
"box.edit.title":"သေတ္တာ ပြင်ဆင်ခြင်း",
|
||||
"box.package.id":"Package ID",
|
||||
"box.package.desc":"Description",
|
||||
"box.package.market":"Market",
|
||||
"box.add_package":"Add Package",
|
||||
"box.number":"Box Number",
|
||||
"box.length":"Length",
|
||||
"box.width":"Width",
|
||||
"box.height":"Height",
|
||||
"box.length":"အရှည်",
|
||||
"box.width":"အကျယ်",
|
||||
"box.height":"အမြင့်",
|
||||
"box.shipment_info":"တင်ပို့သတင်းအချက်အလက်",
|
||||
"box.cargo_type":"ကုန်ပစ္စည်းအမျိုးအစားများ",
|
||||
"box.dimension":"သေတ္တာအရွယ်အစား",
|
||||
"box.delivery_address":"ပို့ဆောင်ရမည့်လိပ်စာ",
|
||||
"box.fcs_shipment_num":"FCS တင်ပို့နံပါတ်",
|
||||
"box.fcs.id":"FCS ID",
|
||||
"box.name":"နာမည်",
|
||||
"box.phone":"ဖုန်းနံပါတ်",
|
||||
"box.actual_weight":"အမှန်အလေးချိန်",
|
||||
"box.add_cargo":"ကုန်ပစ္စည်း\nထည့်ရန်",
|
||||
"box.shipment_weight":"တင်ပို့အလေးချိန်",
|
||||
"box.change_address":"လိပ်စာ\nပြောင်းရန်",
|
||||
"box.status":"အခြေအနေ",
|
||||
"box.create.btn":"သေတ္တာအသစ်ပြုလုပ်မည်",
|
||||
"box.complete.btn":"ထုပ်ပိုးခြင်းပြီးဆုံးမည်",
|
||||
"box.deliver.btn":"ပေးပို့မည်",
|
||||
"box.packages":"အထုပ်များ",
|
||||
"box.tracking.id":"Tracking ID",
|
||||
"box.market":"အွန်လိုင်စျေးဆိုင်",
|
||||
"box.cargo.save.btn":"သိမ်းဆည်းမည်",
|
||||
"Boxes End ================================================================":"",
|
||||
|
||||
"Delivery Start ================================================================":"",
|
||||
@@ -293,7 +313,7 @@
|
||||
"Rate End ================================================================":"",
|
||||
|
||||
"Cargo Start ================================================================":"",
|
||||
"cargo.form.title":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||
"cargo.form.title":"ကုန်ပစ္စည်း",
|
||||
"cargo.type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||
"cargo.weight":"အလေးချိန်",
|
||||
"cargo.rate":"စျေးနှုန်း",
|
||||
|
||||
@@ -25,6 +25,7 @@ class Package {
|
||||
String boxNumber;
|
||||
String cargoDesc;
|
||||
String market;
|
||||
bool isChecked;
|
||||
|
||||
int rate;
|
||||
int weight;
|
||||
@@ -40,8 +41,8 @@ class Package {
|
||||
shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
|
||||
double get price => rate.toDouble() * weight;
|
||||
|
||||
Package({
|
||||
this.id,
|
||||
Package(
|
||||
{this.id,
|
||||
this.trackingID,
|
||||
this.userID,
|
||||
this.userName,
|
||||
@@ -69,7 +70,7 @@ class Package {
|
||||
this.currentStatusDate,
|
||||
this.photoUrls,
|
||||
this.desc,
|
||||
});
|
||||
this.isChecked =false});
|
||||
|
||||
factory Package.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var _currentStatusDate = (map['current_status_date'] as Timestamp);
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
import 'package:fcs/domain/entities/box.dart';
|
||||
import 'package:fcs/domain/entities/cargo.dart';
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_list.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_row.dart';
|
||||
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/package/model/package_model.dart';
|
||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/my_data_table.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
@@ -19,6 +26,8 @@ import 'package:provider/provider.dart';
|
||||
import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
import 'cargo_type_editor.dart';
|
||||
|
||||
class BoxEditor extends StatefulWidget {
|
||||
final Box box;
|
||||
BoxEditor({this.box});
|
||||
@@ -28,53 +37,54 @@ class BoxEditor extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _BoxEditorState extends State<BoxEditor> {
|
||||
TextEditingController _addressEditingController = new TextEditingController();
|
||||
TextEditingController _fromTimeEditingController =
|
||||
new TextEditingController();
|
||||
TextEditingController _toTimeEditingController = new TextEditingController();
|
||||
TextEditingController _noOfPackageEditingController =
|
||||
new TextEditingController();
|
||||
TextEditingController _weightEditingController = new TextEditingController();
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
TextEditingController _heightController = new TextEditingController();
|
||||
TextEditingController _lengthController = new TextEditingController();
|
||||
|
||||
Box _box;
|
||||
bool _isLoading = false;
|
||||
List<String> _images = [
|
||||
"assets/photos/1.jpg",
|
||||
"assets/photos/2.jpg",
|
||||
"assets/photos/3.jpg"
|
||||
];
|
||||
bool isNew;
|
||||
bool isMixBox = false;
|
||||
DeliveryAddress _shippingAddress = new DeliveryAddress();
|
||||
DeliveryAddress _deliveryAddress = new DeliveryAddress();
|
||||
User user;
|
||||
String selectShipmentNumber;
|
||||
List<Package> _packages = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
var packageModel = Provider.of<PackageModel>(context, listen: false);
|
||||
_packages = [
|
||||
packageModel.packages[0],
|
||||
packageModel.packages[1],
|
||||
packageModel.packages[2],
|
||||
packageModel.packages[8]
|
||||
];
|
||||
_packages.forEach((p) {
|
||||
p.isChecked = false;
|
||||
});
|
||||
if (widget.box != null) {
|
||||
_box = widget.box;
|
||||
_shippingAddress = _box.shippingAddress;
|
||||
_deliveryAddress = _box.shippingAddress;
|
||||
isNew = false;
|
||||
// _addressEditingController.text = _pickUp.address;
|
||||
// _fromTimeEditingController.text = _pickUp.fromTime;
|
||||
// _toTimeEditingController.text = _pickUp.toTime;
|
||||
// _noOfPackageEditingController.text = _pickUp.numberOfPackage.toString();
|
||||
// _weightEditingController.text = _pickUp.weight.toString();
|
||||
selectShipmentNumber = _box.shipmentNumber;
|
||||
_widthController.text = _box.width.toString();
|
||||
_heightController.text = _box.height.toString();
|
||||
_lengthController.text = _box.length.toString();
|
||||
} else {
|
||||
List<Package> packages = [
|
||||
// PackageModel.packages[0],
|
||||
// PackageModel.packages[1],
|
||||
// PackageModel.packages[2]
|
||||
];
|
||||
|
||||
List<Cargo> _cargoTypes = [
|
||||
Cargo(type: 'General Cargo', weight: 25),
|
||||
Cargo(type: 'Medicine', weight: 20),
|
||||
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||
];
|
||||
|
||||
var shipmentModel =
|
||||
Provider.of<DeliveryAddressModel>(context, listen: false);
|
||||
_shippingAddress = shipmentModel.deliveryAddresses[1];
|
||||
_deliveryAddress = DeliveryAddress(
|
||||
fullName: 'U Nyi Nyi',
|
||||
addressLine1: '154-19 64th Ave.',
|
||||
addressLine2: 'Flushing',
|
||||
city: 'NY',
|
||||
state: 'NY',
|
||||
phoneNumber: '+1 (292)215-2247');
|
||||
|
||||
isNew = true;
|
||||
_box = Box(
|
||||
@@ -83,7 +93,6 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
width: 0,
|
||||
height: 0,
|
||||
length: 0,
|
||||
packages: packages,
|
||||
cargoTypes: _cargoTypes,
|
||||
shipmentWeight: 0);
|
||||
}
|
||||
@@ -136,57 +145,41 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var mainModel = Provider.of<MainModel>(context);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("box.edit.title")),
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
widget.box == null
|
||||
? Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8), child: Text("New Box")))
|
||||
: Center(child: nameWidget(_box.packageNumber)),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Shipment Information',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
|
||||
var shipmentBox = Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0),
|
||||
child: DropdownButtonFormField(
|
||||
value: _box.shipmentNumber,
|
||||
value: selectShipmentNumber,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'FCS Shipment Number',
|
||||
icon: Icon(Ionicons.ios_airplane,
|
||||
color: primaryColor)
|
||||
// prefixIcon: Icon(Icons.play_arrow)
|
||||
),
|
||||
labelText:
|
||||
AppTranslations.of(context).text("box.fcs_shipment_num"),
|
||||
labelStyle: languageModel.isEng
|
||||
? TextStyle(fontWeight: FontWeight.w500)
|
||||
: TextStyle(
|
||||
fontWeight: FontWeight.w500, fontFamily: "Myanmar3"),
|
||||
icon: Icon(
|
||||
Ionicons.ios_airplane,
|
||||
color: primaryColor,
|
||||
)),
|
||||
items: ["A102", "A103", "A201", "A202"]
|
||||
.map((e) =>
|
||||
DropdownMenuItem(child: Text(e), value: e))
|
||||
.map((e) => DropdownMenuItem(
|
||||
child: Text(
|
||||
e,
|
||||
style: TextStyle(color: primaryColor),
|
||||
),
|
||||
value: e))
|
||||
.toList(),
|
||||
onChanged: (map) => {},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 20),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
selectShipmentNumber = value;
|
||||
});
|
||||
},
|
||||
)));
|
||||
|
||||
final mixBox = Container(
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Checkbox(
|
||||
@@ -211,216 +204,375 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
final fcsIDBox = Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
text: user != null ? user.fcsID : "",
|
||||
labelTextKey: "box.fcs.id",
|
||||
icon: FcsIDIcon(),
|
||||
)),
|
||||
IconButton(
|
||||
icon: Icon(Icons.search, color: primaryColor),
|
||||
onPressed: () => searchUser(context, callbackUserSelect: (u) {
|
||||
setState(() {
|
||||
this.user = u;
|
||||
});
|
||||
})),
|
||||
],
|
||||
));
|
||||
|
||||
final phoneNumberBox = Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: DisplayText(
|
||||
text: user != null ? user.phoneNumber : "",
|
||||
labelTextKey: "box.phone",
|
||||
iconData: Icons.phone,
|
||||
));
|
||||
|
||||
final namebox = Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: DisplayText(
|
||||
text: user != null ? user.name : "",
|
||||
labelTextKey: "box.name",
|
||||
iconData: Icons.person,
|
||||
));
|
||||
|
||||
final packageTitle = Container(
|
||||
padding: EdgeInsets.only(right: 10.0, top: 20),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 50,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue:
|
||||
isNew ? "FCS-0203-390-2" : "FCS-0203-390-2",
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'FCS_ID',
|
||||
hintText: 'FCS_ID',
|
||||
filled: true,
|
||||
icon: Icon(Feather.user, color: primaryColor),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(Icons.search),
|
||||
onPressed: () {})),
|
||||
Expanded(
|
||||
child: LocalText(context, 'box.tracking.id', color: Colors.grey),
|
||||
),
|
||||
LocalText(context, 'box.market', color: Colors.grey),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
List<Widget> getPackageRowList() {
|
||||
return _packages.asMap().entries.map((p) {
|
||||
return Container(
|
||||
color: p.value.isChecked
|
||||
? Colors.grey.withOpacity(0.2)
|
||||
: Colors.grey[50].withOpacity(0.2),
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 0.0, right: 10.0, top: 3.0, bottom: 3.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: p.key == _packages.length - 1
|
||||
? Colors.white
|
||||
: Colors.grey[350],
|
||||
width: 1),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.receiverName,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Customer Name',
|
||||
filled: true,
|
||||
icon: Icon(Feather.user, color: Colors.white),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(Icons.search),
|
||||
onPressed: () {})),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Checkbox(
|
||||
value: p.value.isChecked,
|
||||
activeColor: primaryColor,
|
||||
onChanged: (bool check) {
|
||||
setState(() {
|
||||
p.value.isChecked = check;
|
||||
});
|
||||
}),
|
||||
Expanded(
|
||||
child: new Text(
|
||||
p.value.trackingID,
|
||||
style: textStyle,
|
||||
)),
|
||||
new Text(
|
||||
p.value.market == null ? "" : p.value.market,
|
||||
style: textStyle,
|
||||
)
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Cargo Types',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
// child: DropdownButtonFormField(
|
||||
// value: _box.packageType,
|
||||
// decoration: InputDecoration(
|
||||
// fillColor: Colors.white,
|
||||
// labelText: 'Cargo Type',
|
||||
// icon: Icon(Entypo.box, color: primaryColor)),
|
||||
// items: ["General", "Medicine", "Dangerous"]
|
||||
// .map((e) =>
|
||||
// DropdownMenuItem(child: Text(e), value: e))
|
||||
// .toList(),
|
||||
// onChanged: (map) => {},
|
||||
// ),
|
||||
// ),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.weight.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Actual Weight',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.weightHanging,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
// child: TextFormField(
|
||||
// initialValue: _box.rate.toString(),
|
||||
// textAlign: TextAlign.end,
|
||||
// decoration: InputDecoration(
|
||||
// fillColor: Colors.white,
|
||||
// labelText: 'Rate',
|
||||
// filled: true,
|
||||
// icon: Icon(FontAwesomeIcons.tag,
|
||||
// color: primaryColor),
|
||||
// )),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
// child: TextFormField(
|
||||
// initialValue: _box.amount.toString(),
|
||||
// textAlign: TextAlign.end,
|
||||
// decoration: InputDecoration(
|
||||
// fillColor: Colors.white,
|
||||
// labelText: 'Total Amount',
|
||||
// filled: true,
|
||||
// icon: Icon(FontAwesomeIcons.moneyBill,
|
||||
// color: primaryColor),
|
||||
// )),
|
||||
// ),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
headingRowHeight: 40,
|
||||
columnSpacing: 120,
|
||||
columns: [
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.type",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.weight",
|
||||
color: Colors.grey,
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
final actualWeightBox = Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: DisplayText(
|
||||
text: _box.weight != null ? _box.weight.toString() : "",
|
||||
labelTextKey: "box.actual_weight",
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
));
|
||||
|
||||
final cargoTitle = Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 0.0, top: 20),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: LocalText(context, 'cargo.type', color: Colors.grey),
|
||||
),
|
||||
LocalText(context, 'cargo.weight', color: Colors.grey),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
List<Widget> getCargoRowList() {
|
||||
return _box.cargoTypes.asMap().entries.map((c) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(CargoTypeEditor(cargo: c.value)),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.grey[50].withOpacity(0.2),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 15.0, right: 10.0, top: 15.0, bottom: 15.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.grey[350], width: 1),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Text(
|
||||
c.value.type,
|
||||
style: textStyle,
|
||||
)),
|
||||
new Text(
|
||||
c.value.weight == null ? "0" : c.value.weight.toString(),
|
||||
style: textStyle,
|
||||
)
|
||||
],
|
||||
rows: getCargoRows(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
true
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
final shipmentWeightBox = Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: DisplayText(
|
||||
text:
|
||||
_box.shipmentWeight != null ? _box.shipmentWeight.toString() : "",
|
||||
labelTextKey: "box.shipment_weight",
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
));
|
||||
|
||||
final widthBox = InputText(
|
||||
labelTextKey: 'box.width',
|
||||
iconData: FontAwesomeIcons.arrowCircleRight,
|
||||
controller: _widthController);
|
||||
|
||||
final heightBox = InputText(
|
||||
labelTextKey: 'box.height',
|
||||
iconData: FontAwesomeIcons.arrowAltCircleUp,
|
||||
controller: _heightController);
|
||||
|
||||
final lengthBox = InputText(
|
||||
labelTextKey: 'box.length',
|
||||
iconData: FontAwesomeIcons.arrowCircleUp,
|
||||
controller: _lengthController);
|
||||
|
||||
final createBtn = fcsButton(
|
||||
context,
|
||||
getLocalString(context, 'box.create.btn'),
|
||||
callack: () {},
|
||||
);
|
||||
|
||||
final completeBtn = fcsButton(
|
||||
context,
|
||||
getLocalString(context, 'box.complete.btn'),
|
||||
callack: () {},
|
||||
);
|
||||
|
||||
final deliveryBtn = fcsButton(
|
||||
context,
|
||||
getLocalString(context, 'box.deliver.btn'),
|
||||
callack: () {},
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close, color: primaryColor, size: 30),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
title: widget.box == null
|
||||
? LocalText(
|
||||
context,
|
||||
"boxes.new",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
)
|
||||
: LocalText(
|
||||
context,
|
||||
"box.edit.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(left: 12.0, right: 12),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
widget.box == null
|
||||
? Container()
|
||||
: Center(child: nameWidget(_box.packageNumber)),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"box.shipment_info",
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
shipmentBox,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
fcsIDBox,
|
||||
phoneNumberBox,
|
||||
namebox,
|
||||
mixBox,
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"box.packages",
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
packageTitle,
|
||||
Divider(
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
Column(
|
||||
children: getPackageRowList(),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"box.cargo_type",
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
actualWeightBox,
|
||||
cargoTitle,
|
||||
Divider(
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
Column(
|
||||
children: _box == null || _box.cargoTypes == null
|
||||
? []
|
||||
: getCargoRowList(),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 25),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: FloatingActionButton.extended(
|
||||
icon: Icon(Icons.add),
|
||||
label: Text("Add Cargo"),
|
||||
heroTag: "add cargo",
|
||||
label: LocalText(
|
||||
context,
|
||||
"box.add_cargo",
|
||||
color: Colors.white,
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
onPressed: () {
|
||||
// Navigator.of(context).push(
|
||||
// BottomUpPageRoute(PackageAddition()));
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(CargoTypeEditor()),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Box Dimension',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: fcsInputReadOnly(
|
||||
"Shipment Weight", FontAwesomeIcons.weightHanging,
|
||||
value: _box.shipmentWeight.toString()),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.width.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Width',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowCircleRight,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.height.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Height',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowAltCircleUp,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _box.length.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Length',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowCircleUp,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Shipping Address',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
Divider(),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"box.dimension",
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
DeliveryAddressRow(shippingAddress: _shippingAddress),
|
||||
shipmentWeightBox,
|
||||
widthBox,
|
||||
heightBox,
|
||||
lengthBox,
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"box.delivery_address",
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
DeliveryAddressRow(shippingAddress: _deliveryAddress),
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
||||
padding: EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Container(
|
||||
@@ -429,33 +581,46 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
child: FloatingActionButton.extended(
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
onPressed: () {},
|
||||
onPressed: () async {
|
||||
DeliveryAddress deliveryAddress =
|
||||
await Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(DeliveryAddressList(
|
||||
deliveryAddress: _deliveryAddress)),
|
||||
);
|
||||
setState(() {
|
||||
_deliveryAddress = deliveryAddress;
|
||||
});
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(
|
||||
'Select \nAddress',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
label: LocalText(context, "box.change_address",
|
||||
color: Colors.white),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
isNew
|
||||
? Container()
|
||||
: ExpansionTile(
|
||||
title: Text(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"box.status",
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 500,
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
height: 230,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: isNew
|
||||
? Container()
|
||||
: Timeline(
|
||||
@@ -463,60 +628,25 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
position: TimelinePosition.Left),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
isNew ? Container() : Divider(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
widget.box == null
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Create New Box'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
? createBtn
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Complete packing'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
completeBtn,
|
||||
widget.box.status == 'Arrived'
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Deliver'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
? deliveryBtn
|
||||
: Container(),
|
||||
],
|
||||
)),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -524,27 +654,6 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
);
|
||||
}
|
||||
|
||||
List<MyDataRow> getCargoRows(BuildContext context) {
|
||||
if (_box == null || _box.cargoTypes == null) {
|
||||
return [];
|
||||
}
|
||||
return _box.cargoTypes.map((c) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) {},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
c.type == null ? "" : c.type,
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(
|
||||
new Text(c.weight == null ? "0" : c.weight.toString(),
|
||||
style: textStyle),
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<Widget> getAddressList(
|
||||
BuildContext context, List<DeliveryAddress> addresses) {
|
||||
return addresses.asMap().entries.map((s) {
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/box/model/box_model.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -41,7 +42,8 @@ class _BoxListState extends State<BoxList> {
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("boxes.title")),
|
||||
title: LocalText(context, "boxes.name",
|
||||
color: Colors.white, fontSize: 20),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
|
||||
90
lib/pages/box/cargo_type_editor.dart
Normal file
90
lib/pages/box/cargo_type_editor.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
import 'package:fcs/domain/entities/cargo.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class CargoTypeEditor extends StatefulWidget {
|
||||
final Cargo cargo;
|
||||
CargoTypeEditor({this.cargo});
|
||||
|
||||
@override
|
||||
_CargoTypeEditorState createState() => _CargoTypeEditorState();
|
||||
}
|
||||
|
||||
class _CargoTypeEditorState extends State<CargoTypeEditor> {
|
||||
TextEditingController _typeController = new TextEditingController();
|
||||
TextEditingController _weightController = new TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
Cargo _cargo;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.cargo != null) {
|
||||
_cargo = widget.cargo;
|
||||
_typeController.text = _cargo.type;
|
||||
_weightController.text = _cargo.weight.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final typeBox = InputText(
|
||||
labelTextKey: 'cargo.type',
|
||||
iconData: Icons.text_format,
|
||||
controller: _typeController);
|
||||
final rateBox = InputText(
|
||||
labelTextKey: 'cargo.weight',
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
textInputType: TextInputType.number,
|
||||
controller: _weightController);
|
||||
|
||||
final saveBtn = fcsButton(
|
||||
context,
|
||||
getLocalString(context, 'box.cargo.save.btn'),
|
||||
callack: () {},
|
||||
);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close, color: primaryColor, size: 30),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
title: LocalText(
|
||||
context,
|
||||
"cargo.form.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
)),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
typeBox,
|
||||
rateBox,
|
||||
SizedBox(height: 40),
|
||||
saveBtn,
|
||||
SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user