浏览代码

Merge branch 'master' of gitlab.cds.internal.unity3d.com:upm-packages/ui-widgets/com.unity.uiwidgets into material

/main
xingwei.zhu 6 年前
当前提交
5f884640
共有 59 个文件被更改,包括 2343 次插入700 次删除
  1. 12
      .gitignore
  2. 7
      .npmignore
  3. 6
      CHANGELOG.md
  4. 28
      CONTRIBUTING.md
  5. 27
      LICENSE.md
  6. 25
      README.md
  7. 46
      Runtime/animation/listener_helpers.mixin.gen.cs
  8. 31
      Runtime/foundation/node.mixin.gen.cs
  9. 8
      Runtime/foundation/node.mixin.njk
  10. 44
      Runtime/material/button_theme.cs
  11. 3
      Runtime/material/color_scheme.cs
  12. 2
      Runtime/material/material.cs
  13. 3
      Runtime/material/text_theme.cs
  14. 2
      Runtime/material/theme.cs
  15. 182
      Runtime/material/theme_data.cs
  16. 18
      Runtime/rendering/box.mixin.gen.cs
  17. 88
      Runtime/rendering/object.mixin.gen.cs
  18. 155
      Runtime/rendering/proxy_box.cs
  19. 20
      Runtime/rendering/proxy_box.mixin.gen.cs
  20. 33
      Runtime/widgets/basic.cs
  21. 71
      Runtime/widgets/implicit_animations.cs
  22. 256
      Runtime/widgets/navigator.cs
  23. 2
      Runtime/widgets/routes.cs
  24. 4
      Runtime/widgets/scroll_notification.mixin.gen.cs
  25. 2
      Samples/UIWidgetSample/NavigationSample.cs
  26. 32
      Third Party Notices.md
  27. 8
      package.json
  28. 275
      Runtime/material/dialog.cs
  29. 11
      Runtime/material/dialog.cs.meta
  30. 69
      Runtime/material/dialog_theme.cs
  31. 11
      Runtime/material/dialog_theme.cs.meta
  32. 8
      Samples/UIWidgetsGallery.meta
  33. 6
      Samples/UIWidgetsGallery/UIWidgetsGallery.asmdef
  34. 7
      Samples/UIWidgetsGallery/UIWidgetsGallery.asmdef.meta
  35. 8
      Samples/UIWidgetsGallery/gallery.meta
  36. 135
      Samples/UIWidgetsGallery/gallery/app.cs
  37. 11
      Samples/UIWidgetsGallery/gallery/app.cs.meta
  38. 606
      Samples/UIWidgetsGallery/gallery/demos.cs
  39. 11
      Samples/UIWidgetsGallery/gallery/demos.cs.meta
  40. 46
      Samples/UIWidgetsGallery/gallery/icons.cs
  41. 11
      Samples/UIWidgetsGallery/gallery/icons.cs.meta
  42. 110
      Samples/UIWidgetsGallery/gallery/options.cs
  43. 11
      Samples/UIWidgetsGallery/gallery/options.cs.meta
  44. 64
      Samples/UIWidgetsGallery/gallery/scales.cs
  45. 11
      Samples/UIWidgetsGallery/gallery/scales.cs.meta
  46. 83
      Samples/UIWidgetsGallery/gallery/themes.cs
  47. 11
      Samples/UIWidgetsGallery/gallery/themes.cs.meta
  48. 85
      Samples/UIWidgetsGallery/gallery/updater.cs
  49. 11
      Samples/UIWidgetsGallery/gallery/updater.cs.meta
  50. 7
      Samples/UIWidgetsGallery/main.cs
  51. 11
      Samples/UIWidgetsGallery/main.cs.meta
  52. 242
      .README - External.md
  53. 18
      .gitlab-ci.yml
  54. 19
      build.bat
  55. 7
      build.bat.meta
  56. 16
      build.sh
  57. 7
      build.sh.meta

12
.gitignore


