update data table

This commit is contained in:
phyothandar
2021-09-13 11:09:32 +06:30
parent 5346cd10c5
commit d2b1900537
6 changed files with 76 additions and 73 deletions

View File

@@ -22,25 +22,26 @@ class _CargoTableState extends State<CargoTable> {
Widget build(BuildContext context) {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
child: DataTable(
headingRowHeight: 40,
columnSpacing: 50,
showCheckboxColumn: false,
columns: [
MyDataColumn(
DataColumn(
label: LocalText(
context,
"cargo.type",
color: Colors.grey,
),
),
MyDataColumn(
DataColumn(
label: LocalText(
context,
"cargo.qty",
color: Colors.grey,
),
),
MyDataColumn(
DataColumn(
label: LocalText(
context,
"cargo.weight",
@@ -53,21 +54,21 @@ class _CargoTableState extends State<CargoTable> {
);
}
List<MyDataRow> getCargoRows(BuildContext context) {
List<DataRow> getCargoRows(BuildContext context) {
if (widget.cargoTypes == null) {
return [];
}
double total = 0;
var rows = widget.cargoTypes!.map((c) {
total += c.weight;
return MyDataRow(
onSelectChanged: (bool selected) async {},
return DataRow(
onSelectChanged: (bool? selected) async {},
cells: [
MyDataCell(new Text(
DataCell(new Text(
c.name ?? "",
style: textStyle,
)),
MyDataCell(c.qty == null || c.qty == 0
DataCell(c.qty == null || c.qty == 0
? Center(
child: Text(
"-",
@@ -80,7 +81,7 @@ class _CargoTableState extends State<CargoTable> {
style: textStyle,
),
)),
MyDataCell(
DataCell(
Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2),
style: textStyle),
),
@@ -88,10 +89,10 @@ class _CargoTableState extends State<CargoTable> {
);
}).toList();
var totalRow = MyDataRow(
onSelectChanged: (bool selected) {},
var totalRow = DataRow(
onSelectChanged: (bool? selected) {},
cells: [
MyDataCell(Align(
DataCell(Align(
alignment: Alignment.centerRight,
child: LocalText(
context,
@@ -100,8 +101,8 @@ class _CargoTableState extends State<CargoTable> {
fontWeight: FontWeight.bold,
),
)),
MyDataCell(Text("")),
MyDataCell(
DataCell(Text("")),
DataCell(
Padding(
padding: const EdgeInsets.only(right: 48.0),
child: Align(