浏览代码

Implement ContactsDemo and Unity logo switching with theme.

/main
Yuncong Zhang 6 年前
当前提交
11206008
共有 18 个文件被更改,包括 2805 次插入39 次删除
  1. 386
      Runtime/material/app_bar.cs
  2. 3
      Samples/UIWidgetsGallery/gallery/app.cs
  3. 16
      Samples/UIWidgetsGallery/gallery/demos.cs
  4. 14
      Samples/UIWidgetsGallery/gallery/home.cs
  5. 2
      Tests/Resources/ali_landscape.png.meta
  6. 395
      Runtime/rendering/sliver_persistent_header.cs
  7. 3
      Runtime/rendering/sliver_persistent_header.cs.meta
  8. 372
      Runtime/widgets/sliver_persistent_header.cs
  9. 3
      Runtime/widgets/sliver_persistent_header.cs.meta
  10. 365
      Samples/UIWidgetsGallery/demo/contacts_demo.cs
  11. 3
      Samples/UIWidgetsGallery/demo/contacts_demo.cs.meta
  12. 1001
      Tests/Resources/ali_landscape.png
  13. 55
      Tests/Resources/unity-black.png
  14. 88
      Tests/Resources/unity-black.png.meta
  15. 25
      Tests/Resources/unity-white.png
  16. 88
      Tests/Resources/unity-white.png.meta
  17. 25
      Tests/Resources/unity.png
  18. 0
      /Tests/Resources/ali_landscape.png.meta

386
Runtime/material/app_bar.cs


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

