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

@@ -28,17 +28,18 @@ class _CargoTableState extends State<CargoTable> {
double remainingWeight = 0;
@override
Widget build(BuildContext context) {
return MyDataTable(
return DataTable(
headingRowHeight: 40,
showCheckboxColumn: false,
columns: [
MyDataColumn(
DataColumn(
label: LocalText(
context,
"cargo.type",
color: Colors.grey,
),
),
MyDataColumn(
DataColumn(
label: Row(
children: [
Container(
@@ -57,7 +58,7 @@ class _CargoTableState extends State<CargoTable> {
);
}
List<MyDataRow> getCargoRows(BuildContext context) {
List<DataRow> getCargoRows(BuildContext context) {
if (widget.cargoTypes == null) {
return [];
}
@@ -67,10 +68,10 @@ class _CargoTableState extends State<CargoTable> {
var rows = widget.cargoTypes!.map((c) {
_total += c.weight;
return MyDataRow(
onSelectChanged: (bool selected) async {},
return DataRow(
onSelectChanged: (bool? selected) async {},
cells: [
MyDataCell(Row(
DataCell(Row(
children: [
new Text(
c.name ?? "",
@@ -82,7 +83,7 @@ class _CargoTableState extends State<CargoTable> {
),
],
)),
MyDataCell(
DataCell(
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
@@ -106,10 +107,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,
@@ -118,7 +119,7 @@ class _CargoTableState extends State<CargoTable> {
fontWeight: FontWeight.bold,
),
)),
MyDataCell(
DataCell(
Padding(
padding: const EdgeInsets.only(right: 40.0),
child: Align(
@@ -144,7 +145,8 @@ class _CargoTableState extends State<CargoTable> {
widget.cargoTypes!.forEach((c) {
_types.add(c.name!);
});
if (this._cargos.length == widget.cargoTypes!.length - 1) {
if (this._cargos.length ==
widget.cargoTypes!.length - 1) {
_types.forEach((t) {
if (!_list.contains(t)) {
widget.cargoTypes!.forEach((c) {