浏览代码

fix cupertino

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
24c8d8a3
共有 15 个文件被更改,包括 334 次插入181 次删除
  1. 76
      com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs
  2. 5
      com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs
  3. 13
      com.unity.uiwidgets/Runtime/cupertino/app.cs
  4. 10
      com.unity.uiwidgets/Runtime/cupertino/bottom_tab_bar.cs
  5. 16
      com.unity.uiwidgets/Runtime/cupertino/button.cs
  6. 18
      com.unity.uiwidgets/Runtime/cupertino/colors.cs
  7. 141
      com.unity.uiwidgets/Runtime/cupertino/context_menu.cs
  8. 10
      com.unity.uiwidgets/Runtime/cupertino/context_menu_action.cs
  9. 3
      com.unity.uiwidgets/Runtime/developer/extension.cs
  10. 75
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  11. 63
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  12. 42
      com.unity.uiwidgets/Runtime/ui2/compositing.cs
  13. 28
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  14. 4
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  15. 11
      engine/src/lib/ui/compositing/scene_builder.cc

76
com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs


}
return new Container(
color: CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kBackgroundColor, context),//CupertinoActionSheetUtils._kBackgroundColor,
color: CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kBackgroundColor, context),
child: new Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,

contentSection: new Builder(builder: _buildContent),
actionsSection: _buildActions()
)
/*new Container(
decoration: CupertinoActionSheetUtils._kAlertBlurOverlayDecoration,
child: new _CupertinoAlertRenderWidget(
contentSection: _buildContent(),
actionsSection: _buildActions()
)
)*/
)
)
),

actionSheetWidth = MediaQuery.of(context).size.height -
(CupertinoActionSheetUtils._kEdgeHorizontalPadding * 2);
}
/// tbc semantics
/*return new SafeArea(
child: new Semantics(
namesRoute: true,
scopesRoute: true,
explicitChildNodes: true,
label: "Alert",
child: new CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevated,
child: new Container(
width: actionSheetWidth,
margin: EdgeInsets.symmetric(
horizontal: CupertinoActionSheetUtils._kEdgeHorizontalPadding,
vertical: CupertinoActionSheetUtils._kEdgeVerticalPadding
),
child: new Column(
children: children,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch
)
)
)
)
);*/
child: new Container(
width: actionSheetWidth,
margin: EdgeInsets.symmetric(
horizontal: CupertinoActionSheetUtils._kEdgeHorizontalPadding,
vertical: CupertinoActionSheetUtils._kEdgeVerticalPadding
),
child: new Column(
children: children,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch
)
child: new CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevatedlayer,
child: new Container(
width: actionSheetWidth,
margin: EdgeInsets.symmetric(
horizontal: CupertinoActionSheetUtils._kEdgeHorizontalPadding,
vertical: CupertinoActionSheetUtils._kEdgeVerticalPadding
),
child: new Column(
children: children,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch
))
}
}

color: isDestructiveAction
? CupertinoDynamicColor.resolve(CupertinoColors.systemRed, context)
: CupertinoTheme.of(context).primaryColor);
//CupertinoActionSheetUtils._kActionSheetActionStyle;
if (isDefaultAction) {
style = style.copyWith(fontWeight: FontWeight.w600);
}

constraints: new BoxConstraints(
minHeight: CupertinoActionSheetUtils._kButtonHeight
),
////tbc semantics
child: new Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(

}
public override void updateRenderObject(BuildContext context,RenderObject renderObject ) {
//RenderObject renderObject
renderObject = (_RenderCupertinoAlert) renderObject;
base.updateRenderObject(context, renderObject);
((_RenderCupertinoAlert) renderObject).dividerColor = CupertinoDynamicColor.resolve(CupertinoActionSheetUtils._kButtonDividerColor, context);

}
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
bool hasDivider = contentSection.getMaxIntrinsicHeight(constraints.maxWidth) > 0.0f
&& actionsSection.getMaxIntrinsicHeight(constraints.maxWidth) > 0.0f;
float dividerThickness = hasDivider ? _dividerThickness : 0.0f;