elevation: this.widget.elevation,
child: appBar
));
}
}
class _FloatingAppBar : StatefulWidget {
public _FloatingAppBar(Key key = null, Widget child = null) : base(key: key) {
this.child = child;
}
public readonly Widget child;
public override State createState() {
return new _FloatingAppBarState();
}
}
class _FloatingAppBarState : State<_FloatingAppBar> {
ScrollPosition _position;
public _FloatingAppBarState() {
}
public override void didChangeDependencies() {
base.didChangeDependencies();
if (this._position != null) {
this._position.isScrollingNotifier.removeListener(this._isScrollingListener);
}
this._position = Scrollable.of(this.context)?.position;
if (this._position != null) {
this._position.isScrollingNotifier.addListener(this._isScrollingListener);
}
}
public override void dispose() {
if (this._position != null) {
this._position.isScrollingNotifier.removeListener(this._isScrollingListener);
}
base.dispose();
}
RenderSliverFloatingPersistentHeader _headerRenderer() {
return (RenderSliverFloatingPersistentHeader) this.context.ancestorRenderObjectOfType(
new TypeMatcher<RenderSliverFloatingPersistentHeader>());
}
void _isScrollingListener() {
if (this._position == null) {
return;
}
RenderSliverFloatingPersistentHeader header = this._headerRenderer();
if (this._position.isScrollingNotifier.value) {
header?.maybeStopSnapAnimation(this._position.userScrollDirection);
}
else {
header?.maybeStartSnapAnimation(this._position.userScrollDirection);
}
}
public override Widget build(BuildContext context) {
return this.widget.child;
}
}
class _SliverAppBarDelegate : SliverPersistentHeaderDelegate {
public _SliverAppBarDelegate(
Widget leading,
bool automaticallyImplyLeading,
Widget title,
List<Widget> actions,
Widget flexibleSpace,
PreferredSizeWidget bottom,
float? elevation,
bool forceElevated,
Color backgroundColor,
Brightness? brightness,
IconThemeData iconTheme,
TextTheme textTheme,
bool primary,
bool? centerTitle,
float titleSpacing,
float? expandedHeight,
float? collapsedHeight,
float? topPadding,
bool floating,
bool pinned,
FloatingHeaderSnapConfiguration snapConfiguration
) {
D.assert(primary || topPadding == 0.0);
this.leading = leading;
this.automaticallyImplyLeading = automaticallyImplyLeading;
this.title = title;
this.actions = actions;
this.flexibleSpace = flexibleSpace;
this.bottom = bottom;
this.elevation = elevation;
this.forceElevated = forceElevated;
this.backgroundColor = backgroundColor;
this.brightness = brightness;
this.iconTheme = iconTheme;
this.textTheme = textTheme;
this.primary = primary;
this.centerTitle = centerTitle;
this.titleSpacing = titleSpacing;
this.expandedHeight = expandedHeight;
this.collapsedHeight = collapsedHeight;
this.topPadding = topPadding;
this.floating = floating;
this.pinned = pinned;
this._snapConfiguration = snapConfiguration;
this._bottomHeight = bottom?.preferredSize?.height ?? 0.0f;
}
public readonly Widget leading;
public readonly bool automaticallyImplyLeading;
public readonly Widget title;
public readonly List<Widget> actions;
public readonly Widget flexibleSpace;
public readonly PreferredSizeWidget bottom;
public readonly float? elevation;
public readonly bool forceElevated;
public readonly Color backgroundColor;
public readonly Brightness? brightness;
public readonly IconThemeData iconTheme;
public readonly TextTheme textTheme;
public readonly bool primary;
public readonly bool? centerTitle;
public readonly float titleSpacing;
public readonly float? expandedHeight;
public readonly float? collapsedHeight;
public readonly float? topPadding;
public readonly bool floating;
public readonly bool pinned;
readonly float _bottomHeight;
public override float? minExtent {
get { return this.collapsedHeight ?? (this.topPadding + Constants.kToolbarHeight + this._bottomHeight); }
}
public override float? maxExtent {
get {
return Mathf.Max(
this.topPadding ?? 0.0f + (this.expandedHeight ?? Constants.kToolbarHeight + this._bottomHeight),
this.minExtent ?? 0.0f);
}
}
public override FloatingHeaderSnapConfiguration snapConfiguration {
get { return this._snapConfiguration; }
}
FloatingHeaderSnapConfiguration _snapConfiguration;
public override Widget build(BuildContext context, float shrinkOffset, bool overlapsContent) {
float? visibleMainHeight = this.maxExtent - shrinkOffset - this.topPadding;
float toolbarOpacity = this.pinned && !this.floating
? 1.0f
: ((visibleMainHeight - this._bottomHeight) / Constants.kToolbarHeight)?.clamp(0.0f, 1.0f) ?? 0.0f;
Widget appBar = FlexibleSpaceBar.createSettings(
minExtent: this.minExtent,
maxExtent: this.maxExtent,
currentExtent: Mathf.Max(this.minExtent ?? 0.0f, this.maxExtent ?? 0.0f - shrinkOffset),
toolbarOpacity: toolbarOpacity,
child: new AppBar(
leading: this.leading,
automaticallyImplyLeading: this.automaticallyImplyLeading,
title: this.title,
actions: this.actions,
flexibleSpace: this.flexibleSpace,
bottom: this.bottom,
elevation: this.forceElevated || overlapsContent ||
(this.pinned && shrinkOffset > this.maxExtent - this.minExtent)
? this.elevation ?? 4.0f
: 0.0f,
backgroundColor: this.backgroundColor,
brightness: this.brightness,
iconTheme: this.iconTheme,
textTheme: this.textTheme,
primary: this.primary,
centerTitle: this.centerTitle,
titleSpacing: this.titleSpacing,
toolbarOpacity: toolbarOpacity,
bottomOpacity: this.pinned
? 1.0f
: (visibleMainHeight / this._bottomHeight)?.clamp(0.0f, 1.0f) ?? 1.0f
)
);
return this.floating ? new _FloatingAppBar(child: appBar) : appBar;
}
public override bool shouldRebuild(SliverPersistentHeaderDelegate _oldDelegate) {
_SliverAppBarDelegate oldDelegate = _oldDelegate as _SliverAppBarDelegate;
return this.leading != oldDelegate.leading
|| this.automaticallyImplyLeading != oldDelegate.automaticallyImplyLeading
|| this.title != oldDelegate.title
|| this.actions != oldDelegate.actions
|| this.flexibleSpace != oldDelegate.flexibleSpace
|| this.bottom != oldDelegate.bottom
|| this._bottomHeight != oldDelegate._bottomHeight
|| this.elevation != oldDelegate.elevation
|| this.backgroundColor != oldDelegate.backgroundColor
|| this.brightness != oldDelegate.brightness
|| this.iconTheme != oldDelegate.iconTheme
|| this.textTheme != oldDelegate.textTheme
|| this.primary != oldDelegate.primary
|| this.centerTitle != oldDelegate.centerTitle
|| this.titleSpacing != oldDelegate.titleSpacing
|| this.expandedHeight != oldDelegate.expandedHeight
|| this.topPadding != oldDelegate.topPadding
|| this.pinned != oldDelegate.pinned
|| this.floating != oldDelegate.floating
|| this.snapConfiguration != oldDelegate.snapConfiguration;
}
public override string ToString() {
return
$"{Diagnostics.describeIdentity(this)}(topPadding: {this.topPadding?.ToString("F1")}, bottomHeight: {this._bottomHeight.ToString("F1")}, ...)";
}
}
public class SliverAppBar : StatefulWidget {
public SliverAppBar(
Key key = null,
Widget leading = null,
bool automaticallyImplyLeading = true,
Widget title = null,
List<Widget> actions = null,
Widget flexibleSpace = null,
PreferredSizeWidget bottom = null,
float? elevation = null,
bool forceElevated = false,
Color backgroundColor = null,
Brightness? brightness = null,
IconThemeData iconTheme = null,
TextTheme textTheme = null,
bool primary = true,
bool? centerTitle = null,
float titleSpacing = NavigationToolbar.kMiddleSpacing,
float? expandedHeight = null,
bool floating = false,
bool pinned = false,
bool snap = false
) : base(key: key) {
D.assert(automaticallyImplyLeading != null);
D.assert(forceElevated != null);
D.assert(primary != null);
D.assert(titleSpacing != null);
D.assert(floating != null);
D.assert(pinned != null);
D.assert(snap != null);
D.assert(floating || !snap, "The 'snap' argument only makes sense for floating app bars.");
this.leading = leading;
this.automaticallyImplyLeading = true;
this.title = title;
this.actions = actions;
this.flexibleSpace = flexibleSpace;
this.bottom = bottom;
this.elevation = elevation;
this.forceElevated = forceElevated;
this.backgroundColor = backgroundColor;
this.brightness = brightness;
this.iconTheme = iconTheme;
this.textTheme = textTheme;
this.primary = primary;
this.centerTitle = centerTitle;
this.titleSpacing = NavigationToolbar.kMiddleSpacing;
this.expandedHeight = expandedHeight;
this.floating = floating;
this.pinned = pinned;
this.snap = snap;
}
public readonly Widget leading;
public readonly bool automaticallyImplyLeading;
public readonly Widget title;
public readonly List<Widget> actions;
public readonly Widget flexibleSpace;
public readonly PreferredSizeWidget bottom;
public readonly float? elevation;
public readonly bool forceElevated;
public readonly Color backgroundColor;
public readonly Brightness? brightness;
public readonly IconThemeData iconTheme;
public readonly TextTheme textTheme;
public readonly bool primary;
public readonly bool? centerTitle;
public readonly float titleSpacing;
public readonly float? expandedHeight;
public readonly bool floating;
public readonly bool pinned;
public readonly bool snap;
public override State createState() {
return new _SliverAppBarState();
}
}
class _SliverAppBarState : TickerProviderStateMixin<SliverAppBar> {
FloatingHeaderSnapConfiguration _snapConfiguration;
void _updateSnapConfiguration() {
if (this.widget.snap && this.widget.floating) {
this._snapConfiguration = new FloatingHeaderSnapConfiguration(
vsync: this,
curve: Curves.easeOut,
duration: new TimeSpan(0, 0, 0, 0, 200)
);
}
else {
this._snapConfiguration = null;
}
}
public override void initState() {
base.initState();
this._updateSnapConfiguration();
}
public override void didUpdateWidget(StatefulWidget _oldWidget) {
base.didUpdateWidget(_oldWidget);
SliverAppBar oldWidget = _oldWidget as SliverAppBar;
if (this.widget.snap != oldWidget.snap || this.widget.floating != oldWidget.floating) {
this._updateSnapConfiguration();
}
}
public override Widget build(BuildContext context) {
D.assert(!this.widget.primary || WidgetsD.debugCheckHasMediaQuery(context));
float? topPadding = this.widget.primary ? MediaQuery.of(context).padding.top : 0.0f;
float? collapsedHeight = (this.widget.pinned && this.widget.floating && this.widget.bottom != null)
? this.widget.bottom.preferredSize.height + topPadding
: null;
return MediaQuery.removePadding(
context: context,
removeBottom: true,
child: new SliverPersistentHeader(
floating: this.widget.floating,
pinned: this.widget.pinned,
del: new _SliverAppBarDelegate(
leading: this.widget.leading,
automaticallyImplyLeading: this.widget.automaticallyImplyLeading,
title: this.widget.title,
actions: this.widget.actions,
flexibleSpace: this.widget.flexibleSpace,
bottom: this.widget.bottom,
elevation: this.widget.elevation,
forceElevated: this.widget.forceElevated,
backgroundColor: this.widget.backgroundColor,
brightness: this.widget.brightness,
iconTheme: this.widget.iconTheme,
textTheme: this.widget.textTheme,
primary: this.widget.primary,
centerTitle: this.widget.centerTitle,
titleSpacing: this.widget.titleSpacing,
expandedHeight: this.widget.expandedHeight,
collapsedHeight: collapsedHeight,
topPadding: topPadding,
floating: this.widget.floating,
pinned: this.widget.pinned,
snapConfiguration: this._snapConfiguration
)
)
);
}
}
}

