浏览代码

Tmp store.

/main
Yuncong Zhang 6 年前
当前提交
60ebaf96
共有 12 个文件被更改,包括 207 次插入53 次删除
  1. 3
      Runtime/material/dropdown.cs
  2. 5
      Runtime/widgets/app.cs
  3. 45
      Runtime/widgets/basic.cs
  4. 8
      Runtime/widgets/binding.cs
  5. 11
      Runtime/widgets/debug.cs
  6. 117
      Runtime/widgets/dismissible.cs
  7. 3
      Runtime/widgets/editable_text.cs
  8. 17
      Runtime/widgets/focus_manager.cs
  9. 10
      Runtime/widgets/framework.cs
  10. 36
      Runtime/widgets/gesture_detector.cs
  11. 3
      Runtime/widgets/image.cs
  12. 2
      Runtime/widgets/implicit_animations.cs

3
Runtime/material/dropdown.cs


return Promise<bool>.Resolved(false);
}
public void didChangePlatformBrightness() {
}
public override void initState() {
base.initState();
this._updateSelectedIndex();

5
Runtime/widgets/app.cs


public void didChangeTextScaleFactor() {
this.setState();
}
public void didChangePlatformBrightness() {
this.setState(() => {
});
}
public void didChangeLocales(List<Locale> locale) {
Locale newLocale = this._resolveLocales(locale, this.widget.supportedLocales);

45
Runtime/widgets/basic.cs


this.clipBehavior = clipBehavior;
}
public static Widget shape(
Key key = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.antiAlias,
Widget child = null
) {
D.assert(shape != null);
return new Builder(
key: key,
builder: (BuildContext context) => {
return new ClipPath(
clipper: new ShapeBorderClipper(
shape: shape
),
clipBehavior: clipBehavior,
child: child
);
}
);
}
public readonly CustomClipper<Path> clipper;
public readonly Clip clipBehavior;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Alignment>("alignment", this.alignment));
properties.add(new DiagnosticsProperty<Axis>("constrainedAxis", null));
properties.add(new EnumProperty<Axis?>("constrainedAxis", null));
}
}

public class IntrinsicWidth : SingleChildRenderObjectWidget {
public IntrinsicWidth(Key key = null, float? stepWidth = null, float? stepHeight = null, Widget child = null)
: base(key: key, child: child) {
D.assert(stepWidth == null || stepWidth >= 0.0f);
D.assert(stepHeight == null || stepHeight >= 0.0f);
this.stepWidth = stepWidth;
this.stepHeight = stepHeight;
}

public readonly float? stepHeight;
float? _stepWidth {
get {
return this.stepWidth == 0.0f ? null : this.stepWidth;
}
}
float? _stepHeight {
get {
return this.stepHeight == 0.0f ? null : this.stepHeight;
}
}
return new RenderIntrinsicWidth(stepWidth: this.stepWidth, stepHeight: this.stepHeight);
return new RenderIntrinsicWidth(stepWidth: this._stepWidth, stepHeight: this._stepHeight);
renderObject.stepWidth = this.stepWidth;
renderObject.stepHeight = this.stepHeight;
renderObject.stepWidth = this._stepWidth;
renderObject.stepHeight = this._stepHeight;
}
}

Color shadowColor = null,
Widget child = null) : base(key: key, child: child) {
D.assert(color != null);
D.assert(elevation >= 0.0f);
this.shape = shape;
this.clipBehavior = clipBehavior;

Widget child = null) : base(key: key, child: child) {
D.assert(clipper != null);
D.assert(color != null);
D.assert(elevation >= 0.0f);
this.clipper = clipper;
this.clipBehavior = clipBehavior;
this.elevation = elevation;

8
Runtime/widgets/binding.cs


void didChangeTextScaleFactor();
void didChangePlatformBrightness();
void didChangeLocales(List<Locale> locale);
IPromise<bool> didPopRoute();

foreach (WidgetsBindingObserver observer in this._observers) {
observer.didChangeTextScaleFactor();
}
}
protected override void handlePlatformBrightnessChanged() {
base.handlePlatformBrightnessChanged();
foreach (WidgetsBindingObserver observer in this._observers)
observer.didChangePlatformBrightness();
}
protected virtual void handleLocaleChanged() {

11
Runtime/widgets/debug.cs


if (nonUniqueKey != null) {
throw new UIWidgetsError($"Duplicate key found: {nonUniqueKey}.");
}
return true;
});
return false;