node_modules/
npm-debug.log
yarn-error.log
artifacts/**
build/**
.build_script/**
node_modules/**
.DS_Store
.npmrc
!Documentation~
!.Documentation
npm-debug.log
build.sh.meta
build.bat.meta

7
.npmignore


build.sh.meta
build.bat
build.bat.meta
automation/**
utr_output/**
.Editor/**
.yamato/**
*.zip*
scripts~/**

6
CHANGELOG.md


The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [0.1.0] - 2017-MM-DD
## [1.0.0-preview] - 2019-03-01
### This is the first release of *Unity Package \<Your package name\>*.
### This is the first release of *Unity Package UIWidgets*.
*Short description of this release*
*just the first release*

28
CONTRIBUTING.md


# Contributing
## If you are interested in contributing, here are some ground rules:
* ... Define guidelines & rules for what contributors need to know to successfully make Pull requests against your repo ...
### Code Style (using JetBrains Rider)
1. **Import the Customized Code Cleanup Settings**: Open Preferences -> Manage Layers,
Choose 'Solution "\<YourProjectName\>" personal' and Click "Add Layer" ("+") -> "Open Settings File...".
and Open the file "UIWidgetCleanupPlugin.DotSettings" under \<YourProjectPath\>/Packages/com.unity.uiwidgets/"
2. **Cleanup Code style using the Customized Code Cleanup Settings**: Open Code -> Code Cleanup,
Pick a Cleanup scope as you want and Choose "UIWidgets" as the "Code cleanup profile", then click "OK"
3. **Refine Code Style Rules**: Edit the ".editorconfig" file under \<YourProjectPath\>/Packages/com.unity.uiwidgets/". Visit
https://www.jetbrains.com/help/rider/EditorConfig_Index.html for the detailed.
### Generate Code.
Code files ending with ".gen.cs" are auto generated. Follow these steps to generate them:
1. **Go to scripts Folder and Run npm install**:
```
cd <YourProjectPath>/Packages/com.unity.uiwidgets/scripts~
npm install
```
2. **Run the codegen Command**:
```
node uiwidgets-cli.js codegen . generate mixin code
```
## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement)
By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions.

27
LICENSE.md


Copyright 2019 The UIWidget Authors. All rights reserved.
Copyright 2014 The Chromium Authors. All rights reserved.
UIWidgets copyright © 2019 Unity Technologies ApS
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License).
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions.

25
README.md


| Any IDE recommendation for UIWidgets? | **Rider, VSCode(Open .sln)** |
## How to Contribute
If you want to join us, please contact us via Github and we will respond as soon as possible.
#### Code Style
1. **Import the Customized Code Cleanup Settings**: Open Preferences -> Manage Layers,
Choose 'Solution "\<YourProjectName\>" personal' and Click "Add Layer" ("+") -> "Open Settings File...".
and Open the file "UIWidgetCleanupPlugin.DotSettings" under \<YourProjectPath\>/Packages/com.unity.uiwidgets/"
2. **Cleanup Code style using the Customized Code Cleanup Settings**: Open Code -> Code Cleanup,
Pick a Cleanup scope as you want and Choose "UIWidgets" as the "Code cleanup profile", then click "OK"
3. **Refine Code Style Rules**: Edit the ".editorconfig" file under \<YourProjectPath\>/Packages/com.unity.uiwidgets/". Visit
https://www.jetbrains.com/help/rider/EditorConfig_Index.html for the detailed.
#### Generate njk Code
1. **Go to scripts Folder and Run npm install**:
```
cd <YourProjectPath>/Packages/com.unity.uiwidgets/scripts
npm install
```
2. **Run the codegen Command**:
```
node uiwidgets-cli.js codegen . generate mixin code
```
Check [CONTRIBUTING.md](CONTRIBUTING.md)

46
Runtime/animation/listener_helpers.mixin.gen.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.animation {
public abstract class AnimationLazyListenerMixinAnimation<T> : Animation<T> {
int _listenerCounter = 0;

}
public abstract class AnimationEagerListenerMixinAnimation<T> : Animation<T> {
protected void didRegisterListener() {
}

}
public abstract class
AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
public abstract class AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
readonly ObserverList<VoidCallback> _listeners = new ObserverList<VoidCallback>();
public override void addListener(VoidCallback listener) {

if (this._listeners.Contains(listener)) {
listener();
}
}
catch (Exception exception) {
} catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
public abstract class
AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationEagerListenerMixinAnimation<T> {
public abstract class AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationEagerListenerMixinAnimation<T> {
readonly ObserverList<VoidCallback> _listeners = new ObserverList<VoidCallback>();
public override void addListener(VoidCallback listener) {

if (this._listeners.Contains(listener)) {
listener();
}
}
catch (Exception exception) {
} catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
public abstract class
AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> :
AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> {
public abstract class AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (this._statusListeners.Contains(listener)) {
listener(status);
}
}
catch (Exception exception) {
} catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
public abstract class
AnimationLocalStatusListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T
> {
public abstract class AnimationLocalStatusListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (this._statusListeners.Contains(listener)) {
listener(status);
}
}
catch (Exception exception) {
} catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
public abstract class
AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> :
AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> {
public abstract class AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (this._statusListeners.Contains(listener)) {
listener(status);
}
}
catch (Exception exception) {
} catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
}
}
}

31
Runtime/foundation/node.mixin.gen.cs


using Unity.UIWidgets.async;
namespace Unity.UIWidgets.foundation {
public class AbstractNode {
public class AbstractNode {
public int depth {
get { return this._depth; }
}

while (node.parent != null) {
node = node.parent;
}
D.assert(node != child); // indicates we are about to create a cycle
return true;
});

}
public class AbstractNodeMixinDiagnosticableTree : DiagnosticableTree {
public class AbstractNodeMixinDiagnosticableTree : DiagnosticableTree {
public int depth {
get { return this._depth; }
}

while (node.parent != null) {
node = node.parent;
}
D.assert(node != child); // indicates we are about to create a cycle
return true;
});

}
public abstract class CanonicalMixinDiagnosticableTree : DiagnosticableTree {
public abstract class CanonicalMixinDiagnosticableTree : DiagnosticableTree {
_DependencyList _dependencyList;
_DependencyList _getDependencyList() {

return this._dependencyList;
}
CanonicalMixinDiagnosticableTree _canonical;
CanonicalMixinDiagnosticableTree _getCanonical() {

}
}
}
public bool alwaysUpdate { get; set; } // if canonicalEquals should not be used.
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {

return false;
}
return ReferenceEquals(this._getCanonical(), ((CanonicalMixinDiagnosticableTree) obj)._getCanonical());
if (this.alwaysUpdate) {
return ReferenceEquals(this, obj);
} else {
return ReferenceEquals(this._getCanonical(), ((CanonicalMixinDiagnosticableTree) obj)._getCanonical());
}
}

8
Runtime/foundation/node.mixin.njk


static readonly Dictionary<_DependencyList, WeakReference> _canonicalObjects =
new Dictionary<_DependencyList, WeakReference>();
public bool alwaysUpdate { get; set; } // if canonicalEquals should not be used.
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;

return false;
}
return ReferenceEquals(this._getCanonical(), ((CanonicalMixin{{with}}) obj)._getCanonical());
if (this.alwaysUpdate) {
return ReferenceEquals(this, obj);
} else {
return ReferenceEquals(this._getCanonical(), ((CanonicalMixin{{with}}) obj)._getCanonical());
}
}
public override int GetHashCode() {

44
Runtime/material/button_theme.cs


this.data = data;
}
public static ButtonTheme fromButtonThemeData(
Key key = null,
ButtonThemeData data = null,
Widget child = null) {
return new ButtonTheme(key, data, child);
}
public static ButtonTheme bar(
Key key = null,
ButtonTextTheme textTheme = ButtonTextTheme.accent,
float minWidth = 64.0f,
float height = 36.0f,
EdgeInsets padding = null,
ShapeBorder shape = null,
bool alignedDropdown = false,
Color buttonColor = null,
Color disabledColor = null,
Color highlightColor = null,
Color splashColor = null,
ColorScheme colorScheme = null,
Widget child = null,
ButtonBarLayoutBehavior layoutBehavior = ButtonBarLayoutBehavior.padded
) {
D.assert(minWidth >= 0.0);
D.assert(height >= 0.0);
return new ButtonTheme(key, new ButtonThemeData(
textTheme: textTheme,
minWidth: minWidth,
height: height,
padding: padding ?? EdgeInsets.symmetric(horizontal: 8.0f),
shape: shape,
alignedDropdown: alignedDropdown,
layoutBehavior: layoutBehavior,
buttonColor: buttonColor,
disabledColor: disabledColor,
highlightColor: highlightColor,
splashColor: splashColor,
colorScheme: colorScheme
), child);
}
public readonly ButtonThemeData data;
public static ButtonThemeData of(BuildContext context) {

}
public class ButtonThemeData : Diagnosticable {
public class ButtonThemeData : Diagnosticable, IEquatable<ButtonThemeData> {
public ButtonThemeData(
ButtonTextTheme textTheme = ButtonTextTheme.normal,
float minWidth = 88.0f,

3
Runtime/material/color_scheme.cs


using System;
public class ColorScheme : Diagnosticable {
public class ColorScheme : Diagnosticable, IEquatable<ColorScheme> {
public ColorScheme(
Color primary,
Color primaryVariant,

2
Runtime/material/material.cs


ColorTween _shadowColor;
ShapeBorderTween _border;
protected override void forEachTween(ITweenVisitor visitor) {
protected override void forEachTween(TweenVisitor visitor) {
this._elevation = (FloatTween) visitor.visit(this, this._elevation, this.widget.elevation,
(float value) => new FloatTween(begin: value, end: value));
this._shadowColor = (ColorTween) visitor.visit(this, this._shadowColor, this.widget.shadowColor,

3
Runtime/material/text_theme.cs


using System;
public class TextTheme : Diagnosticable {
public class TextTheme : Diagnosticable, IEquatable<TextTheme> {
public TextTheme(
TextStyle display4 = null,
TextStyle display3 = null,

2
Runtime/material/theme.cs


class _AnimatedThemeState : AnimatedWidgetBaseState<AnimatedTheme> {
ThemeDataTween _data;
protected override void forEachTween(ITweenVisitor visitor) {
protected override void forEachTween(TweenVisitor visitor) {
this._data = (ThemeDataTween) visitor.visit(this, this._data, this.widget.data,
(ThemeData value) => new ThemeDataTween(begin: value));
}

182
Runtime/material/theme_data.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;

shrinkWrap
}
public class ThemeData : Diagnosticable {
public class ThemeData : Diagnosticable, IEquatable<ThemeData> {
public ThemeData(
Brightness? brightness = null,
MaterialColor primarySwatch = null,

MaterialTapTargetSize? materialTapTargetSize = null,
PageTransitionsTheme pageTransitionsTheme = null,
ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
Typography typography = null
) {
brightness = brightness ?? Brightness.light;

(isDark
? ThemeDataUtils._kDarkThemeSplashColor
: ThemeDataUtils._kLightThemeSplashColor);
dialogTheme = dialogTheme ?? new DialogTheme();
D.assert(brightness != null);
D.assert(primaryColor != null);

D.assert(pageTransitionsTheme != null);
D.assert(colorScheme != null);
D.assert(typography != null);
D.assert(dialogTheme != null);
this.brightness = brightness ?? Brightness.light;
this.primaryColor = primaryColor;

this.materialTapTargetSize = materialTapTargetSize ?? MaterialTapTargetSize.padded;
this.pageTransitionsTheme = pageTransitionsTheme;
this.colorScheme = colorScheme;
this.dialogTheme = dialogTheme;
Brightness? brightness,
Color primaryColor,
Brightness? primaryColorBrightness,
Color primaryColorLight,
Color primaryColorDark,
Color canvasColor,
Color accentColor,
Brightness? accentColorBrightness,
Color scaffoldBackgroundColor,
Color bottomAppBarColor,
Color cardColor,
Color dividerColor,
Color highlightColor,
Color splashColor,
InteractiveInkFeatureFactory splashFactory,
Color selectedRowColor,
Color unselectedWidgetColor,
Color disabledColor,
ButtonThemeData buttonTheme,
Color buttonColor,
Color secondaryHeaderColor,
Color textSelectionColor,
Color cursorColor,
Color textSelectionHandleColor,
Color backgroundColor,
Color dialogBackgroundColor,
Color indicatorColor,
Color hintColor,
Color errorColor,
Color toggleableActiveColor,
TextTheme textTheme,
TextTheme primaryTextTheme,
TextTheme accentTextTheme,
IconThemeData iconTheme,
IconThemeData primaryIconTheme,
IconThemeData accentIconTheme,
MaterialTapTargetSize? materialTapTargetSize,
PageTransitionsTheme pageTransitionsTheme,
ColorScheme colorScheme,
Typography typography
Brightness? brightness = null,
Color primaryColor = null,
Brightness? primaryColorBrightness = null,
Color primaryColorLight = null,
Color primaryColorDark = null,
Color canvasColor = null,
Color accentColor = null,
Brightness? accentColorBrightness = null,
Color scaffoldBackgroundColor = null,
Color bottomAppBarColor = null,
Color cardColor = null,
Color dividerColor = null,
Color highlightColor = null,
Color splashColor = null,
InteractiveInkFeatureFactory splashFactory = null,
Color selectedRowColor = null,
Color unselectedWidgetColor = null,
Color disabledColor = null,
ButtonThemeData buttonTheme = null,
Color buttonColor = null,
Color secondaryHeaderColor = null,
Color textSelectionColor = null,
Color cursorColor = null,
Color textSelectionHandleColor = null,
Color backgroundColor = null,
Color dialogBackgroundColor = null,
Color indicatorColor = null,
Color hintColor = null,
Color errorColor = null,
Color toggleableActiveColor = null,
TextTheme textTheme = null,
TextTheme primaryTextTheme = null,
TextTheme accentTextTheme = null,
IconThemeData iconTheme = null,
IconThemeData primaryIconTheme = null,
IconThemeData accentIconTheme = null,
MaterialTapTargetSize? materialTapTargetSize = null,
PageTransitionsTheme pageTransitionsTheme = null,
ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
Typography typography = null
) {
D.assert(brightness != null);
D.assert(primaryColor != null);

D.assert(pageTransitionsTheme != null);
D.assert(colorScheme != null);
D.assert(typography != null);
D.assert(dialogTheme != null);
return new ThemeData(
brightness: brightness,

materialTapTargetSize: materialTapTargetSize,
pageTransitionsTheme: pageTransitionsTheme,
colorScheme: colorScheme,
dialogTheme: dialogTheme,
typography: typography);
}

public readonly ColorScheme colorScheme;
public readonly DialogTheme dialogTheme;
Brightness? brightness,
Color primaryColor,
Brightness? primaryColorBrightness,
Color primaryColorLight,
Color primaryColorDark,
Color accentColor,
Brightness? accentColorBrightness,
Color canvasColor,
Color scaffoldBackgroundColor,
Color bottomAppBarColor,
Color cardColor,
Color dividerColor,
Color highlightColor,
Color splashColor,
InteractiveInkFeatureFactory splashFactory,
Color selectedRowColor,
Color unselectedWidgetColor,
Color disabledColor,
ButtonThemeData buttonTheme,
Color buttonColor,
Color secondaryHeaderColor,
Color textSelectionColor,
Color cursorColor,
Color textSelectionHandleColor,
Color backgroundColor,
Color dialogBackgroundColor,
Color indicatorColor,
Color hintColor,
Color errorColor,
Color toggleableActiveColor,
TextTheme textTheme,
TextTheme primaryTextTheme,
TextTheme accentTextTheme,
IconThemeData iconTheme,
IconThemeData primaryIconTheme,
IconThemeData accentIconTheme,
MaterialTapTargetSize? materialTapTargetSize,
PageTransitionsTheme pageTransitionsTheme,
ColorScheme colorScheme,
Typography typography
Brightness? brightness = null,
Color primaryColor = null,
Brightness? primaryColorBrightness = null,
Color primaryColorLight = null,
Color primaryColorDark = null,
Color accentColor = null,
Brightness? accentColorBrightness = null,
Color canvasColor = null,
Color scaffoldBackgroundColor = null,
Color bottomAppBarColor = null,
Color cardColor = null,
Color dividerColor = null,
Color highlightColor = null,
Color splashColor = null,
InteractiveInkFeatureFactory splashFactory = null,
Color selectedRowColor = null,
Color unselectedWidgetColor = null,
Color disabledColor = null,
ButtonThemeData buttonTheme = null,
Color buttonColor = null,
Color secondaryHeaderColor = null,
Color textSelectionColor = null,
Color cursorColor = null,
Color textSelectionHandleColor = null,
Color backgroundColor = null,
Color dialogBackgroundColor = null,
Color indicatorColor = null,
Color hintColor = null,
Color errorColor = null,
Color toggleableActiveColor = null,
TextTheme textTheme = null,
TextTheme primaryTextTheme = null,
TextTheme accentTextTheme = null,
IconThemeData iconTheme = null,
IconThemeData primaryIconTheme = null,
IconThemeData accentIconTheme = null,
MaterialTapTargetSize? materialTapTargetSize = null,
PageTransitionsTheme pageTransitionsTheme = null,
ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
Typography typography = null
) {
return raw(
brightness: brightness ?? this.brightness,

materialTapTargetSize: materialTapTargetSize ?? this.materialTapTargetSize,
pageTransitionsTheme: pageTransitionsTheme ?? this.pageTransitionsTheme,
colorScheme: colorScheme ?? this.colorScheme,
dialogTheme: dialogTheme ?? this.dialogTheme,
typography: typography ?? this.typography
);
}

materialTapTargetSize: t < 0.5 ? a.materialTapTargetSize : b.materialTapTargetSize,
pageTransitionsTheme: t < 0.5 ? a.pageTransitionsTheme : b.pageTransitionsTheme,
colorScheme: ColorScheme.lerp(a.colorScheme, b.colorScheme, t),
dialogTheme: DialogTheme.lerp(a.dialogTheme, b.dialogTheme, t),
typography: Typography.lerp(a.typography, b.typography, t)
);
}

other.materialTapTargetSize == this.materialTapTargetSize &&
other.pageTransitionsTheme == this.pageTransitionsTheme &&
other.colorScheme == this.colorScheme &&
other.dialogTheme == this.dialogTheme &&
other.typography == this.typography;
}

hashCode = (hashCode * 397) ^ this.materialTapTargetSize.GetHashCode();
hashCode = (hashCode * 397) ^ this.pageTransitionsTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.colorScheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.dialogTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.typography.GetHashCode();
return hashCode;
}

new DiagnosticsProperty<PageTransitionsTheme>("pageTransitionsTheme", this.pageTransitionsTheme));
properties.add(new DiagnosticsProperty<ColorScheme>("colorScheme", this.colorScheme,
defaultValue: defaultData.colorScheme));
properties.add(new DiagnosticsProperty<DialogTheme>("dialogTheme", this.dialogTheme,
defaultValue: defaultData.dialogTheme));
properties.add(new DiagnosticsProperty<Typography>("typography", this.typography,
defaultValue: defaultData.typography));
}

18
Runtime/rendering/box.mixin.gen.cs


using System;
using UnityEngine;
using UnityEngine;
public float? defaultComputeDistanceToFirstActualBaseline(TextBaseline baseline) {
var child = this.firstChild;
while (child != null) {

candidate += childParentData.offset.dy;
if (result != null) {
result = Mathf.Min(result.Value, candidate.Value);
}
else {
} else {
result = candidate;
}
}

}
}
public bool defaultHitTestChildren(HitTestResult result, Offset position) {
public bool defaultHitTestChildren(HitTestResult result, Offset position) {
while (child != null) {
while (child != null)
{
return false;
}

return result;
}
}
}

88
Runtime/rendering/object.mixin.gen.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using UnityEngine;
public abstract class RenderObjectWithChildMixinRenderObject<ChildType> : RenderObject,
RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public abstract class RenderObjectWithChildMixinRenderObject<ChildType> : RenderObject, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {

public override List<DiagnosticsNode> debugDescribeChildren() {
return this.child != null
? new List<DiagnosticsNode> {this.child.toDiagnosticsNode(name: "child")}
? new List<DiagnosticsNode>{this.child.toDiagnosticsNode(name: "child")}
public abstract class RenderObjectWithChildMixinRenderBox<ChildType> : RenderBox,
RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public abstract class RenderObjectWithChildMixinRenderBox<ChildType> : RenderBox, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {

public override List<DiagnosticsNode> debugDescribeChildren() {
return this.child != null
? new List<DiagnosticsNode> {this.child.toDiagnosticsNode(name: "child")}
? new List<DiagnosticsNode>{this.child.toDiagnosticsNode(name: "child")}
public abstract class RenderObjectWithChildMixinRenderSliver<ChildType> : RenderSliver,
RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public abstract class RenderObjectWithChildMixinRenderSliver<ChildType> : RenderSliver, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {

public override List<DiagnosticsNode> debugDescribeChildren() {
return this.child != null
? new List<DiagnosticsNode> {this.child.toDiagnosticsNode(name: "child")}
? new List<DiagnosticsNode>{this.child.toDiagnosticsNode(name: "child")}
public abstract class ContainerParentDataMixinParentData<ChildType> : ParentData,
ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public abstract class ContainerParentDataMixinParentData<ChildType> : ParentData, ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public ChildType previousSibling { get; set; }
public ChildType nextSibling { get; set; }

}
public abstract class ContainerParentDataMixinBoxParentData<ChildType> : BoxParentData,
ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public abstract class ContainerParentDataMixinBoxParentData<ChildType> : BoxParentData, ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public ChildType previousSibling { get; set; }
public ChildType nextSibling { get; set; }

}
public abstract class ContainerParentDataMixinSliverPhysicalParentData<ChildType> : SliverPhysicalParentData,
ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public abstract class ContainerParentDataMixinSliverPhysicalParentData<ChildType> : SliverPhysicalParentData, ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public ChildType previousSibling { get; set; }
public ChildType nextSibling { get; set; }

}
public abstract class ContainerParentDataMixinSliverLogicalParentData<ChildType> : SliverLogicalParentData,
ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public abstract class ContainerParentDataMixinSliverLogicalParentData<ChildType> : SliverLogicalParentData, ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public ChildType previousSibling { get; set; }
public ChildType nextSibling { get; set; }

}
public abstract class ContainerRenderObjectMixinRenderBox<ChildType, ParentDataType> : RenderBox,
ContainerRenderObjectMixin
public abstract class ContainerRenderObjectMixinRenderBox<ChildType, ParentDataType> : RenderBox, ContainerRenderObjectMixin
bool _debugUltimatePreviousSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.previousSibling != null) {

this._firstChild = child;
this._lastChild = this._lastChild ?? child;
}
else {
} else {
D.assert(this._firstChild != null);
D.assert(this._lastChild != null);
D.assert(this._debugUltimatePreviousSiblingOf(after, equals: this._firstChild));

childParentData.previousSibling = after;
afterParentData.nextSibling = child;
this._lastChild = child;
}
else {
} else {
childParentData.nextSibling = afterParentData.nextSibling;
childParentData.previousSibling = after;
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;

if (childParentData.previousSibling == null) {
D.assert(this._firstChild == child);
this._firstChild = childParentData.nextSibling;
}
else {
} else {
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling;
}

this._lastChild = childParentData.previousSibling;
}
else {
} else {
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
}

}
public abstract class ContainerRenderObjectMixinRenderSliver<ChildType, ParentDataType> : RenderSliver,
ContainerRenderObjectMixin
public abstract class ContainerRenderObjectMixinRenderSliver<ChildType, ParentDataType> : RenderSliver, ContainerRenderObjectMixin
bool _debugUltimatePreviousSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.previousSibling != null) {

this._firstChild = child;
this._lastChild = this._lastChild ?? child;
}
else {
} else {
D.assert(this._firstChild != null);
D.assert(this._lastChild != null);
D.assert(this._debugUltimatePreviousSiblingOf(after, equals: this._firstChild));

childParentData.previousSibling = after;
afterParentData.nextSibling = child;
this._lastChild = child;
}
else {
} else {
childParentData.nextSibling = afterParentData.nextSibling;
childParentData.previousSibling = after;
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;

if (childParentData.previousSibling == null) {
D.assert(this._firstChild == child);
this._firstChild = childParentData.nextSibling;
}
else {
} else {
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling;
}

this._lastChild = childParentData.previousSibling;
}
else {
} else {
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
}

}
public abstract class
ContainerRenderObjectMixinRenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack<ChildType,
ParentDataType> : RenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack,
ContainerRenderObjectMixin
public abstract class ContainerRenderObjectMixinRenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack<ChildType, ParentDataType> : RenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack, ContainerRenderObjectMixin
bool _debugUltimatePreviousSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.previousSibling != null) {

this._firstChild = child;
this._lastChild = this._lastChild ?? child;
}
else {
} else {
D.assert(this._firstChild != null);
D.assert(this._lastChild != null);
D.assert(this._debugUltimatePreviousSiblingOf(after, equals: this._firstChild));

childParentData.previousSibling = after;
afterParentData.nextSibling = child;
this._lastChild = child;
}
else {
} else {
childParentData.nextSibling = afterParentData.nextSibling;
childParentData.previousSibling = after;
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;

if (childParentData.previousSibling == null) {
D.assert(this._firstChild == child);
this._firstChild = childParentData.nextSibling;
}
else {
} else {
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling;
}

this._lastChild = childParentData.previousSibling;
}
else {
} else {
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
}

return this.childAfter((ChildType) child);
}
}
}

155
Runtime/rendering/proxy_box.cs


}
}
public class RenderIntrinsicWidth : RenderProxyBox {
public RenderIntrinsicWidth(
float? stepWidth = null,
float? stepHeight = null,
RenderBox child = null
) : base(child) {
this._stepWidth = stepWidth;
this._stepHeight = stepHeight;
}
float? _stepWidth;
public float? stepWidth {
get { return this._stepWidth; }
set {
if (value == this._stepWidth) {
return;
}
this._stepWidth = value;
this.markNeedsLayout();
}
}
float? _stepHeight;
public float? stepHeight {
get { return this._stepHeight; }
set {
if (value == this._stepHeight) {
return;
}
this._stepHeight = value;
this.markNeedsLayout();
}
}
static float _applyStep(float input, float? step) {
D.assert(input.isFinite());
if (step == null) {
return input;
}
return (input / step.Value).ceil() * step.Value;
}
protected override float computeMinIntrinsicWidth(float height) {
return this.computeMaxIntrinsicWidth(height);
}
protected override float computeMaxIntrinsicWidth(float height) {
if (this.child == null) {
return 0.0f;
}
float width = this.child.getMaxIntrinsicWidth(height);
return _applyStep(width, this._stepWidth);
}
protected override float computeMinIntrinsicHeight(float width) {
if (this.child == null) {
return 0.0f;
}
if (!width.isFinite()) {
width = this.computeMaxIntrinsicWidth(float.PositiveInfinity);
}
D.assert(width.isFinite());
float height = this.child.getMinIntrinsicHeight(width);
return _applyStep(height, this._stepHeight);
}
protected override float computeMaxIntrinsicHeight(float width) {
if (this.child == null) {
return 0.0f;
}
if (!width.isFinite()) {
width = this.computeMaxIntrinsicWidth(float.PositiveInfinity);
}
D.assert(width.isFinite());
float height = this.child.getMaxIntrinsicHeight(width);
return _applyStep(height, this._stepHeight);
}
protected override void performLayout() {
if (this.child != null) {
BoxConstraints childConstraints = this.constraints;
if (!childConstraints.hasTightWidth) {
float width = this.child.getMaxIntrinsicWidth(childConstraints.maxHeight);
D.assert(width.isFinite());
childConstraints = childConstraints.tighten(width: _applyStep(width, this._stepWidth));
}
if (this._stepHeight != null) {
float height = this.child.getMaxIntrinsicHeight(childConstraints.maxWidth);
D.assert(height.isFinite());
childConstraints = childConstraints.tighten(height: _applyStep(height, this._stepHeight));
}
this.child.layout(childConstraints, parentUsesSize: true);
this.size = this.child.size;
} else {
this.performResize();
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("stepWidth", this.stepWidth));
properties.add(new FloatProperty("stepHeight", this.stepHeight));
}
}
public class RenderIntrinsicHeight : RenderProxyBox {
public RenderIntrinsicHeight(
RenderBox child = null
) : base(child) {
}
protected override float computeMinIntrinsicWidth(float height) {
if (this.child == null) {
return 0.0f;
}
if (!height.isFinite()) {
height = this.child.getMaxIntrinsicHeight(float.PositiveInfinity);
}
D.assert(height.isFinite());
return this.child.getMinIntrinsicWidth(height);
}
protected override float computeMaxIntrinsicWidth(float height) {
if (this.child == null) {
return 0.0f;
}
if (!height.isFinite()) {
height = this.child.getMaxIntrinsicHeight(float.PositiveInfinity);
}
D.assert(height.isFinite());
return this.child.getMaxIntrinsicWidth(height);
}
protected override float computeMinIntrinsicHeight(float width) {
return this.computeMaxIntrinsicHeight(width);
}
protected override void performLayout() {
if (this.child != null) {
BoxConstraints childConstraints = this.constraints;
if (!childConstraints.hasTightHeight) {
float height = this.child.getMaxIntrinsicHeight(childConstraints.maxWidth);
D.assert(height.isFinite());
childConstraints = childConstraints.tighten(height: height);
}
this.child.layout(childConstraints, parentUsesSize: true);
this.size = this.child.size;
} else {
this.performResize();
}
}
}
public class RenderOpacity : RenderProxyBox {
public RenderOpacity(float opacity = 1.0f, RenderBox child = null) : base(child) {
D.assert(opacity >= 0.0 && opacity <= 1.0);

20
Runtime/rendering/proxy_box.mixin.gen.cs


using Unity.UIWidgets.gestures;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.gestures;
using UnityEngine;
public abstract class
RenderProxyBoxMixinRenderObjectWithChildMixinRenderBox<T> : RenderObjectWithChildMixinRenderBox<T>
where T : RenderBox {
public abstract class RenderProxyBoxMixinRenderObjectWithChildMixinRenderBox<T> : RenderObjectWithChildMixinRenderBox<T> where T : RenderBox {
public override void setupParentData(RenderObject child) {
if (!(child.parentData is ParentData)) {
child.parentData = new ParentData();

if (this.child != null) {
this.child.layout(this.constraints, parentUsesSize: true);
this.size = this.child.size;
}
else {
} else {
this.performResize();
}
}

}
public abstract class RenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack :
public abstract class RenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack:
}
}

33
Runtime/widgets/basic.cs


}
}
public class IntrinsicWidth : SingleChildRenderObjectWidget {
public IntrinsicWidth(Key key = null, float? stepWidth = null, float? stepHeight = null, Widget child = null)
: base(key: key, child: child) {
this.stepWidth = stepWidth;
this.stepHeight = stepHeight;
}
public readonly float? stepWidth;
public readonly float? stepHeight;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderIntrinsicWidth(stepWidth: this.stepWidth, stepHeight: this.stepHeight);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObjectRaw) {
var renderObject = (RenderIntrinsicWidth) renderObjectRaw;
renderObject.stepWidth = this.stepWidth;
renderObject.stepHeight = this.stepHeight;
}
}
public class IntrinsicHeight : SingleChildRenderObjectWidget {
public IntrinsicHeight(Key key = null, Widget child = null)
: base(key: key, child: child) {
}
public override RenderObject createRenderObject(BuildContext context) {
return new RenderIntrinsicHeight();
}
}
public class ListBody : MultiChildRenderObjectWidget {
public ListBody(

bool absorbing = true,
Widget child = null
) : base(key: key, child: child) {
this.absorbing = absorbing;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderAbsorbPointer(

71
Runtime/widgets/implicit_animations.cs


}
}
public abstract class ImplicitlyAnimatedWidget : StatefulWidget {
public ImplicitlyAnimatedWidget(
Key key = null,

public delegate Tween<T> TweenConstructor<T>(T targetValue);
public interface ITweenVisitor {
public interface TweenVisitor {
public class TweenVisitorUpdateTween : ITweenVisitor {
public class TweenVisitorUpdateTween : TweenVisitor {
public Tween<T> visit<T, T2>(ImplicitlyAnimatedWidgetState<T2> state, Tween<T> tween, T targetValue,
TweenConstructor<T> constructor)
where T2 : ImplicitlyAnimatedWidget {

}
public class TweenVisitorCheckStartAnimation : ITweenVisitor {
public class TweenVisitorCheckStartAnimation : TweenVisitor {
public bool shouldStartAnimation;
public TweenVisitorCheckStartAnimation() {

return visitor.shouldStartAnimation;
}
protected abstract void forEachTween(ITweenVisitor visitor);
protected abstract void forEachTween(TweenVisitor visitor);
protected virtual void didUpdateTweens() {
}

}
}
public class _AnimatedContainerState : AnimatedWidgetBaseState<AnimatedContainer> {
class _AnimatedContainerState : AnimatedWidgetBaseState<AnimatedContainer> {
AlignmentTween _alignment;
EdgeInsetsTween _padding;
DecorationTween _decoration;

Matrix3Tween _transform;
protected override void forEachTween(ITweenVisitor visitor) {
protected override void forEachTween(TweenVisitor visitor) {
this._alignment = (AlignmentTween) visitor.visit(this, this._alignment, this.widget.alignment,
(Alignment value) => new AlignmentTween(begin: value));
this._padding = (EdgeInsetsTween) visitor.visit(this, this._padding, this.widget.padding,

}
}
public class AnimatedPadding : ImplicitlyAnimatedWidget {
public AnimatedPadding(
Key key = null,
EdgeInsets padding = null,
Widget child = null,
Curve curve = null,
TimeSpan? duration = null
) : base(key: key, curve: curve, duration: duration) {
D.assert(padding != null);
D.assert(padding.isNonNegative);
this.padding = padding;
this.child = child;
}
public readonly EdgeInsets padding;
public readonly Widget child;
public override State createState() {
return new _AnimatedPaddingState();
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", this.padding));
}
}
class _AnimatedPaddingState : AnimatedWidgetBaseState<AnimatedPadding> {
EdgeInsetsTween _padding;
protected override void forEachTween(TweenVisitor visitor) {
this._padding = (EdgeInsetsTween) visitor.visit(this, this._padding, this.widget.padding,
(EdgeInsets value) => new EdgeInsetsTween(begin: value));
}
public override Widget build(BuildContext context) {
return new Padding(
padding: this._padding.evaluate(this.animation),
child: this.widget.child
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(new DiagnosticsProperty<EdgeInsetsTween>("padding", this._padding,
defaultValue: Diagnostics.kNullDefaultValue));
}
}
public class AnimatedDefaultTextStyle : ImplicitlyAnimatedWidget {
public AnimatedDefaultTextStyle(
Key key = null,

}
public class _AnimatedDefaultTextStyleState : AnimatedWidgetBaseState<AnimatedDefaultTextStyle> {
class _AnimatedDefaultTextStyleState : AnimatedWidgetBaseState<AnimatedDefaultTextStyle> {
protected override void forEachTween(ITweenVisitor visitor) {
protected override void forEachTween(TweenVisitor visitor) {
this._style = (TextStyleTween) visitor.visit(this, this._style, this.widget.style,
(TextStyle value) => new TextStyleTween(begin: value));
}

}
}
public class _AnimatedPhysicalModelState : AnimatedWidgetBaseState<AnimatedPhysicalModel> {
class _AnimatedPhysicalModelState : AnimatedWidgetBaseState<AnimatedPhysicalModel> {
protected override void forEachTween(ITweenVisitor visitor) {
protected override void forEachTween(TweenVisitor visitor) {
this._borderRadius = (BorderRadiusTween) visitor.visit(this, this._borderRadius, this.widget.borderRadius,
(BorderRadius value) => new BorderRadiusTween(begin: value));
this._elevation = (FloatTween) visitor.visit(this, this._elevation, this.widget.elevation,

256
Runtime/widgets/navigator.cs


}
public abstract class Route {
public readonly RouteSettings settings;
internal NavigatorState _navigator;
internal NavigatorState _navigator;
public readonly RouteSettings settings;
public virtual bool willHandlePopInternally {
get { return false; }
}
public object currentResult {
get { return default; }
}
public Promise<object> popped { get; } = new Promise<object>();
public bool isCurrent {
get { return this._navigator != null && this._navigator._history.last() == this; }
}
public bool isFirst {
get { return this._navigator != null && this._navigator._history.first() == this; }
}
public bool isActive {
get { return this._navigator != null && this._navigator._history.Contains(this); }
}
protected internal virtual void install(OverlayEntry insertionPoint) {
}

: RoutePopDisposition.pop);
}
public virtual bool willHandlePopInternally {
get { return false; }
}
public object currentResult {
get { return null; }
}
public IPromise<object> popped {
get { return this._popCompleter; }
}
internal readonly Promise<object> _popCompleter = new Promise<object>();
protected internal virtual bool didPop(object result) {
this.didComplete(result);
return true;

this.popped.Resolve(result);
this._popCompleter.Resolve(result);
}
protected internal virtual void didPopNext(Route nextRoute) {

protected internal virtual void dispose() {
this._navigator = null;
}
}
public class RouteSettings {
public readonly bool isInitialRoute;
public bool isCurrent {
get { return this._navigator != null && this._navigator._history.last() == this; }
}
public readonly string name;
public bool isFirst {
get { return this._navigator != null && this._navigator._history.first() == this; }
}
public bool isActive {
get { return this._navigator != null && this._navigator._history.Contains(this); }
}
}
public class RouteSettings {
public RouteSettings(string name = null, bool isInitialRoute = false) {
this.name = name;
this.isInitialRoute = isInitialRoute;

);
}
public readonly bool isInitialRoute;
public readonly string name;
public override string ToString() {
return $"\"{this.name}\"";

}
public class Navigator : StatefulWidget {
/// The default name for the [initialRoute].
///
/// See also:
///
/// * [dart:ui.Window.defaultRouteName], which reflects the route that the
/// application was started with.
public static string defaultRouteName = "/";
public Navigator(
Key key = null,
string initialRoute = null,
RouteFactory onGenerateRoute = null,
RouteFactory onUnknownRoute = null,
List<NavigatorObserver> observers = null) : base(key) {
D.assert(onGenerateRoute != null);
this.initialRoute = initialRoute;
this.onGenerateRoute = onGenerateRoute;
this.onUnknownRoute = onUnknownRoute;
this.observers = observers ?? new List<NavigatorObserver>();
}
public readonly List<NavigatorObserver> observers;
public Navigator(Key key = null, string initialRoute = null,
RouteFactory onGenerateRoute = null, RouteFactory onUnknownRoute = null,
List<NavigatorObserver> observers = null) : base(key) {
D.assert(onGenerateRoute != null);
this.initialRoute = initialRoute;
this.onUnknownRoute = onUnknownRoute;
this.onGenerateRoute = onGenerateRoute;
this.observers = observers ?? new List<NavigatorObserver>();
}
public readonly List<NavigatorObserver> observers;
public static IPromise<object> pushName(BuildContext context, string routeName) {
return of(context).pushNamed(routeName);
public static readonly string defaultRouteName = "/";
public static IPromise<object> pushNamed(BuildContext context, string routeName) {
return Navigator.of(context).pushNamed(routeName);
return of(context).pushReplacementNamed(routeName, result);
return Navigator.of(context).pushReplacementNamed(routeName, result: result);
return of(context).popAndPushNamed(routeName, result);
return Navigator.of(context).popAndPushNamed(routeName, result: result);
return of(context).pushNamedAndRemoveUntil(newRouteName, predicate);
return Navigator.of(context).pushNamedAndRemoveUntil(newRouteName, predicate);
return of(context).push(route);
return Navigator.of(context).push(route);
return of(context).pushReplacement(newRoute, result);
return Navigator.of(context).pushReplacement(newRoute, result);
return of(context).pushAndRemoveUntil(newRoute, predicate);
return Navigator.of(context).pushAndRemoveUntil(newRoute, predicate);
public static void replace(BuildContext context, Route oldRoute, Route newRoute) {
of(context).replace(oldRoute, newRoute);
public static void replace(BuildContext context, Route oldRoute = null, Route newRoute = null) {
D.assert(oldRoute != null);
D.assert(newRoute != null);
Navigator.of(context).replace(oldRoute: oldRoute, newRoute: newRoute);
of(context).replaceRouteBelow(anchorRoute, newRoute);
D.assert(anchorRoute != null);
D.assert(newRoute != null);
Navigator.of(context).replaceRouteBelow(anchorRoute: anchorRoute, newRoute: newRoute);
public static bool canPop(BuildContext context) {
NavigatorState navigator = Navigator.of(context, nullOk: true);
return navigator != null && navigator.canPop();
}
return of(context).maybePop(result);
return Navigator.of(context).maybePop(result);
return of(context).pop(result);
return Navigator.of(context).pop(result);
of(context).popUntil(predicate);
Navigator.of(context).popUntil(predicate);
of(context).removeRoute(route);
Navigator.of(context).removeRoute(route);
of(context).removeRouteBelow(anchorRoute);
Navigator.of(context).removeRouteBelow(anchorRoute);
}
public static NavigatorState of(

}
public class NavigatorState : TickerProviderStateMixin<Navigator> {
readonly GlobalKey<OverlayState> _overlayKey = GlobalKey<OverlayState>.key();
readonly GlobalKey<OverlayState> _overlayKey = new LabeledGlobalKey<OverlayState>();
readonly HashSet<int> _activePointers = new HashSet<int>();
bool _debugLocked;
int _userGesturesInProgress;
public OverlayState overlay {
get { return this._overlayKey.currentState; }
}
OverlayEntry _currentOverlayEntry {
get {
var route = this._history.FindLast(r => r.overlayEntries.isNotEmpty());
return route?.overlayEntries.last();
}
}
public bool userGestureInProgress {
get { return this._userGesturesInProgress > 0; }
}
public override void initState() {
base.initState();
foreach (var observer in this.widget.observers) {

if (plannedInitialRoutes.Contains(null)) {
D.assert(() => {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
new Exception(
exception: new Exception(
"Could not navigate to initial route.\n" +
$"The requested route name was: \"{initialRouteName}\n" +
"The following routes were therefore attempted:\n" +

return true;
});
this.push(this._routeNamed(Navigator.defaultRouteName));
}
else {
} else {
}
else {
} else {
Route route = null;
if (initialRouteName != Navigator.defaultRouteName) {
route = this._routeNamed(initialRouteName, true);

}
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget(oldWidget);
if (((Navigator) oldWidget).observers != this.widget.observers) {

return true;
});
}
public OverlayState overlay {
get { return this._overlayKey.currentState; }
}
OverlayEntry _currentOverlayEntry {
get {
var route = this._history.FindLast(r => r.overlayEntries.isNotEmpty());
return route?.overlayEntries.last();
}
}
bool _debugLocked;
var settings = new RouteSettings(name, this._history.isEmpty());
var route = this.widget.onGenerateRoute(settings);
var settings = new RouteSettings(
name: name,
isInitialRoute: this._history.isEmpty()
);
var route = (Route) this.widget.onGenerateRoute(settings);
if (route == null && !allowNull) {
D.assert(() => {
if (this.widget.onUnknownRoute == null) {

return true;
});
route = this.widget.onUnknownRoute(settings);
route = (Route) this.widget.onUnknownRoute(settings);
D.assert(() => {
if (route == null) {
throw new UIWidgetsError(

return route;
}
public Promise<object> pushNamed(string routeName) {
public IPromise<object> pushNamed(string routeName) {
public Promise<object> pushReplacementNamed(string routeName, object result = null) {
public IPromise<object> pushReplacementNamed(string routeName, object result = null) {
public Promise<object> popAndPushNamed(string routeName, object result = null) {
public IPromise<object> popAndPushNamed(string routeName, object result = null) {
public Promise<object> pushNamedAndRemoveUntil(string newRouteName, RoutePredicate predicate) {
public IPromise<object> pushNamedAndRemoveUntil(string newRouteName, RoutePredicate predicate) {
public Promise<object> push(Route route) {
public IPromise<object> push(Route route) {
D.assert(!this._debugLocked);
D.assert(() => {
this._debugLocked = true;

}
void _afterNavigation() {
this._cancelActivePointers();
public Promise<object> pushReplacement(Route newRoute, object result = null) {
public IPromise<object> pushReplacement(Route newRoute, object result = null) {
D.assert(!this._debugLocked);
D.assert(() => {
this._debugLocked = true;

newRoute.install(this._currentOverlayEntry);
this._history[index] = newRoute;
newRoute.didPush().whenCompleteOrCancel(() => {
// The old route's exit is not animated. We're assuming that the
// new route completely obscures the old one.
if (this.mounted) {
oldRoute.didComplete(result ?? oldRoute.currentResult);
oldRoute.dispose();

}
foreach (var observer in this.widget.observers) {
observer.didReplace(newRoute, oldRoute);
observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
}
D.assert(() => {

return newRoute.popped;
}
public Promise<object> pushAndRemoveUntil(Route newRoute, RoutePredicate predicate) {
public IPromise<object> pushAndRemoveUntil(Route newRoute, RoutePredicate predicate) {
D.assert(!this._debugLocked);
D.assert(() => {
this._debugLocked = true;

D.assert(!this._debugLocked);
D.assert(oldRoute != null);
D.assert(newRoute != null);
if (oldRoute == newRoute
) // ignore: unrelated_type_equality_checks, https://github.com/dart-lang/sdk/issues/32522
{
if (oldRoute == newRoute) {
return;
}

newRoute.install(oldRoute.overlayEntries.last());
this._history[index] = newRoute;
newRoute.didReplace(oldRoute);
if (index + 1 < this._history.Capacity) {
if (index + 1 < this._history.Count) {
newRoute.didChangeNext(this._history[index + 1]);
this._history[index + 1].didChangePrevious(newRoute);
}

}
foreach (var observer in this.widget.observers) {
observer.didReplace(newRoute, oldRoute);
observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
}
oldRoute.dispose();

this.pop(result);
}
return Promise<bool>.Resolved(true);
return true;
return Promise<bool>.Resolved(false);
return false;
});
}

D.assert(debugPredictedWouldPop);
if (this._history.Count > 1) {
this._history.removeLast();
// If route._navigator is null, the route called finalizeRoute from
// didPop, which means the route has already been disposed and doesn't
// need to be added to _poppedRoutes for later disposal.
if (route._navigator != null) {
this._poppedRoutes.Add(route);
}

this._poppedRoutes.Remove(route);
route.dispose();
}
int _userGesturesInProgress = 0;
public bool userGestureInProgress {
get { return this._userGesturesInProgress > 0; }
}
public void didStartUserGesture() {
this._userGesturesInProgress += 1;

? this._history[this._history.Count - 2]
: null;
// Don't operate the _history list since the gesture may be cancelled.
// In case of a back swipe, the gesture controller will call .pop() itself.
foreach (var observer in this.widget.observers) {
observer.didStartUserGesture(route, previousRoute);
}

}
}
readonly HashSet<int> _activePointers = new HashSet<int>();
void _handlePointerDown(PointerDownEvent evt) {
this._activePointers.Add(evt.pointer);

}
});
}
foreach (var activePointer in this._activePointers) {
WidgetsBinding.instance.cancelPointer(activePointer);
}
this._activePointers.ToList().ForEach(WidgetsBinding.instance.cancelPointer);
public override Widget build(BuildContext context) {
D.assert(!this._debugLocked);

this.focusScopeNode,
autofocus: true,
child: new Overlay(
this._overlayKey,
this._initialOverlayEntries
key: this._overlayKey,
initialEntries: this._initialOverlayEntries
)
) {
alwaysUpdate = true,
}
)
);
}

2
Runtime/widgets/routes.cs


}
public static class DialogUtils {
public static Promise<object> showGeneralDialog(
public static IPromise<object> showGeneralDialog(
BuildContext context = null,
RoutePageBuilder pageBuilder = null,
bool barrierDismissible = false,

4
Runtime/widgets/scroll_notification.mixin.gen.cs


using Unity.UIWidgets.rendering;
namespace Unity.UIWidgets.widgets {
public abstract class ViewportNotificationMixinNotification : Notification {
public int depth {
get { return this._depth; }

}
public abstract class ViewportNotificationMixinLayoutChangedNotification : LayoutChangedNotification {
public int depth {
get { return this._depth; }

this._depth, this._depth == 0 ? "local" : "remote"));
}
}
}

2
Samples/UIWidgetSample/NavigationSample.cs


body: new Container(
color: new Color(0xFF888888),
child: new Center(
child: new CustomButton(onPressed: () => { Navigator.pushName(context, "/detail"); },
child: new CustomButton(onPressed: () => { Navigator.pushNamed(context, "/detail"); },
child: new Text("Go to Detail"))
)),
title: "Home"

32
Third Party Notices.md


This package contains third-party software components governed by the license(s) indicated below:
---------
Component Name: [provide component name]
License Type: [Provide license type, i.e. "MIT", "Apache 2.0"]
Component Name: [flutter](https://flutter.dev/)
[Provide License Details]
License Type: flutter
---------
Component Name: [provide component name]
Copyright 2014 The Chromium Authors. All rights reserved.
License Type: [Provide license type, i.e. "MIT", "Apache 2.0"]
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
[Provide License Details]
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

8
package.json


{
"name": "com.unity.uiwidgets",
"displayName":"UI Widgets",
"version": "0.1.0-preview",
"unity": "2018.3",
"description": "Replace this string with your own description of the package. This description appears in the Package Manager window when the user selects this package from the list. \n\nFor best results, use this text to summarize: \n\u25AA What the package does \n\u25AA How it can benefit the user \n\nNote: Special formatting characters are supported, including line breaks ('\\n') and bullets ('\\u25AA').",
"displayName":"UIWidgets",
"version": "1.0.0-preview",
"unity": "2018.1",
"description": "UIWidgets allows you to build beautiful cross-platform apps through Unity",
"dependencies": {
}
}

275
Runtime/material/dialog.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class Dialog : StatelessWidget {
public Dialog(
Key key = null,
Widget child = null,
TimeSpan? insetAnimationDuration = null,
Curve insetAnimationCurve = null,
ShapeBorder shape = null
) : base(key: key) {
this.child = child;
this.insetAnimationDuration = insetAnimationDuration ?? new TimeSpan(0, 0, 0, 0, 100);
this.insetAnimationCurve = Curves.decelerate;
this.shape = shape;
}
public readonly Widget child;
public readonly TimeSpan insetAnimationDuration;
public readonly Curve insetAnimationCurve;
public readonly ShapeBorder shape;
Color _getColor(BuildContext context) {
return Theme.of(context).dialogBackgroundColor;
}
public static readonly RoundedRectangleBorder _defaultDialogShape =
new RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(2.0f)));
public override Widget build(BuildContext context) {
DialogTheme dialogTheme = DialogTheme.of(context);
return new AnimatedPadding(
padding: MediaQuery.of(context).viewInsets + EdgeInsets.symmetric(horizontal: 40.0f, vertical: 24.0f),
duration: this.insetAnimationDuration,
curve: this.insetAnimationCurve,
child: MediaQuery.removeViewInsets(
removeLeft: true,
removeTop: true,
removeRight: true,
removeBottom: true,
context: context,
child: new Center(
child: new ConstrainedBox(
constraints: new BoxConstraints(minWidth: 280.0f),
child: new Material(
elevation: 24.0f,
color: this._getColor(context),
type: MaterialType.card,
child: this.child,
shape: this.shape ?? dialogTheme.shape ?? _defaultDialogShape
)
)
)
)
);
}
}
public class AlertDialog : StatelessWidget {
public AlertDialog(
Key key = null,
Widget title = null,
EdgeInsets titlePadding = null,
Widget content = null,
EdgeInsets contentPadding = null,
List<Widget> actions = null,
ShapeBorder shape = null
) : base(key: key) {
this.title = title;
this.titlePadding = titlePadding;
this.content = content;
this.contentPadding = contentPadding ?? EdgeInsets.fromLTRB(24.0f, 20.0f, 24.0f, 24.0f);
this.actions = actions;
this.shape = shape;
}
public readonly Widget title;
public readonly EdgeInsets titlePadding;
public readonly Widget content;
public readonly EdgeInsets contentPadding;
public readonly List<Widget> actions;
public readonly ShapeBorder shape;
public override Widget build(BuildContext context) {
// D.assert(debugCheckHasMaterialLocalizations(context));
List<Widget> children = new List<Widget>();
if (this.title != null) {
children.Add(new Padding(
padding: this.titlePadding ??
EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, this.content == null ? 20.0f : 0.0f),
child: new DefaultTextStyle(
style: Theme.of(context).textTheme.title,
child: this.title
)
));
}
if (this.content != null) {
children.Add(new Flexible(
child: new Padding(
padding: this.contentPadding,
child: new DefaultTextStyle(
style: Theme.of(context).textTheme.subhead,
child: this.content
)
)
));
}
if (this.actions != null) {
children.Add(ButtonTheme.bar(
child: new ButtonBar(
children: this.actions
)
));
}
Widget dialogChild = new IntrinsicWidth(
child: new Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children
)
);
return new Dialog(child: dialogChild, shape: this.shape);
}
}
public class SimpleDialogOption : StatelessWidget {
public SimpleDialogOption(
Key key = null,
VoidCallback onPressed = null,
Widget child = null
) : base(key: key) {
this.onPressed = onPressed;
this.child = child;
}
public readonly VoidCallback onPressed;
public readonly Widget child;
public override Widget build(BuildContext context) {
return new InkWell(
onTap: () => this.onPressed(),
child: new Padding(
padding: EdgeInsets.symmetric(vertical: 8.0f, horizontal: 24.0f),
child: this.child
)
);
}
}
public class SimpleDialog : StatelessWidget {
public SimpleDialog(
Key key = null,
Widget title = null,
EdgeInsets titlePadding = null,
List<Widget> children = null,
EdgeInsets contentPadding = null,
ShapeBorder shape = null
) : base(key: key) {
this.title = title;
this.titlePadding = titlePadding ?? EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, 0.0f);
this.children = children;
this.contentPadding = contentPadding ?? EdgeInsets.fromLTRB(0.0f, 12.0f, 0.0f, 16.0f);
this.shape = shape;
}
public readonly Widget title;
public readonly EdgeInsets titlePadding;
public readonly List<Widget> children;
public readonly EdgeInsets contentPadding;
public readonly ShapeBorder shape;
public override Widget build(BuildContext context) {
// D.assert(debugCheckHasMaterialLocalizations(context));
List<Widget> body = new List<Widget>();
if (this.title != null) {
body.Add(new Padding(
padding: this.titlePadding,
child: new DefaultTextStyle(
style: Theme.of(context).textTheme.title,
child: this.title
)
));
}
if (this.children != null) {
body.Add(new Flexible(
child: new SingleChildScrollView(
padding: this.contentPadding,
child: new ListBody(children: this.children)
)
));
}
Widget dialogChild = new IntrinsicWidth(
stepWidth: 56.0f,
child: new ConstrainedBox(
constraints: new BoxConstraints(minWidth: 280.0f),
child: new Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: body
)
)
);
return new Dialog(child: dialogChild, shape: this.shape);
}
}
public static class DialogUtils {
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
);
}
public static IPromise<object> showDialog(
BuildContext context = null,
bool barrierDismissible = true,
WidgetBuilder builder = null
) {
// D.assert(debugCheckHasMaterialLocalizations(context));
return widgets.DialogUtils.showGeneralDialog(
context: context,
pageBuilder: (buildContext, animation, secondaryAnimation) => {
ThemeData theme = Theme.of(context, shadowThemeOnly: true);
Widget pageChild = new Builder(builder: builder);
return new SafeArea(
child: new Builder(
builder: (_) => theme != null
? new Theme(data: theme, child: pageChild)
: pageChild)
);
},
barrierDismissible: barrierDismissible,
// barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
barrierColor: Colors.black54,
transitionDuration: new TimeSpan(0, 0, 0, 0, 150),
transitionBuilder: _buildMaterialDialogTransitions
);
}
}
}

11
Runtime/material/dialog.cs.meta


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

69
Runtime/material/dialog_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class DialogTheme : Diagnosticable, IEquatable<DialogTheme> {
public DialogTheme(ShapeBorder shape = null) {
this.shape = shape;
}
public readonly ShapeBorder shape;
public DialogTheme copyWith(ShapeBorder shape = null) {
return new DialogTheme(shape: shape ?? this.shape);
}
public static DialogTheme of(BuildContext context) {
return Theme.of(context).dialogTheme;
}
public static DialogTheme lerp(DialogTheme a, DialogTheme b, float t) {
return new DialogTheme(
shape: ShapeBorder.lerp(a?.shape, b?.shape, t)
);
}
public bool Equals(DialogTheme other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(this.shape, other.shape);
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((DialogTheme) obj);
}
public override int GetHashCode() {
return (this.shape != null ? this.shape.GetHashCode() : 0);
}
public static bool operator ==(DialogTheme left, DialogTheme right) {
return Equals(left, right);
}
public static bool operator !=(DialogTheme left, DialogTheme right) {
return !Equals(left, right);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape,
defaultValue: Diagnostics.kNullDefaultValue));
}
}
}

11
Runtime/material/dialog_theme.cs.meta


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

8
Samples/UIWidgetsGallery.meta


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

6
Samples/UIWidgetsGallery/UIWidgetsGallery.asmdef


{
"name": "UIWidgetsGallery",
"references": ["Unity.UIWidgets"],
"includePlatforms": [],
"excludePlatforms": []
}

7
Samples/UIWidgetsGallery/UIWidgetsGallery.asmdef.meta


fileFormatVersion: 2
guid: 8597b5a1d1bdd45048ad62795a71b2f2
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsGallery/gallery.meta


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

135
Samples/UIWidgetsGallery/gallery/app.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.async;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace UIWidgetsGallery.gallery {
public delegate IPromise<string> UpdateUrlFetcher();
public class GalleryApp : StatefulWidget {
public GalleryApp(
Key key = null,
UpdateUrlFetcher updateUrlFetcher = null,
bool enablePerformanceOverlay = true,
bool enableRasterCacheImagesCheckerboard = true,
bool enableOffscreenLayersCheckerboard = true,
VoidCallback onSendFeedback = null,
bool testMode = false
) : base(key: key) {
}
public readonly UpdateUrlFetcher updateUrlFetcher;
public readonly bool enablePerformanceOverlay;
public readonly bool enableRasterCacheImagesCheckerboard;
public readonly bool enableOffscreenLayersCheckerboard;
public readonly VoidCallback onSendFeedback;
public readonly bool testMode;
public override State createState() {
return new _GalleryAppState();
}
}
class _GalleryAppState : State<GalleryApp> {
GalleryOptions _options;
Timer _timeDilationTimer;
Dictionary<string, WidgetBuilder> _buildRoutes() {
return GalleryDemo.kAllGalleryDemos.ToDictionary(
(demo) => $"{demo.routeName}",
(demo) => demo.buildRoute);
}
public override void initState() {
base.initState();
this._options = new GalleryOptions(
theme: GalleryTheme.kLightGalleryTheme,
textScaleFactor: GalleryTextScaleValue.kAllGalleryTextScaleValues[0],
timeDilation: SchedulerBinding.instance.timeDilation,
platform: Application.platform
);
}
public override void dispose() {
this._timeDilationTimer?.cancel();
this._timeDilationTimer = null;
base.dispose();
}
void _handleOptionsChanged(GalleryOptions newOptions) {
this.setState(() => {
if (this._options.timeDilation != newOptions.timeDilation) {
this._timeDilationTimer?.cancel();
this._timeDilationTimer = null;
if (newOptions.timeDilation > 1.0) {
// We delay the time dilation change long enough that the user can see
// that UI has started reacting and then we slam on the brakes so that
// they see that the time is in fact now dilated.
this._timeDilationTimer = Window.instance.run(new TimeSpan(0, 0, 0, 0, 150),
() => { SchedulerBinding.instance.timeDilation = newOptions.timeDilation; });
} else {
SchedulerBinding.instance.timeDilation = newOptions.timeDilation;
}
}
this._options = newOptions;
});
}
Widget _applyTextScaleFactor(Widget child) {
return new Builder(
builder: context => {
return new MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: this._options.textScaleFactor.scale
),
child: child
);
}
);
}
public override Widget build(BuildContext context) {
// Widget home = new GalleryHome(
// testMode: this.widget.testMode,
// optionsPage: new GalleryOptionsPage(
// options: this._options,
// onOptionsChanged: _handleOptionsChanged,
// onSendFeedback: this.widget.onSendFeedback ?? () => { Application.OpenURL("https://github.com/UnityTech/UIWidgets/issues"); }
// )
// );
Widget home = null;
if (this.widget.updateUrlFetcher != null) {
home = new Updater(
updateUrlFetcher: this.widget.updateUrlFetcher,
child: home
);
}
return new MaterialApp(
theme: this._options.theme.data.copyWith(/*platform: this._options.platform*/),
title: "UIWidgets Gallery",
color: Colors.grey,
showPerformanceOverlay: this._options.showPerformanceOverlay,
//checkerboardOffscreenLayers: this._options.showOffscreenLayersCheckerboard,
//checkerboardRasterCacheImages: this._options.showRasterCacheImagesCheckerboard,
routes: this._buildRoutes(),
builder: (BuildContext _, Widget child) => this._applyTextScaleFactor(child),
home: home
);
}
}
}

