update localization
This commit is contained in:
@@ -50,7 +50,12 @@ const privilege_processing = "pr";
|
||||
const privilege_receiving = "rc";
|
||||
|
||||
// Pickup types
|
||||
const shipment_local_pickup = "Local Pickup";
|
||||
const shipment_courier_pickup = "Courier Pickup";
|
||||
const shipment_local_dropoff = "Local Drop-off";
|
||||
const shipment_courier_dropoff = "Courier Drop-off";
|
||||
const shipment_local_pickup = "Local pickup";
|
||||
const shipment_courier_pickup = "Courier pickup";
|
||||
const shipment_local_dropoff = "Local drop-off";
|
||||
const shipment_courier_dropoff = "Courier drop-off";
|
||||
|
||||
//Carton types
|
||||
const carton_from_packages = "From packages";
|
||||
const carton_from_shipments = "From shipments";
|
||||
const carton_mix_box = "Mix box";
|
||||
|
||||
@@ -19,7 +19,9 @@ import 'package:fcs/pages/widgets/delivery_address_selection.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_radio_buttons.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_title.dart';
|
||||
import 'package:fcs/pages/widgets/my_data_table.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:fcs/pages/widgets/title_with_add_button.dart';
|
||||
@@ -32,6 +34,7 @@ import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
import 'cargo_type_editor.dart';
|
||||
import 'model/box_model.dart';
|
||||
|
||||
class BoxEditor extends StatefulWidget {
|
||||
final Box box;
|
||||
@@ -52,7 +55,8 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
bool isMixBox = false;
|
||||
DeliveryAddress _deliveryAddress = new DeliveryAddress();
|
||||
User user;
|
||||
String selectShipmentNumber;
|
||||
String _selectShipmentNumber;
|
||||
String _selectedCartonType;
|
||||
List<Package> _packages = [];
|
||||
List<Cargo> _cargoTypes = [];
|
||||
double volumetricRatio = 0;
|
||||
@@ -79,7 +83,7 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
_box = widget.box;
|
||||
_deliveryAddress = _box.shippingAddress;
|
||||
_cargoTypes = _box.cargoTypes;
|
||||
selectShipmentNumber = _box.shipmentNumber;
|
||||
_selectShipmentNumber = _box.shipmentNumber;
|
||||
_widthController.text = _box.width.toString();
|
||||
_heightController.text = _box.height.toString();
|
||||
_lengthController.text = _box.length.toString();
|
||||
@@ -155,38 +159,35 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
var boxModel = Provider.of<BoxModel>(context);
|
||||
|
||||
var shipmentBox = Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, right: 10),
|
||||
child: DropdownButtonFormField(
|
||||
value: selectShipmentNumber,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
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,
|
||||
style: TextStyle(color: primaryColor),
|
||||
),
|
||||
value: e))
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
selectShipmentNumber = value;
|
||||
});
|
||||
},
|
||||
)));
|
||||
child: DropdownButtonFormField(
|
||||
value: _selectShipmentNumber,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
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,
|
||||
style: TextStyle(color: primaryColor),
|
||||
),
|
||||
value: e))
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectShipmentNumber = value;
|
||||
});
|
||||
},
|
||||
));
|
||||
|
||||
final mixBox = Container(
|
||||
child: new Row(
|
||||
@@ -215,41 +216,35 @@ 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 fcsIDBox = 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 phoneNumberBox = 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 namebox = DisplayText(
|
||||
text: user != null ? user.name : "",
|
||||
labelTextKey: "box.name",
|
||||
iconData: Icons.person,
|
||||
);
|
||||
|
||||
final packageTitle = Container(
|
||||
padding: EdgeInsets.only(right: 10.0, top: 20),
|
||||
@@ -483,7 +478,7 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
title: widget.box == null
|
||||
? LocalText(
|
||||
context,
|
||||
"boxes.new",
|
||||
"boxes.create.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
)
|
||||
@@ -494,40 +489,37 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
widget.box == null
|
||||
? Container()
|
||||
: Center(child: nameWidget(_box.packageNumber)),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
TitleWithAddButton(
|
||||
titleKey: "box.shipment_info",
|
||||
),
|
||||
shipmentBox,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
fcsIDBox,
|
||||
phoneNumberBox,
|
||||
namebox,
|
||||
mixBox,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10, left: 10),
|
||||
child: TitleWithAddButton(
|
||||
iconData: Octicons.package,
|
||||
titleKey: "box.packages",
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
widget.box == null
|
||||
? Container()
|
||||
: Center(child: nameWidget(_box.packageNumber)),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Column(
|
||||
LocalTitle(textKey: "box.type.title"),
|
||||
LocalRadioButtons(
|
||||
values: boxModel.cartonTypes,
|
||||
selectedValue: _selectedCartonType,
|
||||
callback: (v) {
|
||||
print(v);
|
||||
setState(() {
|
||||
_selectedCartonType = v;
|
||||
});
|
||||
}),
|
||||
LocalTitle(textKey: "box.shipment_info"),
|
||||
shipmentBox,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
fcsIDBox,
|
||||
namebox,
|
||||
LocalTitle(textKey: "box.packages"),
|
||||
|
||||
Column(
|
||||
children: [
|
||||
packageTitle,
|
||||
Divider(
|
||||
@@ -539,110 +531,111 @@ class _BoxEditorState extends State<BoxEditor> {
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: TitleWithAddButton(
|
||||
iconData: MaterialCommunityIcons.briefcase_check,
|
||||
titleKey: "box.cargo_type",
|
||||
onTap: () async {
|
||||
Cargo cargo = await Navigator.push<Cargo>(
|
||||
context, BottomUpPageRoute(CargoTypeEditor()));
|
||||
if (cargo != null) {
|
||||
setState(() {
|
||||
_box.cargoTypes.add(cargo);
|
||||
});
|
||||
}
|
||||
}),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
cargoTitle,
|
||||
Divider(
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
Column(
|
||||
children: getCargoRowList(),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: TitleWithAddButton(
|
||||
iconData: MaterialCommunityIcons.briefcase_check,
|
||||
titleKey: "box.cargo_type",
|
||||
onTap: () async {
|
||||
Cargo cargo = await Navigator.push<Cargo>(
|
||||
context, BottomUpPageRoute(CargoTypeEditor()));
|
||||
if (cargo != null) {
|
||||
setState(() {
|
||||
_box.cargoTypes.add(cargo);
|
||||
});
|
||||
}
|
||||
}),
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
TitleWithAddButton(
|
||||
titleKey: "box.dimension",
|
||||
),
|
||||
shipmentWeightBox,
|
||||
widthBox,
|
||||
heightBox,
|
||||
lengthBox,
|
||||
SizedBox(height: 25),
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: DefaultDeliveryAddress(
|
||||
deliveryAddress: _deliveryAddress,
|
||||
onTap: () async {
|
||||
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
||||
context,
|
||||
BottomUpPageRoute(DeliveryAddressSelection(
|
||||
deliveryAddress: _deliveryAddress,
|
||||
)),
|
||||
);
|
||||
if (d == null) return;
|
||||
setState(() {
|
||||
this._deliveryAddress = d;
|
||||
});
|
||||
}),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Divider(),
|
||||
isNew
|
||||
? Container()
|
||||
: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: TitleWithAddButton(
|
||||
titleKey: "box.status",
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
cargoTitle,
|
||||
Divider(
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
Column(
|
||||
children: getCargoRowList(),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
TitleWithAddButton(
|
||||
titleKey: "box.dimension",
|
||||
),
|
||||
shipmentWeightBox,
|
||||
widthBox,
|
||||
heightBox,
|
||||
lengthBox,
|
||||
SizedBox(height: 25),
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: DefaultDeliveryAddress(
|
||||
deliveryAddress: _deliveryAddress,
|
||||
labelKey: "box.delivery_address",
|
||||
onTap: () async {
|
||||
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
||||
context,
|
||||
BottomUpPageRoute(DeliveryAddressSelection(
|
||||
deliveryAddress: _deliveryAddress,
|
||||
)),
|
||||
);
|
||||
if (d == null) return;
|
||||
setState(() {
|
||||
this._deliveryAddress = d;
|
||||
});
|
||||
}),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Divider(),
|
||||
isNew
|
||||
? Container()
|
||||
: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: TitleWithAddButton(
|
||||
titleKey: "box.status",
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 230,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: isNew
|
||||
? Container()
|
||||
: Timeline(
|
||||
children: _models(),
|
||||
position: TimelinePosition.Left),
|
||||
),
|
||||
],
|
||||
),
|
||||
isNew ? Container() : Divider(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
widget.box == null
|
||||
? createBtn
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
completeBtn,
|
||||
widget.box.status == 'Arrived'
|
||||
? deliveryBtn
|
||||
: Container(),
|
||||
],
|
||||
)),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
Container(
|
||||
height: 230,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: isNew
|
||||
? Container()
|
||||
: Timeline(
|
||||
children: _models(),
|
||||
position: TimelinePosition.Left),
|
||||
),
|
||||
],
|
||||
),
|
||||
isNew ? Container() : Divider(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
widget.box == null
|
||||
? createBtn
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
completeBtn,
|
||||
widget.box.status == 'Arrived'
|
||||
? deliveryBtn
|
||||
: Container(),
|
||||
],
|
||||
)),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/box.dart';
|
||||
import 'package:fcs/domain/entities/cargo.dart';
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
@@ -295,6 +296,12 @@ class BoxModel extends BaseModel {
|
||||
});
|
||||
}
|
||||
|
||||
List<String> cartonTypes = [
|
||||
carton_from_packages,
|
||||
carton_from_shipments,
|
||||
carton_mix_box
|
||||
];
|
||||
|
||||
void initUser(user) {
|
||||
super.initUser(user);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
||||
),
|
||||
title: LocalText(
|
||||
context,
|
||||
"invitation.new",
|
||||
"invitation.form.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
|
||||
@@ -63,7 +63,7 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
|
||||
),
|
||||
title: LocalText(
|
||||
context,
|
||||
isNew ? "pm.new" : "pm.update",
|
||||
isNew ? "pm.form.new" : "pm.update",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
|
||||
@@ -143,7 +143,7 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
backgroundColor: Colors.white,
|
||||
title: LocalText(
|
||||
context,
|
||||
_isNew ? "receiving.new" : "receiving.update",
|
||||
_isNew ? "receiving.create" : "receiving.update",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
|
||||
@@ -127,7 +127,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
backgroundColor: Colors.white,
|
||||
title: LocalText(
|
||||
context,
|
||||
_isNew ? "boxes.new" : "box.edit.title",
|
||||
_isNew ? "boxes.create.title" : "box.edit.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user