3
Samples/UIWidgetsGallery/gallery/app.cs


onSendFeedback: this.widget.onSendFeedback ?? (() => {
Application.OpenURL("https://github.com/UnityTech/UIWidgets/issues");
})
)
),
options: this._options
);
if (this.widget.updateUrlFetcher != null) {

16
Samples/UIWidgetsGallery/gallery/demos.cs


// routeName: ShrineDemo.routeName,
// buildRoute: (BuildContext context) => new ShrineDemo()
// ),
// new GalleryDemo(
// title: "Contact profile",
// subtitle: "Address book entry with a flexible appbar",
// icon: GalleryIcons.account_box,
// category: GalleryDemoCategory._kDemos,
// routeName: ContactsDemo.routeName,
// buildRoute: (BuildContext context) => new ContactsDemo()
// ),
new GalleryDemo(
title: "Contact profile",
subtitle: "Address book entry with a flexible appbar",
icon: GalleryIcons.account_box,
category: DemoUtils._kDemos,
routeName: ContactsDemo.routeName,
buildRoute: (BuildContext context) => new ContactsDemo()
),
// new GalleryDemo(
// title: "Animation",
// subtitle: "Section organizer",

14
Samples/UIWidgetsGallery/gallery/home.cs


}
class _UIWidgetsLogo : StatelessWidget {
public _UIWidgetsLogo(Key key = null) : base(key: key) {
public _UIWidgetsLogo(Key key = null, bool isDark = false) : base(key: key) {
this._isDark = isDark;
readonly bool _isDark;
public override Widget build(BuildContext context) {
return new Center(

decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage(
"unity")
this._isDark ? "unity-black" : "unity-white")
)
)
)

public GalleryHome(
Key key = null,
bool testMode = false,
Widget optionsPage = null
Widget optionsPage = null,
GalleryOptions options = null
this.options = options;
public readonly GalleryOptions options;
public static bool showPreviewBanner = true;

switchOutCurve: switchOutCurve,
switchInCurve: switchInCurve,
child: this._category == null
? (Widget) new _UIWidgetsLogo()
? (Widget) new _UIWidgetsLogo(isDark: this.widget.options?.theme == GalleryTheme.kDarkGalleryTheme)
: new IconButton(
icon: new BackButtonIcon(),
tooltip: "Back",

2
Tests/Resources/ali_landscape.png.meta


fileFormatVersion: 2
guid: e0f035e3c6f0247b9ba5aab8669a7f0a
guid: e064ac38639964afe8017fb7079bf993
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

395
Runtime/rendering/sliver_persistent_header.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.ui;
using UnityEngine;
namespace Unity.UIWidgets.rendering {
public abstract class RenderSliverPersistentHeader : RenderObjectWithChildMixinRenderSliver<RenderBox> {
public RenderSliverPersistentHeader(RenderBox child = null) {
this.child = child;
}
public virtual float? maxExtent { get; }
public virtual float? minExtent { get; }
public float childExtent {
get {
if (this.child == null) {
return 0.0f;
}
D.assert(this.child.hasSize);
D.assert(this.constraints.axis != null);
switch (this.constraints.axis) {
case Axis.vertical:
return this.child.size.height;
case Axis.horizontal:
return this.child.size.width;
default:
throw new Exception("Unknown axis: " + this.constraints.axis);
}
}
}
bool _needsUpdateChild = true;
float _lastShrinkOffset = 0.0f;
bool _lastOverlapsContent = false;
protected virtual void updateChild(float shrinkOffset, bool overlapsContent) {
}
public override void markNeedsLayout() {
this._needsUpdateChild = true;
base.markNeedsLayout();
}
protected void layoutChild(float scrollOffset, float maxExtent, bool overlapsContent = false) {
D.assert(maxExtent != null);
float shrinkOffset = Mathf.Min(scrollOffset, maxExtent);
if (this._needsUpdateChild || this._lastShrinkOffset != shrinkOffset ||
this._lastOverlapsContent != overlapsContent) {
this.invokeLayoutCallback<SliverConstraints>((SliverConstraints constraints) => {
D.assert(this.constraints == this.constraints);
this.updateChild(shrinkOffset, overlapsContent);
});
this._lastShrinkOffset = shrinkOffset;
this._lastOverlapsContent = overlapsContent;
this._needsUpdateChild = false;
}
D.assert(this.minExtent != null);
D.assert(() => {
if (this.minExtent <= maxExtent) {
return true;
}
throw new UIWidgetsError(
"The maxExtent for this $runtimeType is less than its minExtent.\n" +
"The specified maxExtent was: ${maxExtent.toStringAsFixed(1)}\n" +
"The specified minExtent was: ${minExtent.toStringAsFixed(1)}\n"
);
});
this.child?.layout(
this.constraints.asBoxConstraints(
maxExtent: Mathf.Max(this.minExtent ?? 0.0f, maxExtent - shrinkOffset)),
parentUsesSize: true
);
}
public override float childMainAxisPosition(RenderObject child) {
return base.childMainAxisPosition(this.child);
}
protected override bool hitTestChildren(HitTestResult result, float mainAxisPosition, float crossAxisPosition) {
D.assert(this.geometry.hitTestExtent > 0.0f);
if (this.child != null) {
return RenderSliverHelpers.hitTestBoxChild(this, result, this.child, mainAxisPosition: mainAxisPosition,
crossAxisPosition: crossAxisPosition);
}
return false;
}
public override void applyPaintTransform(RenderObject child, Matrix3 transform) {
D.assert(child != null);
D.assert(child == this.child);
RenderSliverHelpers.applyPaintTransformForBoxChild(this, this.child, transform);
}
public override void paint(PaintingContext context, Offset offset) {
if (this.child != null && this.geometry.visible) {
D.assert(this.constraints.axisDirection != null);
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(this.constraints.axisDirection,
this.constraints.growthDirection)) {
case AxisDirection.up:
offset += new Offset(0.0f,
this.geometry.paintExtent - this.childMainAxisPosition(this.child) - this.childExtent);
break;
case AxisDirection.down:
offset += new Offset(0.0f, this.childMainAxisPosition(this.child));
break;
case AxisDirection.left:
offset += new Offset(
this.geometry.paintExtent - this.childMainAxisPosition(this.child) - this.childExtent,
0.0f);
break;
case AxisDirection.right:
offset += new Offset(this.childMainAxisPosition(this.child), 0.0f);
break;
}
context.paintChild(this.child, offset);
}
}
protected bool excludeFromSemanticsScrolling {
get { return this._excludeFromSemanticsScrolling; }
set {
if (this._excludeFromSemanticsScrolling == value) {
return;
}
this._excludeFromSemanticsScrolling = value;
}
}
bool _excludeFromSemanticsScrolling = false;
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(FloatProperty.lazy("maxExtent", () => this.maxExtent));
properties.add(FloatProperty.lazy("child position", () => this.childMainAxisPosition(this.child)));
}
}
public abstract class RenderSliverScrollingPersistentHeader : RenderSliverPersistentHeader {
public RenderSliverScrollingPersistentHeader(
RenderBox child = null
) : base(child: child) {
}
float _childPosition;
protected override void performLayout() {
float? maxExtent = this.maxExtent;
this.layoutChild(this.constraints.scrollOffset, maxExtent ?? 0.0f);
float? paintExtent = maxExtent - this.constraints.scrollOffset;
this.geometry = new SliverGeometry(
scrollExtent: maxExtent ?? 0.0f,
paintOrigin: Mathf.Min(this.constraints.overlap, 0.0f),
paintExtent: paintExtent?.clamp(0.0f, this.constraints.remainingPaintExtent) ?? 0.0f,
maxPaintExtent: maxExtent ?? 0.0f,
hasVisualOverflow: true
);
this._childPosition = Mathf.Min(0.0f, paintExtent ?? 0.0f - this.childExtent);
}
public override float childMainAxisPosition(RenderObject child) {
D.assert(child == this.child);
return this._childPosition;
}
}
public abstract class RenderSliverPinnedPersistentHeader : RenderSliverPersistentHeader {
public RenderSliverPinnedPersistentHeader(
RenderBox child = null
) : base(child: child) {
}
protected override void performLayout() {
float? maxExtent = this.maxExtent;
bool overlapsContent = this.constraints.overlap > 0.0f;
this.excludeFromSemanticsScrolling =
overlapsContent || (this.constraints.scrollOffset > maxExtent - this.minExtent);
this.layoutChild(this.constraints.scrollOffset, maxExtent ?? 0.0f, overlapsContent: overlapsContent);
float? layoutExtent =
(maxExtent - this.constraints.scrollOffset)?.clamp(0.0f, this.constraints.remainingPaintExtent);
this.geometry = new SliverGeometry(
scrollExtent: maxExtent ?? 0.0f,
paintOrigin: this.constraints.overlap,
paintExtent: Mathf.Min(this.childExtent, this.constraints.remainingPaintExtent),
layoutExtent: layoutExtent,
maxPaintExtent: maxExtent ?? 0.0f,
maxScrollObstructionExtent: this.minExtent ?? 0.0f,
cacheExtent: layoutExtent > 0.0f ? -this.constraints.cacheOrigin + layoutExtent : layoutExtent,
hasVisualOverflow: true
);
}
public override float childMainAxisPosition(RenderObject child) {
return 0.0f;
}
}
public class FloatingHeaderSnapConfiguration {
public FloatingHeaderSnapConfiguration(
TickerProvider vsync,
Curve curve = null,
TimeSpan? duration = null
) {
D.assert(this.vsync != null);
this.vsync = vsync;
this.curve = curve ?? Curves.ease;
this.duration = duration ?? new TimeSpan(0, 0, 0, 0, 300);
}
public readonly TickerProvider vsync;
public readonly Curve curve;
public readonly TimeSpan duration;
}
public abstract class RenderSliverFloatingPersistentHeader : RenderSliverPersistentHeader {
public RenderSliverFloatingPersistentHeader(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null
) : base(child: child) {
this._snapConfiguration = snapConfiguration;
}
AnimationController _controller;
Animation<float> _animation;
protected float _lastActualScrollOffset;
protected float _effectiveScrollOffset;
float _childPosition;
public override void detach() {
this._controller?.dispose();
this._controller = null;
base.detach();
}
public FloatingHeaderSnapConfiguration snapConfiguration {
get { return this._snapConfiguration; }
set {
if (value == this._snapConfiguration) {
return;
}
if (value == null) {
this._controller?.dispose();
}
else {
if (this._snapConfiguration != null && value.vsync != this._snapConfiguration.vsync) {
this._controller?.resync(value.vsync);
}
}
this._snapConfiguration = value;
}
}
FloatingHeaderSnapConfiguration _snapConfiguration;
protected virtual float updateGeometry() {
float? maxExtent = this.maxExtent;
float? paintExtent = maxExtent - this._effectiveScrollOffset;
float? layoutExtent = maxExtent - this.constraints.scrollOffset;
this.geometry = new SliverGeometry(
scrollExtent: maxExtent ?? 0.0f,
paintOrigin: Mathf.Min(this.constraints.overlap, 0.0f),
paintExtent: paintExtent?.clamp(0.0f, this.constraints.remainingPaintExtent) ?? 0.0f,
layoutExtent: layoutExtent?.clamp(0.0f, this.constraints.remainingPaintExtent),
maxPaintExtent: maxExtent ?? 0.0f,
maxScrollObstructionExtent: maxExtent ?? 0.0f,
hasVisualOverflow: true
);
return Mathf.Min(0.0f, paintExtent ?? 0.0f - this.childExtent);
}
public void maybeStartSnapAnimation(ScrollDirection direction) {
if (this.snapConfiguration == null) {
return;
}
if (direction == ScrollDirection.forward && this._effectiveScrollOffset <= 0.0f) {
return;
}
if (direction == ScrollDirection.reverse && this._effectiveScrollOffset >= this.maxExtent) {
return;
}
TickerProvider vsync = this.snapConfiguration.vsync;
TimeSpan duration = this.snapConfiguration.duration;
this._controller = this._controller ?? new AnimationController(vsync: vsync, duration: duration);
this._controller.addListener(() => {
if (this._effectiveScrollOffset == this._animation.value) {
return;
}
this._effectiveScrollOffset = this._animation.value;
this.markNeedsLayout();
});
this._animation = this._controller.drive(
new FloatTween(
begin: this._effectiveScrollOffset,
end: direction == ScrollDirection.forward ? 0.0f : this.maxExtent ?? 0.0f
).chain(new CurveTween(
curve: this.snapConfiguration.curve
))
);
this._controller.forward(from: 0.0f);
}
public void maybeStopSnapAnimation(ScrollDirection direction) {
this._controller?.stop();
}
protected override void performLayout() {
float? maxExtent = this.maxExtent;
if (this._lastActualScrollOffset != null &&
((this.constraints.scrollOffset < this._lastActualScrollOffset) ||
(this._effectiveScrollOffset < maxExtent))) {
float delta = this._lastActualScrollOffset - this.constraints.scrollOffset;
bool allowFloatingExpansion = this.constraints.userScrollDirection == ScrollDirection.forward;
if (allowFloatingExpansion) {
if (this._effectiveScrollOffset > maxExtent) {
this._effectiveScrollOffset = maxExtent ?? 0.0f;
}
}
else {
if (delta > 0.0f) {
delta = 0.0f;
}
}
this._effectiveScrollOffset =
(this._effectiveScrollOffset - delta).clamp(0.0f, this.constraints.scrollOffset);
}
else {
this._effectiveScrollOffset = this.constraints.scrollOffset;
}
bool overlapsContent = this._effectiveScrollOffset < this.constraints.scrollOffset;
this.excludeFromSemanticsScrolling = overlapsContent;
this.layoutChild(this._effectiveScrollOffset, maxExtent ?? 0.0f, overlapsContent: overlapsContent);
this._childPosition = this.updateGeometry();
this._lastActualScrollOffset = this.constraints.scrollOffset;
}
public override float childMainAxisPosition(RenderObject child) {
D.assert(child == this.child);
return this._childPosition;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("effective scroll offset", this._effectiveScrollOffset));
}
}
public abstract class RenderSliverFloatingPinnedPersistentHeader : RenderSliverFloatingPersistentHeader {
public RenderSliverFloatingPinnedPersistentHeader(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null
) : base(child: child, snapConfiguration: snapConfiguration) {
}
protected override float updateGeometry() {
float? minExtent = this.minExtent;
float? maxExtent = this.maxExtent;
float? paintExtent = maxExtent - this._effectiveScrollOffset;
float? layoutExtent = maxExtent - this.constraints.scrollOffset;
this.geometry = new SliverGeometry(
scrollExtent: maxExtent ?? 0.0f,
paintExtent: paintExtent?.clamp(minExtent ?? 0.0f, this.constraints.remainingPaintExtent) ?? 0.0f,
layoutExtent: layoutExtent?.clamp(0.0f, this.constraints.remainingPaintExtent - minExtent ?? 0.0f),
maxPaintExtent: maxExtent ?? 0.0f,
maxScrollObstructionExtent: maxExtent ?? 0.0f,
hasVisualOverflow: true
);
return 0.0f;
}
}
}

