您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

170 行
6.0 KiB

using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.material;
using Unity.UIWidgets.ui;
namespace UIWidgetsGallery.gallery {
public class AnimationSectionsUtils {
public static readonly Color _mariner = new Color(0xFF3B5F8F);
public static readonly Color _mediumPurple = new Color(0xFF8266D4);
public static readonly Color _tomato = new Color(0xFFF95B57);
public static readonly Color _mySin = new Color(0xFFF3A646);
const string _kGalleryAssetsPackage = "flutter_gallery_assets";
public static readonly SectionDetail _eyeglassesDetail = new SectionDetail(
imageAsset: "heroSample/cube2.jpeg",
imageAssetPackage: _kGalleryAssetsPackage,
title: "A cube is a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex",
subtitle: "3K views - 5 days"
);
public static readonly SectionDetail _seatingDetail = new SectionDetail(
imageAsset: "heroSample/sphere2.jpeg",
imageAssetPackage: _kGalleryAssetsPackage,
title: "A sphere is a geometrical object in three-dimensional space that is the surface of a ball",
subtitle: "3K views - 5 days"
);
public static readonly SectionDetail _decorationDetail = new SectionDetail(
imageAsset: "heroSample/capture2.jpeg",
imageAssetPackage: _kGalleryAssetsPackage,
title: "A capsule is a basic three-dimensional geometric shape consisting of a cylinder with hemispherical ends",
subtitle: "3K views - 5 days"
);
public static readonly SectionDetail _protectionDetail = new SectionDetail(
imageAsset: "heroSample/cylinder2.jpeg",
imageAssetPackage: _kGalleryAssetsPackage,
title: "A cylindrical surface is a surface consisting of all the points on all the lines which are parallel to a given line",
subtitle: "3K views - 5 days"
);
public static List<Section> allSections = new List<Section> {
new Section(
heroType: 0,
title: "CUBE",
leftColor: _mediumPurple,
rightColor: _mariner,
backgroundAsset: "products/sunnies",
backgroundAssetPackage: _kGalleryAssetsPackage,
details: new List<SectionDetail> {
_eyeglassesDetail
}
),
new Section(
heroType: 1,
title: "SPHERE",
leftColor: _tomato,
rightColor: _mediumPurple,
backgroundAsset: "products/table",
backgroundAssetPackage: _kGalleryAssetsPackage,
details: new List<SectionDetail> {
_seatingDetail
}
),
new Section(
heroType: 2,
title: "CAPSULE",
leftColor: _mySin,
rightColor: _tomato,
backgroundAsset: "products/earrings",
backgroundAssetPackage: _kGalleryAssetsPackage,
details: new List<SectionDetail> {
_decorationDetail
}
),
new Section(
heroType: 3,
title: "CYLINDER",
leftColor: Colors.green,
rightColor: Colors.lightGreen,
backgroundAsset: "products/hat",
backgroundAssetPackage: _kGalleryAssetsPackage,
details: new List<SectionDetail> {
_protectionDetail
}
)
};
}
public class SectionDetail {
public SectionDetail(
string title = null,
string subtitle = null,
string imageAsset = null,
string imageAssetPackage = null
) {
this.title = title;
this.subtitle = subtitle;
this.imageAsset = imageAsset;
this.imageAssetPackage = imageAssetPackage;
}
public readonly string title;
public readonly string subtitle;
public readonly string imageAsset;
public readonly string imageAssetPackage;
}
public class Section {
public Section(
int heroType,
string title,
string backgroundAsset,
string backgroundAssetPackage,
Color leftColor,
Color rightColor,
List<SectionDetail> details
)
{
this.heroType = heroType;
this.title = title;
this.backgroundAsset = backgroundAsset;
this.backgroundAssetPackage = backgroundAssetPackage;
this.leftColor = leftColor;
this.rightColor = rightColor;
this.details = details;
}
public readonly string title;
public readonly string backgroundAsset;
public readonly string backgroundAssetPackage;
public readonly Color leftColor;
public readonly Color rightColor;
public readonly List<SectionDetail> details;
public readonly int heroType;
public static bool operator ==(Section left, Section right) {
return Equals(left, right);
}
public static bool operator !=(Section left, Section right) {
return !Equals(left, right);
}
public bool Equals(Section other) {
return this.title == other.title;
}
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((Section) obj);
}
public override int GetHashCode() {
return this.title.GetHashCode();
}
}
}