debugLogBreakpointSegments static method
Print a visual view of breakpointSegments
for debugging purposes.
Implementation
static String debugLogBreakpointSegments(
List<ResponsiveBreakpointSegment> responsiveBreakpointSegments) {
var stringBuffer = StringBuffer();
stringBuffer.write('|');
for (int i = 0; i < responsiveBreakpointSegments.length; i++) {
// Convenience variable.
ResponsiveBreakpointSegment segment = responsiveBreakpointSegments[i];
stringBuffer.write(segment.breakpoint.round());
List<dynamic> attributes = [];
String? name = segment.responsiveBreakpoint.name;
if (name != null) attributes.add(name);
double scaleFactor = segment.responsiveBreakpoint.scaleFactor;
if (scaleFactor != 1) attributes.add(scaleFactor);
if (attributes.isNotEmpty) {
stringBuffer.write('(');
for (int i = 0; i < attributes.length; i++) {
stringBuffer.write(attributes[i]);
if (i != attributes.length - 1) stringBuffer.write('|');
}
stringBuffer.write(')');
}
stringBuffer.write(' ----- ');
if (segment.segmentType == ResponsiveBreakpointBehavior.AUTOSCALEDOWN &&
segment.breakpoint < segment.responsiveBreakpoint.breakpoint) {
stringBuffer.write(
'${describeEnum(segment.segmentType)} from ${segment.responsiveBreakpoint.breakpoint.round()}');
} else {
stringBuffer.write(describeEnum(segment.responsiveBreakpoint.behavior));
}
if (i != responsiveBreakpointSegments.length - 1) {
stringBuffer.write(' ----- ');
}
}
stringBuffer.write(' ----- ∞ |');
debugPrint(stringBuffer.toString());
return stringBuffer.toString();
}