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

93 行
3.0 KiB

using uiwidgets;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
public class BackButtonIcon : StatelessWidget {
public BackButtonIcon(
Key key = null) : base(key: key) {
}
static IconData _getIconData(RuntimePlatform platform) {
switch (platform) {
case RuntimePlatform.Android:
case RuntimePlatform.LinuxEditor:
case RuntimePlatform.LinuxPlayer:
case RuntimePlatform.WindowsEditor:
case RuntimePlatform.WindowsPlayer:
return Icons.arrow_back;
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
return Icons.arrow_back_ios;
default:
return Icons.arrow_back;
}
}
public override Widget build(BuildContext context) {
return new Icon(_getIconData(Theme.of(context).platform));
}
}
public class BackButton : StatelessWidget {
public BackButton(
Key key = null,
Color color = null,
VoidCallback onPressed = null) : base(key: key) {
this.color = color;
this.onPressed = onPressed;
}
public readonly Color color;
public readonly VoidCallback onPressed;
public override Widget build(BuildContext context) {
return new IconButton(
icon: new BackButtonIcon(),
color: color,
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
onPressed: () => {
if (onPressed != null) {
onPressed();
}
else {
Navigator.maybePop(context);
}
});
}
}
public class CloseButton : StatelessWidget {
public CloseButton(
Key key = null,
Color color = null,
VoidCallback onPressed = null) : base(key: key) {
this.color = color;
this.onPressed = onPressed;
}
public readonly Color color;
public readonly VoidCallback onPressed;
public override Widget build(BuildContext context) {
D.assert(material_.debugCheckHasMaterialLocalizations(context));
return new IconButton(
icon: new Icon(Icons.close),
color: color,
tooltip: MaterialLocalizations.of(context).closeButtonTooltip,
onPressed: () => {
if (onPressed != null) {
onPressed();
}
else {
Navigator.maybePop(context);
}
});
}
}
}