update localization
This commit is contained in:
@@ -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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user