hitTest: (BoxHitTestResult resultIn, Offset transformed) => {
D.assert(transformed == position - contentSectionParentData.offset);
return contentSection.hitTest(resultIn, position: transformed);
}
) || result.addWithPaintOffset(
}) || result.addWithPaintOffset(
offset: actionsSectionParentData.offset,
position: position,
hitTest: (BoxHitTestResult resultIn, Offset transformed) => {

class _ActionButtonParentDataWidget : ParentDataWidget<_ActionButtonParentData> {
public _ActionButtonParentDataWidget(
Widget child,
Key key = null,
Key key = null
Widget child = null
) : base(key: key, child: child) {
this.isPressed = isPressed;
}

if (parentData.isPressed != isPressed) {
parentData.isPressed = isPressed;
AbstractNodeMixinDiagnosticableTree targetParent = renderObject.parent;
// AbstractNode targetParent = renderObject.parent;
// tbc
if (targetParent is RenderObject) {
((RenderObject) targetParent).markNeedsPaint();
}

public new Type debugTypicalAncestorWidgetClass {
public override Type debugTypicalAncestorWidgetClass {
get {
return typeof(_CupertinoAlertActionsRenderWidget);
}

5
com.unity.uiwidgets/Runtime/cupertino/activity_indicator.cs


}
class _CupertinoActivityIndicatorPainter : AbstractCustomPainter
{//CustomPainter {
//AbstractCustomPainter {
{
float radius =0f
float radius = 0f
) : base(repaint: position) {
tickFundamentalRRect = RRect.fromLTRBXY(

13
com.unity.uiwidgets/Runtime/cupertino/app.cs


Dictionary<string, WidgetBuilder> routes = null,
string initialRoute = null,
RouteFactory onGenerateRoute = null,
InitialRouteListFactory onGenerateInitialRoutes = null,
RouteFactory onUnknownRoute = null,
List<NavigatorObserver> navigatorObservers = null,
TransitionBuilder builder = null,

bool checkerboardOffscreenLayers = false,
bool showSemanticsDebugger = false,
bool debugShowCheckedModeBanner = true,
// tbc????
supportedLocales = supportedLocales ?? new List<Locale> {new Locale("en", "US")};
this.navigatorKey = navigatorKey;
this.home = home;

this.onGenerateRoute = onGenerateRoute;
this.onGenerateInitialRoutes = onGenerateInitialRoutes;
this.onUnknownRoute = onUnknownRoute;
this.navigatorObservers = navigatorObservers ?? new List<NavigatorObserver>();
this.builder = builder;

this.localeResolutionCallback = localeResolutionCallback;
this.supportedLocales = supportedLocales;
this.showPerformanceOverlay = showPerformanceOverlay;
this.showSemanticsDebugger = showSemanticsDebugger;
this.debugShowCheckedModeBanner = debugShowCheckedModeBanner;
this.shortcuts = shortcuts;
this.actions = actions;
}

public readonly bool checkerboardRasterCacheImages;
public readonly bool checkerboardOffscreenLayers;
public readonly bool showSemanticsDebugger;
public readonly bool debugShowWidgetInspector;
//TBC ????
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public readonly Dictionary<LocalKey, ActionFactory> actions;

);
},
shortcuts: widget.shortcuts,
);
);
}
)
)

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


this.border = border ?? new Border(
top: new BorderSide(
color: BottomAppBarUtils._kDefaultTabBarBorderColor,
width: 0.0f, // One physical pixel.
width: 0.0f,
style: BorderStyle.solid
)
);

