update pages for carton
This commit is contained in:
@@ -328,7 +328,7 @@
|
|||||||
"box.mix.number":"Carton number",
|
"box.mix.number":"Carton number",
|
||||||
"box.package":"Packages",
|
"box.package":"Packages",
|
||||||
"box.mix.desc":"Description",
|
"box.mix.desc":"Description",
|
||||||
"box.info.title":"Carton Info",
|
"box.info.title":"Carton",
|
||||||
"box.imageupload.title":"Upload images",
|
"box.imageupload.title":"Upload images",
|
||||||
"box.popupmenu.active":"Active Cartons",
|
"box.popupmenu.active":"Active Cartons",
|
||||||
"box.popupmenu.delivered":"Delivered Cartons",
|
"box.popupmenu.delivered":"Delivered Cartons",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ var dividerColor = Colors.grey.shade400;
|
|||||||
const dangerColor = const Color(0xffff0606);
|
const dangerColor = const Color(0xffff0606);
|
||||||
const hintTextColor = Color.fromARGB(255, 187, 187, 187);
|
const hintTextColor = Color.fromARGB(255, 187, 187, 187);
|
||||||
const linkColor= Color(0xff0000EE);
|
const linkColor= Color(0xff0000EE);
|
||||||
|
const oddColor = Color(0xffECF1F7);
|
||||||
|
|
||||||
const TextStyle labelStyle =
|
const TextStyle labelStyle =
|
||||||
TextStyle(fontSize: 20, color: labelColor, fontWeight: FontWeight.w500);
|
TextStyle(fontSize: 20, color: labelColor, fontWeight: FontWeight.w500);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import '../../domain/entities/user.dart';
|
|||||||
import '../main/util.dart';
|
import '../main/util.dart';
|
||||||
import '../rates/model/shipment_rate_model.dart';
|
import '../rates/model/shipment_rate_model.dart';
|
||||||
import '../widgets/continue_button.dart';
|
import '../widgets/continue_button.dart';
|
||||||
import '../widgets/display_text.dart';
|
|
||||||
import '../widgets/local_title.dart';
|
import '../widgets/local_title.dart';
|
||||||
import '../widgets/previous_button.dart';
|
import '../widgets/previous_button.dart';
|
||||||
import 'cargo_type_addition.dart';
|
import 'cargo_type_addition.dart';
|
||||||
@@ -29,14 +28,14 @@ class CargoWidget extends StatefulWidget {
|
|||||||
final OnContinue? onContinue;
|
final OnContinue? onContinue;
|
||||||
|
|
||||||
const CargoWidget({
|
const CargoWidget({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.cargoTypes,
|
required this.cargoTypes,
|
||||||
required this.surchargeItems,
|
required this.surchargeItems,
|
||||||
this.onPrevious,
|
this.onPrevious,
|
||||||
this.onContinue,
|
this.onContinue,
|
||||||
required this.sender,
|
required this.sender,
|
||||||
required this.consignee,
|
required this.consignee,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CargoWidget> createState() => _CargoWidgetState();
|
State<CargoWidget> createState() => _CargoWidgetState();
|
||||||
@@ -45,9 +44,9 @@ class CargoWidget extends StatefulWidget {
|
|||||||
class _CargoWidgetState extends State<CargoWidget> {
|
class _CargoWidgetState extends State<CargoWidget> {
|
||||||
List<CargoType> _cargoTypes = [];
|
List<CargoType> _cargoTypes = [];
|
||||||
List<CargoType> _surchareItems = [];
|
List<CargoType> _surchareItems = [];
|
||||||
TextEditingController _totalCtl = TextEditingController();
|
TextEditingController totalCtl = TextEditingController();
|
||||||
List<TextEditingController> _cargoTypeControllers = [];
|
List<TextEditingController> cargoTypeControllers = [];
|
||||||
List<TextEditingController> _surchargeControllers = [];
|
List<TextEditingController> surchargeControllers = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -59,36 +58,37 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
// for cargo types
|
// for cargo types
|
||||||
if (widget.cargoTypes.isNotEmpty) {
|
if (widget.cargoTypes.isNotEmpty) {
|
||||||
_cargoTypes = List.from(widget.cargoTypes);
|
_cargoTypes = List.from(widget.cargoTypes);
|
||||||
_cargoTypes.forEach((e) {
|
for (var e in _cargoTypes) {
|
||||||
var editor = new TextEditingController();
|
var editor = TextEditingController();
|
||||||
editor.text = removeTrailingZeros(e.weight);
|
editor.text = removeTrailingZeros(e.weight);
|
||||||
editor.addListener(inputChangeListener);
|
editor.addListener(inputChangeListener);
|
||||||
_cargoTypeControllers.add(editor);
|
cargoTypeControllers.add(editor);
|
||||||
});
|
}
|
||||||
_calculateTotalWeght();
|
_calculateTotalWeght();
|
||||||
} else {
|
} else {
|
||||||
var model = context.read<ShipmentRateModel>();
|
var model = context.read<ShipmentRateModel>();
|
||||||
var cargoes = model.rate.cargoTypes.map((e) => e.clone()).toList();
|
var cargoes = model.rate.cargoTypes.map((e) => e.clone()).toList();
|
||||||
|
|
||||||
_cargoTypes = cargoes.where((e) => e.isDefault).toList();
|
_cargoTypes = cargoes.where((e) => e.isDefault).toList();
|
||||||
_cargoTypes.forEach((e) {
|
// ignore: unused_local_variable
|
||||||
var editor = new TextEditingController();
|
for (var e in _cargoTypes) {
|
||||||
|
var editor = TextEditingController();
|
||||||
editor.text = '';
|
editor.text = '';
|
||||||
editor.addListener(inputChangeListener);
|
editor.addListener(inputChangeListener);
|
||||||
_cargoTypeControllers.add(editor);
|
cargoTypeControllers.add(editor);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//for surcharge items
|
//for surcharge items
|
||||||
|
|
||||||
if (widget.surchargeItems.isNotEmpty) {
|
if (widget.surchargeItems.isNotEmpty) {
|
||||||
_surchareItems = List.from(widget.surchargeItems);
|
_surchareItems = List.from(widget.surchargeItems);
|
||||||
_surchareItems.forEach((e) {
|
for (var e in _surchareItems) {
|
||||||
var editor = new TextEditingController();
|
var editor = TextEditingController();
|
||||||
editor.text = e.qty.toString();
|
editor.text = e.qty.toString();
|
||||||
editor.addListener(inputChangeListener);
|
editor.addListener(inputChangeListener);
|
||||||
_surchargeControllers.add(editor);
|
surchargeControllers.add(editor);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@@ -98,16 +98,16 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
|
|
||||||
_calculateTotalWeght() {
|
_calculateTotalWeght() {
|
||||||
double total = _cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
double total = _cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
||||||
_totalCtl.text = removeTrailingZeros(total);
|
totalCtl.text = removeTrailingZeros(total);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFieldEmpty(int index) {
|
bool isFieldEmpty(int index) {
|
||||||
return _cargoTypeControllers[index].text.isEmpty;
|
return cargoTypeControllers[index].text.isEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<int> getEmptyFields() {
|
List<int> getEmptyFields() {
|
||||||
List<int> emptyFields = [];
|
List<int> emptyFields = [];
|
||||||
for (int i = 0; i < _cargoTypeControllers.length; i++) {
|
for (int i = 0; i < cargoTypeControllers.length; i++) {
|
||||||
if (isFieldEmpty(i)) {
|
if (isFieldEmpty(i)) {
|
||||||
emptyFields.add(i);
|
emptyFields.add(i);
|
||||||
}
|
}
|
||||||
@@ -121,38 +121,36 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
if (emptyFields.isEmpty) {
|
if (emptyFields.isEmpty) {
|
||||||
_cargoTypes.asMap().entries.forEach((e) {
|
_cargoTypes.asMap().entries.forEach((e) {
|
||||||
_cargoTypes[e.key].weight =
|
_cargoTypes[e.key].weight =
|
||||||
double.tryParse(_cargoTypeControllers[e.key].text) ?? 0;
|
double.tryParse(cargoTypeControllers[e.key].text) ?? 0;
|
||||||
});
|
});
|
||||||
double total = _cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
double total = _cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
||||||
setState(() {
|
setState(() {
|
||||||
_totalCtl.text = removeTrailingZeros(total);
|
totalCtl.text = removeTrailingZeros(total);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final senderBox = DisplayText(
|
final senderBox = userDisplayBox(context,
|
||||||
text: widget.sender.name,
|
lableKey: "box.sender.title",
|
||||||
labelTextKey: "box.sender.title",
|
icon: MaterialCommunityIcons.account_arrow_right,
|
||||||
iconData: MaterialCommunityIcons.account_arrow_right,
|
showLink: false,
|
||||||
subText: Text(widget.sender.fcsID!,
|
name: widget.sender.name ?? "",
|
||||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
fcsID: widget.sender.fcsID ?? "");
|
||||||
);
|
|
||||||
|
|
||||||
final consigneeBox = DisplayText(
|
final consigneeBox = userDisplayBox(context,
|
||||||
text: widget.consignee.name,
|
showLink: false,
|
||||||
labelTextKey: "box.consignee.title",
|
lableKey: "box.consignee.title",
|
||||||
iconData: MaterialCommunityIcons.account_arrow_left,
|
icon: MaterialCommunityIcons.account_arrow_left,
|
||||||
subText: Text(widget.consignee.fcsID!,
|
name: widget.consignee.name,
|
||||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
fcsID: widget.consignee.fcsID);
|
||||||
);
|
|
||||||
|
|
||||||
final userRow = Row(
|
final userRow = Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: senderBox, flex: 2),
|
Expanded(flex: 2, child: consigneeBox),
|
||||||
Flexible(child: consigneeBox)
|
Flexible(child: senderBox)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -173,14 +171,14 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
if (cargoType == null) return;
|
if (cargoType == null) return;
|
||||||
_cargoTypes.add(cargoType);
|
_cargoTypes.add(cargoType);
|
||||||
|
|
||||||
_cargoTypeControllers.clear();
|
cargoTypeControllers.clear();
|
||||||
|
|
||||||
_cargoTypes.forEach((e) {
|
for (var e in _cargoTypes) {
|
||||||
var editor = new TextEditingController();
|
var editor = TextEditingController();
|
||||||
editor.text = removeTrailingZeros(e.weight);
|
editor.text = removeTrailingZeros(e.weight);
|
||||||
editor.addListener(inputChangeListener);
|
editor.addListener(inputChangeListener);
|
||||||
_cargoTypeControllers.add(editor);
|
cargoTypeControllers.add(editor);
|
||||||
});
|
}
|
||||||
|
|
||||||
_calculateTotalWeght();
|
_calculateTotalWeght();
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@@ -204,17 +202,17 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
_cargoTypes.removeAt(key);
|
_cargoTypes.removeAt(key);
|
||||||
|
|
||||||
double totalWeight = double.tryParse(_totalCtl.text) ?? 0;
|
double totalWeight = double.tryParse(totalCtl.text) ?? 0;
|
||||||
double removeWeight =
|
double removeWeight =
|
||||||
(double.tryParse(_cargoTypeControllers[key].text) ??
|
(double.tryParse(cargoTypeControllers[key].text) ??
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (totalWeight >= removeWeight) {
|
if (totalWeight >= removeWeight) {
|
||||||
double result = totalWeight - removeWeight;
|
double result = totalWeight - removeWeight;
|
||||||
_totalCtl.text = removeTrailingZeros(result);
|
totalCtl.text = removeTrailingZeros(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
_cargoTypeControllers[key].clear();
|
cargoTypeControllers[key].clear();
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@@ -225,7 +223,7 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
Flexible(
|
Flexible(
|
||||||
child: inputTextFieldWidget(context,
|
child: inputTextFieldWidget(context,
|
||||||
lableText: c.name ?? "",
|
lableText: c.name ?? "",
|
||||||
controller: _cargoTypeControllers[key]),
|
controller: cargoTypeControllers[key]),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -243,7 +241,7 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
radius: 25,
|
radius: 25,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_totalCtl.clear();
|
totalCtl.clear();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Icon(MaterialIcons.clear, color: labelColor)),
|
child: Icon(MaterialIcons.clear, color: labelColor)),
|
||||||
@@ -251,15 +249,15 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
Flexible(
|
Flexible(
|
||||||
child: inputTextFieldWidget(context,
|
child: inputTextFieldWidget(context,
|
||||||
lableText: "Total",
|
lableText: "Total",
|
||||||
controller: _totalCtl,
|
controller: totalCtl,
|
||||||
readOnly: getEmptyFields().isEmpty, onChanged: (neValue) {
|
readOnly: getEmptyFields().isEmpty, onChanged: (neValue) {
|
||||||
List<int> emptyFields = getEmptyFields();
|
List<int> emptyFields = getEmptyFields();
|
||||||
if (emptyFields.length == 1) {
|
if (emptyFields.length == 1) {
|
||||||
double totalWeight = double.tryParse(neValue) ?? 0;
|
double totalWeight = double.tryParse(neValue) ?? 0;
|
||||||
|
|
||||||
_cargoTypes.asMap().entries.forEach((e) {
|
_cargoTypes.asMap().entries.forEach((e) {
|
||||||
_cargoTypes[e.key].weight = double.tryParse(
|
_cargoTypes[e.key].weight =
|
||||||
_cargoTypeControllers[e.key].text) ??
|
double.tryParse(cargoTypeControllers[e.key].text) ??
|
||||||
0;
|
0;
|
||||||
});
|
});
|
||||||
double result = _cargoTypes.fold(
|
double result = _cargoTypes.fold(
|
||||||
@@ -268,7 +266,7 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
if (totalWeight >= result) {
|
if (totalWeight >= result) {
|
||||||
double remaining = totalWeight - result;
|
double remaining = totalWeight - result;
|
||||||
setState(() {
|
setState(() {
|
||||||
_cargoTypeControllers[emptyFields.first].text =
|
cargoTypeControllers[emptyFields.first].text =
|
||||||
removeTrailingZeros(remaining);
|
removeTrailingZeros(remaining);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -297,11 +295,11 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
|
|
||||||
_surchareItems.add(surchargeItem);
|
_surchareItems.add(surchargeItem);
|
||||||
|
|
||||||
_surchargeControllers.clear();
|
surchargeControllers.clear();
|
||||||
_surchareItems.asMap().entries.forEach((e) {
|
_surchareItems.asMap().entries.forEach((e) {
|
||||||
var editor = new TextEditingController();
|
var editor = TextEditingController();
|
||||||
editor.text = e.value.qty.toString();
|
editor.text = e.value.qty.toString();
|
||||||
_surchargeControllers.add(editor);
|
surchargeControllers.add(editor);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@@ -333,7 +331,7 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
child: inputTextFieldWidget(
|
child: inputTextFieldWidget(
|
||||||
context,
|
context,
|
||||||
lableText: c.name ?? "",
|
lableText: c.name ?? "",
|
||||||
controller: _surchargeControllers[key],
|
controller: surchargeControllers[key],
|
||||||
onChanged: (newValue) {
|
onChanged: (newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_surchareItems[key].qty = int.tryParse(newValue) ?? 0;
|
_surchareItems[key].qty = int.tryParse(newValue) ?? 0;
|
||||||
@@ -418,7 +416,7 @@ class _CargoWidgetState extends State<CargoWidget> {
|
|||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
readOnly: readOnly,
|
readOnly: readOnly,
|
||||||
decoration: new InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.all(0),
|
contentPadding: EdgeInsets.all(0),
|
||||||
labelText: lableText,
|
labelText: lableText,
|
||||||
labelStyle: newLabelStyle(color: Colors.black54, fontSize: 17),
|
labelStyle: newLabelStyle(color: Colors.black54, fontSize: 17),
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import 'package:fcs/domain/entities/carton.dart';
|
|||||||
import 'package:fcs/domain/entities/user.dart';
|
import 'package:fcs/domain/entities/user.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/user_search/user_search.dart';
|
import 'package:fcs/pages/user_search/user_search.dart';
|
||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
|
||||||
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
|
||||||
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
||||||
import 'package:fcs/pages/widgets/local_radio_buttons.dart';
|
import 'package:fcs/pages/widgets/local_radio_buttons.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
@@ -22,24 +20,22 @@ import 'model/package_selection_model.dart';
|
|||||||
import 'widget/carton_row.dart';
|
import 'widget/carton_row.dart';
|
||||||
|
|
||||||
class CartonEditor extends StatefulWidget {
|
class CartonEditor extends StatefulWidget {
|
||||||
final Carton? carton;
|
const CartonEditor({super.key});
|
||||||
CartonEditor({this.carton});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_CartonEditorState createState() => _CartonEditorState();
|
_CartonEditorState createState() => _CartonEditorState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CartonEditorState extends State<CartonEditor> {
|
class _CartonEditorState extends State<CartonEditor> {
|
||||||
List<String> _cartonTypes = [carton_from_packages, carton_mix_carton];
|
List<String> cartonTypes = [carton_from_packages, carton_mix_carton];
|
||||||
List<Carton> _cartons = [];
|
List<Carton> cartons = [];
|
||||||
|
|
||||||
bool _isLoading = false;
|
bool isLoading = false;
|
||||||
bool _isNew = false;
|
|
||||||
String? _selectedCartonType;
|
String? _selectedCartonType;
|
||||||
|
|
||||||
User? _consignee;
|
User? _consignee;
|
||||||
User? _sender;
|
User? _sender;
|
||||||
Carton? _carton;
|
|
||||||
bool _hasPackages = true;
|
bool _hasPackages = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -49,26 +45,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_init() {
|
_init() {
|
||||||
if (widget.carton != null) {
|
|
||||||
_carton = widget.carton;
|
|
||||||
_selectedCartonType = _carton!.cartonType;
|
|
||||||
|
|
||||||
_isNew = false;
|
|
||||||
|
|
||||||
_consignee = User(
|
|
||||||
id: _carton!.consigneeID,
|
|
||||||
fcsID: _carton!.consigneeFCSID,
|
|
||||||
name: _carton!.consigneeName);
|
|
||||||
_sender = User(
|
|
||||||
id: _carton!.senderID,
|
|
||||||
fcsID: _carton!.senderFCSID,
|
|
||||||
name: _carton!.senderName);
|
|
||||||
} else {
|
|
||||||
_carton = Carton(cargoTypes: [], packages: []);
|
|
||||||
_isNew = true;
|
|
||||||
_selectedCartonType = carton_from_packages;
|
_selectedCartonType = carton_from_packages;
|
||||||
_cartons = [];
|
|
||||||
}
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@@ -115,8 +92,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final cartonTypeBox = LocalRadioButtons(
|
final cartonTypeBox = LocalRadioButtons(
|
||||||
readOnly: !_isNew,
|
readOnly: false,
|
||||||
values: _cartonTypes,
|
values: cartonTypes,
|
||||||
selectedValue: _selectedCartonType,
|
selectedValue: _selectedCartonType,
|
||||||
callback: (String? v) {
|
callback: (String? v) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -125,8 +102,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
final cartonTitleBox = LocalTitle(
|
final cartonTitleBox = LocalTitle(
|
||||||
textKey: _cartons.isEmpty ? "box.shipment.boxes" : "box.cartion.count",
|
textKey: cartons.isEmpty ? "box.shipment.boxes" : "box.cartion.count",
|
||||||
translationVariables: _cartons.isEmpty ? null : ["${_cartons.length}"],
|
translationVariables: cartons.isEmpty ? null : ["${cartons.length}"],
|
||||||
trailing: Padding(
|
trailing: Padding(
|
||||||
padding: const EdgeInsets.only(right: 5),
|
padding: const EdgeInsets.only(right: 5),
|
||||||
child: InkResponse(
|
child: InkResponse(
|
||||||
@@ -134,20 +111,19 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
//for packages
|
//for packages
|
||||||
if (isFromPackages) {
|
if (isFromPackages) {
|
||||||
if (_sender == null) {
|
if (_consignee == null) {
|
||||||
showMsgDialog(
|
showMsgDialog(context, "Error", "Please select consignee");
|
||||||
context, "Error", "Please select sender's FCS ID");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_consignee == null) {
|
|
||||||
showMsgDialog(
|
if (_sender == null) {
|
||||||
context, "Error", "Please select consignee's FCS ID");
|
showMsgDialog(context, "Error", "Please select sender");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_hasPackages) {
|
if (!_hasPackages) {
|
||||||
showMsgDialog(
|
showMsgDialog(
|
||||||
context, "Error", "No packages in sender and consignee");
|
context, "Error", "No packages in consignee and sender");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,13 +131,11 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => CartonPackageForm(
|
builder: (context) => CartonPackageForm(
|
||||||
sender: _sender!,
|
sender: _sender!, consignee: _consignee!)));
|
||||||
consignee: _consignee!,
|
|
||||||
)));
|
|
||||||
|
|
||||||
if (carton != null) {
|
if (carton != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_cartons.add(carton);
|
cartons.add(carton);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,7 +148,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
|
|
||||||
if (carton != null) {
|
if (carton != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_cartons.add(carton);
|
cartons.add(carton);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,109 +157,33 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final consigneeSearchBox = Row(
|
final consigneeBox = userSearchBox(context,
|
||||||
children: <Widget>[
|
lableKey: 'box.consignee.title',
|
||||||
Flexible(
|
icon: MaterialCommunityIcons.account_arrow_left,
|
||||||
child: Padding(
|
user: _consignee,
|
||||||
padding: const EdgeInsets.only(left: 2),
|
onSearch: () => searchUser(context, onUserSelect: (u) {
|
||||||
child: LocalText(context, "box.consignee.title",
|
|
||||||
color: Colors.black, fontSize: 15),
|
|
||||||
)),
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.search, color: Colors.black),
|
|
||||||
onPressed: () => searchUser(context, onUserSelect: (u) async {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
this._consignee = u;
|
_consignee = u;
|
||||||
});
|
});
|
||||||
|
|
||||||
_checkPackages();
|
_checkPackages();
|
||||||
}, popPage: true)),
|
}, popPage: true));
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
final consigneefcsIDBox = DisplayText(
|
final senderBox = userSearchBox(context,
|
||||||
text: _consignee != null ? _consignee!.fcsID : "",
|
lableKey: 'box.sender.title',
|
||||||
labelTextKey: "processing.fcs.id",
|
icon: MaterialCommunityIcons.account_arrow_right,
|
||||||
icon: FcsIDIcon(),
|
user: _sender,
|
||||||
);
|
onSearch: () => searchUser(context, onUserSelect: (u) {
|
||||||
|
|
||||||
final consigneePhoneBox = DisplayText(
|
|
||||||
text: _consignee != null ? _consignee!.phoneNumber : "",
|
|
||||||
labelTextKey: "processing.phone",
|
|
||||||
iconData: MaterialCommunityIcons.phone);
|
|
||||||
|
|
||||||
final consigneeNameBox = DisplayText(
|
|
||||||
text: _consignee != null ? _consignee!.name : "",
|
|
||||||
labelTextKey: "processing.consignee.name",
|
|
||||||
maxLines: 2,
|
|
||||||
iconData: MaterialCommunityIcons.account_arrow_left);
|
|
||||||
|
|
||||||
final consigneeBox = Container(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
consigneeSearchBox,
|
|
||||||
consigneefcsIDBox,
|
|
||||||
consigneePhoneBox,
|
|
||||||
consigneeNameBox,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final senderSearchBox = Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Flexible(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 2),
|
|
||||||
child: LocalText(context, "box.sender.title",
|
|
||||||
color: Colors.black, fontSize: 15),
|
|
||||||
)),
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.search, color: Colors.black),
|
|
||||||
onPressed: () => searchUser(context, onUserSelect: (u) async {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
this._sender = u;
|
_sender = u;
|
||||||
});
|
});
|
||||||
|
|
||||||
_checkPackages();
|
_checkPackages();
|
||||||
}, popPage: true)),
|
}, popPage: true));
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
final senderIDBox = DisplayText(
|
|
||||||
text: _sender != null ? _sender!.fcsID : "",
|
|
||||||
labelTextKey: "processing.fcs.id",
|
|
||||||
icon: FcsIDIcon());
|
|
||||||
|
|
||||||
final senderPhoneBox = DisplayText(
|
|
||||||
text: _sender != null ? _sender!.phoneNumber : "",
|
|
||||||
labelTextKey: "processing.phone",
|
|
||||||
iconData: MaterialCommunityIcons.phone,
|
|
||||||
);
|
|
||||||
|
|
||||||
final senderNameBox = DisplayText(
|
|
||||||
text: _sender != null ? _sender!.name : "",
|
|
||||||
labelTextKey: "processing.shipper.name",
|
|
||||||
maxLines: 2,
|
|
||||||
iconData: MaterialCommunityIcons.account_arrow_right);
|
|
||||||
|
|
||||||
final senderBox = Container(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
senderSearchBox,
|
|
||||||
senderIDBox,
|
|
||||||
senderPhoneBox,
|
|
||||||
senderNameBox,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: LocalAppBar(
|
appBar: LocalAppBar(
|
||||||
labelKey: _isNew ? "boxes.new" : "box.edit.title",
|
labelKey: "boxes.new",
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
arrowColor: primaryColor,
|
arrowColor: primaryColor,
|
||||||
labelColor: primaryColor),
|
labelColor: primaryColor),
|
||||||
@@ -303,8 +201,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Flexible(child: senderBox),
|
Flexible(child: consigneeBox),
|
||||||
Flexible(child: consigneeBox)
|
Flexible(child: senderBox)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
!_hasPackages
|
!_hasPackages
|
||||||
@@ -319,7 +217,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
cartonTitleBox,
|
cartonTitleBox,
|
||||||
Column(children: _getCartons(context, _cartons)),
|
Column(children: _getCartons(context, cartons)),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
createBtn,
|
createBtn,
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ import 'package:provider/provider.dart';
|
|||||||
|
|
||||||
import '../main/util.dart';
|
import '../main/util.dart';
|
||||||
import '../widgets/local_button.dart';
|
import '../widgets/local_button.dart';
|
||||||
|
import '../widgets/local_text.dart';
|
||||||
import '../widgets/multi_img_file.dart';
|
import '../widgets/multi_img_file.dart';
|
||||||
import 'model/carton_model.dart';
|
import 'model/carton_model.dart';
|
||||||
|
|
||||||
class CartonImageUploadEditor extends StatefulWidget {
|
class CartonImageUploadEditor extends StatefulWidget {
|
||||||
final Carton carton;
|
final Carton carton;
|
||||||
const CartonImageUploadEditor({required this.carton});
|
const CartonImageUploadEditor({super.key, required this.carton});
|
||||||
@override
|
@override
|
||||||
_CartonImageUploaState createState() => _CartonImageUploaState();
|
_CartonImageUploaState createState() => _CartonImageUploaState();
|
||||||
}
|
}
|
||||||
@@ -21,12 +22,12 @@ class CartonImageUploadEditor extends StatefulWidget {
|
|||||||
class _CartonImageUploaState extends State<CartonImageUploadEditor> {
|
class _CartonImageUploaState extends State<CartonImageUploadEditor> {
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
|
||||||
MultiImgController _multiImgController = MultiImgController();
|
MultiImgController multiImgController = MultiImgController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_multiImgController.setImageUrls = widget.carton.photoUrls;
|
multiImgController.setImageUrls = widget.carton.photoUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -44,24 +45,25 @@ class _CartonImageUploaState extends State<CartonImageUploadEditor> {
|
|||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: LocalAppBar(
|
appBar: LocalAppBar(
|
||||||
labelKey: "box.imageupload.title",
|
titleWidget: Column(
|
||||||
|
children: [
|
||||||
|
LocalText(context, "box.imageupload.title",
|
||||||
|
fontSize: 20, color: primaryColor),
|
||||||
|
Text(widget.carton.cartonNumber ?? '',
|
||||||
|
style: TextStyle(fontSize: 15, color: Colors.black))
|
||||||
|
],
|
||||||
|
),
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
labelColor: primaryColor,
|
labelColor: primaryColor,
|
||||||
arrowColor: primaryColor,
|
arrowColor: primaryColor,
|
||||||
actions: []),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: EdgeInsets.only(left: 12.0, right: 12),
|
padding: EdgeInsets.only(left: 12.0, right: 12),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Center(
|
|
||||||
child: Text("${widget.carton.cartonNumber}",
|
|
||||||
style: TextStyle(
|
|
||||||
color: primaryColor,
|
|
||||||
fontSize: 25,
|
|
||||||
))),
|
|
||||||
MultiImageFile(
|
MultiImageFile(
|
||||||
enabled: true,
|
enabled: true,
|
||||||
controller: _multiImgController,
|
controller: multiImgController,
|
||||||
title: "Receipt File",
|
title: "Receipt File",
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
@@ -77,7 +79,7 @@ class _CartonImageUploaState extends State<CartonImageUploadEditor> {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await context.read<CartonModel>().uploadCartonImages(widget.carton,
|
await context.read<CartonModel>().uploadCartonImages(widget.carton,
|
||||||
_multiImgController.getAddedFile, _multiImgController.getDeletedUrl);
|
multiImgController.getAddedFile, multiImgController.getDeletedUrl);
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showMsgDialog(context, "Error", e.toString());
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import '../../domain/entities/carton_size.dart';
|
import '../../domain/entities/carton_size.dart';
|
||||||
|
import '../../domain/entities/fcs_shipment.dart';
|
||||||
import '../carton_size/model/carton_size_model.dart';
|
import '../carton_size/model/carton_size_model.dart';
|
||||||
|
import '../fcs_shipment/model/fcs_shipment_model.dart';
|
||||||
import '../widgets/local_button.dart';
|
import '../widgets/local_button.dart';
|
||||||
import 'carton_package_editor.dart';
|
import 'carton_package_editor.dart';
|
||||||
import 'mix_carton/mix_carton_editor.dart';
|
import 'mix_carton/mix_carton_editor.dart';
|
||||||
@@ -34,9 +36,9 @@ class CartonInfo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CartonInfoState extends State<CartonInfo> {
|
class _CartonInfoState extends State<CartonInfo> {
|
||||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
var dateFormatter = DateFormat('dd MMM yyyy');
|
||||||
final NumberFormat numberFormatter = NumberFormat("#,###");
|
final NumberFormat numberFormatter = NumberFormat("#,###");
|
||||||
MultiImgController _multiImgController = MultiImgController();
|
MultiImgController multiImgController = MultiImgController();
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
late Carton _carton;
|
late Carton _carton;
|
||||||
List<CargoType> _cargoTypes = [];
|
List<CargoType> _cargoTypes = [];
|
||||||
@@ -46,6 +48,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
double totalWeight = 0.0;
|
double totalWeight = 0.0;
|
||||||
double totalSurchargeCount = 0.0;
|
double totalSurchargeCount = 0.0;
|
||||||
CartonSize? standardSize;
|
CartonSize? standardSize;
|
||||||
|
FcsShipment? _shipment;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -57,7 +60,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
_init() async {
|
_init() async {
|
||||||
try {
|
try {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
_multiImgController.setImageUrls = _carton.photoUrls;
|
multiImgController.setImageUrls = _carton.photoUrls;
|
||||||
_cargoTypes = _carton.cargoTypes;
|
_cargoTypes = _carton.cargoTypes;
|
||||||
_surchareItems = _carton.surchareItems;
|
_surchareItems = _carton.surchareItems;
|
||||||
|
|
||||||
@@ -82,6 +85,14 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
_carton.cartonSizeType = customCarton;
|
_carton.cartonSizeType = customCarton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (widget.carton.fcsShipmentID != null &&
|
||||||
|
widget.carton.fcsShipmentID != '') {
|
||||||
|
var s = await context
|
||||||
|
.read<FcsShipmentModel>()
|
||||||
|
.getFcsShipment(widget.carton.fcsShipmentID!);
|
||||||
|
_shipment = s;
|
||||||
|
}
|
||||||
|
|
||||||
if (_carton.cartonType == carton_from_packages) {
|
if (_carton.cartonType == carton_from_packages) {
|
||||||
_packages = await context
|
_packages = await context
|
||||||
.read<PackageModel>()
|
.read<PackageModel>()
|
||||||
@@ -119,11 +130,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
? "${_carton.length.toInt()}”x${_carton.width.toInt()}”x${_carton.height.toInt()}”"
|
? "${_carton.length.toInt()}”x${_carton.width.toInt()}”x${_carton.height.toInt()}”"
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
final cartonNumberBox = DisplayText(
|
|
||||||
text: _carton.cartonNumber,
|
|
||||||
labelTextKey: "box.number",
|
|
||||||
);
|
|
||||||
|
|
||||||
final cartonQrBox = IconButton(
|
final cartonQrBox = IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
@@ -132,7 +138,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
builder: (context) => PrintQrCodePage(carton: _carton)),
|
builder: (context) => PrintQrCodePage(carton: _carton)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
icon: Icon(AntDesign.qrcode, color: Colors.black));
|
icon: Icon(AntDesign.qrcode, color: primaryColor));
|
||||||
|
|
||||||
final cartonTypeBox = DisplayText(
|
final cartonTypeBox = DisplayText(
|
||||||
text: _carton.cartonType == carton_from_packages
|
text: _carton.cartonType == carton_from_packages
|
||||||
@@ -152,11 +158,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
labelTextKey: "box.bill_to",
|
labelTextKey: "box.bill_to",
|
||||||
);
|
);
|
||||||
|
|
||||||
final shipmentBox = DisplayText(
|
|
||||||
text: _carton.fcsShipmentNumber,
|
|
||||||
labelTextKey: "box.fcs_shipment_num",
|
|
||||||
);
|
|
||||||
|
|
||||||
final lastMileBox = DisplayText(
|
final lastMileBox = DisplayText(
|
||||||
text: _carton.lastMile == delivery_caton
|
text: _carton.lastMile == delivery_caton
|
||||||
? 'Delivery'
|
? 'Delivery'
|
||||||
@@ -167,22 +168,34 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final cartonSizeBox = DisplayText(
|
final cartonSizeBox = DisplayText(
|
||||||
subText: Text("${boxDimension ?? 'No defined size'}"),
|
subText: Text(boxDimension ?? 'No defined size'),
|
||||||
labelTextKey: "box.select_carton_size",
|
labelTextKey: "box.select_carton_size",
|
||||||
);
|
);
|
||||||
|
|
||||||
final senderBox = DisplayText(
|
final packageLengthBox = DisplayText(
|
||||||
text: _carton.senderName == null ? "" : _carton.senderName,
|
showLabelLink: true,
|
||||||
subText: Text(_carton.senderFCSID ?? "", style: textStyle),
|
subText: Text(numberFormatter.format(_packages.length)),
|
||||||
labelTextKey: "box.name",
|
labelTextKey: "box.package",
|
||||||
|
onTapLabel: () {},
|
||||||
);
|
);
|
||||||
|
|
||||||
final consigneeNameBox = DisplayText(
|
final mixCartonLengthBox = DisplayText(
|
||||||
text: _carton.consigneeName != null ? _carton.consigneeName : "",
|
showLabelLink: true,
|
||||||
subText: Text(_carton.consigneeFCSID ?? "", style: textStyle),
|
subText: Text(numberFormatter.format(_mixCartons.length)),
|
||||||
labelTextKey: "processing.consignee.name",
|
labelTextKey: "box.shipment.boxes",
|
||||||
|
onTapLabel: () {},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final senderBox = userDisplayBox(context,
|
||||||
|
lableKey: "box.sender.title",
|
||||||
|
name: _carton.senderName,
|
||||||
|
fcsID: _carton.senderFCSID);
|
||||||
|
|
||||||
|
final consigneeNameBox = userDisplayBox(context,
|
||||||
|
lableKey: "box.consignee.title",
|
||||||
|
name: _carton.consigneeName,
|
||||||
|
fcsID: _carton.consigneeFCSID);
|
||||||
|
|
||||||
// final billWidget = Expanded(
|
// final billWidget = Expanded(
|
||||||
// child: Padding(
|
// child: Padding(
|
||||||
// padding: EdgeInsets.only(left: 0, top: 15),
|
// padding: EdgeInsets.only(left: 0, top: 15),
|
||||||
@@ -208,14 +221,13 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
senderBox,
|
consigneeNameBox,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// _carton.billTo == billToSender ? billWidget : const SizedBox()
|
// _carton.billTo == billToConsignee ? billWidget : const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
)),
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -224,13 +236,14 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
consigneeNameBox,
|
senderBox,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// _carton.billTo == billToConsignee ? billWidget : const SizedBox()
|
// _carton.billTo == billToSender ? billWidget : const SizedBox()
|
||||||
],
|
],
|
||||||
))
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -246,82 +259,88 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
fontWeight: FontWeight.normal),
|
fontWeight: FontWeight.normal),
|
||||||
_cargoTypes.isNotEmpty
|
_cargoTypes.isNotEmpty
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: EdgeInsets.only(right: 50),
|
padding: EdgeInsets.only(right: 0),
|
||||||
child: Text("${removeTrailingZeros(totalWeight)} lb",
|
child: Text("${removeTrailingZeros(totalWeight)} lb",
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||||
: const SizedBox()
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.only(right: 0),
|
||||||
padding: const EdgeInsets.only(right: 50),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _cargoTypes.map((e) {
|
children: _cargoTypes.asMap().entries.map((e) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||||
|
child: Container(
|
||||||
|
color: e.key.isEven ? Colors.grey.shade300 : oddColor,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
e.name ?? "",
|
e.value.name ?? "",
|
||||||
style:
|
style:
|
||||||
TextStyle(color: Colors.black, fontSize: 15),
|
TextStyle(color: Colors.black, fontSize: 15),
|
||||||
),
|
),
|
||||||
Text("${removeTrailingZeros(e.weight)} lb",
|
Text("${removeTrailingZeros(e.value.weight)} lb",
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black, fontSize: 15))
|
color: Colors.black, fontSize: 15))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}).toList()),
|
}).toList()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|
||||||
final surchargeItemBox =
|
final surchargeItemBox = Padding(
|
||||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
padding: const EdgeInsets.only(top: 16),
|
||||||
Container(
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
child: Padding(
|
LocalText(context, 'box.input_surcharge_item',
|
||||||
padding: const EdgeInsets.only(right: 50),
|
color: Colors.black54, fontSize: 16, fontWeight: FontWeight.normal),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _surchareItems.map((e) {
|
children: _surchareItems.asMap().entries.map((e) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||||
|
child: Container(
|
||||||
|
color: e.key.isEven ? Colors.grey.shade300 : oddColor,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
e.name ?? "",
|
e.value.name ?? "",
|
||||||
style: TextStyle(color: Colors.black, fontSize: 15),
|
style: TextStyle(color: Colors.black, fontSize: 15),
|
||||||
),
|
),
|
||||||
Text("${removeTrailingZeros((e.qty).toDouble())} pc",
|
Text("${removeTrailingZeros((e.value.qty).toDouble())} pc",
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style:
|
style:
|
||||||
TextStyle(color: Colors.black, fontSize: 15))
|
TextStyle(color: Colors.black, fontSize: 15))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}).toList()),
|
}).toList()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
]),
|
||||||
]);
|
);
|
||||||
|
|
||||||
final img = MultiImageFile(
|
final img = MultiImageFile(
|
||||||
enabled: false,
|
enabled: false,
|
||||||
controller: _multiImgController,
|
controller: multiImgController,
|
||||||
title: "Receipt File",
|
title: "Receipt File",
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -367,15 +386,74 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final shipmentBox = Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
LocalText(context, "package.shipment.title",
|
||||||
|
fontSize: 15, color: Colors.black54),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: dividerColor),
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
DisplayText(
|
||||||
|
text: _shipment?.shipmentNumber,
|
||||||
|
labelTextKey: "FCSshipment.number",
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: DisplayText(
|
||||||
|
text: _shipment != null
|
||||||
|
? _shipment!.cutoffDate != null
|
||||||
|
? dateFormatter.format(_shipment!.cutoffDate!)
|
||||||
|
: ""
|
||||||
|
: "",
|
||||||
|
labelTextKey: "FCSshipment.cutoff_date",
|
||||||
|
)),
|
||||||
|
Flexible(
|
||||||
|
child: DisplayText(
|
||||||
|
text: _shipment != null
|
||||||
|
? _shipment!.etaDate != null
|
||||||
|
? dateFormatter.format(_shipment!.etaDate!)
|
||||||
|
: ""
|
||||||
|
: "",
|
||||||
|
labelTextKey: "FCSshipment.ETA",
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: LocalAppBar(
|
appBar: LocalAppBar(
|
||||||
labelKey: "box.info.title",
|
titleWidget: Column(
|
||||||
|
children: [
|
||||||
|
LocalText(context, "box.info.title",
|
||||||
|
fontSize: 20, color: primaryColor),
|
||||||
|
Text(_carton.cartonNumber ?? '',
|
||||||
|
style: TextStyle(fontSize: 15, color: Colors.black))
|
||||||
|
],
|
||||||
|
),
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
labelColor: primaryColor,
|
labelColor: primaryColor,
|
||||||
arrowColor: primaryColor,
|
arrowColor: primaryColor,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
|
cartonQrBox,
|
||||||
_carton.status == carton_packed_status
|
_carton.status == carton_packed_status
|
||||||
? IconButton(
|
? IconButton(
|
||||||
icon: Icon(Icons.edit, color: primaryColor),
|
icon: Icon(Icons.edit, color: primaryColor),
|
||||||
@@ -385,66 +463,64 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
body: Container(
|
body: Container(
|
||||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||||
child: ListView(children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
Row(children: [
|
|
||||||
Flexible(child: cartonNumberBox, flex: 1),
|
|
||||||
Flexible(
|
|
||||||
child: cartonQrBox,
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(child: cartonTypeBox),
|
Flexible(child: cartonTypeBox),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
fromPackage ? userRowBox : const SizedBox(),
|
fromPackage ? userRowBox : const SizedBox(),
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
fromPackage ? Flexible(child: billInfoBox) : SizedBox(),
|
|
||||||
Flexible(child: shipmentBox),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
fromPackage
|
fromPackage
|
||||||
? Flexible(child: lastMileBox)
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Flexible(child: billInfoBox),
|
||||||
|
Flexible(child: lastMileBox),
|
||||||
|
],
|
||||||
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
Flexible(child: cartonSizeBox),
|
Flexible(child: cartonSizeBox),
|
||||||
|
Flexible(child: packageLengthBox),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_packages.isEmpty
|
fromPackage ? const SizedBox() : mixCartonLengthBox,
|
||||||
? const SizedBox()
|
shipmentBox,
|
||||||
: Padding(
|
// _packages.isEmpty
|
||||||
padding: const EdgeInsets.only(top: 15),
|
// ? const SizedBox()
|
||||||
child: Column(
|
// : Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// padding: const EdgeInsets.only(top: 15),
|
||||||
children: [
|
// child: Column(
|
||||||
LocalText(context, "box.package",
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
color: Colors.black54, fontSize: 15),
|
// children: [
|
||||||
const SizedBox(height: 5),
|
// LocalText(context, "box.package",
|
||||||
Column(
|
// color: Colors.black54, fontSize: 15),
|
||||||
children: getPackageList(_packages),
|
// const SizedBox(height: 5),
|
||||||
),
|
// Column(
|
||||||
],
|
// children: getPackageList(_packages),
|
||||||
),
|
// ),
|
||||||
),
|
// ],
|
||||||
_mixCartons.isEmpty
|
// ),
|
||||||
? const SizedBox()
|
// ),
|
||||||
: Padding(
|
// _mixCartons.isEmpty
|
||||||
padding: const EdgeInsets.only(top: 15),
|
// ? const SizedBox()
|
||||||
child: Column(
|
// : Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// padding: const EdgeInsets.only(top: 15),
|
||||||
children: [
|
// child: Column(
|
||||||
LocalText(context, "box.shipment.boxes",
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
color: Colors.black54, fontSize: 15),
|
// children: [
|
||||||
const SizedBox(height: 5),
|
// LocalText(context, "box.shipment.boxes",
|
||||||
Column(children: getCartonList(_mixCartons)),
|
// color: Colors.black54, fontSize: 15),
|
||||||
],
|
// const SizedBox(height: 5),
|
||||||
),
|
// Column(children: getCartonList(_mixCartons)),
|
||||||
),
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
cargosBox,
|
cargosBox,
|
||||||
surchargeItemBox,
|
_surchareItems.isNotEmpty
|
||||||
|
? surchargeItemBox
|
||||||
|
: const SizedBox(),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
uploadImageBtn,
|
uploadImageBtn,
|
||||||
_carton.photoUrls.isNotEmpty
|
_carton.photoUrls.isNotEmpty
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ class CartonPackageForm extends StatefulWidget {
|
|||||||
final User consignee;
|
final User consignee;
|
||||||
|
|
||||||
const CartonPackageForm({
|
const CartonPackageForm({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.sender,
|
required this.sender,
|
||||||
required this.consignee,
|
required this.consignee,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CartonPackageForm> createState() => _CartonPackageFormState();
|
State<CartonPackageForm> createState() => _CartonPackageFormState();
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import '../fcs_shipment/model/fcs_shipment_model.dart';
|
|||||||
import '../main/util.dart';
|
import '../main/util.dart';
|
||||||
import '../widgets/box_size_picker.dart';
|
import '../widgets/box_size_picker.dart';
|
||||||
import '../widgets/continue_button.dart';
|
import '../widgets/continue_button.dart';
|
||||||
import '../widgets/display_text.dart';
|
|
||||||
import '../widgets/local_dropdown.dart';
|
import '../widgets/local_dropdown.dart';
|
||||||
import '../widgets/local_text.dart';
|
import '../widgets/local_text.dart';
|
||||||
import '../widgets/local_title.dart';
|
import '../widgets/local_title.dart';
|
||||||
@@ -41,7 +40,7 @@ class CartonSizeWidget extends StatefulWidget {
|
|||||||
final double? height;
|
final double? height;
|
||||||
|
|
||||||
const CartonSizeWidget(
|
const CartonSizeWidget(
|
||||||
{Key? key,
|
{super.key,
|
||||||
this.onPrevious,
|
this.onPrevious,
|
||||||
this.onContinue,
|
this.onContinue,
|
||||||
this.shipment,
|
this.shipment,
|
||||||
@@ -53,8 +52,7 @@ class CartonSizeWidget extends StatefulWidget {
|
|||||||
required this.sender,
|
required this.sender,
|
||||||
required this.consignee,
|
required this.consignee,
|
||||||
required this.lastMile,
|
required this.lastMile,
|
||||||
required this.billType})
|
required this.billType});
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CartonSizeWidget> createState() => _CartonSizeWidgetState();
|
State<CartonSizeWidget> createState() => _CartonSizeWidgetState();
|
||||||
@@ -69,9 +67,9 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
|||||||
late String _selectedLastmile;
|
late String _selectedLastmile;
|
||||||
late String _billToValue;
|
late String _billToValue;
|
||||||
|
|
||||||
TextEditingController _widthController = new TextEditingController();
|
TextEditingController widthController = TextEditingController();
|
||||||
TextEditingController _heightController = new TextEditingController();
|
TextEditingController heightController = TextEditingController();
|
||||||
TextEditingController _lengthController = new TextEditingController();
|
TextEditingController lengthController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -83,11 +81,11 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
|||||||
_selectedLastmile = widget.lastMile;
|
_selectedLastmile = widget.lastMile;
|
||||||
_billToValue = widget.billType;
|
_billToValue = widget.billType;
|
||||||
_cartonSizeType = widget.cartonSizeType;
|
_cartonSizeType = widget.cartonSizeType;
|
||||||
_lengthController.text =
|
lengthController.text =
|
||||||
widget.length == null ? "0" : removeTrailingZeros(widget.length ?? 0);
|
widget.length == null ? "0" : removeTrailingZeros(widget.length ?? 0);
|
||||||
_widthController.text =
|
widthController.text =
|
||||||
widget.width == null ? "0" : removeTrailingZeros(widget.width ?? 0);
|
widget.width == null ? "0" : removeTrailingZeros(widget.width ?? 0);
|
||||||
_heightController.text =
|
heightController.text =
|
||||||
widget.height == null ? "0" : removeTrailingZeros(widget.height ?? 0);
|
widget.height == null ? "0" : removeTrailingZeros(widget.height ?? 0);
|
||||||
|
|
||||||
_getStandardCartonSize();
|
_getStandardCartonSize();
|
||||||
@@ -135,35 +133,32 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
|||||||
bool isCustomSize = _cartonSizeType == customCarton;
|
bool isCustomSize = _cartonSizeType == customCarton;
|
||||||
bool isNoneDefinedSize = _cartonSizeType == packageCarton;
|
bool isNoneDefinedSize = _cartonSizeType == packageCarton;
|
||||||
|
|
||||||
final senderBox = DisplayText(
|
final senderBox = userDisplayBox(context,
|
||||||
text: widget.sender.name,
|
lableKey: "box.sender.title",
|
||||||
labelTextKey: "box.sender.title",
|
icon: MaterialCommunityIcons.account_arrow_right,
|
||||||
iconData: MaterialCommunityIcons.account_arrow_right,
|
showLink: false,
|
||||||
subText: Text(widget.sender.fcsID ?? "",
|
name: widget.sender.name ?? "",
|
||||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
fcsID: widget.sender.fcsID ?? "");
|
||||||
);
|
|
||||||
|
|
||||||
final consigneeBox = DisplayText(
|
final consigneeBox = userDisplayBox(context,
|
||||||
text: widget.consignee.name,
|
showLink: false,
|
||||||
labelTextKey: "box.consignee.title",
|
lableKey: "box.consignee.title",
|
||||||
iconData: MaterialCommunityIcons.account_arrow_left,
|
icon: MaterialCommunityIcons.account_arrow_left,
|
||||||
subText: Text(widget.consignee.fcsID ?? '',
|
name: widget.consignee.name,
|
||||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
fcsID: widget.consignee.fcsID);
|
||||||
);
|
|
||||||
|
|
||||||
final userRow = Row(
|
final userRow = Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: senderBox,
|
|
||||||
flex: 2,
|
flex: 2,
|
||||||
|
child: consigneeBox,
|
||||||
),
|
),
|
||||||
Flexible(child: consigneeBox)
|
Flexible(child: senderBox)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
final deliveryTypeBox = Container(
|
final deliveryTypeBox = Row(
|
||||||
child: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
@@ -225,41 +220,10 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final billRadioBox = Container(
|
final billRadioBox = Row(
|
||||||
child: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
_billToValue = billToSender;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
LocalRadio(
|
|
||||||
value: billToSender,
|
|
||||||
groupValue: _billToValue,
|
|
||||||
onChanged: (p0) {
|
|
||||||
setState(() {
|
|
||||||
_billToValue = billToSender;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 10),
|
|
||||||
child: LocalText(context, 'box.sender.title',
|
|
||||||
fontSize: 15,
|
|
||||||
color: _billToValue == billToSender
|
|
||||||
? primaryColor
|
|
||||||
: Colors.black),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)),
|
|
||||||
Flexible(
|
Flexible(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -289,15 +253,43 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
|||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
Flexible(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
_billToValue = billToSender;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
LocalRadio(
|
||||||
|
value: billToSender,
|
||||||
|
groupValue: _billToValue,
|
||||||
|
onChanged: (p0) {
|
||||||
|
setState(() {
|
||||||
|
_billToValue = billToSender;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 10),
|
||||||
|
child: LocalText(context, 'box.sender.title',
|
||||||
|
fontSize: 15,
|
||||||
|
color: _billToValue == billToSender
|
||||||
|
? primaryColor
|
||||||
|
: Colors.black),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
final continueBtn = ContinueButton(onTap: () {
|
final continueBtn = ContinueButton(onTap: () {
|
||||||
double l = double.tryParse(_lengthController.text) ?? 0;
|
double l = double.tryParse(lengthController.text) ?? 0;
|
||||||
double w = double.tryParse(_widthController.text) ?? 0;
|
double w = double.tryParse(widthController.text) ?? 0;
|
||||||
double h = double.tryParse(_heightController.text) ?? 0;
|
double h = double.tryParse(heightController.text) ?? 0;
|
||||||
|
|
||||||
if (_shipment == null) {
|
if (_shipment == null) {
|
||||||
showMsgDialog(context, "Error", "Please select shipment");
|
showMsgDialog(context, "Error", "Please select shipment");
|
||||||
@@ -382,17 +374,17 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
|||||||
|
|
||||||
final lengthBox = BoxSizePicker(
|
final lengthBox = BoxSizePicker(
|
||||||
lableKey: 'box.length',
|
lableKey: 'box.length',
|
||||||
controller: _lengthController,
|
controller: lengthController,
|
||||||
enable: isCustomSize);
|
enable: isCustomSize);
|
||||||
|
|
||||||
final widthBox = BoxSizePicker(
|
final widthBox = BoxSizePicker(
|
||||||
lableKey: 'box.width',
|
lableKey: 'box.width',
|
||||||
controller: _widthController,
|
controller: widthController,
|
||||||
enable: isCustomSize);
|
enable: isCustomSize);
|
||||||
|
|
||||||
final heightBox = BoxSizePicker(
|
final heightBox = BoxSizePicker(
|
||||||
lableKey: 'box.height',
|
lableKey: 'box.height',
|
||||||
controller: _heightController,
|
controller: heightController,
|
||||||
enable: isCustomSize);
|
enable: isCustomSize);
|
||||||
|
|
||||||
final customSizeBox = Padding(
|
final customSizeBox = Padding(
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class CartonSubmit extends StatelessWidget {
|
|||||||
final OnPrevious? onPrevious;
|
final OnPrevious? onPrevious;
|
||||||
final bool isNew;
|
final bool isNew;
|
||||||
const CartonSubmit(
|
const CartonSubmit(
|
||||||
{Key? key,
|
{super.key,
|
||||||
required this.sender,
|
required this.sender,
|
||||||
required this.consingee,
|
required this.consingee,
|
||||||
required this.billToValue,
|
required this.billToValue,
|
||||||
@@ -53,8 +53,7 @@ class CartonSubmit extends StatelessWidget {
|
|||||||
this.height = 0,
|
this.height = 0,
|
||||||
this.cargoTypes = const [],
|
this.cargoTypes = const [],
|
||||||
this.surchareItems = const [],
|
this.surchareItems = const [],
|
||||||
this.isNew = true})
|
this.isNew = true});
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -89,7 +88,7 @@ class CartonSubmit extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LocalText(context, 'box.sender.title',
|
child: LocalText(context, 'box.consignee.title',
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.normal),
|
fontWeight: FontWeight.normal),
|
||||||
@@ -97,7 +96,7 @@ class CartonSubmit extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 13),
|
padding: const EdgeInsets.only(left: 13),
|
||||||
child: LocalText(context, 'box.consignee.title',
|
child: LocalText(context, 'box.sender.title',
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.normal),
|
fontWeight: FontWeight.normal),
|
||||||
@@ -115,33 +114,6 @@ class CartonSubmit extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(sender.name ?? "",
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16.0, fontWeight: FontWeight.w500)),
|
|
||||||
sender.fcsID == null
|
|
||||||
? const SizedBox()
|
|
||||||
: Text(sender.fcsID!,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 14.0, color: Colors.grey)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// billToValue == billToSender
|
|
||||||
// ? billWidget(context)
|
|
||||||
// : const SizedBox()
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 15),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -164,8 +136,36 @@ class CartonSubmit extends StatelessWidget {
|
|||||||
// ? billWidget(context)
|
// ? billWidget(context)
|
||||||
// : const SizedBox()
|
// : const SizedBox()
|
||||||
],
|
],
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(sender.name ?? "",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.w500)),
|
||||||
|
sender.fcsID == null
|
||||||
|
? const SizedBox()
|
||||||
|
: Text(sender.fcsID!,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// billToValue == billToSender
|
||||||
|
// ? billWidget(context)
|
||||||
|
// : const SizedBox()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
))
|
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import '../../domain/entities/user.dart';
|
|||||||
import '../main/util.dart';
|
import '../main/util.dart';
|
||||||
import '../widgets/barcode_scanner.dart';
|
import '../widgets/barcode_scanner.dart';
|
||||||
import '../widgets/continue_button.dart';
|
import '../widgets/continue_button.dart';
|
||||||
import '../widgets/display_text.dart';
|
|
||||||
import '../widgets/local_title.dart';
|
import '../widgets/local_title.dart';
|
||||||
import '../widgets/previous_button.dart';
|
import '../widgets/previous_button.dart';
|
||||||
import 'model/package_selection_model.dart';
|
import 'model/package_selection_model.dart';
|
||||||
@@ -28,14 +27,14 @@ class PackageSelectionWidget extends StatefulWidget {
|
|||||||
final OnContinue? onContinue;
|
final OnContinue? onContinue;
|
||||||
|
|
||||||
const PackageSelectionWidget({
|
const PackageSelectionWidget({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.packages,
|
required this.packages,
|
||||||
this.onPrevious,
|
this.onPrevious,
|
||||||
this.onContinue,
|
this.onContinue,
|
||||||
required this.shipment,
|
required this.shipment,
|
||||||
required this.sender,
|
required this.sender,
|
||||||
required this.consignee,
|
required this.consignee,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PackageSelectionWidget> createState() => _PackageSelectionWidgetState();
|
State<PackageSelectionWidget> createState() => _PackageSelectionWidgetState();
|
||||||
@@ -109,30 +108,25 @@ class _PackageSelectionWidgetState extends State<PackageSelectionWidget> {
|
|||||||
List<Package> searchResults = model.packages;
|
List<Package> searchResults = model.packages;
|
||||||
List<Package> selectedPackageList = model.selectedPackages;
|
List<Package> selectedPackageList = model.selectedPackages;
|
||||||
|
|
||||||
final senderBox = DisplayText(
|
final senderBox = userDisplayBox(context,
|
||||||
text: widget.sender.name,
|
lableKey: "box.sender.title",
|
||||||
labelTextKey: "box.sender.title",
|
icon: MaterialCommunityIcons.account_arrow_right,
|
||||||
iconData: MaterialCommunityIcons.account_arrow_right,
|
showLink: false,
|
||||||
subText: Text(widget.sender.fcsID!,
|
name: widget.sender.name ?? "",
|
||||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
fcsID: widget.sender.fcsID ?? "");
|
||||||
);
|
|
||||||
|
|
||||||
final consigneeBox = DisplayText(
|
final consigneeBox = userDisplayBox(context,
|
||||||
text: widget.consignee.name,
|
showLink: false,
|
||||||
labelTextKey: "box.consignee.title",
|
lableKey: "box.consignee.title",
|
||||||
iconData: MaterialCommunityIcons.account_arrow_left,
|
icon: MaterialCommunityIcons.account_arrow_left,
|
||||||
subText: Text(widget.consignee.fcsID!,
|
name: widget.consignee.name,
|
||||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
fcsID: widget.consignee.fcsID);
|
||||||
);
|
|
||||||
|
|
||||||
final userRow = Row(
|
final userRow = Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(flex: 2, child: consigneeBox),
|
||||||
child: senderBox,
|
Flexible(child: senderBox)
|
||||||
flex: 2,
|
|
||||||
),
|
|
||||||
Flexible(child: consigneeBox)
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -21,27 +21,27 @@ import 'fcs_shipment_editor.dart';
|
|||||||
|
|
||||||
class FcsShipmentInfo extends StatefulWidget {
|
class FcsShipmentInfo extends StatefulWidget {
|
||||||
final FcsShipment fcsShipment;
|
final FcsShipment fcsShipment;
|
||||||
FcsShipmentInfo({required this.fcsShipment});
|
const FcsShipmentInfo({super.key, required this.fcsShipment});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_FcsShipmentInfoState createState() => _FcsShipmentInfoState();
|
_FcsShipmentInfoState createState() => _FcsShipmentInfoState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
var dateFormatter = DateFormat('dd MMM yyyy');
|
||||||
final NumberFormat numberFormatter = NumberFormat("#,###");
|
final NumberFormat numberFormatter = NumberFormat("#,###");
|
||||||
|
|
||||||
late FcsShipment _fcsShipment;
|
late FcsShipment _fcsShipment;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
TextEditingController _shipmentNumberController = new TextEditingController();
|
TextEditingController shipmentNumberController = TextEditingController();
|
||||||
TextEditingController _cutoffDateController = new TextEditingController();
|
TextEditingController cutoffDateController = TextEditingController();
|
||||||
TextEditingController _arrivalDateController = new TextEditingController();
|
TextEditingController arrivalDateController = TextEditingController();
|
||||||
TextEditingController _departureDateControler = new TextEditingController();
|
TextEditingController departureDateControler = TextEditingController();
|
||||||
TextEditingController _shipmentTypeControler = new TextEditingController();
|
TextEditingController shipmentTypeControler = TextEditingController();
|
||||||
TextEditingController _consigneeController = new TextEditingController();
|
TextEditingController consigneeController = TextEditingController();
|
||||||
TextEditingController _portController = new TextEditingController();
|
TextEditingController portController = TextEditingController();
|
||||||
TextEditingController _destinationController = new TextEditingController();
|
TextEditingController destinationController = TextEditingController();
|
||||||
TextEditingController _statusController = new TextEditingController();
|
TextEditingController statusController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -51,21 +51,24 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_load() {
|
_load() {
|
||||||
_shipmentNumberController.text = _fcsShipment.shipmentNumber ?? "";
|
shipmentNumberController.text = _fcsShipment.shipmentNumber ?? "";
|
||||||
if (_fcsShipment.cutoffDate != null)
|
if (_fcsShipment.cutoffDate != null) {
|
||||||
_cutoffDateController.text =
|
cutoffDateController.text =
|
||||||
dateFormatter.format(_fcsShipment.cutoffDate!);
|
dateFormatter.format(_fcsShipment.cutoffDate!);
|
||||||
if (_fcsShipment.etaDate != null)
|
}
|
||||||
_arrivalDateController.text = dateFormatter.format(_fcsShipment.etaDate!);
|
if (_fcsShipment.etaDate != null) {
|
||||||
if (_fcsShipment.departureDate != null)
|
arrivalDateController.text = dateFormatter.format(_fcsShipment.etaDate!);
|
||||||
_departureDateControler.text =
|
}
|
||||||
|
if (_fcsShipment.departureDate != null) {
|
||||||
|
departureDateControler.text =
|
||||||
dateFormatter.format(_fcsShipment.departureDate!);
|
dateFormatter.format(_fcsShipment.departureDate!);
|
||||||
|
}
|
||||||
|
|
||||||
_shipmentTypeControler.text = _fcsShipment.shipmentTypeName ?? "";
|
shipmentTypeControler.text = _fcsShipment.shipmentTypeName ?? "";
|
||||||
_consigneeController.text = _fcsShipment.consigneeName ?? '';
|
consigneeController.text = _fcsShipment.consigneeName ?? '';
|
||||||
_portController.text = _fcsShipment.loadingPortName ?? '';
|
portController.text = _fcsShipment.loadingPortName ?? '';
|
||||||
_destinationController.text = _fcsShipment.destinationPortName ?? '';
|
destinationController.text = _fcsShipment.destinationPortName ?? '';
|
||||||
_statusController.text = _fcsShipment.status ?? "";
|
statusController.text = _fcsShipment.status ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -76,12 +79,12 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cutoffDateDBox = DisplayText(
|
final cutoffDateDBox = DisplayText(
|
||||||
text: _cutoffDateController.text,
|
text: cutoffDateController.text,
|
||||||
labelTextKey: "FCSshipment.cutoff_date",
|
labelTextKey: "FCSshipment.cutoff_date",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
);
|
);
|
||||||
final etaBox = DisplayText(
|
final etaBox = DisplayText(
|
||||||
text: _arrivalDateController.text,
|
text: arrivalDateController.text,
|
||||||
labelTextKey: "FCSshipment.ETA",
|
labelTextKey: "FCSshipment.ETA",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
);
|
);
|
||||||
@@ -99,31 +102,31 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final shipTypeBox = DisplayText(
|
final shipTypeBox = DisplayText(
|
||||||
text: _shipmentTypeControler.text,
|
text: shipmentTypeControler.text,
|
||||||
labelTextKey: "FCSshipment.shipment_type",
|
labelTextKey: "FCSshipment.shipment_type",
|
||||||
iconData: Ionicons.ios_airplane,
|
iconData: Ionicons.ios_airplane,
|
||||||
);
|
);
|
||||||
|
|
||||||
final consigneeBox = DisplayText(
|
final consigneeBox = DisplayText(
|
||||||
text: _consigneeController.text,
|
text: consigneeController.text,
|
||||||
labelTextKey: "FCSshipment.consignee",
|
labelTextKey: "FCSshipment.consignee",
|
||||||
iconData: Icons.work,
|
iconData: Icons.work,
|
||||||
);
|
);
|
||||||
|
|
||||||
final portBox = DisplayText(
|
final portBox = DisplayText(
|
||||||
text: _portController.text,
|
text: portController.text,
|
||||||
labelTextKey: "FCSshipment.port_of_loading",
|
labelTextKey: "FCSshipment.port_of_loading",
|
||||||
iconData: FontAwesomeIcons.ship,
|
iconData: FontAwesomeIcons.ship,
|
||||||
);
|
);
|
||||||
|
|
||||||
final destinationBox = DisplayText(
|
final destinationBox = DisplayText(
|
||||||
text: _destinationController.text,
|
text: destinationController.text,
|
||||||
labelTextKey: "FCSshipment.final_destination",
|
labelTextKey: "FCSshipment.final_destination",
|
||||||
iconData: MaterialCommunityIcons.location_enter,
|
iconData: MaterialCommunityIcons.location_enter,
|
||||||
);
|
);
|
||||||
|
|
||||||
final statusBox = DisplayText(
|
final statusBox = DisplayText(
|
||||||
text: _statusController.text,
|
text: statusController.text,
|
||||||
labelTextKey: "FCSshipment.status",
|
labelTextKey: "FCSshipment.status",
|
||||||
iconData: Feather.clock,
|
iconData: Feather.clock,
|
||||||
);
|
);
|
||||||
@@ -185,8 +188,15 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
|||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: LocalAppBar(
|
appBar: LocalAppBar(
|
||||||
titleWidget: Text(_shipmentNumberController.text,
|
titleWidget: Column(
|
||||||
style: TextStyle(fontSize: 20, color: primaryColor)),
|
children: [
|
||||||
|
LocalText(context, "FCSshipment.form.title",
|
||||||
|
fontSize: 20, color: primaryColor),
|
||||||
|
Text(shipmentNumberController.text,
|
||||||
|
style: TextStyle(fontSize: 15, color: Colors.black))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
labelColor: primaryColor,
|
labelColor: primaryColor,
|
||||||
arrowColor: primaryColor,
|
arrowColor: primaryColor,
|
||||||
|
|||||||
@@ -471,16 +471,22 @@ Widget userSearchBox(BuildContext context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget userDisplayBox(BuildContext context,
|
Widget userDisplayBox(BuildContext context,
|
||||||
{required String lableKey, IconData? icon, String? name, String? fcsID}) {
|
{required String lableKey,
|
||||||
|
IconData? icon,
|
||||||
|
String? name,
|
||||||
|
String? fcsID,
|
||||||
|
bool showLink = true}) {
|
||||||
return fcsID != null && fcsID != ""
|
return fcsID != null && fcsID != ""
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.only(top: 8.0, bottom: 8),
|
padding: const EdgeInsets.only(top: 8.0, bottom: 8),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
icon != null
|
||||||
|
? Padding(
|
||||||
padding: const EdgeInsets.only(right: 15),
|
padding: const EdgeInsets.only(right: 15),
|
||||||
child: Icon(icon, color: primaryColor)),
|
child: Icon(icon, color: primaryColor))
|
||||||
|
: const SizedBox(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -489,16 +495,18 @@ Widget userDisplayBox(BuildContext context,
|
|||||||
color: Colors.black54, fontSize: 15),
|
color: Colors.black54, fontSize: 15),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: null,
|
onTap: null,
|
||||||
child: Text(
|
child: Text(name ?? '',
|
||||||
name ?? '',
|
style: showLink
|
||||||
style: TextStyle(
|
? TextStyle(
|
||||||
shadows: [
|
shadows: [
|
||||||
Shadow(color: linkColor, offset: Offset(0, -2))
|
Shadow(
|
||||||
|
color: linkColor,
|
||||||
|
offset: Offset(0, -2))
|
||||||
],
|
],
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline,
|
||||||
decorationColor: linkColor),
|
decorationColor: linkColor)
|
||||||
),
|
: TextStyle(color: Colors.black)),
|
||||||
),
|
),
|
||||||
Text(fcsID,
|
Text(fcsID,
|
||||||
style: TextStyle(fontSize: 13, color: labelColor))
|
style: TextStyle(fontSize: 13, color: labelColor))
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ class DisplayText extends StatelessWidget {
|
|||||||
final bool? withBorder;
|
final bool? withBorder;
|
||||||
final Color? borderColor;
|
final Color? borderColor;
|
||||||
final Widget? icon;
|
final Widget? icon;
|
||||||
|
final bool showLabelLink;
|
||||||
|
final Function()? onTapLabel;
|
||||||
|
|
||||||
const DisplayText({
|
const DisplayText(
|
||||||
Key? key,
|
{super.key,
|
||||||
this.text,
|
this.text,
|
||||||
this.subText,
|
this.subText,
|
||||||
this.labelTextKey,
|
this.labelTextKey,
|
||||||
@@ -24,14 +26,31 @@ class DisplayText extends StatelessWidget {
|
|||||||
this.withBorder = false,
|
this.withBorder = false,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
this.icon,
|
this.icon,
|
||||||
|
this.showLabelLink = false,
|
||||||
}) : super(key: key);
|
this.onTapLabel});
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var languageModel = Provider.of<LanguageModel>(context);
|
var languageModel = Provider.of<LanguageModel>(context);
|
||||||
|
|
||||||
var labelStyle = languageModel.isEng
|
var labelStyle = languageModel.isEng
|
||||||
? TextStyle(color: Colors.black54, fontSize: 15)
|
? showLabelLink
|
||||||
|
? TextStyle(
|
||||||
|
color: Colors.transparent,
|
||||||
|
fontSize: 15,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
decorationColor: linkColor,
|
||||||
|
shadows: [Shadow(color: linkColor, offset: Offset(0, -2))],
|
||||||
|
)
|
||||||
|
: TextStyle(color: Colors.black54, fontSize: 15)
|
||||||
|
: showLabelLink
|
||||||
|
? TextStyle(
|
||||||
|
color: Colors.transparent,
|
||||||
|
fontFamily: "Myanmar3",
|
||||||
|
fontSize: 15,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
decorationColor: linkColor,
|
||||||
|
shadows: [Shadow(color: linkColor, offset: Offset(0, -2))],
|
||||||
|
)
|
||||||
: TextStyle(
|
: TextStyle(
|
||||||
color: Colors.black54, fontFamily: "Myanmar3", fontSize: 15);
|
color: Colors.black54, fontFamily: "Myanmar3", fontSize: 15);
|
||||||
var textStyle = languageModel.isEng
|
var textStyle = languageModel.isEng
|
||||||
@@ -54,26 +73,26 @@ class DisplayText extends StatelessWidget {
|
|||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
labelTextKey == null
|
labelTextKey == null
|
||||||
? Container()
|
? Container()
|
||||||
: Text(
|
: InkWell(
|
||||||
|
onTap: showLabelLink ? onTapLabel : null,
|
||||||
|
child: Text(
|
||||||
AppTranslations.of(context)!.text(labelTextKey!),
|
AppTranslations.of(context)!.text(labelTextKey!),
|
||||||
style: labelStyle,
|
style: labelStyle,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
text == null
|
text == null
|
||||||
? Container()
|
? Container()
|
||||||
: Text(
|
: Text(
|
||||||
text!,
|
text!,
|
||||||
style: textStyle,
|
style: textStyle,
|
||||||
),
|
),
|
||||||
subText == null
|
subText == null ? Container() : subText!,
|
||||||
? Container()
|
|
||||||
: subText!,
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user