浏览代码

Merge branch 'dev_1.17.5' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/gallery

/zgh-devtools
xingweizhu 4 年前
当前提交
f38c2e23
共有 19 个文件被更改,包括 820 次插入19 次删除
  1. 30
      com.unity.uiwidgets/Runtime/material/expansion_panel.cs
  2. 2
      com.unity.uiwidgets/Runtime/material/flat_button.cs
  3. 2
      com.unity.uiwidgets/Runtime/material/raised_button.cs
  4. 1
      com.unity.uiwidgets/Runtime/widgets/animated_size.cs
  5. 15
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  6. 87
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/CustomPaintSample.cs
  7. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/CustomPaintSample.cs.meta
  8. 172
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ExpansionPanelSample.cs
  9. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ExpansionPanelSample.cs.meta
  10. 69
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/HttpRequestSample.cs
  11. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/HttpRequestSample.cs.meta
  12. 52
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/LongPressSample.cs
  13. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/LongPressSample.cs.meta
  14. 228
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/NavigationSample.cs
  15. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/NavigationSample.cs.meta
  16. 45
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/PageViewSample.cs
  17. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/PageViewSample.cs.meta
  18. 59
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ScrollbarSample.cs
  19. 11
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ScrollbarSample.cs.meta

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


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

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

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

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

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

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


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

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


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

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


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

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


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

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

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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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