3
Runtime/rendering/sliver_persistent_header.cs.meta


fileFormatVersion: 2
guid: 8bf4842a43ca4b13ae8d333813e166c9
timeCreated: 1553064435

372
Runtime/widgets/sliver_persistent_header.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
namespace Unity.UIWidgets.widgets {
public abstract class SliverPersistentHeaderDelegate {
public SliverPersistentHeaderDelegate() {
}
public abstract Widget build(BuildContext context, float shrinkOffset, bool overlapsContent);
public abstract float? minExtent { get; }
public abstract float? maxExtent { get; }
public virtual FloatingHeaderSnapConfiguration snapConfiguration {
get { return null; }
}
public abstract bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate);
}
public class SliverPersistentHeader : StatelessWidget {
public SliverPersistentHeader(
Key key = null,
SliverPersistentHeaderDelegate del = null,
bool pinned = false,
bool floating = false
) : base(key: key) {
D.assert(del != null);
D.assert(pinned != null);
D.assert(floating != null);
this.del = del;
this.pinned = pinned;
this.floating = floating;
}
public readonly SliverPersistentHeaderDelegate del;
public readonly bool pinned;
public readonly bool floating;
public override Widget build(BuildContext context) {
if (this.floating && this.pinned) {
return new _SliverFloatingPinnedPersistentHeader(del: this.del);
}
if (this.pinned) {
return new _SliverPinnedPersistentHeader(del: this.del);
}
if (this.floating) {
return new _SliverFloatingPersistentHeader(del: this.del);
}
return new _SliverScrollingPersistentHeader(del: this.del);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<SliverPersistentHeaderDelegate>("del", this.del));
List<string> flags = new List<string> { };
if (this.pinned) {
flags.Add("pinned");
}
if (this.floating) {
flags.Add("floating");
}
if (flags.isEmpty()) {
flags.Add("normal");
}
properties.add(new EnumerableProperty<string>("mode", flags));
}
}
class _SliverPersistentHeaderElement : RenderObjectElement {
public _SliverPersistentHeaderElement(_SliverPersistentHeaderRenderObjectWidget widget) : base(widget) {
}
public _SliverPersistentHeaderRenderObjectWidget widget {
get { return (_SliverPersistentHeaderRenderObjectWidget) base.widget; }
}
public override RenderObject renderObject {
get { return base.renderObject; }
}
public override void mount(Element parent, object newSlot) {
base.mount(parent, newSlot);
(this.renderObject as _RenderSliverPersistentHeaderForWidgetsMixin)._element = this;
}
public override void unmount() {
base.unmount();
(this.renderObject as _RenderSliverPersistentHeaderForWidgetsMixin)._element = null;
}
public override void update(Widget _newWidget) {
base.update(_newWidget);
_SliverPersistentHeaderRenderObjectWidget newWidget =
_newWidget as _SliverPersistentHeaderRenderObjectWidget;
_SliverPersistentHeaderRenderObjectWidget oldWidget = this.widget;
SliverPersistentHeaderDelegate newDelegate = newWidget.del;
SliverPersistentHeaderDelegate oldDelegate = oldWidget.del;
if (newDelegate != oldDelegate &&
(newDelegate.GetType() != oldDelegate.GetType() || newDelegate.shouldRebuild(oldDelegate))) {
(this.renderObject as _RenderSliverPersistentHeaderForWidgetsMixin).triggerRebuild();
}
}
protected override void performRebuild() {
base.performRebuild();
(this.renderObject as _RenderSliverPersistentHeaderForWidgetsMixin).triggerRebuild();
}
Element child;
public void _build(float shrinkOffset, bool overlapsContent) {
this.owner.buildScope(this,
() => {
this.child = this.updateChild(this.child,
this.widget.del.build(this, shrinkOffset, overlapsContent), null);
});
}
protected override void forgetChild(Element child) {
D.assert(child == this.child);
this.child = null;
}
protected override void insertChildRenderObject(RenderObject child, object slot) {
D.assert((bool) (this.renderObject as RenderSliverPersistentHeader).debugValidateChild(child));
(this.renderObject as RenderSliverPersistentHeader).child = (RenderBox) child;
}
protected override void moveChildRenderObject(RenderObject child, object slot) {
D.assert(false);
}
protected override void removeChildRenderObject(RenderObject child) {
(this.renderObject as RenderSliverPersistentHeader).child = null;
}
public override void visitChildren(ElementVisitor visitor) {
if (this.child != null) {
visitor(this.child);
}
}
}
abstract class _SliverPersistentHeaderRenderObjectWidget : RenderObjectWidget {
public _SliverPersistentHeaderRenderObjectWidget(
Key key = null,
SliverPersistentHeaderDelegate del = null
) : base(key: key) {
D.assert(del != null);
this.del = del;
}
public readonly SliverPersistentHeaderDelegate del;
public override Element createElement() {
return new _SliverPersistentHeaderElement(this);
}
public abstract override RenderObject createRenderObject(BuildContext context);
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(new DiagnosticsProperty<SliverPersistentHeaderDelegate>("del", this.del));
}
}
interface _RenderSliverPersistentHeaderForWidgetsMixin {
_SliverPersistentHeaderElement _element { get; set; }
float? minExtent { get; }
float? maxExtent { get; }
void triggerRebuild();
}
class _SliverScrollingPersistentHeader : _SliverPersistentHeaderRenderObjectWidget {
public _SliverScrollingPersistentHeader(
Key key = null,
SliverPersistentHeaderDelegate del = null
) : base(key: key, del: del) {
}
public override RenderObject createRenderObject(BuildContext context) {
return new _RenderSliverScrollingPersistentHeaderForWidgets();
}
}
abstract class _RenderSliverScrollingPersistentHeader : RenderSliverScrollingPersistentHeader {
}
class _RenderSliverScrollingPersistentHeaderForWidgets : _RenderSliverScrollingPersistentHeader,
_RenderSliverPersistentHeaderForWidgetsMixin {
public _SliverPersistentHeaderElement _element {
get { return this._ele; }
set { this._ele = value; }
}
_SliverPersistentHeaderElement _ele;
public override float? minExtent {
get { return this._element.widget.del.minExtent; }
}
public override float? maxExtent {
get { return this._element.widget.del.maxExtent; }
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(this._element != null);
this._element._build(shrinkOffset, overlapsContent);
}
public void triggerRebuild() {
this.markNeedsLayout();
}
}
class _SliverPinnedPersistentHeader : _SliverPersistentHeaderRenderObjectWidget {
public _SliverPinnedPersistentHeader(
Key key = null,
SliverPersistentHeaderDelegate del = null
) : base(key: key, del: del) {
}
public override RenderObject createRenderObject(BuildContext context) {
return new _RenderSliverPinnedPersistentHeaderForWidgets();
}
}
abstract class _RenderSliverPinnedPersistentHeader : RenderSliverPinnedPersistentHeader {
}
class _RenderSliverPinnedPersistentHeaderForWidgets : _RenderSliverPinnedPersistentHeader,
_RenderSliverPersistentHeaderForWidgetsMixin {
public _SliverPersistentHeaderElement _element {
get { return this._ele; }
set { this._ele = value; }
}
_SliverPersistentHeaderElement _ele;
public override float? minExtent {
get { return this._element.widget.del.minExtent; }
}
public override float? maxExtent {
get { return this._element.widget.del.maxExtent; }
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(this._element != null);
this._element._build(shrinkOffset, overlapsContent);
}
public void triggerRebuild() {
this.markNeedsLayout();
}
}
class _SliverFloatingPersistentHeader : _SliverPersistentHeaderRenderObjectWidget {
public _SliverFloatingPersistentHeader(
Key key = null,
SliverPersistentHeaderDelegate del = null
) : base(key: key, del: del) {
}
public override RenderObject createRenderObject(BuildContext context) {
_RenderSliverFloatingPersistentHeaderForWidgets ret = new _RenderSliverFloatingPersistentHeaderForWidgets();
ret.snapConfiguration = this.del.snapConfiguration;
return ret;
}
public override void updateRenderObject(BuildContext context, RenderObject _renderObject) {
_RenderSliverFloatingPersistentHeaderForWidgets renderObject =
_renderObject as _RenderSliverFloatingPersistentHeaderForWidgets;
renderObject.snapConfiguration = this.del.snapConfiguration;
}
}
abstract class _RenderSliverFloatingPinnedPersistentHeader : RenderSliverFloatingPinnedPersistentHeader {
}
class _RenderSliverFloatingPinnedPersistentHeaderForWidgets : _RenderSliverFloatingPinnedPersistentHeader,
_RenderSliverPersistentHeaderForWidgetsMixin {
public _SliverPersistentHeaderElement _element {
get { return this._ele; }
set { this._ele = value; }
}
_SliverPersistentHeaderElement _ele;
public override float? minExtent {
get { return this._element.widget.del.minExtent; }
}
public override float? maxExtent {
get { return this._element.widget.del.maxExtent; }
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(this._element != null);
this._element._build(shrinkOffset, overlapsContent);
}
public void triggerRebuild() {
this.markNeedsLayout();
}
}
class _SliverFloatingPinnedPersistentHeader : _SliverPersistentHeaderRenderObjectWidget {
public _SliverFloatingPinnedPersistentHeader(
Key key = null,
SliverPersistentHeaderDelegate del = null
) : base(key: key, del: del) {
}
public override RenderObject createRenderObject(BuildContext context) {
_RenderSliverFloatingPinnedPersistentHeaderForWidgets ret =
new _RenderSliverFloatingPinnedPersistentHeaderForWidgets();
ret.snapConfiguration = this.del.snapConfiguration;
return ret;
}
public override void updateRenderObject(BuildContext context, RenderObject _renderObject) {
_RenderSliverFloatingPinnedPersistentHeaderForWidgets renderObject =
_renderObject as _RenderSliverFloatingPinnedPersistentHeaderForWidgets;
renderObject.snapConfiguration = this.del.snapConfiguration;
}
}
abstract class _RenderSliverFloatingPersistentHeader : RenderSliverFloatingPersistentHeader {
}
class _RenderSliverFloatingPersistentHeaderForWidgets : _RenderSliverFloatingPersistentHeader,
_RenderSliverPersistentHeaderForWidgetsMixin {
public _SliverPersistentHeaderElement _element {
get { return this._ele; }
set { this._ele = value; }
}
_SliverPersistentHeaderElement _ele;
public override float? minExtent {
get { return this._element.widget.del.minExtent; }
}
public override float? maxExtent {
get { return this._element.widget.del.maxExtent; }
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(this._element != null);
this._element._build(shrinkOffset, overlapsContent);
}
public void triggerRebuild() {
this.markNeedsLayout();
}
}
}

