build method
build will build a list of _scenarios
with a given layout
Implementation
Widget build() {
final requiredSize = requiredWidgetSize;
final numberOfDevices = _numberOfDevicesPerScenario;
assert(scenarios.length % numberOfDevices == 0,
'scenarios should always be divisible by number of devices');
final numberOfRequiredRows = scenarios.length ~/ numberOfDevices;
final scenarioRows = <Row>[];
for (var i = 0; i < numberOfRequiredRows; i++) {
final startRange = i * numberOfDevices;
scenarioRows.add(Row(
children: scenarios
.getRange(startRange, startRange + numberOfDevices)
.map((scenario) => scenario.widget)
.toList(),
));
}
return Align(
alignment: Alignment.topLeft,
child: Container(
width: requiredSize.width,
height: requiredSize.height,
color: bgColor ?? const Color(0xFFEEEEEE),
child: Column(
children: [
...scenarioRows,
],
),
),
);
}