您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
64 行
1.9 KiB
64 行
1.9 KiB
using System;
|
|
using Unity.UIWidgets.animation;
|
|
using Unity.UIWidgets.foundation;
|
|
using Unity.UIWidgets.material;
|
|
using Unity.UIWidgets.painting;
|
|
using Unity.UIWidgets.widgets;
|
|
using UnityEngine;
|
|
|
|
namespace UIWidgetsGallery.gallery
|
|
{
|
|
public class Photo : StatelessWidget
|
|
{
|
|
public Photo(Key key = null, string photo = null, Action onTap = null) : base(key: key)
|
|
{
|
|
D.assert(photo != null);
|
|
this.photo = photo;
|
|
this.onTap = onTap;
|
|
}
|
|
|
|
public readonly string photo;
|
|
public readonly Action onTap;
|
|
|
|
public override Widget build(BuildContext context)
|
|
{
|
|
return new GestureDetector(
|
|
onTap: () => onTap?.Invoke(),
|
|
child: new LayoutBuilder(
|
|
builder: ((buildContext, constraints) =>
|
|
{
|
|
return Image.file(photo, fit: BoxFit.contain);
|
|
}) )
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
public class RadialExpansion : StatelessWidget
|
|
{
|
|
public RadialExpansion(Key key = null, float maxRadius = 0.0f, Widget child = null)
|
|
: base(key: key)
|
|
{
|
|
this.maxRadius = maxRadius;
|
|
this.child = child;
|
|
}
|
|
|
|
public readonly float maxRadius;
|
|
public readonly Widget child;
|
|
|
|
public override Widget build(BuildContext context)
|
|
{
|
|
return new ClipOval(
|
|
child: new Center(
|
|
child: new SizedBox(
|
|
width: 2.0f * (maxRadius / Mathf.Sqrt(2)),
|
|
height: 2.0f * (maxRadius / Mathf.Sqrt(2)),
|
|
child: new ClipRect(
|
|
child: child
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}
|
|
}
|