add fcs shipment info
This commit is contained in:
206
lib/pages/fcs_shipment/fcs_shipment_info.dart
Normal file
206
lib/pages/fcs_shipment/fcs_shipment_info.dart
Normal file
@@ -0,0 +1,206 @@
|
||||
import 'package:fcs/domain/entities/fcs_shipment.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/popupmenu.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'fcs_shipment_editor.dart';
|
||||
|
||||
class FcsShipmentInfo extends StatefulWidget {
|
||||
final FcsShipment fcsShipment;
|
||||
FcsShipmentInfo({this.fcsShipment});
|
||||
|
||||
@override
|
||||
_FcsShipmentInfoState createState() => _FcsShipmentInfoState();
|
||||
}
|
||||
|
||||
class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
FcsShipment _fcsShipment;
|
||||
bool _isLoading = false;
|
||||
TextEditingController _shipmentNumberController = new TextEditingController();
|
||||
TextEditingController _cutoffDateController = new TextEditingController();
|
||||
TextEditingController _arrivalDateController = new TextEditingController();
|
||||
TextEditingController _departureDateControler = new TextEditingController();
|
||||
TextEditingController _shipmentTypeControler = new TextEditingController();
|
||||
TextEditingController _consigneeController = new TextEditingController();
|
||||
TextEditingController _portController = new TextEditingController();
|
||||
TextEditingController _destinationController = new TextEditingController();
|
||||
TextEditingController _statusController = new TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fcsShipment = widget.fcsShipment;
|
||||
_shipmentNumberController.text = _fcsShipment.shipmentNumber;
|
||||
_cutoffDateController.text = dateFormatter.format(_fcsShipment.cutoffDate);
|
||||
_arrivalDateController.text =
|
||||
dateFormatter.format(_fcsShipment.arrivalDate);
|
||||
_departureDateControler.text =
|
||||
dateFormatter.format(_fcsShipment.departureDate);
|
||||
_shipmentTypeControler.text = _fcsShipment.shipType;
|
||||
_consigneeController.text = _fcsShipment.consignee;
|
||||
_portController.text = _fcsShipment.port;
|
||||
_destinationController.text = _fcsShipment.destination;
|
||||
_statusController.text = _fcsShipment.status;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final shipmentNumberBox = DisplayText(
|
||||
text: _shipmentNumberController.text,
|
||||
labelTextKey: "FCSshipment.number",
|
||||
iconData: Ionicons.ios_airplane,
|
||||
);
|
||||
final cutoffDateDBox = DisplayText(
|
||||
text: _cutoffDateController.text,
|
||||
labelTextKey: "FCSshipment.cutoff_date",
|
||||
iconData: Icons.date_range,
|
||||
);
|
||||
final etaBox = DisplayText(
|
||||
text: _arrivalDateController.text,
|
||||
labelTextKey: "FCSshipment.ETA",
|
||||
iconData: Icons.date_range,
|
||||
);
|
||||
|
||||
final departureDateBox = DisplayText(
|
||||
text: _departureDateControler.text,
|
||||
labelTextKey: "FCSshipment.departure_date",
|
||||
iconData: Icons.date_range,
|
||||
);
|
||||
|
||||
final shipTypeBox = DisplayText(
|
||||
text: _shipmentTypeControler.text,
|
||||
labelTextKey: "FCSshipment.shipment_type",
|
||||
iconData: Ionicons.ios_airplane,
|
||||
);
|
||||
|
||||
final consigneeBox = DisplayText(
|
||||
text: _consigneeController.text,
|
||||
labelTextKey: "FCSshipment.consignee",
|
||||
iconData: Icons.work,
|
||||
);
|
||||
|
||||
final portBox = DisplayText(
|
||||
text: _portController.text,
|
||||
labelTextKey: "FCSshipment.port_of_loading",
|
||||
iconData: FontAwesomeIcons.ship,
|
||||
);
|
||||
|
||||
final destinationBox = DisplayText(
|
||||
text: _destinationController.text,
|
||||
labelTextKey: "FCSshipment.final_destination",
|
||||
iconData: MaterialCommunityIcons.location_enter,
|
||||
);
|
||||
|
||||
final statusBox = DisplayText(
|
||||
text: _statusController.text,
|
||||
labelTextKey: "FCSshipment.status",
|
||||
iconData: Icons.av_timer,
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
title: LocalText(
|
||||
context,
|
||||
"FCSshipment.form.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
onPressed: _edit,
|
||||
),
|
||||
menuPopWidget(context)
|
||||
],
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(children: <Widget>[
|
||||
shipmentNumberBox,
|
||||
cutoffDateDBox,
|
||||
etaBox,
|
||||
departureDateBox,
|
||||
shipTypeBox,
|
||||
consigneeBox,
|
||||
portBox,
|
||||
destinationBox,
|
||||
statusBox,
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
]),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_edit() async {
|
||||
await Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => FcsShipmentEditor(shipment: _fcsShipment)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget menuPopWidget(BuildContext context) {
|
||||
return PopupMenuButton<PopupMenu>(
|
||||
elevation: 3.2,
|
||||
icon: Icon(Icons.more_vert, color: primaryColor),
|
||||
tooltip: 'This is tooltip',
|
||||
onSelected: (choice) {
|
||||
print(choice.id);
|
||||
if (choice.id == 1) {
|
||||
} else if (choice.id == 2) {
|
||||
} else if (choice.id == 3) {
|
||||
} else if (choice.id == 4) {}
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
return menuPopup.map((PopupMenu choice) {
|
||||
return PopupMenuItem<PopupMenu>(
|
||||
value: choice,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 15),
|
||||
child: LocalText(
|
||||
context,
|
||||
choice.status,
|
||||
color: primaryColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user