calculateColumnCurrentBreakPointSizeFactor static method
int
calculateColumnCurrentBreakPointSizeFactor({
- required BSColumn column,
- required BSBreakPointLabels currentBreakPointLabel,
get a BSColumn's breakpoint size factor from the columns breakpoints, and the current breakpoint set by the BSContainer ex if current breakpoint xxl, and the column has breakpoints col-md-5, and col-sm-3, 5 will be returned
Implementation
static int calculateColumnCurrentBreakPointSizeFactor({
required BSColumn column,
required BSBreakPointLabels currentBreakPointLabel,
}) {
// get current breakpoint index
int currentBreakPointLabelIndex = BSBreakPointLabels.values.indexWhere(
(element) => element == currentBreakPointLabel,
);
// get column breakpoint indexes in order from xxl to col
List<List<int>> indexes = getColumBreakpointIndexes(
column: column,
);
// find the applicable breakpoint
for (int i = 0; i < indexes.length; i++) {
if (indexes[i][0] >= currentBreakPointLabelIndex) {
return indexes[i][1];
}
}
// for compiler, should not be called ever
// default is col-12 if nothing is entered
return 12;
}