getGutterScrollMargins function
Calculate combined scroll margins from all gutter sources.
Implementation
GutterScrollMargins getGutterScrollMargins(
EditorState state,
GutterWidthInfo info,
) {
var left = 0.0, right = 0.0, top = 0.0, bottom = 0.0;
for (final source in state.facet(gutterScrollMargins)) {
final m = source(info);
if (m != null) {
if (m.left > left) left = m.left;
if (m.right > right) right = m.right;
if (m.top > top) top = m.top;
if (m.bottom > bottom) bottom = m.bottom;
}
}
// Add gutter widths based on text direction if fixed
if (info.fixed) {
if (info.textDirection == Direction.ltr) {
left += info.beforeWidth;
right += info.afterWidth;
} else {
right += info.beforeWidth;
left += info.afterWidth;
}
}
return GutterScrollMargins(left: left, right: right, top: top, bottom: bottom);
}