Color inactive = CupertinoDynamicColor.resolve(inactiveColor, context);
Widget result = new DecoratedBox(
decoration: new BoxDecoration(
border: resolvedBorder,//border,
color: backgroundColor //?? CupertinoTheme.of(context).barBackgroundColor
border: resolvedBorder,
color: backgroundColor
),
child: new SizedBox(
height: BottomAppBarUtils._kTabBarHeight + bottomPadding,

),
child: new DefaultTextStyle( // Default with the inactive state.
style: CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(color: inactive),
//CupertinoTheme.of(context).textTheme.tabLabelTextStyle
child: new Padding(
padding: EdgeInsets.only(bottom: bottomPadding),
child: new Row(

_wrapActiveItem(
context,
new Expanded(
//// ??? semantics tbc ???
child: new GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: onTap == null ? null : (GestureTapCallback) (() => { onTap(tabIndex); }),

if (!active) {
return item;
}
//Color activeColor = this.activeColor ?? CupertinoTheme.of(context).primaryColor;
Color activeColor = CupertinoDynamicColor.resolve(
this.activeColor ?? CupertinoTheme.of(context).primaryColor,
context

16
com.unity.uiwidgets/Runtime/cupertino/button.cs


BorderRadius borderRadius = null,
VoidCallback onPressed = null
) : base(key: key) {
D.assert((pressedOpacity >= 0.0 && pressedOpacity <= 1.0) || pressedOpacity == null );
//D.assert(disabledColor != null);
_filled = false;
D.assert((pressedOpacity >= 0.0 && pressedOpacity <= 1.0));
_filled = false;
this.child = child;
this.onPressed = onPressed;
this.padding = padding;

VoidCallback onPressed = null
) {
disabledColor = disabledColor ?? CupertinoColors.quaternarySystemFill;
D.assert(pressedOpacity >= 0.0 && pressedOpacity <= 1.0);
D.assert(disabledColor != null);
D.assert(pressedOpacity >= 0.0 && pressedOpacity <= 1.0);
var btn = new CupertinoButton(
key: key,
color: null,

_animate();
}
});
/*ticker.then(() => {
if (mounted && wasHeldDown != _buttonHeldDown) {
_animate();
}
});*/
}
public override Widget build(BuildContext context) {

widget.onPressed();
}
},
////tbc semantics
child: new ConstrainedBox(
constraints: widget.minSize == null
? new BoxConstraints() :

18
com.unity.uiwidgets/Runtime/cupertino/colors.cs


Color highContrastElevatedColor = null,
Color darkHighContrastElevatedColor = null,
Element debugResolveContext = null
): base(effectiveColor.value)
): base(0)
{
D.assert(color != null,()=>"color8 == null");
D.assert(darkColor != null,()=>"color7 == null");

D.assert(darkElevatedColor != null,()=>"color3 == null");
D.assert(highContrastElevatedColor != null,()=>"color2 == null");
D.assert(darkHighContrastElevatedColor != null,()=>"color1 == null");
D.assert(effectiveColor != null);
_effectiveColor = effectiveColor ?? color;
this.color = color;

}
public override string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug) {
/*string toString(string name, Color color) {
string toStringColor(string name, Color color) {
}*/
}
List<string> xs = new List<string>();
xs.Add(toStringColor("color",color));
if (_isPlatformBrightnessDependent)

}
public string toStringColor(string name, Color color) {
string marker = color == _effectiveColor ? "*" : "";
return marker + name + " = " + color.ToString() + marker;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
if (_debugLabel != null)

}
public static DiagnosticsProperty<Color> createCupertinoColorProperty(
string name = null,
Color value = null,
string name ,
Color value ,
bool showName = true,
object defaultValue = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine,

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


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

),
contextMenuLocation: _contextMenuLocation,
previousChildRect: _decoyChildEndRect,
builder: (BuildContext context, Animation< float> animation)=>{
builder: (BuildContext _context, Animation<float> animation)=>{
return widget.previewBuilder(context, animation, widget.child);
return widget.previewBuilder(_context, animation, widget.child);
}
);
Navigator.of(context, rootNavigator: true).push(_route);

public void _onDecoyAnimationStatusChange(AnimationStatus animationStatus) {
switch (animationStatus) {
case AnimationStatus.dismissed:
if (_route == null) {
setState(()=> {
_childHidden = false;
});
}
_lastOverlayEntry?.remove();
_lastOverlayEntry = null;
break;
case AnimationStatus.completed:
setState(()=>{
_childHidden = true;
});
_openContextMenu();
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timestamp) =>{
_lastOverlayEntry?.remove();
_lastOverlayEntry = null;
_openController.reset();
});
break;
default:
return;
}
public void _onDecoyAnimationStatusChange(AnimationStatus animationStatus) {
switch (animationStatus) {
case AnimationStatus.dismissed:
if (_route == null) {
setState(()=> {
_childHidden = false;
});
}
_lastOverlayEntry?.remove();
_lastOverlayEntry = null;
break;
case AnimationStatus.completed:
setState(()=>{
_childHidden = true;
});
_openContextMenu();
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timestamp) =>{
_lastOverlayEntry?.remove();
_lastOverlayEntry = null;
_openController.reset();
});
break;
default:
return;
}
}