11
Samples/UIWidgetsGallery/gallery/app.cs.meta


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

606
Samples/UIWidgetsGallery/gallery/demos.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.widgets;
namespace UIWidgetsGallery.gallery {
public class GalleryDemoCategory : IEquatable<GalleryDemoCategory> {
GalleryDemoCategory(string name = null, IconData icon = null) {
D.assert(name != null);
D.assert(icon != null);
this.name = name;
this.icon = icon;
}
public readonly string name;
public readonly IconData icon;
public bool Equals(GalleryDemoCategory other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return string.Equals(this.name, other.name) && Equals(this.icon, other.icon);
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((GalleryDemoCategory) obj);
}
public override int GetHashCode() {
unchecked {
return ((this.name != null ? this.name.GetHashCode() : 0) * 397) ^
(this.icon != null ? this.icon.GetHashCode() : 0);
}
}
public static bool operator ==(GalleryDemoCategory left, GalleryDemoCategory right) {
return Equals(left, right);
}
public static bool operator !=(GalleryDemoCategory left, GalleryDemoCategory right) {
return !Equals(left, right);
}
public override string ToString() {
return $"{this.GetType()}({this.name})";
}
public static readonly GalleryDemoCategory _kDemos = new GalleryDemoCategory(
name: "Studies",
icon: GalleryIcons.animation
);
public static readonly GalleryDemoCategory _kStyle = new GalleryDemoCategory(
name: "Style",
icon: GalleryIcons.custom_typography
);
public static readonly GalleryDemoCategory _kMaterialComponents = new GalleryDemoCategory(
name: "Material",
icon: GalleryIcons.category_mdc
);
public static readonly GalleryDemoCategory _kCupertinoComponents = new GalleryDemoCategory(
name: "Cupertino",
icon: GalleryIcons.phone_iphone
);
public static readonly GalleryDemoCategory _kMedia = new GalleryDemoCategory(
name: "Media",
icon: GalleryIcons.drive_video
);
}
public class GalleryDemo {
public GalleryDemo(
string title = null,
IconData icon = null,
string subtitle = null,
GalleryDemoCategory category = null,
string routeName = null,
string documentationUrl = null,
WidgetBuilder buildRoute = null
) {
D.assert(title != null);
D.assert(icon != null);
D.assert(category != null);
D.assert(routeName != null);
D.assert(buildRoute != null);
this.title = title;
this.icon = icon;
this.subtitle = subtitle;
this.category = category;
this.routeName = routeName;
this.documentationUrl = documentationUrl;
this.buildRoute = buildRoute;
}
public readonly string title;
public readonly IconData icon;
public readonly string subtitle;
public readonly GalleryDemoCategory category;
public readonly string routeName;
public readonly string documentationUrl;
public readonly WidgetBuilder buildRoute;
public override string ToString() {
return $"{this.GetType()}({this.title} {this.routeName})";
}
static List<GalleryDemo> _buildGalleryDemos() {
List<GalleryDemo> galleryDemos = new List<GalleryDemo> {
// // Demos
// new GalleryDemo(
// title: "Shrine",
// subtitle: "Basic shopping app",
// icon: GalleryIcons.shrine,
// category: GalleryDemoCategory._kDemos,
// 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: "Animation",
// subtitle: "Section organizer",
// icon: GalleryIcons.animation,
// category: GalleryDemoCategory._kDemos,
// routeName: AnimationDemo.routeName,
// buildRoute: (BuildContext context) => new AnimationDemo()
// ),
//
// // Style
// new GalleryDemo(
// title: "Colors",
// subtitle: "All of the predefined colors",
// icon: GalleryIcons.colors,
// category: GalleryDemoCategory._kStyle,
// routeName: ColorsDemo.routeName,
// buildRoute: (BuildContext context) => ColorsDemo()
// ),
// new GalleryDemo(
// title: "Typography",
// subtitle: "All of the predefined text styles",
// icon: GalleryIcons.custom_typography,
// category: GalleryDemoCategory._kStyle,
// routeName: TypographyDemo.routeName,
// buildRoute: (BuildContext context) => TypographyDemo()
// ),
//
// // Material Components
// new GalleryDemo(
// title: "Backdrop",
// subtitle: "Select a front layer from back layer",
// icon: GalleryIcons.backdrop,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: BackdropDemo.routeName,
// buildRoute: (BuildContext context) => BackdropDemo()
// ),
// new GalleryDemo(
// title: "Bottom app bar",
// subtitle: "Optional floating action button notch",
// icon: GalleryIcons.bottom_app_bar,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: BottomAppBarDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/BottomAppBar-class.html",
// buildRoute: (BuildContext context) => BottomAppBarDemo()
// ),
// new GalleryDemo(
// title: "Bottom navigation",
// subtitle: "Bottom navigation with cross-fading views",
// icon: GalleryIcons.bottom_navigation,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: BottomNavigationDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/BottomNavigationBar-class.html",
// buildRoute: (BuildContext context) => BottomNavigationDemo()
// ),
// new GalleryDemo(
// title: "Bottom sheet: Modal",
// subtitle: "A dismissable bottom sheet",
// icon: GalleryIcons.bottom_sheets,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: ModalBottomSheetDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/showModalBottomSheet.html",
// buildRoute: (BuildContext context) => ModalBottomSheetDemo()
// ),
// new GalleryDemo(
// title: "Bottom sheet: Persistent",
// subtitle: "A bottom sheet that sticks around",
// icon: GalleryIcons.bottom_sheet_persistent,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: PersistentBottomSheetDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/ScaffoldState/showBottomSheet.html",
// buildRoute: (BuildContext context) => PersistentBottomSheetDemo()
// ),
// new GalleryDemo(
// title: "Buttons",
// subtitle: "Flat, raised, dropdown, and more",
// icon: GalleryIcons.generic_buttons,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: ButtonsDemo.routeName,
// buildRoute: (BuildContext context) => ButtonsDemo()
// ),
// new GalleryDemo(
// title: "Buttons: Floating Action Button",
// subtitle: "FAB with transitions",
// icon: GalleryIcons.buttons,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: TabsFabDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/FloatingActionButton-class.html",
// buildRoute: (BuildContext context) => TabsFabDemo()
// ),
// new GalleryDemo(
// title: "Cards",
// subtitle: "Baseline cards with rounded corners",
// icon: GalleryIcons.cards,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: CardsDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/Card-class.html",
// buildRoute: (BuildContext context) => CardsDemo()
// ),
// new GalleryDemo(
// title: "Chips",
// subtitle: "Labeled with delete buttons and avatars",
// icon: GalleryIcons.chips,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: ChipDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/Chip-class.html",
// buildRoute: (BuildContext context) => ChipDemo()
// ),
// new GalleryDemo(
// title: "Data tables",
// subtitle: "Rows and columns",
// icon: GalleryIcons.data_table,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: DataTableDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/PaginatedDataTable-class.html",
// buildRoute: (BuildContext context) => DataTableDemo()
// ),
// new GalleryDemo(
// title: "Dialogs",
// subtitle: "Simple, alert, and fullscreen",
// icon: GalleryIcons.dialogs,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: DialogDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/showDialog.html",
// buildRoute: (BuildContext context) => DialogDemo()
// ),
// new GalleryDemo(
// title: "Elevations",
// subtitle: "Shadow values on cards",
// // TODO(larche): Change to custom icon for elevations when one exists.
// icon: GalleryIcons.cupertino_progress,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: ElevationDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/Material/elevation.html",
// buildRoute: (BuildContext context) => ElevationDemo()
// ),
// new GalleryDemo(
// title: "Expand/collapse list control",
// subtitle: "A list with one sub-list level",
// icon: GalleryIcons.expand_all,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: TwoLevelListDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/ExpansionTile-class.html",
// buildRoute: (BuildContext context) => TwoLevelListDemo()
// ),
// new GalleryDemo(
// title: "Expansion panels",
// subtitle: "List of expanding panels",
// icon: GalleryIcons.expand_all,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: ExpansionPanelsDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/ExpansionPanel-class.html",
// buildRoute: (BuildContext context) => ExpansionPanelsDemo()
// ),
// new GalleryDemo(
// title: "Grid",
// subtitle: "Row and column layout",
// icon: GalleryIcons.grid_on,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: GridListDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/widgets/GridView-class.html",
// buildRoute: (BuildContext context) => new GridListDemo()
// ),
// new GalleryDemo(
// title: "Icons",
// subtitle: "Enabled and disabled icons with opacity",
// icon: GalleryIcons.sentiment_very_satisfied,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: IconsDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/IconButton-class.html",
// buildRoute: (BuildContext context) => IconsDemo()
// ),
// new GalleryDemo(
// title: "Lists",
// subtitle: "Scrolling list layouts",
// icon: GalleryIcons.list_alt,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: ListDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/ListTile-class.html",
// buildRoute: (BuildContext context) => new ListDemo()
// ),
// new GalleryDemo(
// title: "Lists: leave-behind list items",
// subtitle: "List items with hidden actions",
// icon: GalleryIcons.lists_leave_behind,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: LeaveBehindDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/widgets/Dismissible-class.html",
// buildRoute: (BuildContext context) => new LeaveBehindDemo()
// ),
// new GalleryDemo(
// title: "Lists: reorderable",
// subtitle: "Reorderable lists",
// icon: GalleryIcons.list_alt,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: ReorderableListDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/ReorderableListView-class.html",
// buildRoute: (BuildContext context) => new ReorderableListDemo()
// ),
// new GalleryDemo(
// title: "Menus",
// subtitle: "Menu buttons and simple menus",
// icon: GalleryIcons.more_vert,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: MenuDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/PopupMenuButton-class.html",
// buildRoute: (BuildContext context) => new MenuDemo()
// ),
// new GalleryDemo(
// title: "Navigation drawer",
// subtitle: "Navigation drawer with standard header",
// icon: GalleryIcons.menu,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: DrawerDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/Drawer-class.html",
// buildRoute: (BuildContext context) => DrawerDemo()
// ),
// new GalleryDemo(
// title: "Pagination",
// subtitle: "PageView with indicator",
// icon: GalleryIcons.page_control,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: PageSelectorDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/TabBarView-class.html",
// buildRoute: (BuildContext context) => PageSelectorDemo()
// ),
// new GalleryDemo(
// title: "Pickers",
// subtitle: "Date and time selection widgets",
// icon: GalleryIcons.@event,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: DateAndTimePickerDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/showDatePicker.html",
// buildRoute: (BuildContext context) => DateAndTimePickerDemo()
// ),
// new GalleryDemo(
// title: "Progress indicators",
// subtitle: "Linear, circular, indeterminate",
// icon: GalleryIcons.progress_activity,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: ProgressIndicatorDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html",
// buildRoute: (BuildContext context) => ProgressIndicatorDemo()
// ),
// new GalleryDemo(
// title: "Pull to refresh",
// subtitle: "Refresh indicators",
// icon: GalleryIcons.refresh,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: OverscrollDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/RefreshIndicator-class.html",
// buildRoute: (BuildContext context) => OverscrollDemo()
// ),
// new GalleryDemo(
// title: "Search",
// subtitle: "Expandable search",
// icon: Icons.search,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: SearchDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/showSearch.html",
// buildRoute: (BuildContext context) => SearchDemo()
// ),
// new GalleryDemo(
// title: "Selection controls",
// subtitle: "Checkboxes, radio buttons, and switches",
// icon: GalleryIcons.check_box,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: SelectionControlsDemo.routeName,
// buildRoute: (BuildContext context) => SelectionControlsDemo()
// ),
// new GalleryDemo(
// title: "Sliders",
// subtitle: "Widgets for selecting a value by swiping",
// icon: GalleryIcons.sliders,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: SliderDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/Slider-class.html",
// buildRoute: (BuildContext context) => SliderDemo()
// ),
// new GalleryDemo(
// title: "Snackbar",
// subtitle: "Temporary messaging",
// icon: GalleryIcons.snackbar,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: SnackBarDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/ScaffoldState/showSnackBar.html",
// buildRoute: (BuildContext context) => SnackBarDemo()
// ),
// new GalleryDemo(
// title: "Tabs",
// subtitle: "Tabs with independently scrollable views",
// icon: GalleryIcons.tabs,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: TabsDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/TabBarView-class.html",
// buildRoute: (BuildContext context) => TabsDemo()
// ),
// new GalleryDemo(
// title: "Tabs: Scrolling",
// subtitle: "Tab bar that scrolls",
// category: GalleryDemoCategory._kMaterialComponents,
// icon: GalleryIcons.tabs,
// routeName: ScrollableTabsDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/TabBar-class.html",
// buildRoute: (BuildContext context) => ScrollableTabsDemo()
// ),
// new GalleryDemo(
// title: "Text fields",
// subtitle: "Single line of editable text and numbers",
// icon: GalleryIcons.text_fields_alt,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: TextFormFieldDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/TextFormField-class.html",
// buildRoute: (BuildContext context) => const TextFormFieldDemo()
// ),
// new GalleryDemo(
// title: "Tooltips",
// subtitle: "Short message displayed on long-press",
// icon: GalleryIcons.tooltip,
// category: GalleryDemoCategory._kMaterialComponents,
// routeName: TooltipDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/material/Tooltip-class.html",
// buildRoute: (BuildContext context) => TooltipDemo()
// ),
//
// // Cupertino Components
// new GalleryDemo(
// title: "Activity Indicator",
// icon: GalleryIcons.cupertino_progress,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoProgressIndicatorDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoActivityIndicator-class.html",
// buildRoute: (BuildContext context) => CupertinoProgressIndicatorDemo()
// ),
// new GalleryDemo(
// title: "Alerts",
// icon: GalleryIcons.dialogs,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoAlertDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/showCupertinoDialog.html",
// buildRoute: (BuildContext context) => CupertinoAlertDemo()
// ),
// new GalleryDemo(
// title: "Buttons",
// icon: GalleryIcons.generic_buttons,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoButtonsDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoButton-class.html",
// buildRoute: (BuildContext context) => CupertinoButtonsDemo()
// ),
// new GalleryDemo(
// title: "Navigation",
// icon: GalleryIcons.bottom_navigation,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoNavigationDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoTabScaffold-class.html",
// buildRoute: (BuildContext context) => CupertinoNavigationDemo()
// ),
// new GalleryDemo(
// title: "Pickers",
// icon: GalleryIcons.@event,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoPickerDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoPicker-class.html",
// buildRoute: (BuildContext context) => CupertinoPickerDemo()
// ),
// new GalleryDemo(
// title: "Pull to refresh",
// icon: GalleryIcons.cupertino_pull_to_refresh,
// category: _kCupertinoComponents,
// routeName: CupertinoRefreshControlDemo.routeName,
// documentationUrl:
// "https://docs.flutter.io/flutter/cupertino/CupertinoSliverRefreshControl-class.html",
// buildRoute: (BuildContext context) => CupertinoRefreshControlDemo()
// ),
// new GalleryDemo(
// title: "Segmented Control",
// icon: GalleryIcons.tabs,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoSegmentedControlDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoSegmentedControl-class.html",
// buildRoute: (BuildContext context) => CupertinoSegmentedControlDemo()
// ),
// new GalleryDemo(
// title: "Sliders",
// icon: GalleryIcons.sliders,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoSliderDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoSlider-class.html",
// buildRoute: (BuildContext context) => CupertinoSliderDemo()
// ),
// new GalleryDemo(
// title: "Switches",
// icon: GalleryIcons.cupertino_switch,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoSwitchDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoSwitch-class.html",
// buildRoute: (BuildContext context) => CupertinoSwitchDemo()
// ),
// new GalleryDemo(
// title: "Text Fields",
// icon: GalleryIcons.text_fields_alt,
// category: GalleryDemoCategory._kCupertinoComponents,
// routeName: CupertinoTextFieldDemo.routeName,
// buildRoute: (BuildContext context) => CupertinoTextFieldDemo()
// ),
//
// // Media
// new GalleryDemo(
// title: "Animated images",
// subtitle: "GIF and WebP animations",
// icon: GalleryIcons.animation,
// category: GalleryDemoCategory._kMedia,
// routeName: ImagesDemo.routeName,
// buildRoute: (BuildContext context) => ImagesDemo()
// ),
// new GalleryDemo(
// title: "Video",
// subtitle: "Video playback",
// icon: GalleryIcons.drive_video,
// category: GalleryDemoCategory._kMedia,
// routeName: VideoDemo.routeName,
// buildRoute: (BuildContext context) => new VideoDemo()
// ),
};
// Keep Pesto around for its regression test value. It is not included
// in (release builds) the performance tests.
D.assert(() => {
// galleryDemos.Insert(0,
// new GalleryDemo(
// title: "Pesto",
// subtitle: "Simple recipe browser",
// icon: Icons.adjust,
// category: GalleryDemoCategory._kDemos,
// routeName: PestoDemo.routeName,
// buildRoute: (BuildContext context) => new PestoDemo()
// )
// );
return true;
});
return galleryDemos;
}
public static readonly List<GalleryDemo> kAllGalleryDemos = _buildGalleryDemos();
public static readonly HashSet<GalleryDemoCategory> kAllGalleryDemoCategories =
new HashSet<GalleryDemoCategory>(kAllGalleryDemos.Select(demo => demo.category));
public static readonly Dictionary<GalleryDemoCategory, List<GalleryDemo>> kGalleryCategoryToDemos =
kAllGalleryDemoCategories.ToDictionary(
category => category,
category => kAllGalleryDemos.Where(demo => demo.category == category).ToList()
);
public static readonly Dictionary<string, string> kDemoDocumentationUrl =
kAllGalleryDemos.Where(demo => demo.documentationUrl != null).ToDictionary(
demo => demo.routeName,
demo => demo.documentationUrl
);
}
}

