122 lines
3.5 KiB
Dart
122 lines
3.5 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:http/http.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:fcs/model/chart_model.dart';
|
|
import 'package:fcs/theme/theme.dart';
|
|
import 'package:fcs/vo/po_do_count.dart';
|
|
import 'package:fcs/widget/local_text.dart';
|
|
import 'package:fcs/widget/my_data_table.dart';
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
class POLineDetail extends StatefulWidget {
|
|
const POLineDetail();
|
|
@override
|
|
_POLineDetailState createState() => _POLineDetailState();
|
|
}
|
|
|
|
class _POLineDetailState extends State<POLineDetail> {
|
|
final numberFormatter = new NumberFormat("#,###");
|
|
var dateFormatter = new DateFormat('dd MMM yyyy');
|
|
bool _isLoading = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var chartModel = Provider.of<ChartModel>(context);
|
|
|
|
return LocalProgress(
|
|
inAsyncCall: _isLoading,
|
|
child: Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: primaryColor,
|
|
title: LocalText(
|
|
context,
|
|
'po.counts',
|
|
color: Colors.white,
|
|
fontSize: 18,
|
|
),
|
|
),
|
|
body: Container(
|
|
child: ListView(
|
|
children: <Widget>[
|
|
Column(
|
|
children: <Widget>[
|
|
Container(
|
|
padding: EdgeInsets.only(top: 20, left: 20, right: 20),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
LocalText(context, "chart.date"),
|
|
LocalText(context, "po.total_count")
|
|
],
|
|
),
|
|
),
|
|
Column(
|
|
children: getRowTotalCountWidget(
|
|
chartModel.podoCount.getPOTotalCounts()),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
));
|
|
}
|
|
|
|
List<Widget> getRowTotalCountWidget(List<TotalCountData> data) {
|
|
return data.map((d) {
|
|
return Container(
|
|
child: ExpansionTile(
|
|
title: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
Text(dateFormatter.format(d.date), style: textStyle),
|
|
Text(numberFormatter.format(d.totalCount), style: textStyle),
|
|
],
|
|
),
|
|
children: <Widget>[
|
|
SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: MyDataTable(
|
|
columnSpacing: 100,
|
|
columns: [
|
|
MyDataColumn(label: LocalText(context, "po.count.status")),
|
|
MyDataColumn(label: LocalText(context, "po.count")),
|
|
],
|
|
rows: getStatusRow(d.detailCountsList),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}).toList();
|
|
}
|
|
|
|
List<MyDataRow> getStatusRow(List<CountData> po) {
|
|
po.sort((a, b) => a.status.compareTo(b.status));
|
|
return po.map((p) {
|
|
var r = MyDataRow(
|
|
cells: [
|
|
MyDataCell(
|
|
new Text(p.status, style: textStyle),
|
|
),
|
|
MyDataCell(
|
|
new Text(
|
|
p.count != null ? numberFormatter.format(p.count) : '0',
|
|
style: textStyle,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
|
|
return r;
|
|
}).toList();
|
|
}
|
|
}
|