浏览代码

FIX REVIEW

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
f46e61f1
共有 9 个文件被更改,包括 47 次插入96 次删除
  1. 33
      com.unity.uiwidgets/Runtime/widgets/disposable_build_context.cs
  2. 6
      com.unity.uiwidgets/Runtime/widgets/icon.cs
  3. 6
      com.unity.uiwidgets/Runtime/widgets/image.cs
  4. 12
      com.unity.uiwidgets/Runtime/widgets/nested_scroll_view.cs
  5. 24
      com.unity.uiwidgets/Runtime/widgets/page_view.cs
  6. 4
      com.unity.uiwidgets/Runtime/widgets/preferred_size.cs
  7. 2
      com.unity.uiwidgets/Runtime/widgets/scrollable.cs
  8. 3
      com.unity.uiwidgets/Runtime/widgets/shortcuts.cs
  9. 53
      com.unity.uiwidgets/Runtime/widgets/image_icon.cs

33
com.unity.uiwidgets/Runtime/widgets/disposable_build_context.cs


using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.widgets {
public class DisposableBuildContext<T> where T : State{
public DisposableBuildContext(T _state) {
D.assert(_state != null);
D.assert(_state.mounted, () => "A DisposableBuildContext was given a BuildContext for an Element that is not mounted.");
this._state = _state;
}
T _state;
public class DisposableBuildContext {
State _state;
public BuildContext context {
get {
D.assert(_debugValidate());

public bool _debugValidate() {
D.assert(
_state == null || _state.mounted,() =>
"A DisposableBuildContext tried to access the BuildContext of a disposed " +
"State object. This can happen when the creator of this " +
"DisposableBuildContext fails to call dispose when it is disposed."
);
"A DisposableBuildContext tried to access the BuildContext of a disposed " +
"State object. This can happen when the creator of this " +
"DisposableBuildContext fails to call dispose when it is disposed."
);
return true;
}

}
public class DisposableBuildContext<T> : DisposableBuildContext where T : State{
public DisposableBuildContext(T _state) {
D.assert(_state != null);
D.assert(_state.mounted, () => "A DisposableBuildContext was given a BuildContext for an Element that is not mounted.");
this._state = _state;
}
T _state;
}
}

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


color: iconColor,
fontSize: iconSize,
fontFamily: icon.fontFamily
//package: icon.fontPackage
)
)
);

