浏览代码

fix image flow

/add_hero_sample
siyao 3 年前
当前提交
7e7166c1
共有 1 个文件被更改,包括 45 次插入13 次删除
  1. 58
      AwesomeUIWidgets/Assets/Scripts/ImageFlowDemo.cs

58
AwesomeUIWidgets/Assets/Scripts/ImageFlowDemo.cs


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using Color = Unity.UIWidgets.ui.Color;
using FontStyle = Unity.UIWidgets.ui.FontStyle;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace UIWidgetsSample
{

"lottieflow-social-networks-16-7-000000-easey.json",
};
public static List<string> localImages = new List<string>()
{
"heroSample/cube2.jpeg",
"heroSample/sphere2.jpeg",
"heroSample/capture2.jpeg",
"heroSample/cylinder2.jpeg",
};
public static List<string> imageUrls = new List<string>()
{
"https://cdn.pixabay.com/photo/2016/10/21/14/50/plouzane-1758197_960_720.jpg",

internal static Random random = new Random();
public static bool UseImage = true;
public static bool UseLocalImage = false;
public static bool UseAmountSlider = false;
public static T RandomSelect<T>(this List<T> a)

{
if (Utils.UseImage)
{
_tiles.Add(
new ImageTile(
Utils.colors.RandomSelect(),
Utils.imageUrls.RandomSelect()
)
);
if (Utils.UseLocalImage)
{
_tiles.Add(
new ImageTile(
Utils.colors.RandomSelect(),
Utils.localImages.RandomSelect(),
true
)
);
}
else
{
_tiles.Add(
new ImageTile(
Utils.colors.RandomSelect(),
Utils.imageUrls.RandomSelect()
)
);
}
}
else
{

internal class ImageTile : StatefulWidget
{
internal ImageTile(Color backgroundColor, string path)
internal ImageTile(Color backgroundColor, string path, bool local = false)
this.local = local;
public readonly bool local;
public override State createState()
{

{
public override Widget build(BuildContext context)
{
if (widget.local)
{
return new Container(
color: widget.backgroundColor,
child: Image.file(
widget.path,
fit: BoxFit.cover
)
);
}
child: new InkWell(
onTap: () => { },
child: Image.network(
child: Image.network(
)
)
);
}

正在加载...
取消
保存