94 lines
2.7 KiB
Dart
94 lines
2.7 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:fcs/model/do_model.dart';
|
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
|
import 'package:fcs/vo/do.dart';
|
|
import 'package:fcs/widget/local_text.dart';
|
|
import 'package:fcs/widget/my_data_table.dart';
|
|
import 'package:fcs/widget/number_cell.dart';
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
class DeliveryBarDetail extends StatefulWidget {
|
|
final DateTime date;
|
|
const DeliveryBarDetail(this.date);
|
|
@override
|
|
_DeliveryBarDetailState createState() => _DeliveryBarDetailState();
|
|
}
|
|
|
|
class _DeliveryBarDetailState extends State<DeliveryBarDetail> {
|
|
final numberFormatter = new NumberFormat("#,###");
|
|
var dateFormatter = new DateFormat('dd-MMM-yyyy');
|
|
bool _isLoading = false;
|
|
List<DOSubmission> dos = [];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
DOModel dOModel = Provider.of<DOModel>(context, listen: false);
|
|
dOModel.getDOForDelivery(widget.date).then((dos) {
|
|
setState(() {
|
|
this.dos = dos;
|
|
});
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return LocalProgress(
|
|
inAsyncCall: _isLoading,
|
|
child: Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: primaryColor,
|
|
title: LocalText(
|
|
context,
|
|
'delivery.detail.title',
|
|
translationVariables: [dateFormatter.format(widget.date)],
|
|
color: Colors.white,
|
|
fontSize: 18,
|
|
),
|
|
),
|
|
body: Container(
|
|
padding: EdgeInsets.only(top: 5),
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.vertical,
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
padding: EdgeInsets.only(left: 3),
|
|
child: MyDataTable(
|
|
columnSpacing: 20,
|
|
columns: [
|
|
MyDataColumn(label: LocalText(context, "do.name")),
|
|
MyDataColumn(label: LocalText(context, "do.do_num")),
|
|
MyDataColumn(
|
|
label: LocalText(context, "do.quantity"), numeric: true),
|
|
],
|
|
rows: getProductRow(),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
List<MyDataRow> getProductRow() {
|
|
return dos.map((d) {
|
|
var r = MyDataRow(
|
|
cells: [
|
|
MyDataCell(
|
|
new Text(d.userName, style: textStyle),
|
|
),
|
|
MyDataCell(
|
|
new Text(d.doNumber, style: textStyle),
|
|
),
|
|
MyDataCell(NumberCell(d.totalQty)),
|
|
],
|
|
);
|
|
|
|
return r;
|
|
}).toList();
|
|
}
|
|
}
|