kg
6 年前
当前提交
c523fe54
共有 62 个文件被更改,包括 2376 次插入 和 700 次删除
-
12.gitignore
-
7.npmignore
-
6CHANGELOG.md
-
28CONTRIBUTING.md
-
27LICENSE.md
-
25README.md
-
46Runtime/animation/listener_helpers.mixin.gen.cs
-
31Runtime/foundation/node.mixin.gen.cs
-
8Runtime/foundation/node.mixin.njk
-
44Runtime/material/button_theme.cs
-
3Runtime/material/color_scheme.cs
-
2Runtime/material/material.cs
-
3Runtime/material/text_theme.cs
-
2Runtime/material/theme.cs
-
182Runtime/material/theme_data.cs
-
18Runtime/rendering/box.mixin.gen.cs
-
88Runtime/rendering/object.mixin.gen.cs
-
155Runtime/rendering/proxy_box.cs
-
20Runtime/rendering/proxy_box.mixin.gen.cs
-
33Runtime/widgets/basic.cs
-
71Runtime/widgets/implicit_animations.cs
-
256Runtime/widgets/navigator.cs
-
2Runtime/widgets/routes.cs
-
4Runtime/widgets/scroll_notification.mixin.gen.cs
-
2Samples/UIWidgetSample/NavigationSample.cs
-
32Third Party Notices.md
-
8package.json
-
11Runtime/material/app.cs.meta
-
275Runtime/material/dialog.cs
-
11Runtime/material/dialog.cs.meta
-
69Runtime/material/dialog_theme.cs
-
11Runtime/material/dialog_theme.cs.meta
-
11Runtime/material/page.cs.meta
-
11Runtime/material/page_transitions_theme.cs.meta
-
8Samples/UIWidgetsGallery.meta
-
6Samples/UIWidgetsGallery/UIWidgetsGallery.asmdef
-
7Samples/UIWidgetsGallery/UIWidgetsGallery.asmdef.meta
-
8Samples/UIWidgetsGallery/gallery.meta
-
135Samples/UIWidgetsGallery/gallery/app.cs
-
11Samples/UIWidgetsGallery/gallery/app.cs.meta
-
606Samples/UIWidgetsGallery/gallery/demos.cs
-
11Samples/UIWidgetsGallery/gallery/demos.cs.meta
-
46Samples/UIWidgetsGallery/gallery/icons.cs
-
11Samples/UIWidgetsGallery/gallery/icons.cs.meta
-
110Samples/UIWidgetsGallery/gallery/options.cs
-
11Samples/UIWidgetsGallery/gallery/options.cs.meta
-
64Samples/UIWidgetsGallery/gallery/scales.cs
-
11Samples/UIWidgetsGallery/gallery/scales.cs.meta
-
83Samples/UIWidgetsGallery/gallery/themes.cs
-
11Samples/UIWidgetsGallery/gallery/themes.cs.meta
-
85Samples/UIWidgetsGallery/gallery/updater.cs
-
11Samples/UIWidgetsGallery/gallery/updater.cs.meta
-
7Samples/UIWidgetsGallery/main.cs
-
11Samples/UIWidgetsGallery/main.cs.meta
-
242.README - External.md
-
18.gitlab-ci.yml
-
19build.bat
-
7build.bat.meta
-
16build.sh
-
7build.sh.meta
|
|||
# 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. |
|
|||
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. |
|
|||
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. |
|
|||
{ |
|||
"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": { |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: dc9696f81c77043c69bd5d7fc47d08ab |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 813c881d6861d4a4c899bbd38814134c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 555377d80e88a41b9b9918d8114897ab |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 6fd7f696cb0094bd49c32ac427eb655a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 4c76ac623551c4c6e99a8823506048ee |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: d5570637d1b25467596ae3c19ff7f0b2 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
{ |
|||
"name": "UIWidgetsGallery", |
|||
"references": ["Unity.UIWidgets"], |
|||
"includePlatforms": [], |
|||
"excludePlatforms": [] |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8597b5a1d1bdd45048ad62795a71b2f2 |
|||
AssemblyDefinitionImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 05f67c3cc663543059f6e339e99ce4b8 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3fff3cf3a1dd243d088be72945a3d7e9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 |
|||
); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b079397083e3d41bb83262e1423dfa25 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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"); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7b7592e2675d347bb9036ed6cb4fabe0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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})"; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9eb439aba25814f79979120cd5966537 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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"), |
|||
}; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9bf87177b342d4feba4778ca5a9b20a5 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7510605485ec34459a4ac9b456cf583f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c69f6e2d93b02484fab6f2e2408c7d88 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.engine; |
|||
|
|||
namespace UIWidgetsGallery { |
|||
public class GalleryMain : UIWidgetsPanel { |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9c5c86936ca864ae684720ddcd50d759 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
# 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]) |
|
|||
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 |
|
|||
@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% %* |
|||
) |
|
|||
fileFormatVersion: 2 |
|||
guid: 9551e4091df864fc0a2b9d8b6e324e2e |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#!/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 |
|
|||
fileFormatVersion: 2 |
|||
guid: ea964234d2ddc42d9b625244d96bb27d |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue