浏览代码

add fix

/zgh-devtools
Shiyun Wen 4 年前
当前提交
2aa1eadc
共有 15 个文件被更改,包括 43 次插入213 次删除
  1. 36
      com.unity.uiwidgets/Runtime/cupertino/context_menu.cs
  2. 10
      com.unity.uiwidgets/Runtime/cupertino/dialog.cs
  3. 2
      com.unity.uiwidgets/Runtime/cupertino/switch.cs
  4. 4
      com.unity.uiwidgets/Runtime/material/divider.cs
  5. 4
      com.unity.uiwidgets/Runtime/painting/basic_types.cs
  6. 2
      com.unity.uiwidgets/Runtime/scheduler2/binding.cs
  7. 2
      com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs
  8. 2
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  9. 1
      com.unity.uiwidgets/Runtime/widgets/localizations.cs
  10. 27
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  11. 2
      com.unity.uiwidgets/Runtime/widgets/routes.cs
  12. 31
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  13. 116
      com.unity.uiwidgets/Runtime/widgets/text.cs
  14. 8
      com.unity.uiwidgets/Runtime/widgets/text_selection.cs
  15. 9
      com.unity.uiwidgets/Runtime/widgets/texture.cs

36
com.unity.uiwidgets/Runtime/cupertino/context_menu.cs