11
Samples/UIWidgetsGallery/gallery/demos.cs.meta


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

46
Samples/UIWidgetsGallery/gallery/icons.cs


using Unity.UIWidgets.widgets;
namespace UIWidgetsGallery.gallery {
public static class GalleryIcons {
public static readonly IconData tooltip = new IconData(0xe900, fontFamily: "GalleryIcons");
public static readonly IconData text_fields_alt = new IconData(0xe901, fontFamily: "GalleryIcons");
public static readonly IconData tabs = new IconData(0xe902, fontFamily: "GalleryIcons");
public static readonly IconData switches = new IconData(0xe903, fontFamily: "GalleryIcons");
public static readonly IconData sliders = new IconData(0xe904, fontFamily: "GalleryIcons");
public static readonly IconData shrine = new IconData(0xe905, fontFamily: "GalleryIcons");
public static readonly IconData sentiment_very_satisfied = new IconData(0xe906, fontFamily: "GalleryIcons");
public static readonly IconData refresh = new IconData(0xe907, fontFamily: "GalleryIcons");
public static readonly IconData progress_activity = new IconData(0xe908, fontFamily: "GalleryIcons");
public static readonly IconData phone_iphone = new IconData(0xe909, fontFamily: "GalleryIcons");
public static readonly IconData page_control = new IconData(0xe90a, fontFamily: "GalleryIcons");
public static readonly IconData more_vert = new IconData(0xe90b, fontFamily: "GalleryIcons");
public static readonly IconData menu = new IconData(0xe90c, fontFamily: "GalleryIcons");
public static readonly IconData list_alt = new IconData(0xe90d, fontFamily: "GalleryIcons");
public static readonly IconData grid_on = new IconData(0xe90e, fontFamily: "GalleryIcons");
public static readonly IconData expand_all = new IconData(0xe90f, fontFamily: "GalleryIcons");
public static readonly IconData @event = new IconData(0xe910, fontFamily: "GalleryIcons");
public static readonly IconData drive_video = new IconData(0xe911, fontFamily: "GalleryIcons");
public static readonly IconData dialogs = new IconData(0xe912, fontFamily: "GalleryIcons");
public static readonly IconData data_table = new IconData(0xe913, fontFamily: "GalleryIcons");
public static readonly IconData custom_typography = new IconData(0xe914, fontFamily: "GalleryIcons");
public static readonly IconData colors = new IconData(0xe915, fontFamily: "GalleryIcons");
public static readonly IconData chips = new IconData(0xe916, fontFamily: "GalleryIcons");
public static readonly IconData check_box = new IconData(0xe917, fontFamily: "GalleryIcons");
public static readonly IconData cards = new IconData(0xe918, fontFamily: "GalleryIcons");
public static readonly IconData buttons = new IconData(0xe919, fontFamily: "GalleryIcons");
public static readonly IconData bottom_sheets = new IconData(0xe91a, fontFamily: "GalleryIcons");
public static readonly IconData bottom_navigation = new IconData(0xe91b, fontFamily: "GalleryIcons");
public static readonly IconData animation = new IconData(0xe91c, fontFamily: "GalleryIcons");
public static readonly IconData account_box = new IconData(0xe91d, fontFamily: "GalleryIcons");
public static readonly IconData snackbar = new IconData(0xe91e, fontFamily: "GalleryIcons");
public static readonly IconData category_mdc = new IconData(0xe91f, fontFamily: "GalleryIcons");
public static readonly IconData cupertino_progress = new IconData(0xe920, fontFamily: "GalleryIcons");
public static readonly IconData cupertino_pull_to_refresh = new IconData(0xe921, fontFamily: "GalleryIcons");
public static readonly IconData cupertino_switch = new IconData(0xe922, fontFamily: "GalleryIcons");
public static readonly IconData generic_buttons = new IconData(0xe923, fontFamily: "GalleryIcons");
public static readonly IconData backdrop = new IconData(0xe924, fontFamily: "GalleryIcons");
public static readonly IconData bottom_app_bar = new IconData(0xe925, fontFamily: "GalleryIcons");
public static readonly IconData bottom_sheet_persistent = new IconData(0xe926, fontFamily: "GalleryIcons");
public static readonly IconData lists_leave_behind = new IconData(0xe927, fontFamily: "GalleryIcons");
}
}

