-
Notifications
You must be signed in to change notification settings - Fork 1
/
helpers.dart
50 lines (46 loc) · 1.19 KB
/
helpers.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import 'package:flutter/material.dart';
/// Generates empty columns using the specified columnCount,
/// if no column count is provided, it uses the [columns.length] value
columnBlueprint(columnCount, columns) {
var data = List.generate(
columnCount, (index) => {'title': '', 'index': index, 'key': index});
columns = [...data];
return columns;
}
/// Generates empty rows from rowCount values provided
rowBlueprint(int rowCount, columns, rows) {
List sampleRow = [];
for (var i = 0; i < rowCount; i++) {
var item = {};
columns.forEach((element) {
item[element['key']] = '';
});
sampleRow.add(item);
}
rows = [...sampleRow];
return rows;
}
/// adds a row to existing row lists
addOneRow(columns, rows) {
var item = {};
columns.forEach((element) {
item[element['key']] = '';
});
rows.add(item);
return rows;
}
///Create an empty column for saveIcon
Widget iconColumn(showSaveIcon, thPaddingTop, thPaddingBottom) {
return Visibility(
visible: showSaveIcon,
child: Flexible(
fit: FlexFit.loose,
child: Padding(
padding: EdgeInsets.only(
top: thPaddingTop,
bottom: thPaddingBottom,
),
),
),
);
}