Skip to content

Commit 59792c6

Browse files
removeRowIcon added which enables removing rows seperately.
1 parent 25612b1 commit 59792c6

File tree

6 files changed

+791
-738
lines changed

6 files changed

+791
-738
lines changed

lib/commons/constants.dart

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
int iconColumnIndex = 1;
1+
int iconColumnIndex = 1;

lib/commons/helpers.dart

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

lib/commons/math_functions.dart

100644100755
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
class MathFunctions {
2-
int addtion(List<int> items) {
3-
int sum = items.fold(0, (p, c) => p + c);
4-
return sum;
5-
}
6-
7-
int subtraction(List<int> items) {
8-
int diff = items.fold(0, (p, c) => c - p);
9-
return diff;
10-
}
11-
}
12-
13-
List<int> test = [1, 2, 3];
14-
15-
MathFunctions math = MathFunctions();
16-
final sum = math.addtion(test);
1+
class MathFunctions {
2+
int addtion(List<int> items) {
3+
int sum = items.fold(0, (p, c) => p + c);
4+
return sum;
5+
}
6+
7+
int subtraction(List<int> items) {
8+
int diff = items.fold(0, (p, c) => c - p);
9+
return diff;
10+
}
11+
}
12+
13+
List<int> test = [1, 2, 3];
14+
15+
MathFunctions math = MathFunctions();
16+
final sum = math.addtion(test);

0 commit comments

Comments
 (0)