public static readonly Color _lightModeMaskColor = new Color(0xFF888888);
public static readonly Color _masklessColor = new Color(0xFFFFFFFF);
public readonly GlobalKey _childGlobalKey = new LabeledGlobalKey<State<StatefulWidget>>();
public readonly GlobalKey _childGlobalKey = GlobalKey<State<StatefulWidget>>.key();
public override void initState() {
base.initState();
_mask = new _OnOffAnimation<Color>(
controller: widget.controller,
onValue: _lightModeMaskColor,
offValue: _masklessColor,
intervalOn: 0.0f,
intervalOff: 0.5f
);
Rect midRect = widget.beginRect.deflate(
widget.beginRect.width * (CupertinoContextMenuUtils._kOpenScale - 1.0f) / 2f
);
List<TweenSequenceItem<Rect>> tweenSequenceItems = new List<TweenSequenceItem<Rect>>();
tweenSequenceItems.Add(
new TweenSequenceItem<Rect>(
tween: new RectTween(
begin: widget.beginRect,
end: midRect
public override void initState() {
base.initState();
_mask = new _OnOffAnimation<Color>(
controller: widget.controller,
onValue: _lightModeMaskColor,
offValue: _masklessColor,
intervalOn: 0.0f,
intervalOff: 0.5f
);
Rect midRect = widget.beginRect.deflate(
widget.beginRect.width * (CupertinoContextMenuUtils._kOpenScale - 1.0f) / 2f
);
List<TweenSequenceItem<Rect>> tweenSequenceItems = new List<TweenSequenceItem<Rect>>();
tweenSequenceItems.Add(
new TweenSequenceItem<Rect>(
tween: new RectTween(
begin: widget.beginRect,
end: midRect
).chain(new CurveTween(curve: Curves.easeInOutCubic)),
weight: 1.0f
));

if (widget.controller.value < 0.5f) {
return;
}
//HapticFeedback.selectionClick();????
//HapticFeedback.selectionClick();????
/// tbc ???
_rect.removeListener(_rectListener);
}

}
public Widget _buildAnimation(BuildContext context, Widget child) {
Color color = widget.controller.status == AnimationStatus.reverse ? _masklessColor : _mask.value;
List<Color> colors = new List<Color>();
colors.Add(color);
colors.Add(color);
return Positioned.fromRect(
rect: _rect.value,
child: //kIsweb?
new Container(key: _childGlobalKey, child: widget.child)
/*: new ShaderMask(
key: _childGlobalKey,
shaderCallback: (Rect bounds) => {
return new LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: colors
).createShader(bounds);
},
child: widget.child
)*/
);
public Widget _buildAnimation(BuildContext context, Widget child) {
Color color = widget.controller.status == AnimationStatus.reverse ? _masklessColor : _mask.value;
List<Color> colors = new List<Color>();
colors.Add(color);
colors.Add(color);
return Positioned.fromRect(
rect: _rect.value,
child: foundation_.kIsWeb
? (Widget) new Container(key: _childGlobalKey, child: widget.child)
: new ShaderMask(
key: _childGlobalKey,
shaderCallback: (Rect bounds) => {
return new LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: colors).createShader(bounds);
},
child: widget.child
)
);
}
public override Widget build(BuildContext context) {
List<Widget> widgets = new List<Widget>();

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


IconData trailingIcon = null
) : base(key: key) {
D.assert(child != null);
D.assert(isDefaultAction != null);
D.assert(isDestructiveAction != null);
this.child = child;
this.isDefaultAction = isDefaultAction;
this.isDestructiveAction = isDestructiveAction;

color: CupertinoColors.black,
textBaseline: TextBaseline.alphabetic
);
public GlobalKey _globalKey = new LabeledGlobalKey<State<StatefulWidget>>();
//GlobalKey();
public GlobalKey _globalKey = GlobalKey<State<StatefulWidget>>.key();
bool _isPressed = false;
void onTapDown(TapDownDetails details) {

onTapDown: onTapDown,
onTapUp: onTapUp,
onTapCancel: onTapCancel,
onTap: //widget.onPressed,
widget.onPressed == null
onTap: widget.onPressed == null
? (GestureTapCallback) null
: () => {
if (widget.onPressed != null) {

behavior: HitTestBehavior.opaque,
child: /////semantics tbc ???
child:
new ConstrainedBox(
constraints: new BoxConstraints(
minHeight: _kButtonHeight

3
com.unity.uiwidgets/Runtime/developer/extension.cs


using System.Collections;
using System.Collections.Generic;
public static partial class developer_ {
public static class developer_ {
public static void postEvent(string eventKind, Hashtable eventData) {
}
}

75
com.unity.uiwidgets/Runtime/rendering/layer.cs


using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
using Shader = Unity.UIWidgets.ui.Shader;
namespace Unity.UIWidgets.rendering {
public class AnnotationEntry<T> {

}
public class PictureLayer : Layer {
public PictureLayer(Rect canvasBounds) {

}
return children;
}
}
public class ShaderMaskLayer : ContainerLayer {
public ShaderMaskLayer(
Shader shader = null,
Rect maskRect = null,
BlendMode blendMode = BlendMode.clear
) {
_shader = shader;
_maskRect = maskRect;
_blendMode = blendMode;
}
public Shader shader {
get {
return _shader;
}
set{
if (value != _shader) {
_shader = value;
markNeedsAddToScene();
}
}
}
Shader _shader;
public Rect maskRect {
get { return _maskRect; }
set {
if (value != _maskRect) {
_maskRect = value;
markNeedsAddToScene();
}
}
}
Rect _maskRect;
public BlendMode blendMode {
get { return _blendMode; }
set {
if (value != _blendMode) {
_blendMode = value;
markNeedsAddToScene();
}
}
}
BlendMode _blendMode;
public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
D.assert(shader != null);
D.assert(maskRect != null);
D.assert(blendMode != null);
D.assert(layerOffset != null);
Rect shiftedMaskRect = layerOffset == Offset.zero ? maskRect : maskRect.shift(layerOffset);
engineLayer = builder.pushShaderMask(
shader,
shiftedMaskRect,
blendMode,
oldLayer: _engineLayer as ui.ShaderMaskEngineLayer
);
addChildrenToScene(builder, layerOffset);
builder.pop();
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Shader>("shader", shader));
properties.add(new DiagnosticsProperty<Rect>("maskRect", maskRect));
properties.add(new DiagnosticsProperty<BlendMode>("blendMode", blendMode));
}
}

63
com.unity.uiwidgets/Runtime/rendering/proxy_box.cs


opaque,
translucent,
}
public delegate Shader ShaderCallback(Rect bounds);
class RenderShaderMask : RenderProxyBox {
public RenderShaderMask(
RenderBox child = null,
ShaderCallback shaderCallback = null,
BlendMode blendMode = BlendMode.modulate
) : base(child) {
D.assert(shaderCallback != null);
D.assert(blendMode != null);
_shaderCallback = shaderCallback;
_blendMode = blendMode;
}
public new ShaderMaskLayer layer {
get {
return base.layer as ShaderMaskLayer;
}
set { }
}
public ShaderCallback shaderCallback {
get {
return _shaderCallback;
}
set {
D.assert(value != null);
if (_shaderCallback == value)
return;
_shaderCallback = value;
markNeedsPaint();
}
}
ShaderCallback _shaderCallback;
public BlendMode blendMode {
get { return _blendMode;}
set {
D.assert(value != null);
if (_blendMode == value)
return;
_blendMode = value;
markNeedsPaint();
}
}
BlendMode _blendMode;
protected override bool alwaysNeedsCompositing {
get { return child != null;}
}
public override void paint(PaintingContext context, Offset offset) {
if (child != null) {
D.assert(needsCompositing);
layer = layer ?? new ShaderMaskLayer();
layer.shader = _shaderCallback(Offset.zero & size);
layer.maskRect = offset & size;
layer.blendMode = _blendMode;
context.pushLayer(layer, base.paint, offset);
} else {
layer = null;
}
}
}
public interface RenderAnimatedOpacityMixin<T> : RenderObjectWithChildMixin<T> where T : RenderObject {

42
com.unity.uiwidgets/Runtime/ui2/compositing.cs


});
return true;
}
public unsafe TransformEngineLayer pushTransform(
float[] matrix4,
TransformEngineLayer oldLayer = null

D.assert(_debugPushLayer(layer));
return layer;
}
public ShaderMaskEngineLayer pushShaderMask(
Shader shader,
Rect maskRect,
BlendMode blendMode,
ShaderMaskEngineLayer oldLayer = null
) {
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "pushShaderMask"));
ShaderMaskEngineLayer layer = new ShaderMaskEngineLayer(SceneBuilder_pushShaderMask(
_ptr,
shader._ptr,
maskRect.left,
maskRect.right,
maskRect.top,
maskRect.bottom,
(int)blendMode
));
D.assert(_debugPushLayer(layer));
return layer;
}
public PhysicalShapeEngineLayer pushPhysicalShape(
Path path,

Clip clipBehavior = Clip.none,
PhysicalShapeEngineLayer oldLayer = null) {
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "PhysicalShapeEngineLayer"));
PhysicalShapeEngineLayer layer = new PhysicalShapeEngineLayer(SceneBuilder_pushPhysicalShape(_ptr, path._ptr, elevation, (int)color.value, (int)(shadowColor?.value ?? 0xFF000000), (int)clipBehavior));
PhysicalShapeEngineLayer layer = new PhysicalShapeEngineLayer(
SceneBuilder_pushPhysicalShape(_ptr,
path._ptr,
elevation,
(int)color.value,
(int)(shadowColor?.value ?? 0xFF000000),
(int)clipBehavior));
D.assert(_debugPushLayer(layer));
return layer;
}

