164 lines
6.0 KiB
Dart
164 lines
6.0 KiB
Dart
|
|
import 'package:fcs/vo/shipment.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:intl/intl.dart';
|
||
|
|
import 'package:provider/provider.dart';
|
||
|
|
import 'package:fcs/theme/theme.dart';
|
||
|
|
import 'package:fcs/widget/progress.dart';
|
||
|
|
|
||
|
|
import '../../model/announcement_model.dart';
|
||
|
|
import '../../widget/local_text.dart';
|
||
|
|
import '../util.dart';
|
||
|
|
|
||
|
|
class ShipmentList extends StatefulWidget {
|
||
|
|
@override
|
||
|
|
_ShipmentListState createState() => _ShipmentListState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _ShipmentListState extends State<ShipmentList> {
|
||
|
|
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||
|
|
final double dotSize = 10.0;
|
||
|
|
String status;
|
||
|
|
|
||
|
|
bool _isLoading = false;
|
||
|
|
|
||
|
|
@override
|
||
|
|
void initState() {
|
||
|
|
super.initState();
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
void dispose() {
|
||
|
|
super.dispose();
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
var shipmentModel = Provider.of<AnnouncementModel>(context);
|
||
|
|
final addbutton = Container(
|
||
|
|
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
|
||
|
|
child: Container(
|
||
|
|
height: 45.0,
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: primaryColor,
|
||
|
|
shape: BoxShape.rectangle,
|
||
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0))),
|
||
|
|
child: ButtonTheme(
|
||
|
|
minWidth: 900.0,
|
||
|
|
height: 100.0,
|
||
|
|
child: FlatButton(
|
||
|
|
onPressed: () {
|
||
|
|
// Navigator.push(
|
||
|
|
// context,
|
||
|
|
// MaterialPageRoute(
|
||
|
|
// builder: (context) => ManualPage(
|
||
|
|
// marketplace: 'Amazon',
|
||
|
|
// )));
|
||
|
|
},
|
||
|
|
child: LocalText(
|
||
|
|
context,
|
||
|
|
'shipment.add',
|
||
|
|
color: Colors.white,
|
||
|
|
fontSize: 16,
|
||
|
|
fontWeight: FontWeight.bold,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
|
||
|
|
return LocalProgress(
|
||
|
|
inAsyncCall: _isLoading,
|
||
|
|
child: Scaffold(
|
||
|
|
appBar: AppBar(
|
||
|
|
backgroundColor: primaryColor,
|
||
|
|
title: LocalText(context, 'shipment.title',
|
||
|
|
fontSize: 18, color: Colors.white),
|
||
|
|
),
|
||
|
|
body: Column(
|
||
|
|
children: <Widget>[
|
||
|
|
Expanded(
|
||
|
|
child: new ListView.builder(
|
||
|
|
scrollDirection: Axis.vertical,
|
||
|
|
padding: EdgeInsets.only(left: 15, right: 15, top: 15),
|
||
|
|
shrinkWrap: true,
|
||
|
|
itemCount: shipmentModel.shipments.length,
|
||
|
|
itemBuilder: (BuildContext context, int index) {
|
||
|
|
Shipment _shipment = shipmentModel.shipments[index];
|
||
|
|
return Card(
|
||
|
|
elevation: 10,
|
||
|
|
color: Colors.white,
|
||
|
|
child: InkWell(
|
||
|
|
onTap: () {
|
||
|
|
// Navigator.push(
|
||
|
|
// context,
|
||
|
|
// MaterialPageRoute(
|
||
|
|
// builder: (context) => POSubmissionForm(
|
||
|
|
// poSubmission: _shipment,
|
||
|
|
// )),
|
||
|
|
// );
|
||
|
|
},
|
||
|
|
child: Row(
|
||
|
|
children: <Widget>[
|
||
|
|
Expanded(
|
||
|
|
child: new Padding(
|
||
|
|
padding:
|
||
|
|
const EdgeInsets.symmetric(vertical: 16.0),
|
||
|
|
child: new Row(
|
||
|
|
children: <Widget>[
|
||
|
|
new Padding(
|
||
|
|
padding: new EdgeInsets.symmetric(
|
||
|
|
horizontal: 15.0 - dotSize / 2),
|
||
|
|
child: Padding(
|
||
|
|
padding: EdgeInsets.all(5.0),
|
||
|
|
child: Image.asset(
|
||
|
|
"assets/truck.png",
|
||
|
|
width: 40,
|
||
|
|
height: 40,
|
||
|
|
color: primaryColor,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
new Expanded(
|
||
|
|
child: new Column(
|
||
|
|
crossAxisAlignment:
|
||
|
|
CrossAxisAlignment.start,
|
||
|
|
children: <Widget>[
|
||
|
|
new Text(
|
||
|
|
_shipment.shipmentNumber.toString(),
|
||
|
|
style: new TextStyle(
|
||
|
|
fontSize: 12.0,
|
||
|
|
color: Colors.black),
|
||
|
|
),
|
||
|
|
new Text(
|
||
|
|
dateFormatter
|
||
|
|
.format(_shipment.shipDate),
|
||
|
|
style: new TextStyle(
|
||
|
|
fontSize: 12.0,
|
||
|
|
color: Colors.grey),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.only(right: 18.0),
|
||
|
|
child: getStatus(_shipment.status),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}),
|
||
|
|
),
|
||
|
|
addbutton,
|
||
|
|
SizedBox(height: 15)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|