update ui

This commit is contained in:
tzw
2025-04-02 15:02:49 +06:30
parent 17ca3e2a3f
commit f1c5342ae4
16 changed files with 253 additions and 245 deletions

View File

@@ -21,7 +21,7 @@ import '../main/util.dart';
class FcsShipmentEditor extends StatefulWidget {
final FcsShipment? shipment;
FcsShipmentEditor({this.shipment});
const FcsShipmentEditor({super.key, this.shipment});
@override
_FcsShipmentEditorState createState() => _FcsShipmentEditorState();
@@ -29,14 +29,14 @@ class FcsShipmentEditor extends StatefulWidget {
class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final _formKey = GlobalKey<FormState>();
var dateFormatter = new DateFormat('dd MMM yyyy');
TextEditingController _shipmentNumberController = new TextEditingController();
TextEditingController _cutoffDateController = new TextEditingController();
TextEditingController _etaDateController = new TextEditingController();
var dateFormatter = DateFormat('dd MMM yyyy');
final _shipmentNumberController = TextEditingController();
final _cutoffDateController = TextEditingController();
final _etaDateController = TextEditingController();
TextEditingController _statusController = new TextEditingController();
final _statusController = TextEditingController();
FcsShipment _shipment = new FcsShipment();
FcsShipment _shipment = FcsShipment();
bool _isLoading = false;
ShipmentType? _currentShipmentType;
ShipmentConsignee? _currentConsignee;
@@ -52,11 +52,13 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
if (widget.shipment != null) {
_shipment = widget.shipment!;
_shipmentNumberController.text = _shipment.shipmentNumber ?? "";
if (_shipment.cutoffDate != null)
if (_shipment.cutoffDate != null) {
_cutoffDateController.text =
dateFormatter.format(_shipment.cutoffDate!);
if (_shipment.etaDate != null)
}
if (_shipment.etaDate != null) {
_etaDateController.text = dateFormatter.format(_shipment.etaDate!);
}
_statusController.text = _shipment.status ?? "";
@@ -111,6 +113,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final shipmentTypeBox = DropdownButtonFormField(
value: _currentShipmentType == "" ? null : _currentShipmentType,
style: TextStyle(fontSize: 14, color: Colors.black),
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
enabledBorder:
@@ -125,7 +128,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
AppTranslations.of(context)!.text('FCSshipment.shipment_type'),
icon: Icon(Ionicons.ios_airplane, color: primaryColor)),
items: shipmentTypes
.map((e) => DropdownMenuItem(child: Text(e.name), value: e))
.map((e) => DropdownMenuItem(value: e, child: Text(e.name)))
.toList(),
onChanged: (selected) => {
setState(() {
@@ -136,6 +139,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final consigneeBox = DropdownButtonFormField(
value: _currentConsignee == "" ? null : _currentConsignee,
style: TextStyle(fontSize: 14, color: Colors.black),
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
enabledBorder:
@@ -160,6 +164,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final loadingPortBox = DropdownButtonFormField(
value: _currentLoadingPort == "" ? null : _currentLoadingPort,
style: TextStyle(fontSize: 14, color: Colors.black),
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
enabledBorder:
@@ -185,6 +190,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
final destinationBox = DropdownButtonFormField(
value: _currentDestination == "" ? null : _currentDestination,
style: TextStyle(fontSize: 14, color: Colors.black),
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
enabledBorder:
@@ -293,7 +299,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
destinationBox,
SizedBox(height: 30),
_isNew ? createBtn : updateBtn,
SizedBox(height: 15)
SizedBox(height: 30)
]),
),
),

View File

@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:fcs/constants.dart';
import 'package:fcs/domain/entities/fcs_shipment.dart';
import 'package:fcs/helpers/theme.dart';
@@ -248,6 +250,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
padding: const EdgeInsets.only(left: 12.0, right: 12),
child: ListView(children: <Widget>[
statusBox,
const SizedBox(height: 5),
Row(mainAxisAlignment: MainAxisAlignment.end, children: [
Expanded(
child: cutoffDateDBox,
@@ -255,6 +258,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
),
Flexible(child: etaBox),
]),
const SizedBox(height: 5),
Row(
children: [
Expanded(
@@ -264,9 +268,13 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
Flexible(child: packageBox)
],
),
const SizedBox(height: 5),
shipTypeBox,
const SizedBox(height: 5),
consigneeBox,
const SizedBox(height: 5),
portBox,
const SizedBox(height: 5),
destinationBox,
const SizedBox(height: 30),
_fcsShipment.status == fcs_shipment_pending_status