浏览代码

Merge branch 'dev_1.17.5' into siyaoH/1.17/keyboard

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
4882bcd1
共有 58 个文件被更改,包括 2223 次插入157 次删除
  1. 8
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs
  2. 3
      com.unity.uiwidgets/Runtime/gestures/multidrag.cs
  3. 30
      com.unity.uiwidgets/Runtime/material/expansion_panel.cs
  4. 2
      com.unity.uiwidgets/Runtime/material/flat_button.cs
  5. 2
      com.unity.uiwidgets/Runtime/material/raised_button.cs
  6. 139
      com.unity.uiwidgets/Runtime/material/slider_theme.cs
  7. 10
      com.unity.uiwidgets/Runtime/painting/alignment.cs
  8. 1
      com.unity.uiwidgets/Runtime/painting/image_resolution.cs
  9. 5
      com.unity.uiwidgets/Runtime/rendering/list_wheel_viewport.cs
  10. 2
      com.unity.uiwidgets/Runtime/rendering/sliver_padding.cs
  11. 4
      com.unity.uiwidgets/Runtime/rendering/sliver_persistent_header.cs
  12. 6
      com.unity.uiwidgets/Runtime/rendering/viewport.cs
  13. 2
      com.unity.uiwidgets/Runtime/services/text_input.cs
  14. 7
      com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.gen.cs
  15. 4
      com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.njk
  16. 3
      com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.gen.cs
  17. 5
      com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.njk
  18. 1
      com.unity.uiwidgets/Runtime/widgets/animated_size.cs
  19. 2
      com.unity.uiwidgets/Runtime/widgets/drag_target.cs
  20. 4
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  21. 15
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  22. 6
      com.unity.uiwidgets/Runtime/widgets/page_view.cs
  23. 43
      com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.cs
  24. 8
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta
  25. 56
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs
  26. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs.meta
  27. 86
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs
  28. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs.meta
  29. 61
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs
  30. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs.meta
  31. 131
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs
  32. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs.meta
  33. 82
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs
  34. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs.meta
  35. 79
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs
  36. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs.meta
  37. 53
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs
  38. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs.meta
  39. 3
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample.meta
  40. 232
      com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.mixin.gen.cs
  41. 240
      com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.mixin.njk
  42. 168
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/DragDropSample.cs
  43. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/DragDropSample.cs.meta
  44. 52
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/LongPressSample.cs
  45. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/LongPressSample.cs.meta
  46. 228
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/NavigationSample.cs
  47. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/NavigationSample.cs.meta
  48. 45
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/PageViewSample.cs
  49. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/PageViewSample.cs.meta
  50. 59
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ScrollbarSample.cs
  51. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ScrollbarSample.cs.meta
  52. 87
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/CustomPaintSample.cs
  53. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/CustomPaintSample.cs.meta
  54. 172
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ExpansionPanelSample.cs
  55. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ExpansionPanelSample.cs.meta
  56. 69
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/HttpRequestSample.cs
  57. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/HttpRequestSample.cs.meta

8
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs


public readonly List<string> colorNameItems;
public override Widget build(BuildContext context) {
return new WillPopScope(
//onWillPop: () => { return Promise<bool>.Resolved(true); },
//onWillPop: this.onWillPop,

title: new Text("Profile")
)
}
),
tabBuilder: (BuildContext _context, int index) => {
D.assert(index >= 0 && index <= 2);

height: 44.0f,
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage(
"people/square/trevor"
image: new FileImage(
file:""
)
),
shape: BoxShape.circle

height: 44.0f,
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage(
image: new FileImage(
"people/square/sandra"
)
),

3
com.unity.uiwidgets/Runtime/gestures/multidrag.cs


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

public override void dispose() {
foreach (var key in _pointers.Keys) {
foreach (var key in _pointers.Keys.ToList()) {
_removeState(key);
}
D.assert(_pointers.isEmpty);

30
com.unity.uiwidgets/Runtime/material/expansion_panel.cs


public override Widget build(BuildContext context) {
List<MergeableMaterialItem> items = new List<MergeableMaterialItem>();
for (int index = 0; index < widget.children.Count; index++) {
int expandIndex = index;
if (_isChildExpanded(index) && index != 0 && !_isChildExpanded(index - 1)) {
for (int i = 0; i < widget.children.Count; i++) {
int expandIndex = i;
if (_isChildExpanded(expandIndex) && expandIndex != 0 && !_isChildExpanded(expandIndex - 1)) {
key: new _SaltedKey<BuildContext, int>(context, index * 2 - 1)));
key: new _SaltedKey<BuildContext, int>(context, expandIndex * 2 - 1)));
ExpansionPanel child = widget.children[index];
ExpansionPanel child = widget.children[expandIndex];
_isChildExpanded(index)
_isChildExpanded(expandIndex)
margin: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(end: 8.0f),
//margin: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(end: 8.0f),
isExpanded: _isChildExpanded(index),
isExpanded: _isChildExpanded(expandIndex),
? (bool isExpanded) => _handlePressed(isExpanded, index)
? (bool isExpanded) => _handlePressed(isExpanded, expandIndex)
: (ValueChanged<bool>) null
)
);

child: new AnimatedContainer(
duration: widget.animationDuration,
curve: Curves.fastOutSlowIn,
margin: _isChildExpanded(index) ? widget.expandedHeaderPadding : EdgeInsets.zero,
margin: _isChildExpanded(expandIndex) ? widget.expandedHeaderPadding : EdgeInsets.zero,
child: new ConstrainedBox(
constraints: new BoxConstraints(
minHeight: material_._kPanelHeaderCollapsedHeight),

);
if (child.canTapOnHeader) {
header = new InkWell(
onTap: () => _handlePressed(_isChildExpanded(index), index),
onTap: () => _handlePressed(_isChildExpanded(expandIndex), expandIndex),
key: new _SaltedKey<BuildContext, int>(context, index * 2),
key: new _SaltedKey<BuildContext, int>(context, expandIndex * 2),
child: new Column(
children: new List<Widget> {
header,

firstCurve: new Interval(0.0f, 0.6f, curve: Curves.fastOutSlowIn),
secondCurve: new Interval(0.4f, 1.0f, curve: Curves.fastOutSlowIn),
sizeCurve: Curves.fastOutSlowIn,
crossFadeState: _isChildExpanded(index)
crossFadeState: _isChildExpanded(expandIndex)
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: widget.animationDuration

)
);
if (_isChildExpanded(index) && index != widget.children.Count - 1) {
if (_isChildExpanded(expandIndex) && expandIndex != widget.children.Count - 1) {
key: new _SaltedKey<BuildContext, int>(context, index * 2 + 1)));
key: new _SaltedKey<BuildContext, int>(context, expandIndex * 2 + 1)));
}
}

2
com.unity.uiwidgets/Runtime/material/flat_button.cs


return new RawMaterialButton(
onPressed: onPressed,
onLongPress: () => onLongPress(),
onLongPress: () => onLongPress?.Invoke(),
onHighlightChanged: onHighlightChanged,
fillColor: buttonTheme.getFillColor(this),
textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)),

2
com.unity.uiwidgets/Runtime/material/raised_button.cs


return new RawMaterialButton(
onPressed: onPressed,
onLongPress: () => onLongPress(),
onLongPress: () => onLongPress?.Invoke(),
onHighlightChanged: onHighlightChanged,
clipBehavior: clipBehavior.Value,
fillColor: buttonTheme.getFillColor(this),

139
com.unity.uiwidgets/Runtime/material/slider_theme.cs


}
public abstract Size getPreferredSize(
bool? isEnabled,
bool? isDiscrete,
bool isEnabled,
bool isDiscrete,
TextPainter textPainter = null);
public abstract void paint(

Animation<float> enableAnimation = null,
bool? isDiscrete = null,
bool isDiscrete = false,
TextPainter labelPainter = null,
RenderBox parentBox = null,
SliderThemeData sliderTheme = null,

public abstract Size getPreferredSize(
SliderThemeData sliderTheme = null,
bool? isEnabled = null);
bool isEnabled = false);
public abstract void paint(
PaintingContext context,

Animation<float> enableAnimation = null,
Offset thumbCenter = null,
bool? isEnabled = null,
bool isEnabled = false,
TextDirection? textDirection = null);
public static readonly SliderTickMarkShape noTickMark = new _EmptySliderTickMarkShape();