"To return an empty space that takes as little room as possible, return \"new Container(width: 0.0, height: 0.0)\".");
}
if (widget == built) {
throw new UIWidgetsError(
"A build function returned context.widget.\n" +
"The offending widget is: $widget\n" +
"Build functions must never return their BuildContext parameter\'s widget or a child that contains 'context.widget'. " +
"Doing so introduces a loop in the widget tree that can cause the app to crash."
);
}
return true;
});
}

"WidgetsApp widget at the top of your application widget tree."
);
}
return true;
});
return true;

117
Runtime/widgets/dismissible.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

namespace Unity.UIWidgets.widgets {
public delegate void DismissDirectionCallback(DismissDirection? direction);
public delegate Promise<bool> ConfirmDismissCallback(DismissDirection? direction);
public enum DismissDirection {
vertical,

Widget child = null,
Widget background = null,
Widget secondaryBackground = null,
ConfirmDismissCallback confirmDismiss = null,
VoidCallback onResize = null,
DismissDirectionCallback onDismissed = null,
DismissDirection direction = DismissDirection.horizontal,

float crossAxisEndOffset = 0.0f
float crossAxisEndOffset = 0.0f,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(key: key) {
D.assert(key != null);
D.assert(secondaryBackground != null ? background != null : true);

this.child = child;
this.background = background;
this.secondaryBackground = secondaryBackground;
this.confirmDismiss = confirmDismiss;
this.dragStartBehavior = dragStartBehavior;
}
public readonly Widget child;

public readonly DismissDirectionCallback onDismissed;
public readonly ConfirmDismissCallback confirmDismiss;
public readonly TimeSpan resizeDuration;
public readonly TimeSpan? resizeDuration;
public readonly TimeSpan movementDuration;
public readonly TimeSpan? movementDuration;
public readonly DragStartBehavior dragStartBehavior;
public override State createState() {
return new _DismissibleState();

}
this._dragUnderway = false;
if (this._moveController.isCompleted) {
this._startResizeAnimation();
return;
}
this._confirmStartResizeAnimation().Then((value) => {
if (this._moveController.isCompleted && value) {
this._startResizeAnimation();
}
else {
float flingVelocity = this._directionIsXAxis
? details.velocity.pixelsPerSecond.dx
: details.velocity.pixelsPerSecond.dy;
switch (this._describeFlingGesture(details.velocity)) {
case _FlingGestureKind.forward:
D.assert(this._dragExtent != 0.0f);
D.assert(!this._moveController.isDismissed);
if ((this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ??
_kDismissThreshold) >= 1.0) {
this._moveController.reverse();
break;
}
this._dragExtent = flingVelocity.sign();
this._moveController.fling(velocity: flingVelocity.abs() * _kFlingVelocityScale);
break;
case _FlingGestureKind.reverse:
D.assert(this._dragExtent != 0.0f);
D.assert(!this._moveController.isDismissed);
this._dragExtent = flingVelocity.sign();
this._moveController.fling(velocity: -flingVelocity.abs() * _kFlingVelocityScale);
break;
case _FlingGestureKind.none:
if (!this._moveController.isDismissed) {
// we already know it's not completed, we check that above
if (this._moveController.value >
(this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ??
_kDismissThreshold)) {
this._moveController.forward();
}
else {
this._moveController.reverse();
}
}
float flingVelocity = this._directionIsXAxis
? details.velocity.pixelsPerSecond.dx
: details.velocity.pixelsPerSecond.dy;
switch (this._describeFlingGesture(details.velocity)) {
case _FlingGestureKind.forward:
D.assert(this._dragExtent != 0.0f);
D.assert(!this._moveController.isDismissed);
if ((this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ?? _kDismissThreshold) >= 1.0) {
this._moveController.reverse();
break;
break;
}
});
}
this._dragExtent = flingVelocity.sign();
this._moveController.fling(velocity: flingVelocity.abs() * _kFlingVelocityScale);
break;
case _FlingGestureKind.reverse:
D.assert(this._dragExtent != 0.0);
D.assert(!this._moveController.isDismissed);
this._dragExtent = flingVelocity.sign();
this._moveController.fling(velocity: -flingVelocity.abs() * _kFlingVelocityScale);
break;
case _FlingGestureKind.none:
if (!this._moveController.isDismissed) {
// we already know it's not completed, we check that above
if (this._moveController.value >
(this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ?? _kDismissThreshold)) {
this._moveController.forward();
}
else {
this._moveController.reverse();
}
void _handleDismissStatusChanged(AnimationStatus status) {
if (status == AnimationStatus.completed && !this._dragUnderway) {
this._confirmStartResizeAnimation().Then((value) => {
if (value) {
this._startResizeAnimation();
}
else {
this._moveController.reverse();
break;
this.updateKeepAlive();
});
void _handleDismissStatusChanged(AnimationStatus status) {
if (status == AnimationStatus.completed && !this._dragUnderway) {
this._startResizeAnimation();
IPromise<bool> _confirmStartResizeAnimation() {
if (this.widget.confirmDismiss != null) {
DismissDirection? direction = this._dismissDirection;
D.assert(direction != null);
return this.widget.confirmDismiss(direction);
this.updateKeepAlive();
return Promise<bool>.Resolved(true);
}
void _startResizeAnimation() {

: (GestureDragUpdateCallback) this._handleDragUpdate,
onVerticalDragEnd: this._directionIsXAxis ? null : (GestureDragEndCallback) this._handleDragEnd,
behavior: HitTestBehavior.opaque,
child: content
child: content,
dragStartBehavior: this.widget.dragStartBehavior
);
}
}

3
Runtime/widgets/editable_text.cs


public void didChangeTextScaleFactor() {
}
public void didChangePlatformBrightness() {
}
public void didChangeLocales(List<Locale> locale) {
}

17
Runtime/widgets/focus_manager.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;

internal FocusScopeNode _lastChild;
internal FocusNode _focus;
internal List<FocusScopeNode> _focusPath;
internal List<FocusScopeNode> _getFocusPath() {
List<FocusScopeNode> nodes = new List<FocusScopeNode>{this};
FocusScopeNode node = this._parent;
while(node != null && node != this._manager?.rootScope) {
nodes.Add(node);
node = node._parent;
}
return nodes;
}
internal void _prepend(FocusScopeNode child) {
D.assert(child != this);

public void requestFocus(FocusNode node) {
D.assert(node != null);
if (this._focus == node) {
if (this._focus == node && this._focusPath.SequenceEqual(this._manager?._getCurrentFocusPath())) {
return;
}

this._focus._manager = this._manager;
this._focus._hasKeyboardToken = true;
this._didChangeFocusChain();
this._focusPath = this._getFocusPath();
}
internal void _resignFocus(FocusNode node) {

this._currentFocus._notify();
}
}
internal List<FocusScopeNode> _getCurrentFocusPath() => this._currentFocus?._parent?._getFocusPath();
public void focusNone(bool focus) {
if (focus) {

10
Runtime/widgets/framework.cs


static readonly Dictionary<CompositeKey, Element> _registry =
new Dictionary<CompositeKey, Element>();
static readonly HashSet<CompositeKey> _removedKeys = new HashSet<CompositeKey>();
static readonly HashSet<Element> _debugIllFatedElements = new HashSet<Element>();
static readonly Dictionary<CompositeKey, Element> _debugReservations =

});
if (_registry[compKey] == element) {
_registry.Remove(compKey);
_removedKeys.Add(compKey);
}
}

}
properties.add(new FlagProperty("dirty", value: this.dirty, ifTrue: "dirty"));
if (this._dependencies != null && this._dependencies.isNotEmpty()) {
List<DiagnosticsNode> diagnosticsDependencies = this._dependencies
.Select((InheritedElement element) => element.widget.toDiagnosticsNode(style: DiagnosticsTreeStyle.sparse))
.ToList();
properties.add(new DiagnosticsProperty<List<DiagnosticsNode>>("dependencies", diagnosticsDependencies));
}
}
public override List<DiagnosticsNode> debugDescribeChildren() {

"the inherited widget is in a constructor or an initState() method, " +
"then the rebuilt dependent widget will not reflect the changes in the " +
"inherited widget.\n" +
"Typically references to to inherited widgets should occur in widget build() methods. Alternatively, " +
"Typically references to inherited widgets should occur in widget build() methods. Alternatively, " +
"initialization based on inherited widgets can be placed in the didChangeDependencies method, which " +
"is called after initState and whenever the dependencies change thereafter."
);

36
Runtime/widgets/gesture_detector.cs


GestureTapCancelCallback onTapCancel = null,
GestureDoubleTapCallback onDoubleTap = null,
GestureLongPressCallback onLongPress = null,
GestureLongPressUpCallback onLongPressUp = null,
GestureLongPressDragStartCallback onLongPressDragStart = null,
GestureLongPressDragUpdateCallback onLongPressDragUpdate = null,
GestureLongPressDragUpCallback onLongPressDragUp = null,
GestureDragDownCallback onVerticalDragDown = null,
GestureDragStartCallback onVerticalDragStart = null,
GestureDragUpdateCallback onVerticalDragUpdate = null,

bool haveHorizontalDrag =
onHorizontalDragStart != null || onHorizontalDragUpdate != null ||
onHorizontalDragEnd != null;
bool haveLongPress = onLongPress != null || onLongPressUp != null;
bool haveLongPressDrag = onLongPressDragStart != null || onLongPressDragUpdate != null || onLongPressDragUp != null;
bool havePan = onPanStart != null || onPanUpdate != null || onPanEnd != null;
if (havePan) {
if (haveVerticalDrag && haveHorizontalDrag) {

);
}
}
if (haveLongPress && haveLongPressDrag) {
throw new UIWidgetsError(
"Incorrect GestureDetector arguments.\n" +
"Having both a long press and a long press drag recognizer is " +
"redundant as the long press drag is a superset of long press. " +
"Except long press drag allows for drags after the long press is " +
"triggered."
);
}
return true;
});

this.onTapCancel = onTapCancel;
this.onDoubleTap = onDoubleTap;
this.onLongPress = onLongPress;
this.onLongPressUp = onLongPressUp;
this.onLongPressDragStart = onLongPressDragStart;
this.onLongPressDragUpdate = onLongPressDragUpdate;
this.onLongPressDragUp = onLongPressDragUp;
this.onVerticalDragDown = onVerticalDragDown;
this.onVerticalDragStart = onVerticalDragStart;
this.onVerticalDragUpdate = onVerticalDragUpdate;

public readonly GestureTapCancelCallback onTapCancel;
public readonly GestureDoubleTapCallback onDoubleTap;
public readonly GestureLongPressCallback onLongPress;
public readonly GestureLongPressUpCallback onLongPressUp;
public readonly GestureLongPressDragStartCallback onLongPressDragStart;
public readonly GestureLongPressDragUpdateCallback onLongPressDragUpdate;
public readonly GestureLongPressDragUpCallback onLongPressDragUp;
public readonly GestureDragDownCallback onVerticalDragDown;
public readonly GestureDragStartCallback onVerticalDragStart;
public readonly GestureDragUpdateCallback onVerticalDragUpdate;

);
}
if (this.onLongPress != null) {
if (this.onLongPress != null || this.onLongPressUp != null) {
}
if (this.onLongPressDragStart != null || this.onLongPressDragUpdate != null || this.onLongPressDragUp != null) {
gestures[LongPressDragGestureRecognizer] = new GestureRecognizerFactoryWithHandlers<LongPressDragGestureRecognizer>(
() => LongPressDragGestureRecognizer(debugOwner: this),
(LongPressDragGestureRecognizer instance) => {
instance.onLongPressStart = this.onLongPressDragStart;
instance.onLongPressDragUpdate = this.onLongPressDragUpdate;
instance.onLongPressUp = this.onLongPressDragUp;
}
);
}
if (this.onVerticalDragDown != null ||

3
Runtime/widgets/image.cs


void listener(ImageInfo image, bool sync) {
completer.Resolve();
stream.removeListener(listener);
stream.removeListener(listener);
if (onError != null) {
onError(exception);
}

}
stream.addListener(listener, onError: errorListener);
completer.Then(() => { stream.removeListener(listener); });
return completer;
}
}

2
Runtime/widgets/implicit_animations.cs


) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
D.assert(child != null);
D.assert(shape != null);
D.assert(elevation != null);
D.assert(elevation != null && elevation >= 0.0f);
D.assert(color != null);
D.assert(shadowColor != null);
D.assert(duration != null);

正在加载...
取消
保存