Skip to content

Commit 42d3a72

Browse files
committed
Fix analysis hints in flutter_html_table
1 parent f7ad078 commit 42d3a72

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/flutter_html_table/lib/flutter_html_table.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ Widget _layoutCells(RenderContext context, BoxConstraints constraints) {
3838
if (colWidth != null && colWidth.endsWith("%")) {
3939
if (!constraints.hasBoundedWidth) {
4040
// In a horizontally unbounded container; always wrap content instead of applying flex
41-
return IntrinsicContentTrackSize();
41+
return const IntrinsicContentTrackSize();
4242
}
4343
final percentageSize =
4444
double.tryParse(colWidth.substring(0, colWidth.length - 1));
4545
return percentageSize != null && !percentageSize.isNaN
4646
? FlexibleTrackSize(percentageSize * 0.01)
47-
: IntrinsicContentTrackSize();
47+
: const IntrinsicContentTrackSize();
4848
} else if (colWidth != null) {
4949
final fixedPxSize = double.tryParse(colWidth);
5050
return fixedPxSize != null
5151
? FixedTrackSize(fixedPxSize)
52-
: IntrinsicContentTrackSize();
52+
: const IntrinsicContentTrackSize();
5353
} else {
54-
return IntrinsicContentTrackSize();
54+
return const IntrinsicContentTrackSize();
5555
}
5656
});
5757
})
@@ -66,7 +66,7 @@ Widget _layoutCells(RenderContext context, BoxConstraints constraints) {
6666

6767
// All table rows have a height intrinsic to their (spanned) contents
6868
final rowSizes =
69-
List.generate(rows.length, (_) => IntrinsicContentTrackSize());
69+
List.generate(rows.length, (_) => const IntrinsicContentTrackSize());
7070

7171
// Calculate column bounds
7272
int columnMax = 0;
@@ -103,6 +103,10 @@ Widget _layoutCells(RenderContext context, BoxConstraints constraints) {
103103
columnColspanOffset[columni].clamp(1, columnMax - columni - 1);
104104
}
105105
cells.add(GridPlacement(
106+
columnStart: columni,
107+
columnSpan: min(child.colspan, columnMax - columni),
108+
rowStart: rowi,
109+
rowSpan: min(child.rowspan, rows.length - rowi),
106110
child: CssBoxWidget(
107111
style: child.style
108112
.merge(row.style), //TODO padding/decoration(color/border)
@@ -118,10 +122,6 @@ Widget _layoutCells(RenderContext context, BoxConstraints constraints) {
118122
),
119123
),
120124
),
121-
columnStart: columni,
122-
columnSpan: min(child.colspan, columnMax - columni),
123-
rowStart: rowi,
124-
rowSpan: min(child.rowspan, rows.length - rowi),
125125
));
126126
columnRowOffset[columni] = child.rowspan - 1;
127127
columnColspanOffset[columni] = child.colspan;
@@ -138,11 +138,11 @@ Widget _layoutCells(RenderContext context, BoxConstraints constraints) {
138138
// Create column tracks (insofar there were no colgroups that already defined them)
139139
List<TrackSize> finalColumnSizes = columnSizes.take(columnMax).toList();
140140
finalColumnSizes += List.generate(max(0, columnMax - finalColumnSizes.length),
141-
(_) => IntrinsicContentTrackSize());
141+
(_) => const IntrinsicContentTrackSize());
142142

143143
if (finalColumnSizes.isEmpty || rowSizes.isEmpty) {
144144
// No actual cells to show
145-
return SizedBox();
145+
return const SizedBox();
146146
}
147147

148148
return LayoutGrid(

0 commit comments

Comments
 (0)