11
Samples/UIWidgetsGallery/gallery/icons.cs.meta


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

110
Samples/UIWidgetsGallery/gallery/options.cs


using System;
using Unity.UIWidgets.foundation;
using UnityEngine;
namespace UIWidgetsGallery.gallery {
public class GalleryOptions : IEquatable<GalleryOptions> {
public GalleryOptions(
GalleryTheme theme = null,
GalleryTextScaleValue textScaleFactor = null,
float timeDilation = 1.0f,
RuntimePlatform? platform = null,
bool showOffscreenLayersCheckerboard = false,
bool showRasterCacheImagesCheckerboard = false,
bool showPerformanceOverlay = false
) {
D.assert(theme != null);
D.assert(textScaleFactor != null);
this.theme = theme;
this.textScaleFactor = textScaleFactor;
this.timeDilation = timeDilation;
this.platform = platform ?? Application.platform;
this.showOffscreenLayersCheckerboard = showOffscreenLayersCheckerboard;
this.showRasterCacheImagesCheckerboard = showRasterCacheImagesCheckerboard;
this.showPerformanceOverlay = showPerformanceOverlay;
}
public readonly GalleryTheme theme;
public readonly GalleryTextScaleValue textScaleFactor;
public readonly float timeDilation;
public readonly RuntimePlatform platform;
public readonly bool showPerformanceOverlay;
public readonly bool showRasterCacheImagesCheckerboard;
public readonly bool showOffscreenLayersCheckerboard;
public GalleryOptions copyWith(
GalleryTheme theme = null,
GalleryTextScaleValue textScaleFactor = null,
float? timeDilation = null,
RuntimePlatform? platform = null,
bool? showPerformanceOverlay = null,
bool? showRasterCacheImagesCheckerboard = null,
bool? showOffscreenLayersCheckerboard = null
) {
return new GalleryOptions(
theme: theme ?? this.theme,
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
timeDilation: timeDilation ?? this.timeDilation,
platform: platform ?? this.platform,
showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay,
showOffscreenLayersCheckerboard:
showOffscreenLayersCheckerboard ?? this.showOffscreenLayersCheckerboard,
showRasterCacheImagesCheckerboard: showRasterCacheImagesCheckerboard ??
this.showRasterCacheImagesCheckerboard
);
}
public bool Equals(GalleryOptions other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(this.theme, other.theme) && Equals(this.textScaleFactor, other.textScaleFactor) &&
this.timeDilation.Equals(other.timeDilation) && this.platform == other.platform &&
this.showPerformanceOverlay == other.showPerformanceOverlay &&
this.showRasterCacheImagesCheckerboard == other.showRasterCacheImagesCheckerboard &&
this.showOffscreenLayersCheckerboard == other.showOffscreenLayersCheckerboard;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((GalleryOptions) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = (this.theme != null ? this.theme.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (this.textScaleFactor != null ? this.textScaleFactor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ this.timeDilation.GetHashCode();
hashCode = (hashCode * 397) ^ (int) this.platform;
hashCode = (hashCode * 397) ^ this.showPerformanceOverlay.GetHashCode();
hashCode = (hashCode * 397) ^ this.showRasterCacheImagesCheckerboard.GetHashCode();
hashCode = (hashCode * 397) ^ this.showOffscreenLayersCheckerboard.GetHashCode();
return hashCode;
}
}
public static bool operator ==(GalleryOptions left, GalleryOptions right) {
return Equals(left, right);
}
public static bool operator !=(GalleryOptions left, GalleryOptions right) {
return !Equals(left, right);
}
public override string ToString() {
return $"{this.GetType()}({this.theme})";
}
}
}

11
Samples/UIWidgetsGallery/gallery/options.cs.meta


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

64
Samples/UIWidgetsGallery/gallery/scales.cs


using System;
using System.Collections.Generic;
namespace UIWidgetsGallery.gallery {
public class GalleryTextScaleValue : IEquatable<GalleryTextScaleValue> {
public GalleryTextScaleValue(float? scale = null, string label = null) {
this.scale = scale;
this.label = label;
}
public readonly float? scale;
public readonly string label;
public bool Equals(GalleryTextScaleValue other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return this.scale.Equals(other.scale) && string.Equals(this.label, other.label);
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((GalleryTextScaleValue) obj);
}
public override int GetHashCode() {
unchecked {
return (this.scale.GetHashCode() * 397) ^ (this.label != null ? this.label.GetHashCode() : 0);
}
}
public static bool operator ==(GalleryTextScaleValue left, GalleryTextScaleValue right) {
return Equals(left, right);
}
public static bool operator !=(GalleryTextScaleValue left, GalleryTextScaleValue right) {
return !Equals(left, right);
}
public override string ToString() {
return $"{this.GetType()}({this.label})";
}
public static readonly List<GalleryTextScaleValue> kAllGalleryTextScaleValues = new List<GalleryTextScaleValue> {
new GalleryTextScaleValue(null, "System Default"),
new GalleryTextScaleValue(0.8f, "Small"),
new GalleryTextScaleValue(1.0f, "Normal"),
new GalleryTextScaleValue(1.3f, "Large"),
new GalleryTextScaleValue(2.0f, "Huge"),
};
}
}

11
Samples/UIWidgetsGallery/gallery/scales.cs.meta


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

83
Samples/UIWidgetsGallery/gallery/themes.cs


using Unity.UIWidgets.material;
using Unity.UIWidgets.ui;
namespace UIWidgetsGallery.gallery {
public class GalleryTheme {
GalleryTheme(string name, ThemeData data) {
this.name = name;
this.data = data;
}
public readonly string name;
public readonly ThemeData data;
public static readonly GalleryTheme kDarkGalleryTheme = new GalleryTheme("Dark", _buildDarkTheme());
public static readonly GalleryTheme kLightGalleryTheme = new GalleryTheme("Light", _buildLightTheme());
static TextTheme _buildTextTheme(TextTheme baseTheme) {
return baseTheme.copyWith(
title: baseTheme.title.copyWith(
fontFamily: "GoogleSans"
)
);
}
static ThemeData _buildDarkTheme() {
Color primaryColor = new Color(0xFF0175c2);
Color secondaryColor = new Color(0xFF13B9FD);
ThemeData baseTheme = ThemeData.dark();
ColorScheme colorScheme = ColorScheme.dark().copyWith(
primary: primaryColor,
secondary: secondaryColor
);
return baseTheme.copyWith(
primaryColor: primaryColor,
buttonColor: primaryColor,
indicatorColor: Colors.white,
accentColor: secondaryColor,
canvasColor: new Color(0xFF202124),
scaffoldBackgroundColor: new Color(0xFF202124),
backgroundColor: new Color(0xFF202124),
errorColor: new Color(0xFFB00020),
buttonTheme: new ButtonThemeData(
colorScheme: colorScheme,
textTheme: ButtonTextTheme.primary
),
textTheme: _buildTextTheme(baseTheme.textTheme),
primaryTextTheme: _buildTextTheme(baseTheme.primaryTextTheme),
accentTextTheme: _buildTextTheme(baseTheme.accentTextTheme)
);
}
static ThemeData _buildLightTheme() {
Color primaryColor = new Color(0xFF0175c2);
Color secondaryColor = new Color(0xFF13B9FD);
ColorScheme colorScheme = ColorScheme.light().copyWith(
primary: primaryColor,
secondary: secondaryColor
);
ThemeData baseTheme = ThemeData.light();
return baseTheme.copyWith(
colorScheme: colorScheme,
primaryColor: primaryColor,
buttonColor: primaryColor,
indicatorColor: Colors.white,
splashColor: Colors.white24,
splashFactory: InkRipple.splashFactory,
accentColor: secondaryColor,
canvasColor: Colors.white,
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
errorColor: new Color(0xFFB00020),
buttonTheme: new ButtonThemeData(
colorScheme: colorScheme,
textTheme: ButtonTextTheme.primary
),
textTheme: _buildTextTheme(baseTheme.textTheme),
primaryTextTheme: _buildTextTheme(baseTheme.primaryTextTheme),
accentTextTheme: _buildTextTheme(baseTheme.accentTextTheme)
);
}
}
}

11
Samples/UIWidgetsGallery/gallery/themes.cs.meta


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

85
Samples/UIWidgetsGallery/gallery/updater.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
using UnityEngine;
using DialogUtils = Unity.UIWidgets.material.DialogUtils;
namespace UIWidgetsGallery.gallery {
public class Updater : StatefulWidget {
public Updater(UpdateUrlFetcher updateUrlFetcher = null, Widget child = null, Key key = null)
: base(key: key) {
D.assert(updateUrlFetcher != null);
this.updateUrlFetcher = updateUrlFetcher;
this.child = child;
}
public readonly UpdateUrlFetcher updateUrlFetcher;
public readonly Widget child;
public override State createState() {
return new UpdaterState();
}
}
public class UpdaterState : State<Updater> {
public override void initState() {
base.initState();
this._checkForUpdates();
}
static DateTime? _lastUpdateCheck;
IPromise _checkForUpdates() {
// Only prompt once a day
if (_lastUpdateCheck != null &&
(DateTime.Now - _lastUpdateCheck.Value).TotalDays < 1) {
return Promise.Resolved(); // We already checked for updates recently
}
_lastUpdateCheck = DateTime.Now;
return this.widget.updateUrlFetcher().Then(updateUrl => {
if (updateUrl != null) {
return DialogUtils.showDialog(context: this.context, builder: this._buildDialog).Then(
result => {
if (result != null) {
bool wantsUpdate = (bool) result;
if (wantsUpdate) {
Application.OpenURL(updateUrl);
}
}
});
}
return Promise.Resolved();
});
}
Widget _buildDialog(BuildContext context) {
ThemeData theme = Theme.of(context);
TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
return new AlertDialog(
title: new Text("Update UIWidgets Gallery?"),
content: new Text("A newer version is available.", style: dialogTextStyle),
actions: new List<Widget>() {
new FlatButton(
child: new Text("NO THANKS"),
onPressed: () => { Navigator.pop(context, false); }
),
new FlatButton(
child: new Text("UPDATE"),
onPressed: () => { Navigator.pop(context, true); }
)
}
);
}
public override Widget build(BuildContext context) {
return this.widget.child;
}
}
}

11
Samples/UIWidgetsGallery/gallery/updater.cs.meta


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

7
Samples/UIWidgetsGallery/main.cs


using Unity.UIWidgets.engine;
namespace UIWidgetsGallery {
public class GalleryMain : UIWidgetsPanel {
}
}

11
Samples/UIWidgetsGallery/main.cs.meta


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

242
.README - External.md


# UPM Package Starter Kit
The purpose of this starter kit is to provide the data structure and development guidelines for new packages meant for the **Unity Package Manager (UPM)**.
## Are you ready to become a package?
The Package Manager is a work-in-progress for Unity and, in that sense, there are a few criteria that must be met for your package to be considered on the package list at this time:
- **Your code accesses public Unity C# APIs only.** If you have a native code component, it will need to ship with an official editor release. Internal API access might eventually be possible for Unity made packages, but not at this time.
- **Your code doesn't require security, obfuscation, or conditional access control.** Anyone should be able to download your package and access the source code.
## Package structure
```none
<root>
├── package.json
├── README.md
├── CHANGELOG.md
├── LICENSE.md
├── Third Party Notices.md
├── QAReport.md
├── Editor
│ ├── Unity.[YourPackageName].Editor.asmdef
│ └── EditorExample.cs
├── Runtime
│ ├── Unity.[YourPackageName].asmdef
│ └── RuntimeExample.cs
├── Tests
│ ├── .tests.json
│ ├── Editor
│ │ ├── Unity.[YourPackageName].Editor.Tests.asmdef
│ │ └── EditorExampleTest.cs
│ └── Runtime
│ ├── Unity.[YourPackageName].Tests.asmdef
│ └── RuntimeExampleTest.cs
├── Samples
│ └── Example
│ ├── .sample.json
│ └── SampleExample.cs
└── Documentation~
├── your-package-name.md
└── Images
```
## Develop your package
Package development works best within the Unity Editor. Here's how to set that up:
1. Start **Unity**, create a local empty project.
1. In a console (or terminal) application, go to the newly created project folder, then copy the contents of this starter kit into the packages directory.
__Note:__ Your directory name must be the name of your package (Example: `"com.unity.terrain-builder"`)
1. ##### Fill in your package information
Update the following required fields in file **package.json**:
- `"name"`: Package name, it should follow this naming convention: `"com.[YourCompanyName].[sub-group].[your-package-name]"`
(Example: `"com.unity.2d.animation"`, where `sub-group` should match the sub-group you selected in Gitlab)
- `"displayName"`: Package user friendly display name. (Example: `"Terrain Builder SDK"`). <br>__Note:__ Use a display name that will help users understand what your package is intended for.
- `"version"`: Package version `"X.Y.Z"`, your project **must** adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
Follow this guideline:
- To introduce a new feature or bug fix, increment the minor version (X.**Y**.Z)
- To introduce a breaking API change, increment the major version (**X**.Y.Z)
- The patch version (X.Y.**Z**), is reserved for sustainable engineering use only.
- `"unity"`: Unity Version your package is compatible with. (Example: `"2018.1"`)
- `"description"`: This description appears in the Package Manager window when the user selects this package from the list. For best results, use this text to summarize what the package does and how it can benefit the user.<br>__Note:__ Special formatting characters are supported, including line breaks (`\n`) and unicode characters such as bullets (`\u25AA`).<br>
Update the following recommended fields in file **package.json**:
- `"dependencies"`: List of packages this package depends on. All dependencies will also be downloaded and loaded in a project with your package. Here's an example:
```
dependencies: {
"com.unity.ads": "1.0.0"
"com.unity.analytics": "2.0.0"
}
```
- `"keywords"`: List of words that will be indexed by the package manager search engine to facilitate discovery.
Update the following field in file **Tests/.tests.json**:
- `"createSeparatePackage"`: If this is set to true, the CI will create an separate package for these tests.
1. You should now see your package in the Project Window, along with all other available packages for your project.
1. ##### Rename and update assembly definition files.
Assembly definition files are used to generate C# assemblies during compilation. Package code must include asmdef files to ensure package code isolation. You can read up on assembly definition files [here](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html).
If your package contains Editor code, rename and modify [Editor/Unity.YourPackageName.Editor.asmdef](Editor/Unity.YourPackageName.Editor.asmdef). Otherwise, delete the Editor directory.
* Name **must** match your package name, suffixed by `.Editor` (i.e `Unity.[YourPackageName].Editor`)
* Assembly **must** reference `Unity.[YourPackageName]` (if you have any Runtime)
* Platforms **must** include `"Editor"`
If your package contains code that needs to be included in Unity runtime builds, rename and modify [Runtime/Unity.YourPackageName.asmdef](Runtime/Unity.YourPackageName.asmdef). Otherwise, delete the Runtime directory.
* Name **must** match your package name (i.e `Unity.[YourPackageName]`)
If your package has Editor code, you **must** include Editor Tests in your package. In that case, rename and modify [Tests/Editor/Unity.YourPackageName.Editor.Tests.asmdef](Tests/Editor/Unity.YourPackageName.Editor.Tests.asmdef).
* Name **must** match your package name, suffixed by `.Editor.Tests` (i.e `Unity.[YourPackageName].Editor.Tests`)
* Assembly **must** reference `Unity.[YourPackageName].Editor` and `Unity.[YourPackageName]` (if you have any Runtime)
* Platforms **must** include `"Editor"`
* Optional Unity references **must** include `"TestAssemblies"` to allow your Editor Tests to show up in the Test Runner/run on Katana when your package is listed in project manifest `testables`
If your package has Runtime code, you **must** include Playmode Tests in your package. In that case, rename and modify [Tests/Runtime/Unity.YourPackageName.Tests.asmdef](Tests/Runtime/Unity.YourPackageName.Tests.asmdef).
* Name **must** match your package name, suffixed by `.Tests` (i.e `Unity.[YourPackageName].Tests`)
* Assembly **must** reference `Unity.[YourPackageName]`
* Optional Unity references **must** include `"TestAssemblies"` to allow your Playmode Tests to show up in the Test Runner/run on Katana when your package is listed in project manifest `testables`
>
> The reason for choosing such name schema is to ensure that the name of the assembly built based on *assembly definition file* (_a.k.a .asmdef_) will follow the .Net [Framework Design Guidelines](https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/index)
1. ##### Document your package.
Rename and update **your-package-name.md** documentation file. Use this documentation template file to create preliminary, high-level documentation. This document is meant to introduce users to the features and sample files included in your package. Your package documentation files will be used to generate online and local docs, available from the package manager UI.
**Document your public APIs**
* All public APIs need to be documented with XmlDoc. If you don't need an API to be accessed by clients, mark it as internal instead.
* API documentation is generated from [XmlDoc tags](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/xml-documentation-comments) included with all public APIs found in the package. See [Editor/EditorExample.cs](Editor/EditorExample.cs) for an example.
**Documentation flow**
* Documentation needs to be ready when a publish request is sent to Release Management, as they will ask the documentation team to review it.
* The package will remain in `preview` mode until the final documentation is completed. Users will have access to the developer-generated documentation only in preview packages.
* When the documentation is completed, the documentation team will update the package git repo with the updates and they will publish it on the web.
* The package's development team will then need to submit a new package version with updated docs.
* The starting page in the user manual that links to package documentation is [Here](https://docs.unity3d.com/Manual/PackagesList.html).
* The `Documentation~` folder is suffixed with `~` so that its content does not get loaded in the editor, which is the recommended behavior. If this is problematic, you can still name it `Documentation` and all tools will still work correctly. `.Documentation` is also supported.
**Test your documentation locally**
As you are developing your documentation, you can see what your documentation will look like by using the DocTools extension (optional).
Once the DocTools package is installed, it will add a `Generate Documentation` button in the Package Manager UI's details of your installed packages. To install the extension, follow these steps:
1. Make sure you have `Package Manager UI v1.9.6` or above.
1. Your project manifest will need to point to a staging registry for this, which you can do by adding this line to it: `"registry": "https://staging-packages.unity.com"`
1. Install `Package Manager DocTools v1.0.0-preview.6` or above from the `Package Manager UI` (in the `All Packages` section).
1. After installation, you will see a `Generate Documentation` button which will generate the documentation locally, and open a web browser to a locally served version of your documentation so you can preview it.
1. (optional) If your package documentation contains multiple `.md` files for the user manual, see [this page](https://docs.unity3d.com/Packages/com.unity.package-manager-doctools@1.0/manual/index.html#table-of-content) to add a table of content to your documentation.
The DocTools extension is still in preview, if you come across arguable results, please discuss them on #docs-packman.
1. ##### Add samples to your package (code & assets).
If your package contains a sample, rename the `Samples/Example` folder, and update the `.sample.json` file in it.
In the case where your package contains multiple samples, you can make a copy of the `Samples/Example` folder for each sample, and update the `.sample.json` file accordingly.
Similar to `.tests.json` file, there is a `"createSeparatePackage"` field in `.sample.json`.If set to true, the CI will create an separate package for the sample..
Delete the `Samples` folder altogether if your package does not need samples.
As of Unity release 2019.1, the /Samples directory of a package will be recognized by the package manager. Samples will not be imported to Unity when the package is added to a project, but will instead be offered to users of the package as an optional import, which can be added to their "/Assets" directory through a UI option.
1. ##### Validate your package.
Before you publish your package, you need to make sure that it passes all the necessary validation checks by using the Package Validation Suite extension (optional).
Once the Validation Suite package is installed, it will add a `Validate` button in the Package Manager UI's details of your installed packages. To install the extension, follow these steps:
1. Make sure you have `Package Manager UI v1.9.6` or above.
1. Your project manifest will need to point to a staging registry for this, which you can do by adding this line to it: `"registry": "https://staging-packages.unity.com"`
1. Install `Package Validation Suite v0.3.0-preview.13` or above from the `Package Manager UI` in the `All Packages` section. If you can't find it there, try turning on `Show preview packages` in the `Advanced` menu.
1. After installation, you will see a `Validate` button show up in the Package Manager UI, which, when pressed, will run a series of tests and expose a `See Results` button for additional explanation.
1. If it succeeds, you will see a green bar with a `Success` message.
1. If it fails, you will see a red bar with a `Failed` message.
The validation suite is still in preview, if you come across arguable results, please discuss them on #release-management.
1. ##### Add tests to your package.
All packages must contain tests. Tests are essential for Unity to ensure that the package works as expected in different scenarios.
**Editor tests**
* Write all your Editor Tests in `Tests/Editor`
**Playmode Tests**
* Write all your Playmode Tests in `Tests/Runtime`.
1. ##### Update **CHANGELOG.md**.
Every new feature or bug fix should have a trace in this file. For more details on the chosen changelog format, see [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## Create a Pre-Release Package
Pre-Release Packages are a great way of getting your features in front of Unity Developers in order to get early feedback on functionality and UI designs. Pre-Release packages need to go through the publishing to production flow, as would any other package, but with diminished requirements. Here are the supported Pre-Release tags (to be used in package.json,`version` field), along with the requirements for each one:
**Preview** - ex: `"version" : "1.2.0-preview"`
* Expected Package structure respected
* Package loads in Unity Editor without errors
* License file present - With third party notices file if necessary
* Test coverage is good - Optional but preferred
* Public APIs documented, minimal feature docs exists- Optional but preferred
## Make sure your package meets all legal requirements
##### Update **Third Party Notices.md** & **License.md**
1. If your package has third-party elements and its licenses are approved, then all the licenses must be added to the `Third Party Notices.md` file. Simply duplicate the `Component Name/License Type/Provide License Details` section if you have more then one licenes.
a. Concerning `[Provide License Details]` in the `Third Party Notices.md`, a URL can work as long as it actually points to the reproduced license and the copyright information _(if applicable)_.
1. If your package does not have third party elements, you can remove the `Third Party Notices.md` file from your package.
## Preparing your package for Staging
Before publishing your package to production, you must send your package on the Package Manager's **staging** repository. The staging repository is monitored by QA and release management, and is where package validation will take place before it is accepted in production.
## *** IMPORTANT: The staging repository is publicly accessible, do not publish any packages with sensitive material you aren't ready to share with the public ***
1. Publishing your changes to the package manager's **staging** repository happens from Gitlab. To do so, simply setup your project's Continuous integration, which will be triggered by "Tags" on your branches.
* Join the **#devs-packman** channel on Slack, and request a staging **USERNAME** and **API_KEY**.
* In Gitlab, under the **Settings-> CI/CD -> Secret Variables** section, setup the following 2 project variables:
* API_KEY = [your API KEY]
* USER_NAME = [your USER NAME@unity]
* You're almost done! To publish a version of your package, make sure all your changes are checked into Gitlab, then create a new tag to reflect the version you are publishing (ex. "v1.2.2"), **the tag will trigger a publish to Staging**. You can view progress you the publish request by switch over to the "CI / CD" part of your project.
1. Do it yourself CI
If you are using your own CI, it is still recommended that you use the `build.sh` wrapper script that comes with the starter kit, as it handle the installation of the actual CI build scripts for you.
Instead of calling `npm pack` and `npm publish` in the package root folder in your CI, use
```
./build.sh package-ci pack --git-head $CI_COMMIT_SHA --git-url $CI_REPOSITORY_URL
```
and
```
./build.sh package-ci publish --git-head $CI_COMMIT_SHA --git-url $CI_REPOSITORY_URL
```
respectively.
1. Test your package locally
Now that your package is published on the package manager's **staging** repository, you can test your package in the editor by creating a new project, and editing the project's `manifest.json` file to point to your staging package, as such:
```
dependencies: {
"com.[YourCompanyName].[sub-group].[your-package-name]": "0.1.0"
},
"registry": "https://staging-packages.unity.com"
```
## Get your package published to Production
Packages are promoted to the **production** repository from **staging**, described above.
Once you feel comfortable that your package is ready for prime time, and passes validation (Validation Suite), reach out to Unity so your package can be passed along to Release Management, for evaluation.
**Release management will validate your package content, and check that the editor/playmode tests are passed before promoting the package to production. You will receive a confirmation email once the package is in production.**
**You're almost done!**
At this point, your package is available on the cloud, but not discoverable through the editor:
1. Contact the Package Manager team to ask them to add your package to the list of discoverable package for the Unity Editor. All you need to provide is the package name (com.[YourCompanyName].[sub-group].[your-package-name])

18
.gitlab-ci.yml


image: node:6.10.0
variables:
BINTRAY_STAGING: 'https://staging-packages.unity.com'
before_script:
- chmod +x build.sh
stages:
- push_to_packman_staging
push_to_packman_staging:
stage: push_to_packman_staging
only:
- tags
script:
- ./build.sh npm auth "$BINTRAY_STAGING" "$USER_NAME" "$API_KEY"
- ./build.sh package-ci publish --git-head $CI_COMMIT_SHA --git-url $CI_REPOSITORY_URL

19
build.bat


@ECHO OFF
REM Wrapper script to make running the node.js CI script a little quicker.
REM Arguments are same as for index.js
SET BUILD_SCRIPT="./.build_script/node_modules/upm-template-utils/index.js"
IF NOT EXIST %BUILD_SCRIPT% (
mkdir "./.build_script/node_modules" >NUL
CD .build_script
CALL npm install upm-template-utils --registry https://api.bintray.com/npm/unity/unity-staging --no-save --loglevel error >NUL
CD ..
)
IF "%1" == "" (
node %BUILD_SCRIPT%
) ELSE (
node %BUILD_SCRIPT% %*
)

7
build.bat.meta


fileFormatVersion: 2
guid: 9551e4091df864fc0a2b9d8b6e324e2e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
build.sh


#!/bin/sh
BUILD_SCRIPT="./.build_script/node_modules/upm-template-utils/index.js"
if [ ! -f $BUILD_SCRIPT ]; then
mkdir -p "./.build_script/node_modules"
cd .build_script
npm install upm-template-utils --registry https://api.bintray.com/npm/unity/unity-staging --no-save --loglevel error >/dev/null
cd ..
fi
if [ -z $1 ]; then
node $BUILD_SCRIPT
else
node $BUILD_SCRIPT $*
fi

7
build.sh.meta


fileFormatVersion: 2
guid: ea964234d2ddc42d9b625244d96bb27d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存