Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/src/ast/nodes/left_right.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class LeftRightNode extends SlotableNode<EquationRowNode> {
// Delimiter
return LineElement(
customCrossSize: (height, depth) {
if (!height.isFinite || !depth.isFinite) {
return const BoxConstraints(minHeight: 20.0);
}
final delta = math.max(height - a, depth + a);
final delimeterFullHeight = math.max(delta / 500 * delimiterFactor,
2 * delta - delimiterShorfall.toLpUnder(options));
Expand All @@ -61,7 +64,7 @@ class LeftRightNode extends SlotableNode<EquationRowNode> {
: getSpacingSize(index == 0 ? AtomType.open : AtomType.rel,
body[(index + 1) ~/ 2].leftType, options.style)
.toLpUnder(options),
child: LayoutBuilderPreserveBaseline(
child: LayoutBuilder(
builder: (context, constraints) => buildCustomSizedDelimWidget(
index == 0
? leftDelim
Expand Down
4 changes: 3 additions & 1 deletion lib/src/ast/nodes/sqrt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SqrtNode extends SlotableNode {
// so 'SelectionManagerMixin.getRenderLineAtOffset' can find
// render lines in the base widget
child: IgnorePointer(
child: LayoutBuilderPreserveBaseline(
child: LayoutBuilder(
builder: (context, constraints) => sqrtSvg(
minDelimiterHeight: constraints.minHeight,
baseWidth: constraints.minWidth,
Expand Down Expand Up @@ -136,13 +136,15 @@ enum _SqrtPos {
class SqrtLayoutDelegate extends CustomLayoutDelegate<_SqrtPos> {
final MathOptions options;
final MathOptions baseOptions;

// final MathOptions indexOptions;

SqrtLayoutDelegate({
required this.options,
required this.baseOptions,
// required this.indexOptions,
});

var heightAboveBaseline = 0.0;
var svgHorizontalPos = 0.0;
var svgVerticalPos = 0.0;
Expand Down
2 changes: 0 additions & 2 deletions lib/src/render/layout/layout_builder_baseline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class LayoutBuilderPreserveBaseline
class _RenderLayoutBuilderPreserveBaseline extends RenderBox
with
RenderObjectWithChildMixin<RenderBox>,
RenderObjectWithLayoutCallbackMixin,
RenderConstrainedLayoutBuilder<BoxConstraints, RenderBox> {
@override
double? computeDistanceToActualBaseline(TextBaseline baseline) =>
Expand Down Expand Up @@ -60,7 +59,6 @@ class _RenderLayoutBuilderPreserveBaseline extends RenderBox
@override
void performLayout() {
final constraints = this.constraints;
runLayoutCallback();
if (child != null) {
child!.layout(constraints, parentUsesSize: true);
size = constraints.constrain(child!.size);
Expand Down
4 changes: 3 additions & 1 deletion lib/src/render/layout/line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class LineParentData extends ContainerBoxParentData<RenderBox> {

bool alignerOrSpacer = false;

late BoxConstraints constraints;

@override
String toString() =>
'${super.toString()}; canBreakBefore = $canBreakBefore; customSize = ${customCrossSize != null}; trailingMargin = $trailingMargin; alignerOrSpacer = $alignerOrSpacer';
Expand Down Expand Up @@ -340,7 +342,7 @@ class RenderLine extends RenderBox
} else if (childParentData.alignerOrSpacer) {
alignerAndSpacers.add(child);
} else {
final childSize = child.getLayoutSize(infiniteConstraint, dry: dry);
final childSize = child.getLayoutSize(constraints.loosen(), dry: dry);
sizeMap[child] = childSize;
final distance = dry ? 0.0 : child.getDistanceToBaseline(textBaseline)!;
maxHeightAboveBaseline = math.max(maxHeightAboveBaseline, distance);
Expand Down