if (icon.matchTextDirectiom) {
if (icon.matchTextDirection) {
switch (textDirection) {
case TextDirection.rtl:
iconWidget = new Transform(

break;
}
}
return new SizedBox(
width: iconSize,
height: iconSize,

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


public void didChangeAccessibilityFeatures() {
//base.didChangeAccessibilityFeatures();
setState(() => {
_updateInvertColors();
});

}
void _resolveImage() {
ScrollAwareImageProvider<object> provider = new ScrollAwareImageProvider<object>(
context: _scrollAwareContext,
imageProvider: (ImageProvider<object>)widget.image
);
ImageStream newStream =
widget.image.resolve(ImageUtils.createLocalImageConfiguration(
context,

12
com.unity.uiwidgets/Runtime/widgets/nested_scroll_view.cs


class _NestedScrollViewCustomScrollView : CustomScrollView {
public _NestedScrollViewCustomScrollView(
Axis scrollDirection,
bool reverse ,
bool reverse,
ScrollPhysics physics,
ScrollController controller,
List<Widget> slivers,

ScrollDirection _userScrollDirection = ScrollDirection.idle;
public void updateUserScrollDirection(ScrollDirection value) {
D.assert(value != null);
_userScrollDirection = value;
_outerPosition.didUpdateScrollDirection(value);
foreach (_NestedScrollPosition position in _innerPositions) {

public Future animateTo(
float to,
TimeSpan? duration = null,
Curve curve = null
TimeSpan duration,
Curve curve
duration ?? new TimeSpan(0,0,0,0),
duration,
curve
);
List<Future> resultFutures = new List<Future> {outerActivity.done};

DrivenScrollActivity innerActivity = position.createDrivenScrollActivity(
nestOffset(to, position),
duration ?? new TimeSpan(0,0,0,0),
duration,
curve
);
resultFutures.Add(innerActivity.done);

24
com.unity.uiwidgets/Runtime/widgets/page_view.cs


public Future animateToPage(
int page,
TimeSpan? duration = null,
Curve curve = null) {
TimeSpan duration,
Curve curve ) {
duration ?? new TimeSpan(0,0,0,0,0),
duration,
public void jumpToPage(int page) {
_PagePosition position = (_PagePosition) this.position;

public Future nextPage(
TimeSpan? duration = null, Curve curve = null) {
TimeSpan duration, Curve curve) {
public Future previousPage(TimeSpan? duration = null, Curve curve = null) {
public Future previousPage(TimeSpan duration, Curve curve) {
return animateToPage(page.round() - 1, duration: duration, curve: curve);
}

public interface IPageMetrics : ScrollMetrics {
float page { get; }
float viewportFraction { get; }
}
public class PageMetrics : FixedScrollMetrics, IPageMetrics {

public override bool applyViewportDimension(float viewportDimension) {
float oldViewportDimensions = this.viewportDimension;
bool result = base.applyViewportDimension(viewportDimension);
float oldPixels = pixels;
float page = (oldPixels == null || oldViewportDimensions == 0.0) ? _pageToUseOnStartup : getPageFromPixels(oldPixels, oldViewportDimensions);
float? oldPixels = null;
if (havePixels) {
oldPixels = pixels;
}
float page = (oldPixels == null || oldViewportDimensions == 0.0f)
? _pageToUseOnStartup
: getPageFromPixels(oldPixels.Value, oldViewportDimensions);
if (newPixels != oldPixels) {
correctPixels(newPixels);
return false;

4
com.unity.uiwidgets/Runtime/widgets/preferred_size.cs


Size preferredSize { get; }
}
public abstract class PreferredSizeWidget : Widget{ //StatefulWidget, SizePreferred {
public abstract class PreferredSizeWidget : Widget{
protected PreferredSizeWidget(Key key = null) : base(key: key) {
}

public class PreferredSize : StatelessWidget{//PreferredSizeWidget {
public class PreferredSize : StatelessWidget{
public PreferredSize(
Key key = null,
Widget child = null,

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


return widget == null ? null : widget.scrollable;
}
static bool recommendDeferredLoadingForContext(BuildContext context) {
public static bool recommendDeferredLoadingForContext(BuildContext context) {
_ScrollableScope widget = context.getElementForInheritedWidgetOfExactType<_ScrollableScope>()?.widget as _ScrollableScope;
if (widget == null) {
return false;

3
com.unity.uiwidgets/Runtime/widgets/shortcuts.cs


sortedHashes[3] = iterator.GetHashCode();
}
sortedHashes.Sort();
return _hashCode = (_hashCode * 397) ^ (sortedHashes != null ? sortedHashes.GetHashCode() : 0);
//return ((_keys != null ? _keys.GetHashCode() : 0) * 397) ^ _hashCode;
return _hashCode = (_hashCode * 397) ^ (sortedHashes != null ? sortedHashes.GetHashCode() : 0);
}
}
public static bool operator ==(KeySet<T> left, KeySet<T> right) {

53
com.unity.uiwidgets/Runtime/widgets/image_icon.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.painting;
namespace Unity.UIWidgets.widgets {
public class ImageIcon: StatelessWidget {
public ImageIcon(
ImageProvider image ,
Key key = null,
float? size = null,
Color color = null
) : base(key: key) {
this.image = image;
this.size = size;
this.color = color;
}
public readonly ImageProvider image;
public readonly float? size;
public readonly Color color;
public override Widget build(BuildContext context) {
IconThemeData iconTheme = IconTheme.of(context);
float? iconSize = size == null ? iconTheme.size : size;
if (image == null)
return new SizedBox(width: iconSize, height: iconSize);
float? iconOpacity = iconTheme.opacity;
Color iconColor = color ?? iconTheme.color;
if (iconOpacity != null && iconOpacity != 1.0)
iconColor = iconColor.withOpacity(iconColor.opacity * (iconOpacity ?? 1.0f));
return new Image(
image: image,
width: iconSize,
height: iconSize,
color: iconColor,
fit: BoxFit.scaleDown,
alignment: Alignment.center
//excludeFromSemantics: true
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ImageProvider>("image'", image, ifNull: "<empty>", showName: false));
properties.add(new FloatProperty("size", size, defaultValue: null));
properties.add(new ColorProperty("color", color, defaultValue: null));
}
}
}
正在加载...
取消
保存