public class _CupertinoContextMenuState : TickerProviderStateMixin<CupertinoContextMenu> {
public readonly GlobalKey _childGlobalKey = GlobalKey<State<StatefulWidget>>.key();
static readonly TimeSpan kLongPressTimeout = TimeSpan.FromMilliseconds(500);//new TimeSpan(0, 0, 0, 0, 500);
static readonly TimeSpan kLongPressTimeout = TimeSpan.FromMilliseconds(500);
public bool _childHidden = false;
public AnimationController _openController;
public Rect _decoyChildEndRect;

public Orientation _lastOrientation;
public readonly Rect _previousChildRect;
public float _scale = 1.0f;
public readonly GlobalKey _sheetGlobalKey = new LabeledGlobalKey<State<StatefulWidget>>();//GlobalKey();
public readonly GlobalKey _sheetGlobalKey = new LabeledGlobalKey<State<StatefulWidget>>();
public readonly static CurveTween _curve = new CurveTween(
curve: Curves.easeOutBack
);

public readonly Tween< float> _opacityTween = new FloatTween(begin: 0.0f, end: 1.0f);
public Animation< float> _sheetOpacity;
public readonly string barrierLabel;
//public override string barrierLabel;
public Color barrierColor {
//public readonly string barrierLabel;
public override string barrierLabel { get; }
public override Color barrierColor {
public bool barrierDismissible{
public override bool barrierDismissible{
public bool semanticsDismissible {
public override bool semanticsDismissible {
public TimeSpan transitionDuration {
public override TimeSpan transitionDuration {
/*public static AlignmentDirectional getSheetAlignment(_ContextMenuLocation contextMenuLocation) {
public static AlignmentDirectional getSheetAlignment(_ContextMenuLocation contextMenuLocation) {
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
return AlignmentDirectional.topCenter;

return AlignmentDirectional.topStart;
}
}*/
}
public static Rect _getScaledRect(GlobalKey globalKey, float scale) {
Rect childRect = CupertinoContextMenuUtils._getRect(globalKey);
Size sizeScaled = childRect.size * scale;

base.offstage = _externalOffstage || _internalOffstage;
changedInternalState();
}
public bool didPop(object result) {
protected internal override bool didPop(object result) {
public bool offstage{
public override bool offstage{
set{
_externalOffstage = value;
_setOffstageInternally();

public TickerFuture didPush() {
protected internal override TickerFuture didPush() {
_internalOffstage = true;
_setOffstageInternally();
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timeSpan)=>{

});
return base.didPush();
}
public Animation<float> createAnimation() {
public override Animation<float> createAnimation() {
Animation< float> animation = base.createAnimation();
_sheetOpacity = _opacityTween.animate(new CurvedAnimation(
parent: animation,

child: new Opacity(
opacity: _sheetOpacity.value,
child: Transform.scale(
//alignment: getSheetAlignment(_contextMenuLocation),
alignment: getSheetAlignment(_contextMenuLocation),
scale: sheetScale,
child: new _ContextMenuSheet(
key: _sheetGlobalKey,

// Build the animation for the _ContextMenuSheet.
Widget _buildSheetAnimation(BuildContext context, Widget child) {
return Transform.scale(
//alignment: _ContextMenuRoute.getSheetAlignment(widget.contextMenuLocation),
alignment: _ContextMenuRoute.getSheetAlignment(widget.contextMenuLocation),
scale: _sheetScaleAnimation.value,
child: new Opacity(
opacity: _sheetOpacityAnimation.value,

);
_sheetController = new AnimationController(
duration: TimeSpan.FromMilliseconds(100),
reverseDuration: TimeSpan.FromMilliseconds(300),/// TBC ???
reverseDuration: TimeSpan.FromMilliseconds(300),
vsync: this
);
_sheetScaleAnimation = new FloatTween(

10
com.unity.uiwidgets/Runtime/cupertino/dialog.cs


}
}
/*class _DialogActionButtonParentData : MultiChildLayoutParentData {
public _DialogActionButtonParentData(
bool isPressed = false
) {
this.isPressed = isPressed;
}
public bool isPressed;
}*/
public class CupertinoDialogAction : StatelessWidget {
public CupertinoDialogAction(
Key key = null,

2
com.unity.uiwidgets/Runtime/cupertino/switch.cs


void _handleTap() {
if (isInteractive) {
widget.onChanged(!widget.value);
//_emitVibration();
}
}

if (isInteractive) {
needsPositionAnimation = false;
_reactionController.forward();
//_emitVibration();
}
}

4
com.unity.uiwidgets/Runtime/material/divider.cs


child: new Container(
height: thickness,
//TODO: update to EdgeInsetsGeometry
/*margin: EdgeInsetsDirectional.only(start: indent,
end: endIndent),*/
margin: EdgeInsetsDirectional.only(start: indent,
end: endIndent),
decoration: new BoxDecoration(
border: new Border(
bottom: createBorderSide(context, color: color, width: thickness))

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


Axis axis,
bool reverse) {
switch (axis) {
/*case Axis.horizontal:
return reverse ? AxisDirection.left : AxisDirection.right;
case Axis.vertical:
return reverse ? AxisDirection.up : AxisDirection.down;*/
case Axis.horizontal:
D.assert(WidgetsD.debugCheckHasDirectionality(context));
TextDirection textDirection = Directionality.of(context);

2
com.unity.uiwidgets/Runtime/scheduler2/binding.cs


Completer _nextFrameCompleter;
Future endOfFrame {
public Future endOfFrame {
get {
if (_nextFrameCompleter == null) {
if (schedulerPhase == SchedulerPhase.idle)

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


public interface DirectionalFocusTraversalPolicyMixin {
//Dictionary<FocusScopeNode, _DirectionalPolicyData> _policyData = new Dictionary<FocusScopeNode, _DirectionalPolicyData>();
void invalidateScopeData(FocusScopeNode node);
void changedScope(FocusNode node = null, FocusScopeNode oldScope = null);
FocusNode findFirstFocusInDirection(FocusNode currentNode, TraversalDirection direction);

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


}
}
void reassemble(Element root) {
public void reassemble(Element root) {
try {
D.assert(root._parent == null);
D.assert(root.owner == this);

1
com.unity.uiwidgets/Runtime/widgets/localizations.cs


}
public abstract class LocalizationsDelegate<T> : LocalizationsDelegate {
//public abstract Future<T> load(Locale locale);
public override Type type {
get { return typeof(T); }
}

27
com.unity.uiwidgets/Runtime/widgets/navigator.cs


public virtual Future<RoutePopDisposition> willPop() {
/// async
return Future.value(isFirst
? RoutePopDisposition.bubble
: RoutePopDisposition.pop).to<RoutePopDisposition>();

_RouteEntry routeEntry = null;
foreach (var historyEntry in _navigator._history) {
if (_RouteEntry.isRoutePredicate(this)(historyEntry)) {
//Route
routeEntry = historyEntry;
break;
}

get { return _overlayKey.currentState; }
}
public List<OverlayEntry> _allRouteOverlayEntries { ///sync
public List<OverlayEntry> _allRouteOverlayEntries {
//yield* entry.route.overlayEntries;
/*foreach (var historyOverlayEntry in historyEntry.route.overlayEntries) {
yield return historyOverlayEntry;
}*/
}
return overlayEntries;
}

routeJsonable["settings"] = settingsJsonable;
}
// todo
developer.developer_.postEvent("Flutter.Navigation", new Hashtable{
{"route", routeJsonable}
});

}
}
D.assert(anyEntry,()=> "Navigator has no active routes to replace.");
//_history.lastWhere(_RouteEntry.isPresentPredicate).complete(result, isReplaced: true);
_RouteEntry lastEntry = null;
foreach (var historyEntry in _history) {
if (_RouteEntry.isPresentPredicate(historyEntry)) {

D.assert(index >= 0, () => "There are no routes below the specified anchorRoute.");
_history.Insert(index + 1, new _RouteEntry(newRoute, initialState: _RouteLifecycle.replace));
//_history[index].remove(isReplaced: true);
_history.RemoveAt(index);
_flushHistoryUpdates();
D.assert(() => {

}
public bool canPop() {
IEnumerable<_RouteEntry> iterator = new List<_RouteEntry>();//_history.where(_RouteEntry.isPresentPredicate).iterator;
IEnumerable<_RouteEntry> iterator = new List<_RouteEntry>();
foreach (var historyEntry in _history) {
if (_RouteEntry.isPresentPredicate(historyEntry)) {
iterator.Append(historyEntry);

return true;
});
_RouteEntry entry = null; //_history.lastWhere(_RouteEntry.isPresentPredicate);
_RouteEntry entry = null;
foreach (_RouteEntry route in _history) {
if (_RouteEntry.isPresentPredicate(route)) {
entry = route;

});
D.assert(route._navigator == this);
bool wasCurrent = route.isCurrent;
_RouteEntry entry = null; //_history.firstWhere(_RouteEntry.isRoutePredicate(route), orElse: () => null);
_RouteEntry entry = null;
foreach (_RouteEntry routeEntry in _history) {
if (_RouteEntry.isRoutePredicate(route)(routeEntry)) {
entry = routeEntry;

RenderAbsorbPointer absorber =
_overlayKey.currentContext?.findAncestorRenderObjectOfType<RenderAbsorbPointer>();
setState(() => { absorber.absorbing = true; });//absorber?.
setState(() => {
if(absorber != null)
absorber.absorbing = true;
});
}
_activePointers.ToList().ForEach(WidgetsBinding.instance.cancelPointer);

public override Widget build(BuildContext context) {
D.assert(!_debugLocked);//_debuglocked = false;
D.assert(!_debugLocked);
D.assert(_history.isNotEmpty());
return new Listener(
onPointerDown: _handlePointerDown,

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


}
public virtual bool maintainState { get; }
public bool offstage {
public virtual bool offstage {
get { return _offstage; }
set {
if (_offstage == value) {

31
com.unity.uiwidgets/Runtime/widgets/sliver.cs


RenderBox _currentBeforeChild;
protected override void performRebuild() {
//_didUnderflow = false;
_childWidgets.Clear();
base.performRebuild();
_currentBeforeChild = null;

_currentlyUpdatingChildIndex = index;
if(_childElements.getOrDefault(index) != null &&
_childElements.getOrDefault(index) != newChildren.getOrDefault(index))
// if (_childElements[index] != null && _childElements[index] != newChildren[index])
{
_childElements[index] = updateChild(_childElements[index], null, index);
}

}
return newChild;
/*SliverMultiBoxAdaptorParentData oldParentData = null;
if (child != null && child.renderObject != null) {
oldParentData = (SliverMultiBoxAdaptorParentData) child.renderObject.parentData;
}
Element newChild = base.updateChild(child, newWidget, newSlot);
SliverMultiBoxAdaptorParentData newParentData = null;
if (newChild != null && newChild.renderObject != null) {
newParentData = (SliverMultiBoxAdaptorParentData) newChild.renderObject.parentData;
}
if (oldParentData != newParentData && oldParentData != null && newParentData != null) {
newParentData.layoutOffset = oldParentData.layoutOffset;
}
return newChild;*/
}
internal override void forgetChild(Element child) {

}).ToList().ForEach(e => visitor(e));
}
}
/*public class SliverFillRemaining : SingleChildRenderObjectWidget {
public SliverFillRemaining(
Key key = null,
Widget child = null
) : base(key: key, child: child) {
}
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverFillRemaining();
}
}*/
public class KeepAlive : ParentDataWidget<IKeepAliveParentDataMixin> {
public KeepAlive(

116
com.unity.uiwidgets/Runtime/widgets/text.cs


) : base(key: key, child: child) {
D.assert(style != null);
D.assert(softWrap != null);
D.assert(overflow != null);
D.assert(textWidthBasis != null);
this.style = style;
this.textAlign = textAlign;
this.softWrap = softWrap;

return context.dependOnInheritedWidgetOfExactType<DefaultTextStyle>() ?? new DefaultTextStyle();
}
public override bool updateShouldNotify(InheritedWidget oldWidget) {
//InheritedWidget
//DefaultTextStyle
textAlign != ((DefaultTextStyle)oldWidget).textAlign ||
softWrap != ((DefaultTextStyle)oldWidget).softWrap ||
overflow != ((DefaultTextStyle)oldWidget).overflow ||
maxLines != ((DefaultTextStyle)oldWidget).maxLines ||
textWidthBasis != ((DefaultTextStyle)oldWidget).textWidthBasis ||
textHeightBehavior != ((DefaultTextStyle)oldWidget).textHeightBehavior;
textAlign != ((DefaultTextStyle)oldWidget).textAlign ||
softWrap != ((DefaultTextStyle)oldWidget).softWrap ||
overflow != ((DefaultTextStyle)oldWidget).overflow ||
maxLines != ((DefaultTextStyle)oldWidget).maxLines ||
textWidthBasis != ((DefaultTextStyle)oldWidget).textWidthBasis ||
textHeightBehavior != ((DefaultTextStyle)oldWidget).textHeightBehavior;
}
public override Widget wrap(BuildContext context, Widget child) {

}
/*public class DefaultTextStyle : InheritedWidget {
public DefaultTextStyle(
Key key = null,
TextStyle style = null,
TextAlign? textAlign = null,
bool softWrap = true,
TextOverflow overflow = TextOverflow.clip,
int? maxLines = null,
Widget child = null
) : base(key, child) {
D.assert(style != null);
D.assert(maxLines == null || maxLines > 0);
D.assert(child != null);
this.style = style;
this.textAlign = textAlign;
this.softWrap = softWrap;
this.overflow = overflow;
this.maxLines = maxLines;
}
DefaultTextStyle() {
style = new TextStyle();
textAlign = null;
softWrap = true;
overflow = TextOverflow.clip;
maxLines = null;
}
public static DefaultTextStyle fallback() {
return _fallback;
}
static readonly DefaultTextStyle _fallback = new DefaultTextStyle();
public static Widget merge(
Key key = null,
TextStyle style = null,
TextAlign? textAlign = null,
bool? softWrap = null,
TextOverflow? overflow = null,
int? maxLines = null,
Widget child = null
) {
D.assert(child != null);
return new Builder(builder: (context => {
var parent = of(context);
return new DefaultTextStyle(
key: key,
style: parent.style.merge(style),
textAlign: textAlign ?? parent.textAlign,
softWrap: softWrap ?? parent.softWrap,
overflow: overflow ?? parent.overflow,
maxLines: maxLines ?? parent.maxLines,
child: child
);
}));
}
public readonly TextStyle style;
public readonly TextAlign? textAlign;
public readonly bool softWrap;
public readonly TextOverflow overflow;
public readonly int? maxLines;
public static DefaultTextStyle of(BuildContext context) {
var inherit = (DefaultTextStyle) context.inheritFromWidgetOfExactType(typeof(DefaultTextStyle));
return inherit ?? fallback();
}
public override bool updateShouldNotify(InheritedWidget w) {
var oldWidget = (DefaultTextStyle) w;
return style != oldWidget.style ||
textAlign != oldWidget.textAlign ||
softWrap != oldWidget.softWrap ||
overflow != oldWidget.overflow ||
maxLines != oldWidget.maxLines;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
if (style != null) {
style.debugFillProperties(properties);
}
properties.add(new EnumProperty<TextAlign?>("textAlign", textAlign,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new FlagProperty("softWrap", value: softWrap, ifTrue: "wrapping at box width",
ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextOverflow>("overflow", overflow,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new IntProperty("maxLines", maxLines,
defaultValue: foundation_.kNullDefaultValue));
}
}*/
public class Text : StatelessWidget {
public Text(string data,

8
com.unity.uiwidgets/Runtime/widgets/text_selection.cs


);
}
}
/*public abstract class TextSelectionGestureDetectorBuilderDelegate {
public GlobalKey<EditableTextState> editableTextKey { get; }
public bool forcePressEnabled {
get;
}
public bool selectionEnabled { get; }
}*/
public interface TextSelectionGestureDetectorBuilderDelegate {
GlobalKey<EditableTextState> editableTextKey { get; }

9
com.unity.uiwidgets/Runtime/widgets/texture.cs


namespace Unity.UIWidgets.widgets {
public class Texture : LeafRenderObjectWidget {
// TODO: check whether following is needed
// public static void textureFrameAvailable(Window instance = null) {
// if (instance == null) {
// WindowAdapter.windowAdapters.ForEach(w => w.scheduleFrame(false));
// } else {
// instance.scheduleFrame(false);
// }
// }
public Texture(
Key key = null,
int? textureId = null) : base(key: key) {

正在加载...
取消
保存