浏览代码

fix .Value problems

/siyaoH-1.17-PlatformMessage
guanghuispark 4 年前
当前提交
7e74af2e
共有 9 个文件被更改,包括 25 次插入25 次删除
  1. 4
      com.unity.uiwidgets/Runtime/painting/placeholder_span.cs
  2. 4
      com.unity.uiwidgets/Runtime/painting/text_painter.cs
  3. 4
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  4. 12
      com.unity.uiwidgets/Runtime/rendering/flex.cs
  5. 14
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  6. 2
      com.unity.uiwidgets/Runtime/rendering/shifted_box.cs
  7. 2
      com.unity.uiwidgets/Runtime/rendering/sliver_fixed_extent_list.cs
  8. 6
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs
  9. 2
      com.unity.uiwidgets/Runtime/widgets/widget_span.cs

4
com.unity.uiwidgets/Runtime/painting/placeholder_span.cs


namespace Unity.UIWidgets.painting {
abstract class PlaceholderSpan : InlineSpan {
public PlaceholderSpan(
TextBaseline? baseline = null,
TextBaseline baseline = TextBaseline.alphabetic,
TextStyle style = null,
PlaceholderAlignment alignment = PlaceholderAlignment.bottom

public PlaceholderAlignment alignment;
public TextBaseline? baseline;
public TextBaseline baseline;
public override void computeToPlainText(
StringBuilder buffer,

4
com.unity.uiwidgets/Runtime/painting/text_painter.cs


public class TextPainter {
InlineSpan _text;
TextAlign? _textAlign;
TextAlign _textAlign;
TextDirection? _textDirection;
float _textScaleFactor;
Paragraph _layoutTemplate;

}
}
public TextAlign? textAlign {
public TextAlign textAlign {
get { return _textAlign; }
set {
if (_textAlign == value) {

4
com.unity.uiwidgets/Runtime/rendering/editable.cs


bool _onlyWhitespace(TextRange range) {
for (int i = range.start; i < range.end; i++) {
int codeUnit = text.codeUnitAt(i).Value;
int codeUnit = text.codeUnitAt(i) ?? 0;
if (!EditableUtils._isWhitespace(codeUnit)) {
return false;
}

}
}
public TextAlign? textAlign {
public TextAlign textAlign {
get { return _textPainter.textAlign; }
set {
if (_textPainter.textAlign == value) {

12
com.unity.uiwidgets/Runtime/rendering/flex.cs


}
public float _getIntrinsicSize(
Axis? sizingDirection = null,
float? extent = null,
_ChildSizingFunction childSize = null
Axis sizingDirection,
float extent,
_ChildSizingFunction childSize
) {
if (_direction == sizingDirection) {
float totalFlex = 0.0f;

int flex = _getFlex(child);
totalFlex += flex;
if (flex > 0) {
float flexFraction = childSize(child, extent.Value) / _getFlex(child);
float flexFraction = childSize(child, extent) / _getFlex(child);
inflexibleSpace += childSize(child, extent.Value);
inflexibleSpace += childSize(child, extent);
}
var childParentData = (FlexParentData) child.parentData;

child = childParentData.nextSibling;
}
float spacePerFlex = Mathf.Max(0.0f, ((availableMainSpace - inflexibleSpace) / totalFlex).Value);
float spacePerFlex = Mathf.Max(0.0f, ((availableMainSpace - inflexibleSpace) / totalFlex) ?? 0.0f);
child = firstChild;
while (child != null) {

14
com.unity.uiwidgets/Runtime/rendering/paragraph.cs


}
public TextAlign textAlign {
get { return _textPainter.textAlign.Value; }
get { return _textPainter.textAlign; }
set {
if (_textPainter.textAlign == value) {
return;

placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(child.getMaxIntrinsicWidth(height), height),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baseline: _placeholderSpans[childIndex].baseline,
baselineOffset:0.0f
);
child = childAfter(child);

placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(intrinsicWidth, intrinsicHeight),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baseline: _placeholderSpans[childIndex].baseline,
baselineOffset:0.0f
);
child = childAfter(child);

placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(intrinsicWidth, intrinsicHeight),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baseline: _placeholderSpans[childIndex].baseline,
baselineOffset:0.0f
);
child = childAfter(child);

switch (_placeholderSpans[childIndex].alignment) {
case ui.PlaceholderAlignment.baseline: {
baselineOffset = child.getDistanceToBaseline(
_placeholderSpans[childIndex].baseline.Value
).Value;
_placeholderSpans[childIndex].baseline
) ?? 0.0f;
break;
}
default: {

_placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: child.size,
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baseline: _placeholderSpans[childIndex].baseline,
baselineOffset: baselineOffset
);
child = childAfter(child);

2
com.unity.uiwidgets/Runtime/rendering/shifted_box.cs


child.layout(constraints.loosen(), parentUsesSize: true);
float? childBaseline = child.getDistanceToBaseline(baselineType);
float actualBaseline = baseline;
float top = actualBaseline - childBaseline.Value;
float top = actualBaseline - (childBaseline ?? 0.0f);
var childParentData = (BoxParentData) child.parentData;
childParentData.offset = new Offset(0.0f, top);
Size childSize = child.size;

2
com.unity.uiwidgets/Runtime/rendering/sliver_fixed_extent_list.cs


if (firstChild != null) {
int leadingGarbage = _calculateLeadingGarbage(firstIndex);
int trailingGarbage = _calculateTrailingGarbage(targetLastIndex.Value);
int trailingGarbage = targetLastIndex == null ? 0: _calculateTrailingGarbage(targetLastIndex.Value);
collectGarbage(leadingGarbage, trailingGarbage);
}
else {

6
com.unity.uiwidgets/Runtime/widgets/editable_text.cs


public readonly StrutStyle strutStyle;
public readonly Color selectionColor;
public readonly float textScaleFactor;
public readonly TextAlign? textAlign;
public readonly TextAlign textAlign;
public readonly TextDirection? textDirection;
public readonly bool obscureText;
public readonly TextWidthBasis textWidthBasis;

StrutStyle strutStyle = null,
Color selectionColor = null,
float textScaleFactor = 1.0f,
TextAlign? textAlign = null,
TextAlign textAlign = TextAlign.start,
TextDirection? textDirection = null,
Locale locale = null,
bool obscureText = false,

strutStyle: strutStyle,
selectionColor: selectionColor,
textScaleFactor: textScaleFactor,
textAlign: textAlign ?? TextAlign.start,
textAlign: textAlign,
textDirection: textDirection,
locale: locale ?? Localizations.localeOf(context, nullOk: true),
selection: value.selection,

2
com.unity.uiwidgets/Runtime/widgets/widget_span.cs


class WidgetSpan : PlaceholderSpan,IEquatable<WidgetSpan> {
public WidgetSpan(
Widget child ,
TextBaseline? baseline = null,
TextBaseline baseline = TextBaseline.alphabetic,
TextStyle style = null,
PlaceholderAlignment alignment = PlaceholderAlignment.bottom
) : base(

正在加载...
取消
保存