3
Runtime/widgets/sliver_persistent_header.cs.meta


fileFormatVersion: 2
guid: 1e795962fe2d4c3291bbbe4bb1146a80
timeCreated: 1553067038

365
Samples/UIWidgetsGallery/demo/contacts_demo.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
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 Image = Unity.UIWidgets.widgets.Image;
namespace UIWidgetsGallery.gallery {
class _ContactCategory : StatelessWidget {
public _ContactCategory(Key key = null, IconData icon = null, List<Widget> children = null) : base(key: key) {
this.icon = icon;
this.children = children;
}
public readonly IconData icon;
public readonly List<Widget> children;
public override Widget build(BuildContext context) {
ThemeData themeData = Theme.of(context);
return new Container(
padding: EdgeInsets.symmetric(vertical: 16.0f),
decoration: new BoxDecoration(
border: new Border(bottom: new BorderSide(color: themeData.dividerColor))
),
child: new DefaultTextStyle(
style: Theme.of(context).textTheme.subhead,
child: new SafeArea(
top: false,
bottom: false,
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: new List<Widget> {
new Container(
padding: EdgeInsets.symmetric(vertical: 24.0f),
width: 72.0f,
child: new Icon(this.icon, color: themeData.primaryColor)
),
new Expanded(child: new Column(children: this.children))
}
)
)
)
);
}
}
class _ContactItem : StatelessWidget {
public _ContactItem(Key key = null, IconData icon = null, List<string> lines = null, string tooltip = null,
VoidCallback onPressed = null) : base(key: key) {
D.assert(lines.Count > 1);
this.icon = icon;
this.lines = lines;
this.tooltip = tooltip;
this.onPressed = onPressed;
}
public readonly IconData icon;
public readonly List<string> lines;
public readonly string tooltip;
public readonly VoidCallback onPressed;
public override Widget build(BuildContext context) {
ThemeData themeData = Theme.of(context);
List<Widget> columnChildren = this.lines.GetRange(0, this.lines.Count - 1)
.Select<string, Widget>((string line) => new Text(line)).ToList();
columnChildren.Add(new Text(this.lines.Last(), style: themeData.textTheme.caption));
List<Widget> rowChildren = new List<Widget> {
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: columnChildren
)
)
};
if (this.icon != null) {
rowChildren.Add(new SizedBox(
width: 72.0f,
child: new IconButton(
icon: new Icon(this.icon),
color: themeData.primaryColor,
onPressed: this.onPressed
)
));
}
return new Padding(
padding: EdgeInsets.symmetric(vertical: 16.0f),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: rowChildren
)
);
}
}
public class ContactsDemo : StatefulWidget {
public const string routeName = "/contacts";
public override State createState() {
return new ContactsDemoState();
}
}
public enum AppBarBehavior {
normal,
pinned,
floating,
snapping
}
public class ContactsDemoState : State<ContactsDemo> {
readonly GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>.key();
const float _appBarHeight = 256.0f;
AppBarBehavior _appBarBehavior = AppBarBehavior.pinned;
public override Widget build(BuildContext context) {
return new Theme(
data: new ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.indigo,
platform: Theme.of(context).platform
),
child: new Scaffold(
key: this._scaffoldKey,
body: new CustomScrollView(
slivers: new List<Widget> {
new SliverAppBar(
expandedHeight: _appBarHeight,
pinned: this._appBarBehavior == AppBarBehavior.pinned,
floating: this._appBarBehavior == AppBarBehavior.floating ||
this._appBarBehavior == AppBarBehavior.snapping,
snap: this._appBarBehavior == AppBarBehavior.snapping,
actions: new List<Widget> {
new IconButton(
icon: new Icon(Icons.create),
tooltip: "Edit",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text("Editing isn't supported in this screen.")
));
}
),
new PopupMenuButton<AppBarBehavior>(
onSelected: (AppBarBehavior value) => {
this.setState(() => { this._appBarBehavior = value; });
},
itemBuilder: (BuildContext _context) => new List<PopupMenuEntry<AppBarBehavior>> {
new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.normal,
child: new Text("App bar scrolls away")
),
new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.pinned,
child: new Text("App bar stays put")
),
new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.floating,
child: new Text("App bar floats")
),
new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.snapping,
child: new Text("App bar snaps")
)
}
)
},
flexibleSpace: new FlexibleSpaceBar(
title: new Text("Ali Connors"),
background: new Stack(
fit: StackFit.expand,
children: new List<Widget> {
Image.asset(
"ali_landscape.png",
fit: BoxFit.cover,
height: _appBarHeight
),
new DecoratedBox(
decoration: new BoxDecoration(
gradient: new LinearGradient(
begin: new Alignment(0.0f, -1.0f),
end: new Alignment(0.0f, -0.4f),
colors: new List<Color>
{new Color(0x60000000), new Color(0x00000000)}
)
)
)
}
)
)
),
new SliverList(
del: new SliverChildListDelegate(new List<Widget> {
new AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.dark,
child: new _ContactCategory(
icon: Icons.call,
children: new List<Widget> {
new _ContactItem(
icon: Icons.message,
tooltip: "Send message",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text(
"Pretend that this opened your SMS application.")
));
},
lines: new List<string> {
"(650) 555-1234",
"Mobile"
}
),
new _ContactItem(
icon: Icons.message,
tooltip: "Send message",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text("A messaging app appears.")
));
},
lines: new List<string> {
"(323) 555-6789",
"Work"
}
),
new _ContactItem(
icon: Icons.message,
tooltip: "Send message",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text(
"Imagine if you will, a messaging application.")
));
},
lines: new List<string> {
"(650) 555-6789",
"Home"
}
)
}
)
),
new _ContactCategory(
icon: Icons.contact_mail,
children: new List<Widget> {
new _ContactItem(
icon: Icons.email,
tooltip: "Send personal e-mail",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text("Here, your e-mail application would open.")
));
},
lines: new List<string> {
"ali_connors@example.com",
"Personal"
}
),
new _ContactItem(
icon: Icons.email,
tooltip: "Send work e-mail",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text(
"Summon your favorite e-mail application here.")
));
},
lines: new List<string> {
"aliconnors@example.com",
"Work"
}
)
}
),
new _ContactCategory(
icon: Icons.location_on,
children: new List<Widget> {
new _ContactItem(
icon: Icons.map,
tooltip: "Open map",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text("This would show a map of San Francisco.")
));
},
lines: new List<string> {
"2000 Main Street",
"San Francisco, CA",
"Home"
}
),
new _ContactItem(
icon: Icons.map,
tooltip: "Open map",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text("This would show a map of Mountain View.")
));
},
lines: new List<string> {
"1600 Amphitheater Parkway",
"Mountain View, CA",
"Work"
}
),
new _ContactItem(
icon: Icons.map,
tooltip: "Open map",
onPressed: () => {
this._scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text(
"This would also show a map, if this was not a demo.")
));
},
lines: new List<string> {
"126 Severyns Ave",
"Mountain View, CA",
"Jet Travel",
}
)
}
),
new _ContactCategory(
icon: Icons.today,
children: new List<Widget> {
new _ContactItem(
lines: new List<string> {
"Birthday",
"January 9th, 1989"
}
),
new _ContactItem(
lines: new List<string> {
"Wedding anniversary",
"June 21st, 2014"
}
),
new _ContactItem(
lines: new List<string> {
"First day in office",
"January 20th, 2015",
}
),
new _ContactItem(
lines: new List<string> {
"Last day in office",
"August 9th, 2018"
}
)
}
)
})
)
}
)
)
);
}
}
}

3
Samples/UIWidgetsGallery/demo/contacts_demo.cs.meta


fileFormatVersion: 2
guid: 42aac0c9b12e437db9787de912355ed9
timeCreated: 1553060178

1001
Tests/Resources/ali_landscape.png
文件差异内容过多而无法显示
查看文件

55
Tests/Resources/unity-black.png

之前 之后
宽度: 1000  |  高度: 1000  |  大小: 21 KiB

88
Tests/Resources/unity-black.png.meta


fileFormatVersion: 2
guid: b09b9022b548f4a788de5d6d2b47aeac
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

25
Tests/Resources/unity-white.png
文件差异内容过多而无法显示
查看文件

88
Tests/Resources/unity-white.png.meta


fileFormatVersion: 2
guid: 18b226d86a5e74dd392f35201ac60139
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

25
Tests/Resources/unity.png

之前 之后

/Tests/Resources/unity.png.meta → /Tests/Resources/ali_landscape.png.meta

正在加载...
取消
保存