RenderBox parentBox = null,
Offset offset = null,
SliderThemeData sliderTheme = null,
bool? isEnabled = null,
bool? isDiscrete = null);
bool isEnabled = false,
bool isDiscrete = false);
public abstract void paint(
PaintingContext context,

Animation<float> enableAnimation = null,
Offset thumbCenter = null,
bool? isEnabled = null,
bool? isDiscrete = null,
bool isEnabled = false,
bool isDiscrete = false,
TextDirection? textDirection = null
);
}

}
public abstract Size getPreferredSize(bool? isEnabled, bool? isDiscrete);
public abstract Size getPreferredSize(bool isEnabled, bool isDiscrete);
public abstract void paint(
PaintingContext context,

bool? isDiscrete = null,
bool? isEnabled = null,
bool isDiscrete = false,
bool isEnabled = false,
bool? isOnTop = null,
TextDirection? textDirection = null,
SliderThemeData sliderTheme = null,

Offset center,
Animation<float> activationAnimation = null,
Animation<float> enableAnimation = null,
bool? isDiscrete = null,
bool isDiscrete = false,
bool? isOnTop = null,
TextPainter labelPainter = null,
RenderBox parentBox = null,

public abstract Size getPreferredSize(
SliderThemeData sliderTheme = null,
bool? isEnabled = null
bool isEnabled = false
);
public abstract void paint(

Animation<float> enableAnimation = null,
Offset startThumbCenter = null,
Offset endThumbCenter = null,
bool? isEnabled = null,
bool isEnabled = false,
TextDirection? textDirection = null
);
}

RenderBox parentBox = null,
Offset offset = null,
SliderThemeData sliderTheme = null,
bool? isEnabled = null,
bool? isDiscrete = null
bool isEnabled = false,
bool isDiscrete = false
);
public abstract void paint(

Animation<float> enableAnimation = null,
Offset startThumbCenter = null,
Offset endThumbCenter = null,
bool? isEnabled = null,
bool? isDiscrete = null,
bool isEnabled = false,
bool isDiscrete = false,
TextDirection? textDirection = null
);
}