[DllImport(NativeBindings.dllName)]
static extern void SceneBuilder_addPerformanceOverlay(int enabledOptions, float left, float right, float top,
float bottom);
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushShaderMask(
IntPtr ptr,
IntPtr shader,
float maskRectLeft,
float maskRectRight,
float maskRectTop,
float maskRectBottom,
int blendMod);
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushPhysicalShape(IntPtr ptr, IntPtr path, float evelation, int color,
int shadowColor, int clipBehavior);

28
com.unity.uiwidgets/Runtime/widgets/basic.cs


defaultValue: VerticalDirection.down));
}
}
public class ShaderMask : SingleChildRenderObjectWidget {
public ShaderMask(
Key key = null,
ShaderCallback shaderCallback = null,
BlendMode blendMode = BlendMode.modulate,
Widget child = null
) : base(key: key, child: child){
D.assert(shaderCallback != null);
D.assert(blendMode != null);
}
public readonly ShaderCallback shaderCallback;
public readonly BlendMode blendMode;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderShaderMask(
shaderCallback: shaderCallback,
blendMode: blendMode
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderShaderMask)renderObject;
((RenderShaderMask)renderObject).shaderCallback = shaderCallback;
((RenderShaderMask)renderObject).blendMode = blendMode;
}
}
public class PhysicalModel : SingleChildRenderObjectWidget {
public PhysicalModel(

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


badAncestors.Insert(0, result);
try {
List<ErrorDescription> errors = new List<ErrorDescription>();
foreach (ParentDataElement<ParentData> ancestor in badAncestors)
foreach (ParentDataElement<ParentData> _ancestor in badAncestors)
$"- {ancestor.widget} (typically placed directly inside a {ancestor.widget.debugTypicalAncestorWidgetClass} widget)"));
$"- {_ancestor.widget} (typically placed directly inside a {_ancestor.widget.debugTypicalAncestorWidgetClass} widget)"));
List<DiagnosticsNode> results = new List<DiagnosticsNode>();
results.Add( new ErrorSummary("Incorrect use of ParentDataWidget."));
results.Add(new ErrorDescription("The following ParentDataWidgets are providing parent data to the same RenderObject:"));

11
engine/src/lib/ui/compositing/scene_builder.cc


}
UIWIDGETS_API(EngineLayer*)
SceneBuilder_pushShaderMask(SceneBuilder* ptr,
Shader* shader, float maskRectLeft, float maskRectRight, float maskRectTop,
float maskRectBottom, int blendMode) {
const auto layer = ptr->pushShaderMask(
shader, maskRectLeft, maskRectRight, maskRectTop,
maskRectBottom, blendMode);
layer->AddRef();
return layer.get();
}
UIWIDGETS_API(EngineLayer*)
SceneBuilder_pushPhysicalShape(SceneBuilder* ptr, CanvasPath* path,
float elevation, int color, int shadowColor,
int clipBehavior) {

正在加载...
取消
保存