RenderBox parentBox = null,
Offset offset = null,
SliderThemeData sliderTheme = null,
bool? isEnabled = null,
bool? isDiscrete = null) {
bool isEnabled = false,
bool isDiscrete = false) {
D.assert(isEnabled != null);
D.assert(isDiscrete != null);
D.assert(parentBox != null);
D.assert(sliderTheme != null);
float thumbWidth = sliderTheme.thumbShape.getPreferredSize(isEnabled, isDiscrete).width;

SliderThemeData sliderTheme = null,
Animation<float> enableAnimation = null,
Offset thumbCenter = null,
bool? isEnabled = false,
bool? isDiscrete = false,
bool isEnabled = false,
bool isDiscrete = false,
TextDirection? textDirection = null) {
D.assert(context != null);
D.assert(offset != null);

D.assert(enableAnimation != null);
D.assert(textDirection != null);
D.assert(thumbCenter != null);
D.assert(isEnabled != null);
D.assert(isDiscrete != null);
if (sliderTheme.trackHeight == 0) {
return;

RenderBox parentBox = null,
Offset offset = null,
SliderThemeData sliderTheme = null,
bool? isEnabled = null,
bool? isDiscrete = null) {
bool isEnabled = false,
bool isDiscrete = false) {
D.assert(isEnabled != null);
D.assert(isDiscrete != null);
D.assert(parentBox != null);
D.assert(sliderTheme != null);
float thumbWidth = sliderTheme.thumbShape.getPreferredSize(isEnabled, isDiscrete).width;

SliderThemeData sliderTheme = null,
Animation<float> enableAnimation = null,
Offset thumbCenter = null,
bool? isEnabled = false,
bool? isDiscrete = false,
bool isEnabled = false,
bool isDiscrete = false,
TextDirection? textDirection = null) {
D.assert(context != null);
D.assert(offset != null);

RenderBox parentBox = null,
Offset offset = null,
SliderThemeData sliderTheme = null,
bool? isEnabled = false,
bool? isDiscrete = false
bool isEnabled = false,
bool isDiscrete = false
) {
offset = offset ?? Offset.zero;

D.assert(sliderTheme.overlayShape != null);
D.assert(isEnabled != null);
D.assert(isDiscrete != null);
float overlayWidth = sliderTheme.overlayShape.getPreferredSize(isEnabled, isDiscrete).width;
float trackHeight = sliderTheme.trackHeight.Value;

Animation<float> enableAnimation = null,
Offset startThumbCenter = null,
Offset endThumbCenter = null,
bool? isEnabled = false,
bool? isDiscrete = false,
bool isEnabled = false,
bool isDiscrete = false,
TextDirection? textDirection = null
) {
D.assert(context != null);

D.assert(enableAnimation != null);
D.assert(startThumbCenter != null);
D.assert(endThumbCenter != null);
D.assert(isEnabled != null);
D.assert(isDiscrete != null);
D.assert(textDirection != null);
ColorTween activeTrackColorTween = new ColorTween(begin: sliderTheme.disabledActiveTrackColor,

RenderBox parentBox = null,
Offset offset = null,
SliderThemeData sliderTheme = null,
bool? isEnabled = false,
bool? isDiscrete = false
bool isEnabled = false,
bool isDiscrete = false
) {
offset = offset ?? Offset.zero;

D.assert(sliderTheme.overlayShape != null);
D.assert(sliderTheme.trackHeight != null);
D.assert(isEnabled != null);
D.assert(isDiscrete != null);
float overlayWidth = sliderTheme.overlayShape.getPreferredSize(isEnabled, isDiscrete).width;
float trackHeight = sliderTheme.trackHeight.Value;

Animation<float> enableAnimation = null,
Offset startThumbCenter = null,
Offset endThumbCenter = null,
bool? isEnabled = false,
bool? isDiscrete = false,
bool isEnabled = false,
bool isDiscrete = false,
TextDirection? textDirection = null
) {
D.assert(context != null);

D.assert(enableAnimation != null);
D.assert(startThumbCenter != null);
D.assert(endThumbCenter != null);
D.assert(isEnabled != null);
D.assert(isDiscrete != null);
D.assert(textDirection != null);
ColorTween activeTrackColorTween = new ColorTween(begin: sliderTheme.disabledActiveTrackColor,

public override Size getPreferredSize(
SliderThemeData sliderTheme = null,
bool? isEnabled = null
bool isEnabled = false
D.assert(isEnabled != null);
return Size.fromRadius(tickMarkRadius ?? sliderTheme.trackHeight.Value / 2f);
}

SliderThemeData sliderTheme = null,
Animation<float> enableAnimation = null,
Offset thumbCenter = null,
bool? isEnabled = null,
bool isEnabled = false,
TextDirection? textDirection = null
) {
D.assert(context != null);

D.assert(enableAnimation != null);
D.assert(textDirection != null);
D.assert(thumbCenter != null);
D.assert(isEnabled != null);
Color begin = null;
Color end = null;

public override Size getPreferredSize(
SliderThemeData sliderTheme = null,
bool? isEnabled = false
bool isEnabled = false
D.assert(isEnabled != null);
return Size.fromRadius(tickMarkRadius ?? sliderTheme.trackHeight.Value / 2f);
}

Animation<float> enableAnimation = null,
Offset startThumbCenter = null,
Offset endThumbCenter = null,
bool? isEnabled = false,
bool isEnabled = false,
TextDirection? textDirection = null
) {
D.assert(context != null);

D.assert(enableAnimation != null);
D.assert(startThumbCenter != null);
D.assert(endThumbCenter != null);
D.assert(isEnabled != null);
D.assert(textDirection != null);
bool isBetweenThumbs = false;

class _EmptySliderTickMarkShape : SliderTickMarkShape {
public override Size getPreferredSize(
SliderThemeData sliderTheme = null,
bool? isEnabled = null) {
bool isEnabled = false) {
return Size.zero;
}

SliderThemeData sliderTheme = null,
Animation<float> enableAnimation = null,
Offset thumbCenter = null,
bool? isEnabled = null,
bool isEnabled = false,
TextDirection? textDirection = null) {
}
}

bool? isEnabled = null,
bool? isDiscrete = null,
bool isEnabled = false,
bool isDiscrete = false,
TextPainter textPainter = null) {
return Size.zero;
}

Offset center,
Animation<float> activationAnimation = null,
Animation<float> enableAnimation = null,
bool? isDiscrete = null,
bool isDiscrete = false,
TextPainter labelPainter = null,
RenderBox parentBox = null,
SliderThemeData sliderTheme = null,

}
public override Size getPreferredSize(bool? isEnabled, bool? isDiscrete, TextPainter textPainter = null) {
public override Size getPreferredSize(bool isEnabled, bool isDiscrete, TextPainter textPainter = null) {
return Size.fromRadius(isEnabled == true ? enabledThumbRadius : _disabledThumbRadius);
}

Offset center,
Animation<float> activationAnimation = null,
Animation<float> enableAnimation = null,
bool? isDiscrete = null,
bool isDiscrete = false,
TextPainter labelPainter = null,
RenderBox parentBox = null,
SliderThemeData sliderTheme = null,

get { return disabledThumbRadius ?? enabledThumbRadius; }
}
public override Size getPreferredSize(bool? isEnabled, bool? isDiscrete) {
public override Size getPreferredSize(bool isEnabled, bool isDiscrete) {
return Size.fromRadius(isEnabled == true ? enabledThumbRadius : _disabledThumbRadius);
}

Animation<float> activationAnimation = null,
Animation<float> enableAnimation = null,
bool? isDiscrete = false,
bool? isEnabled = false,
bool isDiscrete = false,
bool isEnabled = false,
bool? isOnTop = null,
TextDirection? textDirection = null,
SliderThemeData sliderTheme = null,

bool showValueIndicator = false;
switch (sliderTheme.showValueIndicator) {
case ShowValueIndicator.onlyForDiscrete:
showValueIndicator = isDiscrete.Value;
showValueIndicator = isDiscrete;
showValueIndicator = !isDiscrete.Value;
showValueIndicator = !isDiscrete;
break;
case ShowValueIndicator.always:
showValueIndicator = true;

public readonly float overlayRadius;
public override Size getPreferredSize(bool? isEnabled, bool? isDiscrete, TextPainter textPainter = null) {
public override Size getPreferredSize(bool isEnabled, bool isDiscrete, TextPainter textPainter = null) {
return Size.fromRadius(overlayRadius);
}

Animation<float> activationAnimation = null,
Animation<float> enableAnimation = null,
bool? isDiscrete = null,
bool isDiscrete = false,
TextPainter labelPainter = null,
RenderBox parentBox = null,
SliderThemeData sliderTheme = null,

static readonly _PaddleSliderTrackShapePathPainter _pathPainter = new _PaddleSliderTrackShapePathPainter();
public override Size getPreferredSize(
bool? isEnabled,
bool? isDiscrete,
bool isEnabled,
bool isDiscrete,
TextPainter labelPainter = null) {
D.assert(labelPainter != null);
return _pathPainter.getPreferredSize(isEnabled, isDiscrete, labelPainter);

Offset center,
Animation<float> activationAnimation = null,
Animation<float> enableAnimation = null,
bool? isDiscrete = null,
bool isDiscrete = false,
TextPainter labelPainter = null,
RenderBox parentBox = null,
SliderThemeData sliderTheme = null,

Offset center,
Animation<float> activationAnimation = null,
Animation<float> enableAnimation = null,
bool? isDiscrete = null,
bool isDiscrete = false,
bool? isOnTop = null,
TextPainter labelPainter = null,
RenderBox parentBox = null,

const bool _debuggingLabelLocation = false;
public Size getPreferredSize(
bool? isEnabled,
bool? isDiscrete,
bool isEnabled,
bool isDiscrete,
TextPainter labelPainter
) {
D.assert(labelPainter != null);

10
com.unity.uiwidgets/Runtime/painting/alignment.cs


}
public override Alignment resolve(TextDirection? direction) {
direction = direction ?? TextDirection.ltr;
switch (direction) {
case TextDirection.rtl:
return new Alignment(_x - _start, _y);
case TextDirection.ltr:
return new Alignment(_x + _start, _y);
}
return null;
return this;
}

1
com.unity.uiwidgets/Runtime/painting/image_resolution.cs


public class AssetImage : AssetBundleImageProvider, IEquatable<AssetImage> {
public AssetImage(string assetName,
AssetBundle bundle = null) {
D.assert(false,() => "AssetImage is currently not supported, you can use FileImage instead");
D.assert(assetName != null);
this.assetName = assetName;
this.bundle = bundle;

5
com.unity.uiwidgets/Runtime/rendering/list_wheel_viewport.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.cupertino;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

RenderBox after = null
) {
invokeLayoutCallback<BoxConstraints>((BoxConstraints constraints) => {
D.assert(this.constraints == this.constraints);
D.assert(constraints == this.constraints);
childManager.createChild(index, after: after);
});
}

D.assert(this.constraints == this.constraints);
D.assert(constraints == this.constraints);
childManager.removeChild(child);
});
}

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


constraints.remainingPaintExtent
);
geometry = new SliverGeometry(
scrollExtent: mainAxisPadding ?? 0.0f+ childLayoutGeometry.scrollExtent,
scrollExtent: (mainAxisPadding ?? 0.0f) + childLayoutGeometry.scrollExtent,
paintExtent: paintExtent,
layoutExtent: Mathf.Min(mainAxisPaddingPaintExtent + childLayoutGeometry.layoutExtent, paintExtent),
cacheExtent: Mathf.Min(mainAxisPaddingCacheExtent + childLayoutGeometry.cacheExtent, constraints.remainingCacheExtent),

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


bool _lastOverlapsContent = false;
public OverScrollHeaderStretchConfiguration stretchConfiguration;
protected void updateChild(float shrinkOffset, bool overlapsContent) {
protected virtual void updateChild(float shrinkOffset, bool overlapsContent) {
}
public override void markNeedsLayout() {

}
}
FloatingHeaderSnapConfiguration _snapConfiguration;
public FloatingHeaderSnapConfiguration _snapConfiguration;
protected virtual float updateGeometry() {
float stretchOffset = 0.0f;

6
com.unity.uiwidgets/Runtime/rendering/viewport.cs


AxisDirection axisDirection = AxisDirection.down,
AxisDirection crossAxisDirection = AxisDirection.right,
ViewportOffset offset = null,
float cacheExtent = RenderViewportUtils.defaultCacheExtent,
float? cacheExtent = null,
D.assert(cacheExtentStyle == CacheExtentStyle.pixel);
D.assert(cacheExtent != null || cacheExtentStyle == CacheExtentStyle.pixel);
_cacheExtent = cacheExtent;
_cacheExtent = cacheExtent ?? RenderViewportUtils.defaultCacheExtent;
_cacheExtentStyle = cacheExtentStyle;
}

2
com.unity.uiwidgets/Runtime/services/text_input.cs


string text = "",
TextSelection selection = null,
TextRange composing = null) {
this.selection = this.selection ?? TextSelection.collapsed(offset: -1);
selection = selection ?? TextSelection.collapsed(offset: -1);
D.assert(text != null);
this.text = text;

7
com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.gen.cs


using System;
using Unity.UIWidgets.ui;
using UnityEngine;
namespace Unity.UIWidgets.foundation {
public class DiagnosticableTreeMixinChangeNotifier : ChangeNotifier, DiagnosticableTreeMixin {
protected DiagnosticableTreeMixinChangeNotifier() {

}
public virtual void debugFillProperties(DiagnosticPropertiesBuilder properties) { }
}
}

4
com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.njk


using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Unity.UIWidgets.foundation {
{% macro DiagnosticableTreeMixin(with) %}
{% set className = 'DiagnosticableTreeMixin' + with %}

3
com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.gen.cs


using System;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.widgets {
public class DirectionalFocusTraversalPolicyMixinFocusTraversalPolicy : FocusTraversalPolicy, DirectionalFocusTraversalPolicyMixin {
protected DirectionalFocusTraversalPolicyMixinFocusTraversalPolicy() {

5
com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.njk


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
{% macro DirectionalFocusTraversalPolicyMixin(with) %}
{% set className = 'DirectionalFocusTraversalPolicyMixin' + with %}

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


TimeSpan? reverseDuration = null,
TickerProvider vsync = null) : base(key: key, child: child) {
D.assert(duration != null);
D.assert(reverseDuration != null);
D.assert(vsync != null);
this.alignment = alignment ?? Alignment.center;
this.curve = curve ?? Curves.linear;

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


D.assert(!_candidateAvatars.Contains(avatar));
D.assert(!_rejectedAvatars.Contains(avatar));
if (avatar.data is _DragAvatar<T> && (widget.onWillAccept == null || widget.onWillAccept(avatar.data))) {
if (avatar is _DragAvatar<T> && (widget.onWillAccept == null || widget.onWillAccept(avatar.data))) {
setState(() => { _candidateAvatars.Add(avatar); });
return true;
}

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


hasSameSuperclass = oldElementClass == newWidgetClass;
return true;
});
if (hasSameSuperclass && child.widget == newWidget) {
if (hasSameSuperclass && Equals(child.widget,newWidget)) {
if (!Equals(child.slot, newSlot)) {
updateSlotForChild(child, newSlot);
}

}
child.update(newWidget);
D.assert(child.widget == newWidget);
D.assert(Equals(child.widget, newWidget));
D.assert(() => {
child.owner._debugElementWasRebuilt(child);
return true;

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


public static Future<T> pushNamed<T>(BuildContext context, string routeName, object arguments = null) {
return of(context).pushNamed<T>(routeName, arguments: arguments);
}
public static Future pushNamed(BuildContext context, string routeName, object arguments = null) {
return of(context).pushNamed(routeName, arguments: arguments);
}
public static Future<T> pushReplacementNamed<T,TO>(BuildContext context, string routeName,
TO result = default , object arguments = null) {

name: name,
arguments: arguments
);
Route<T> route = widget.onGenerateRoute(settings) as Route<T>;
var routeee = widget.onGenerateRoute(settings);
Route<T> route = routeee as Route<T>;
if (route == null && !allowNull) {
D.assert(() => {
if (widget.onUnknownRoute == null) {

object arguments = null
) {
return push<T>(_routeNamed<T>(routeName, arguments: arguments));
}
public Future pushNamed(
string routeName,
object arguments = null
) {
return push(_routeNamed(routeName, arguments: arguments));
}
public Future<T> pushReplacementNamed<T, TO>(

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


}
public override bool applyViewportDimension(float viewportDimension) {
float oldViewportDimensions = this.viewportDimension;
float oldViewportDimensions = 0.0f;
if (haveDimensions) {
oldViewportDimensions = this.viewportDimension;
}
bool result = base.applyViewportDimension(viewportDimension);
float? oldPixels = null;
if (havePixels) {

43
com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.cs


using Unity.UIWidgets.rendering;
namespace Unity.UIWidgets.widgets {
static class sliver_persistent_header_utils {
public static _SliverPersistentHeaderElement _element { get; set; }
}
public abstract class SliverPersistentHeaderDelegate {
public SliverPersistentHeaderDelegate() {
}

}
}
class _SliverPersistentHeaderElement : RenderObjectElement {
public class _SliverPersistentHeaderElement : RenderObjectElement {
public _SliverPersistentHeaderElement(_SliverPersistentHeaderRenderObjectWidget widget) : base(widget) {
}

public override void mount(Element parent, object newSlot) {
base.mount(parent, newSlot);
(renderObject as _RenderSliverPersistentHeaderForWidgetsMixin)._element = this;
sliver_persistent_header_utils._element = this;
(renderObject as _RenderSliverPersistentHeaderForWidgetsMixin)._element = null;
sliver_persistent_header_utils._element = null;
}
public override void update(Widget _newWidget) {

}
}
abstract class _SliverPersistentHeaderRenderObjectWidget : RenderObjectWidget {
public abstract class _SliverPersistentHeaderRenderObjectWidget : RenderObjectWidget {
public _SliverPersistentHeaderRenderObjectWidget(
Key key = null,
SliverPersistentHeaderDelegate layoutDelegate = null

}
}
interface _RenderSliverPersistentHeaderForWidgetsMixin {
// on RenderSliverPersistentHeader ???? todo
_SliverPersistentHeaderElement _element { get; set; }
public interface _RenderSliverPersistentHeaderForWidgetsMixin {
float? minExtent {
get;
}
float? maxExtent {
get;
}
void updateChild(float shrinkOffset, bool overlapsContent);
void triggerRebuild();
}

abstract class _RenderSliverScrollingPersistentHeader : RenderSliverScrollingPersistentHeader {
}
class _RenderSliverScrollingPersistentHeaderForWidgets : RenderSliverScrollingPersistentHeader, _RenderSliverPersistentHeaderForWidgetsMixin {
class _RenderSliverScrollingPersistentHeaderForWidgets : _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverScrollingPersistentHeader {
public _RenderSliverScrollingPersistentHeaderForWidgets(
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null

abstract class _RenderSliverPinnedPersistentHeader : RenderSliverPinnedPersistentHeader {
}
class _RenderSliverPinnedPersistentHeaderForWidgets : RenderSliverPinnedPersistentHeader,
_RenderSliverPersistentHeaderForWidgetsMixin {
class _RenderSliverPinnedPersistentHeaderForWidgets : _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverPinnedPersistentHeader {
public _RenderSliverPinnedPersistentHeaderForWidgets(
RenderBox child = null,

}
public _SliverPersistentHeaderElement _element {
get { return _ele; }
set { _ele = value; }
get { return sliver_persistent_header_utils._element; }
set { sliver_persistent_header_utils._element = value; }
}
_SliverPersistentHeaderElement _ele;

abstract class _RenderSliverFloatingPinnedPersistentHeader : RenderSliverFloatingPinnedPersistentHeader {
}
class _RenderSliverFloatingPinnedPersistentHeaderForWidgets : RenderSliverFloatingPinnedPersistentHeader,
_RenderSliverPersistentHeaderForWidgetsMixin {
class _RenderSliverFloatingPinnedPersistentHeaderForWidgets : _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverFloatingPinnedPersistentHeader {
public _RenderSliverFloatingPinnedPersistentHeaderForWidgets(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null,

abstract class _RenderSliverFloatingPersistentHeader : RenderSliverFloatingPersistentHeader {
}
class _RenderSliverFloatingPersistentHeaderForWidgets : RenderSliverFloatingPersistentHeader,
_RenderSliverPersistentHeaderForWidgetsMixin {
class _RenderSliverFloatingPersistentHeaderForWidgets : _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverFloatingPersistentHeader {
public _RenderSliverFloatingPersistentHeaderForWidgets(
RenderBox child = null,

8
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta


fileFormatVersion: 2
guid: c0f377c78881e9243879a01b93524d63
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

56
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs


using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Material = Unity.UIWidgets.material.Material;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialInkWellSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new MaterialInkWellWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class MaterialInkWellWidget : StatefulWidget {
public MaterialInkWellWidget(Key key = null) : base(key) {
}
public override State createState() {
return new MaterialInkWidgetState();
}
}
public class MaterialInkWidgetState : State<MaterialInkWellWidget> {
public override Widget build(BuildContext context) {
return new Material(
//color: Colors.blue,
child: new Center(
child: new Container(
width: 200,
height: 200,
child: new InkWell(
borderRadius: BorderRadius.circular(2.0f),
highlightColor: new Color(0xAAFF0000),
splashColor: new Color(0xAA0000FF),
onTap: () => { Debug.Log("on tap"); }
)
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs.meta


fileFormatVersion: 2
guid: b9e88c33e9f304d40bab9c27f1276033
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

86
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialNavigationBarSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new MaterialNavigationBarWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
class MaterialNavigationBarWidget : StatefulWidget {
public MaterialNavigationBarWidget(Key key = null) : base(key) {
}
public override State createState() {
return new MaterialNavigationBarWidgetState();
}
}
class MaterialNavigationBarWidgetState : SingleTickerProviderStateMixin<MaterialNavigationBarWidget> {
int _currentIndex = 0;
public MaterialNavigationBarWidgetState() {
}
public override Widget build(BuildContext context) {
return new Scaffold(
bottomNavigationBar: new Container(
height: 100,
color: Colors.blue,
child: new Center(
child: new BottomNavigationBar(
type: BottomNavigationBarType.shifting,
// type: BottomNavigationBarType.fix,
items: new List<BottomNavigationBarItem> {
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.work, size: 30),
title: new Text("Work"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.work, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.home, size: 30),
title: new Text("Home"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.home, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.shop, size: 30),
title: new Text("Shop"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.shop, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.school, size: 30),
title: new Text("School"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.school, size: 50),
backgroundColor: Colors.blue
),
},
currentIndex: this._currentIndex,
onTap: (value) => { this.setState(() => { this._currentIndex = value; }); }
)
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs.meta


fileFormatVersion: 2
guid: cc34344049d222b468f2487b97076448
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

61
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs


using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialSliderSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new MaterialSliderWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class MaterialSliderWidget : StatefulWidget {
public override State createState() {
return new MaterialSliderState();
}
}
public class MaterialSliderState : State<MaterialSliderWidget> {
float _value = 0.8f;
void onChanged(float value) {
this.setState(() => { this._value = value; });
}
public override Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Slider and Indicators")),
body: new Column(
children: new List<Widget> {
new Padding(
padding: EdgeInsets.only(top: 100.0f),
child: new Container(
child: new Slider(
divisions: 10,
min: 0.4f,
label: "Here",
value: this._value,
onChanged: this.onChanged))
)
}
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs.meta


fileFormatVersion: 2
guid: 0152b6f575e6ca44baea965a23ebe498
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

131
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialTabBarSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new TabBarDemo()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class TabBarDemo : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new MaterialTabBarWidget();
/*
return new DefaultTabController(
length: 3,
child: new Scaffold(
appBar: new AppBar(
bottom: new TabBar(
tabs: new List<Widget> {
new Tab(icon: new Icon(Icons.directions_car)),
new Tab(icon: new Icon(Icons.directions_transit)),
new Tab(icon: new Icon(Icons.directions_bike)),
}
),
title: new Text("Tabs Demo")
),
body: new TabBarView(
children: new List<Widget> {
new Icon(Icons.directions_car),
new Icon(Icons.directions_transit),
new Icon(Icons.directions_bike),
}
)
)
);*/
}
}
public class MaterialTabBarWidget : StatefulWidget {
public MaterialTabBarWidget(Key key = null) : base(key) {
}
public override State createState() {
return new MaterialTabBarWidgetState();
}
}
public class MaterialTabBarWidgetState : SingleTickerProviderStateMixin<MaterialTabBarWidget> {
TabController _tabController;
public override void initState() {
base.initState();
this._tabController = new TabController(vsync: this, length: Choice.choices.Count);
}
public override void dispose() {
this._tabController.dispose();
base.dispose();
}
void _nextPage(int delta) {
int newIndex = this._tabController.index + delta;
if (newIndex < 0 || newIndex >= this._tabController.length) {
return;
}
this._tabController.animateTo(newIndex);
}
public override Widget build(BuildContext context) {
List<Widget> tapChildren = new List<Widget>();
foreach (Choice choice in Choice.choices) {
tapChildren.Add(
new Padding(
padding: EdgeInsets.all(16.0f),
child: new ChoiceCard(choice: choice)));
}
return new Scaffold(
appBar: new AppBar(
title: new Center(
child: new Text("AppBar Bottom Widget")
),
leading: new IconButton(
tooltip: "Previous choice",
icon: new Icon(Unity.UIWidgets.material.Icons.arrow_back),
onPressed: () => { this._nextPage(-1); }
),
actions: new List<Widget> {
new IconButton(
icon: new Icon(Unity.UIWidgets.material.Icons.arrow_forward),
tooltip: "Next choice",
onPressed: () => { this._nextPage(1); })
},
bottom: new PreferredSize(
preferredSize: Size.fromHeight(48.0f),
child: new Theme(
data: Theme.of(context).copyWith(accentColor: Colors.white),
child: new Container(
height: 48.0f,
alignment: Alignment.center,
child: new TabPageSelector(
controller: this._tabController))))
),
body: new TabBarView(
controller: this._tabController,
children: tapChildren
));
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs.meta


fileFormatVersion: 2
guid: fecd06f805d0b0f4ead134b1ad6a9a49
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

82
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Image = Unity.UIWidgets.widgets.Image;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialThemeSample: UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
home: new MaterialThemeSampleWidget(),
darkTheme: new ThemeData(primaryColor: Colors.black26)
));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class MaterialThemeSampleWidget: StatefulWidget {
public override State createState() {
return new _MaterialThemeSampleWidgetState();
}
}
class _MaterialThemeSampleWidgetState : State<MaterialThemeSampleWidget> {
public override Widget build(BuildContext context) {
return new Theme(
data: new ThemeData(
appBarTheme: new AppBarTheme(
color: Colors.purple
),
bottomAppBarTheme: new BottomAppBarTheme(
color: Colors.blue
),
cardTheme: new CardTheme(
color: Colors.red,
elevation: 2.0f
)
),
child: new Scaffold(
appBar: new AppBar(title: new Text("Test App Bar Theme")),
body: new Center(
child: new Card(
shape: new RoundedRectangleBorder(
borderRadius: BorderRadius.all(5.0f)
),
child: new Container(
height: 250,
child: new Column(
children: new List<Widget> {
new Text("Card Theme")
}
)
)
)
),
bottomNavigationBar: new BottomAppBar(
child: new Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: new List<Widget> {
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.menu), onPressed: () => { }),
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.account_balance), onPressed: () => { })
})
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs.meta


fileFormatVersion: 2
guid: b2a39cf0b83823749a13aebaf25cfb1b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

79
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs


using System.Collections.Generic;
using System.Linq;
using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Material = Unity.UIWidgets.material.Material;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class ReorderableListSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new MaterialReorderableListViewWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
class MaterialReorderableListViewWidget : StatefulWidget {
public MaterialReorderableListViewWidget(Key key = null) : base(key) {
}
public override State createState() {
return new MaterialReorderableListViewWidgetState();
}
}
class MaterialReorderableListViewWidgetState : State<MaterialReorderableListViewWidget> {
List<string> _list = new List<string> {"Apple", "Ball", "Cat", "Dog", "Elephant"};
public override Widget build(BuildContext context) {
return new Scaffold(
body: new ReorderableListView(
children: this._list.Select<string, Widget>((item) =>
{
return new ListTile(
Key.key(item),
title: new Text(item),
trailing: new Icon(Icons.menu));
}).ToList(),
onReorder: (int start, int current) =>
{
if (start < current) {
int end = current - 1;
string startItem = _list[start];
int i = 0;
int local = start;
do {
_list[local] = _list[++local];
i++;
} while (i < end - start);
_list[end] = startItem;
}
// dragging from bottom to top
else if (start > current) {
string startItem = _list[start];
for (int i = start; i > current; i--) {
_list[i] = _list[i - 1];
}
_list[current] = startItem;
}
setState(() => {});
}
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs.meta


fileFormatVersion: 2
guid: f510d7fbd19431046bfb4b92c39b4da4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

53
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class TableSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new TableWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class TableWidget : StatelessWidget {
public TableWidget(Key key = null) : base(key) {
}
public override Widget build(BuildContext context) {
return new Scaffold(
body: new Table(
children: new List<TableRow> {
new TableRow(
decoration: new BoxDecoration(color: Colors.blue),
children: new List<Widget> {
new Text("item 1"),
new Text("item 2")
}
),
new TableRow(children: new List<Widget> {
new Text("item 3"),
new Text("item 4")
}
)
},
defaultVerticalAlignment: TableCellVerticalAlignment.middle));
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs.meta


fileFormatVersion: 2
guid: 1cba65c03fbf50f4cac974273a7c9445
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

3
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample.meta


fileFormatVersion: 2
guid: 00ea9ee5829c47a687a61fb521f91107
timeCreated: 1612237197

232
com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.mixin.gen.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
namespace Unity.UIWidgets.widgets {
public abstract class _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverFloatingPersistentHeader : RenderSliverFloatingPersistentHeader, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverFloatingPersistentHeader(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(
child: child,
stretchConfiguration: stretchConfiguration) {
_snapConfiguration = snapConfiguration;
}
public _SliverPersistentHeaderElement _element {
get {
return sliver_persistent_header_utils._element;
}
set {
if (value == sliver_persistent_header_utils._element) {
return;
}
sliver_persistent_header_utils._element = value;
}
}
public override float? minExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
public override float? maxExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}
void _RenderSliverPersistentHeaderForWidgetsMixin.triggerRebuild() {
triggerRebuild();
}
void triggerRebuild() {
markNeedsLayout();
}
protected override void performLayout() {
base.performLayout();
}
}
public abstract class _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverFloatingPinnedPersistentHeader : RenderSliverFloatingPinnedPersistentHeader, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverFloatingPinnedPersistentHeader(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
snapConfiguration: snapConfiguration,
stretchConfiguration: stretchConfiguration) {
}
public _SliverPersistentHeaderElement _element {
get {
return sliver_persistent_header_utils._element;
}
set {
if (value == sliver_persistent_header_utils._element) {
return;
}
sliver_persistent_header_utils._element = value;
}
}
public override float? minExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
public override float? maxExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}
void _RenderSliverPersistentHeaderForWidgetsMixin.triggerRebuild() {
triggerRebuild();
}
void triggerRebuild() {
markNeedsLayout();
}
protected override void performLayout() {
base.performLayout();
}
}
public abstract class _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverPinnedPersistentHeader : RenderSliverPinnedPersistentHeader, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverPinnedPersistentHeader(
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
stretchConfiguration: stretchConfiguration) {
}
public _SliverPersistentHeaderElement _element {
get {
return sliver_persistent_header_utils._element;
}
set {
if (value == sliver_persistent_header_utils._element) {
return;
}
sliver_persistent_header_utils._element = value;
}
}
public override float? minExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
public override float? maxExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}
void _RenderSliverPersistentHeaderForWidgetsMixin.triggerRebuild() {
triggerRebuild();
}
void triggerRebuild() {
markNeedsLayout();
}
protected override void performLayout() {
base.performLayout();
}
}
public abstract class _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverScrollingPersistentHeader : RenderSliverScrollingPersistentHeader, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverScrollingPersistentHeader(
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
stretchConfiguration: stretchConfiguration) {
}
public _SliverPersistentHeaderElement _element {
get {
return sliver_persistent_header_utils._element;
}
set {
if (value == sliver_persistent_header_utils._element) {
return;
}
sliver_persistent_header_utils._element = value;
}
}
public override float? minExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
public override float? maxExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}
void _RenderSliverPersistentHeaderForWidgetsMixin.triggerRebuild() {
triggerRebuild();
}
void triggerRebuild() {
markNeedsLayout();
}
protected override void performLayout() {
base.performLayout();
}
}
}

240
com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.mixin.njk


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
namespace Unity.UIWidgets.widgets {
{% macro _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader(with) %}
public abstract class _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader{{with}} : {{with}}, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverFloatingPersistentHeader(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(
child: child,
stretchConfiguration: stretchConfiguration) {
_snapConfiguration = snapConfiguration;
}
public _SliverPersistentHeaderElement _element {
get {
return sliver_persistent_header_utils._element;
}
set {
if (value == sliver_persistent_header_utils._element) {
return;
}
sliver_persistent_header_utils._element = value;
}
}
public override float? minExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
public override float? maxExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}
void _RenderSliverPersistentHeaderForWidgetsMixin.triggerRebuild() {
triggerRebuild();
}
void triggerRebuild() {
markNeedsLayout();
}
protected override void performLayout() {
base.performLayout();
}
}
{% endmacro %}
{{ _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader('RenderSliverFloatingPersistentHeader') }}
{% macro _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader(with) %}
public abstract class _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader{{with}} : {{with}}, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverFloatingPinnedPersistentHeader(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
snapConfiguration: snapConfiguration,
stretchConfiguration: stretchConfiguration) {
}
public _SliverPersistentHeaderElement _element {
get {
return sliver_persistent_header_utils._element;
}
set {
if (value == sliver_persistent_header_utils._element) {
return;
}
sliver_persistent_header_utils._element = value;
}
}
public override float? minExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
public override float? maxExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}
void _RenderSliverPersistentHeaderForWidgetsMixin.triggerRebuild() {
triggerRebuild();
}
void triggerRebuild() {
markNeedsLayout();
}
protected override void performLayout() {
base.performLayout();
}
}
{% endmacro %}
{{ _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader('RenderSliverFloatingPinnedPersistentHeader') }}
{% macro _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader(with) %}
public abstract class _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader{{with}} : {{with}}, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverPinnedPersistentHeader(
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
stretchConfiguration: stretchConfiguration) {
}
public _SliverPersistentHeaderElement _element {
get {
return sliver_persistent_header_utils._element;
}
set {
if (value == sliver_persistent_header_utils._element) {
return;
}
sliver_persistent_header_utils._element = value;
}
}
public override float? minExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
public override float? maxExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}
void _RenderSliverPersistentHeaderForWidgetsMixin.triggerRebuild() {
triggerRebuild();
}
void triggerRebuild() {
markNeedsLayout();
}
protected override void performLayout() {
base.performLayout();
}
}
{% endmacro %}
{{ _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader('RenderSliverPinnedPersistentHeader') }}
{% macro _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader(with) %}
public abstract class _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader{{with}} : {{with}}, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeaderRenderSliverScrollingPersistentHeader(
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
stretchConfiguration: stretchConfiguration) {
}
public _SliverPersistentHeaderElement _element {
get {
return sliver_persistent_header_utils._element;
}
set {
if (value == sliver_persistent_header_utils._element) {
return;
}
sliver_persistent_header_utils._element = value;
}
}
public override float? minExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
public override float? maxExtent {
get {
return _element.widget.layoutDelegate.minExtent;
}
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}
void _RenderSliverPersistentHeaderForWidgetsMixin.triggerRebuild() {
triggerRebuild();
}
void triggerRebuild() {
markNeedsLayout();
}
protected override void performLayout() {
base.performLayout();
}
}
{% endmacro %}
{{ _RenderSliverPersistentHeaderForWidgetsMixinOnRenderSliverPersistentHeader('RenderSliverScrollingPersistentHeader') }}
}

168
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/DragDropSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class DragDropSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new WidgetsApp(
home: new DragDropApp(),
pageRouteBuilder: (settings, builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (Buildcontext, animation, secondaryAnimation) => builder(context)
)
);
}
}
class DragDropApp : StatefulWidget {
public DragDropApp(Key key = null) : base(key) {
}
public override State createState() {
return new DragDropState();
}
}
class DragTargetWidget : StatefulWidget {
public DragTargetWidget(Key key = null) : base(key) {
}
public override State createState() {
return new DragTargetWidgetState();
}
}
class DragTargetWidgetState : State<DragTargetWidget> {
int value;
public override Widget build(BuildContext context)
{
return new Positioned(
left: 40.0f,
bottom: 40.0f,
child: new DragTarget<int>(
onWillAccept: (o) => true,
onAccept: obj => {
Debug.Log("ON ACCEPTED ..." + obj);
this.setState(() => { this.value += obj; });
},
builder: (inner_context2, accepted, rejected) => {
return new Container(
width: 40.0f,
height: 40.0f,
constraints: BoxConstraints.tight(new Size(40, 40)),
color: Colors.red,
child: new Center(child: new Text("" + this.value))
);
}
)
);
}
}
class DragDropState : State<DragDropApp> {
public override Widget build(BuildContext context) {
var entries = new List<OverlayEntry>();
var entry_bg = new OverlayEntry(
inner_context => new Container(
color: Colors.white
));
var entry = new OverlayEntry(
inner_context => new Positioned(
left: 0.0f,
bottom: 0.0f,
child: new GestureDetector(
onTap: () => { },
child: new Draggable<int>(
data: 5,
child: new Container(
color: Colors.blue,
width: 30.0f,
height: 30.0f,
constraints: BoxConstraints.tight(new Size(30, 30)),
child: new Center(child: new Text("5"))
),
feedback: new Container(
color: Colors.green,
width: 30.0f,
height: 30.0f),
//maxSimultaneousDrags: 1,
childWhenDragging: new Container(
color: Colors.black,
width: 30.0f,
height: 30.0f,
constraints: BoxConstraints.tight(new Size(30, 30))
)
)
)
)
);
var entry3 = new OverlayEntry(
inner_context => new Positioned(
left: 0.0f,
bottom: 40.0f,
child: new GestureDetector(
onTap: () => { },
child:
new Draggable<int>(
data: 8,
child: new Container(
color: Colors.grey,
width: 30.0f,
height: 30.0f,
constraints: BoxConstraints.tight(new Size(30, 30)),
child: new Center(child: new Text("8")))
,
feedback: new Container(
color: Colors.green,
width: 30.0f,
height: 30.0f),
maxSimultaneousDrags: 1,
childWhenDragging: new Container(
color: Colors.black,
width: 30.0f,
height: 30.0f,
constraints: BoxConstraints.tight(new Size(30, 30))
)
)
)
)
);
var entry2 = new OverlayEntry(
inner_context => new DragTargetWidget()
);
entries.Add(entry_bg);
entries.Add(entry);
entries.Add(entry2);
entries.Add(entry3);
return new Container(
color: Colors.white,
child: new Overlay(
initialEntries: entries
)
);
}
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/DragDropSample.cs.meta


fileFormatVersion: 2
guid: f6b796615f43b734d8c9507513773ff3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

52
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/LongPressSample.cs


using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace UIWidgetsSample {
public class LongPressSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MyApp());
}
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new WidgetsApp(
home: new LongPressSampleWidget(),
pageRouteBuilder: (settings, builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (Buildcontext, animation, secondaryAnimation) => builder(context)
)
);
}
}
public class LongPressSampleWidget : StatefulWidget {
public override State createState() {
return new _LongPressSampleWidgetState();
}
}
class _LongPressSampleWidgetState : State<LongPressSampleWidget> {
public override Widget build(BuildContext context) {
return new GestureDetector(
onLongPressStart: (value) => { Debug.Log($"Long Press Drag Start: {value}"); },
onLongPressMoveUpdate: (value) => { Debug.Log($"Long Press Drag Update: {value}"); },
onLongPressEnd: (value) => { Debug.Log($"Long Press Drag Up: {value}"); },
onLongPressUp: () => { Debug.Log($"Long Press Up"); },
onLongPress: () => { Debug.Log($"Long Press"); },
child: new Center(
child: new Container(
width: 200,
height: 200,
color: Colors.blue
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/LongPressSample.cs.meta


fileFormatVersion: 2
guid: b77689aad2545fb4bb66d5d41126fab2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

228
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/NavigationSample.cs


using System;
using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using DialogUtils = Unity.UIWidgets.widgets.DialogUtils;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class NavigationSample : UIWidgetsPanel {
protected override void main()
{
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new WidgetsApp(
initialRoute: "/",
textStyle: new TextStyle(fontSize: 24),
pageRouteBuilder: (settings, builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (BuildContext subContext, Animation<float> animation,
Animation<float> secondaryAnimation) => builder(subContext),
transitionsBuilder: (BuildContext subContext, Animation<float>
animation, Animation<float> secondaryAnimation, Widget child) =>
new _FadeUpwardsPageTransition(
routeAnimation: animation,
child: child
)
),
routes: new Dictionary<string, WidgetBuilder> {
{"/", (subContext) => new HomeScreen()},
{"/detail", (subContext) => new DetailScreen()}
}
);
}
}
}
public class CustomButton : StatelessWidget {
public CustomButton(
Key key = null,
GestureTapCallback onPressed = null,
EdgeInsets padding = null,
Color backgroundColor = null,
Widget child = null
) : base(key: key) {
this.onPressed = onPressed;
this.padding = padding ?? EdgeInsets.all(8.0f);
this.backgroundColor = backgroundColor ?? Colors.white;
this.child = child;
}
public readonly GestureTapCallback onPressed;
public readonly EdgeInsets padding;
public readonly Widget child;
public readonly Color backgroundColor;
public override Widget build(BuildContext context) {
return new GestureDetector(
onTap: this.onPressed,
child: new Container(
padding: this.padding,
color: this.backgroundColor,
child: this.child
)
);
}
}
class HomeScreen : StatelessWidget {
public override Widget build(BuildContext context) {
return new NavigationPage(
body: new Container(
color: new Color(0xFF888888),
child: new Center(
child: new CustomButton(onPressed: () => { Navigator.pushNamed(context, "/detail"); },
child: new Text("Go to Detail"))
)),
title: "Home"
);
}
}
class DetailScreen : StatelessWidget {
public override Widget build(BuildContext context) {
return new NavigationPage(
body: new Container(
color: new Color(0xFF1389FD),
child: new Center(
child: new Column(
children: new List<Widget>() {
new CustomButton(onPressed: () => { Navigator.pop<object>(context); }, child: new Text("Back")),
new CustomButton(
onPressed: () => {
_Dialog.showDialog(context, builder: (BuildContext c) => new Dialog());
}, child: new Text("Show Dialog"))
}
)
)),
title: "Detail");
}
}
class Dialog : StatelessWidget {
public override Widget build(BuildContext context) {
return new Center(child: new Container(
color: new Color(0xFFFF0000),
width: 100,
height: 80,
child: new Center(
child: new Text("Hello Dialog")
)));
}
}
class _FadeUpwardsPageTransition : StatelessWidget {
internal _FadeUpwardsPageTransition(
Key key = null,
Animation<float> routeAnimation = null, // The route's linear 0.0 - 1.0 animation.
Widget child = null
) : base(key: key) {
this._positionAnimation = _bottomUpTween.chain(_fastOutSlowInTween).animate(routeAnimation);
this._opacityAnimation = _easeInTween.animate(routeAnimation);
this.child = child;
}
static Tween<Offset> _bottomUpTween = new OffsetTween(
begin: new Offset(0.0f, 0.25f),
end: Offset.zero
);
static Animatable<float> _fastOutSlowInTween = new CurveTween(curve: Curves.fastOutSlowIn);
static Animatable<float> _easeInTween = new CurveTween(curve: Curves.easeIn);
readonly Animation<Offset> _positionAnimation;
readonly Animation<float> _opacityAnimation;
public readonly Widget child;
public override Widget build(BuildContext context) {
return new SlideTransition(
position: this._positionAnimation,
child: new FadeTransition(
opacity: this._opacityAnimation,
child: this.child
)
);
}
}
class NavigationPage : StatelessWidget {
public readonly Widget body;
public readonly string title;
public NavigationPage(Widget body = null, string title = null) {
this.title = title;
this.body = body;
}
public override Widget build(BuildContext context) {
Widget back = null;
if (Navigator.of(context).canPop()) {
back = new CustomButton(onPressed: () => { Navigator.pop<object>(context); },
child: new Text("Go Back"));
back = new Column(mainAxisAlignment: MainAxisAlignment.center, children: new List<Widget>() {back});
}
return new Container(
child: new Column(
children: new List<Widget>() {
new ConstrainedBox(constraints: new BoxConstraints(maxHeight: 80),
child: new DecoratedBox(
decoration: new BoxDecoration(color: new Color(0XFFE1ECF4)),
child: new NavigationToolbar(leading: back,
middle: new Text(this.title, textAlign: TextAlign.center)))),
new Flexible(child: this.body)
}
)
);
}
}
static class _Dialog {
public static void showDialog(BuildContext context,
bool barrierDismissible = true, WidgetBuilder builder = null) {
DialogUtils.showGeneralDialog<object>(
context: context,
pageBuilder: (BuildContext buildContext, Animation<float> animation,
Animation<float> secondaryAnimation) => {
return builder(buildContext);
},
barrierDismissible: barrierDismissible,
barrierColor: new Color(0x8A000000),
transitionDuration: TimeSpan.FromMilliseconds(150),
transitionBuilder: _buildMaterialDialogTransitions
);
}
static Widget _buildMaterialDialogTransitions(BuildContext context,
Animation<float> animation, Animation<float> secondaryAnimation, Widget child) {
return new FadeTransition(
opacity: new CurvedAnimation(
parent: animation,
curve: Curves.easeOut
),
child: child
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/NavigationSample.cs.meta


fileFormatVersion: 2
guid: 351f52ea9be972a48ad92328d8a99951
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

45
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/PageViewSample.cs


using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class PageViewSample : UIWidgetsPanel {
protected override void main()
{
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new WidgetsApp(
home: new Container(
width: 200,
height: 400,
child: new PageView(
children: new List<Widget>() {
new Container(
color: new Color(0xFFE91E63)
),
new Container(
color: new Color(0xFF00BCD4)
),
new Container(
color: new Color(0xFF673AB7)
)
}
)),
pageRouteBuilder: (settings, builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (Buildcontext, animation, secondaryAnimation) => builder(context)
)
);
}
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/PageViewSample.cs.meta


fileFormatVersion: 2
guid: dfec4b1201ff9494e83d2f2cc6e22f82
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

59
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ScrollbarSample.cs


using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class ScrollbarSample : UIWidgetsPanel {
protected override void main()
{
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new WidgetsApp(
home: new Container(
decoration: new BoxDecoration(
border: Border.all(color: new Color(0xFFFFFF00))
),
child: new Scrollbar(
child: new ListView(
children: new List<Widget> {
new Container(height: 40.0f, child: new Text("0")),
new Container(height: 40.0f, child: new Text("1")),
new Container(height: 40.0f, child: new Text("2")),
new Container(height: 40.0f, child: new Text("3")),
new Container(height: 40.0f, child: new Text("4")),
new Container(height: 40.0f, child: new Text("5")),
new Container(height: 40.0f, child: new Text("6")),
new Container(height: 40.0f, child: new Text("7")),
new Container(height: 40.0f, child: new Text("8")),
new Container(height: 40.0f, child: new Text("9")),
new Container(height: 40.0f, child: new Text("10")),
new Container(height: 40.0f, child: new Text("11")),
new Container(height: 40.0f, child: new Text("12")),
new Container(height: 40.0f, child: new Text("13")),
new Container(height: 40.0f, child: new Text("14")),
new Container(height: 40.0f, child: new Text("15")),
new Container(height: 40.0f, child: new Text("16")),
new Container(height: 40.0f, child: new Text("17")),
}
)
)
),
pageRouteBuilder: (settings, builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (Buildcontext, animation, secondaryAnimation) => builder(context)
)
);
}
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ScrollbarSample.cs.meta


fileFormatVersion: 2
guid: 0666abb393df1e44bb00b1cff94ad6ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

87
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/CustomPaintSample.cs


using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class CustomPaintSample : UIWidgetsPanel {
protected override void main()
{
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new WidgetsApp(
home: new Unity.UIWidgets.widgets.CustomPaint(
child: new Container(width: 300, height: 300, color: new Color(0XFFFFFFFF)),
foregroundPainter: new GridPainter(null)
),
pageRouteBuilder: (settings, builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (Buildcontext, animation, secondaryAnimation) => builder(context)
)
);
}
}
}
public class GridPainter : AbstractCustomPainter {
public GridPainter(Listenable repaint) : base(repaint) {
}
public override void paint(Canvas canvas, Size size) {
int numGrid = 4;
var paint = new Paint();
paint.color = new Color(0xFFFF0000);
paint.strokeWidth = 2;
paint.style = PaintingStyle.stroke;
for (int i = 1; i < numGrid; i++) {
float offsetY = size.height * i / numGrid;
canvas.drawLine(new Offset(0, offsetY), new Offset(size.width, offsetY),
paint);
}
for (int i = 1; i < numGrid; i++) {
float offsetx = size.width * i / numGrid;
canvas.drawLine(new Offset(offsetx, 0), new Offset(offsetx, size.height),
paint);
}
// draw a arrow line
canvas.save();
canvas.rotate(0.4f);
canvas.scale(2, 2);
canvas.translate(50, 50);
canvas.drawLine(new Offset(0, 0), new Offset(100, 0),
new Paint() {
color = new Color(0xFFFF0000),
strokeWidth = 2,
style = PaintingStyle.stroke
});
var path = new Path();
var arrowPaint = new Paint() {
color = new Color(0xFFFF0000),
style = PaintingStyle.fill
};
path.moveTo(100, 0);
path.lineTo(100, 5);
path.lineTo(120, 0);
path.lineTo(100, -5);
path.close();
canvas.drawPath(path, arrowPaint);
canvas.restore();
}
public override bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/CustomPaintSample.cs.meta


fileFormatVersion: 2
guid: 64240ba829347de43abdb2daa8488bc6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

172
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ExpansionPanelSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Material = Unity.UIWidgets.material.Material;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class ExpansionPanelSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
int testCaseId = 1;
readonly List<Widget> testCases = new List<Widget> {
new SingleChildScrollWidget(),
new ExpansionPanelWidget()
};
public override Widget build(BuildContext context)
{
return new MaterialApp(
home: this.testCases[this.testCaseId]
);
}
}
}
class SingleChildScrollWidget : StatefulWidget {
public SingleChildScrollWidget(Key key = null) : base(key) {
}
public override State createState() {
return new SingleChildScrollWidgetState();
}
}
class SingleChildScrollWidgetState : State<SingleChildScrollWidget> {
public override Widget build(BuildContext context) {
return new Material(
child: new SingleChildScrollView(
child: new Container(
width: 40.0f,
height: 40.0f,
constraints: BoxConstraints.tight(new Size(40, 600)),
color:Colors.red,
child: new Center(child: new Text("Beijing"))
)
)
);
}
}
class ExpansionPanelWidget : StatefulWidget {
public ExpansionPanelWidget(Key key = null) : base(key) {
}
public override State createState() {
return new ExpansionPanelWidgetState();
}
}
class ExpansionPanelWidgetState : State<ExpansionPanelWidget> {
readonly List<bool> isExpand = new List<bool> {false, false};
public override Widget build(BuildContext context) {
return new Material(
child: new SingleChildScrollView(
child: new ExpansionPanelList(
expansionCallback: (int _index, bool _isExpanded) => {
Debug.Log("<tile " + _index + "> from [" + (_isExpanded ? "Open" : "Close") + "]" +
" to [" + (_isExpanded ? "Close" : "Open") + "]");
this.isExpand[_index] = !_isExpanded;
this.setState(() => { });
},
children: new List<ExpansionPanel> {
new ExpansionPanel(
headerBuilder: (BuildContext subContext, bool isExpanded) => {
return new Container(
color: Colors.black45,
child: new Center(
child: new Text("Beijing")
)
);
},
body: new Container(
child: new Column(
children: new List<Widget> {
new Card(
child: new Container(
color: Colors.black38,
height: 36,
width: 300,
child: new Center(
child: new Text("Beijing")
)
)
)
}
)
),
isExpanded: this.isExpand[0]
),
new ExpansionPanel(
headerBuilder: (BuildContext subContext, bool isExpanded) => {
return new Container(
color: Colors.black45,
child: new Center(
child: new Text("Hebei")
)
);
},
body: new Container(
child: new Column(
children: new List<Widget> {
new Card(
child: new Container(
color: Colors.black38,
height: 36,
width: 300,
child: new Center(
child: new Text("Tianjin")
)
)
),
new Card(
child: new Container(
color: Colors.black38,
height: 36,
width: 300,
child: new Center(
child: new Text("Shijiazhuang")
)
)
),
new Card(
child: new Container(
color: Colors.black38,
height: 36,
width: 300,
child: new Center(
child: new Text("Zhumadian")
)
)
)
}
)
),
isExpanded: this.isExpand[1]
),
}
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ExpansionPanelSample.cs.meta


fileFormatVersion: 2
guid: 49545bd84f0a8614e866467b68490383
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

69
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/HttpRequestSample.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using UnityEngine.Networking;
using ui_ = Unity.UIWidgets.widgets.ui_;
public class HttpRequestSample : UIWidgetsPanel
{
protected override void main() {
ui_.runApp(new MaterialApp(
title: "Http Request Sample",
home: new Scaffold(
body:new AsyncRequestWidget(this.gameObject)
)
));
}
}
public class AsyncRequestWidget : StatefulWidget {
public readonly GameObject gameObjOfUIWidgetsPanel;
public AsyncRequestWidget(GameObject gameObjOfUiWidgetsPanel, Key key = null) : base(key) {
this.gameObjOfUIWidgetsPanel = gameObjOfUiWidgetsPanel;
}
public override State createState() {
return new _AsyncRequestWidgetState();
}
}
[Serializable]
public class TimeData {
public long currentFileTime;
}
class _AsyncRequestWidgetState : State<AsyncRequestWidget> {
long _fileTime;
public override Widget build(BuildContext context) {
var isolate = Isolate.current;
return new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: new List<Widget>() {
new FlatButton(child: new Text("Click To Get Time"), onPressed: () => {
UnityWebRequest www = UnityWebRequest.Get("http://worldclockapi.com/api/json/est/now");
var asyncOperation = www.SendWebRequest();
asyncOperation.completed += operation => {
var timeData = JsonUtility.FromJson<TimeData>(www.downloadHandler.text);
using(Isolate.getScope(isolate))
{
this.setState(() => { this._fileTime = timeData.currentFileTime; });
}
};
}),
new Text($"current file time: {this._fileTime}")
});
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/HttpRequestSample.cs.meta


fileFormatVersion: 2
guid: b8fdebced4875694db8d21968f82b2c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存