您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
60 行
1.8 KiB
60 行
1.8 KiB
using Unity.UIWidgets.foundation;
|
|
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.IPhonePlayer:
|
|
return Icons.arrow_back_ios;
|
|
default:
|
|
return Icons.arrow_back;
|
|
}
|
|
|
|
D.assert(false);
|
|
return null;
|
|
}
|
|
|
|
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) : base(key: key) {
|
|
this.color = color;
|
|
}
|
|
|
|
public readonly Color color;
|
|
|
|
public override Widget build(BuildContext context) {
|
|
return new IconButton(
|
|
icon: new BackButtonIcon(),
|
|
color: this.color,
|
|
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
|
|
onPressed: () => { Navigator.maybePop(context); });
|
|
}
|
|
}
|
|
|
|
public class CloseButton : StatelessWidget {
|
|
public CloseButton(
|
|
Key key = null) : base(key: key) {
|
|
}
|
|
|
|
public override Widget build(BuildContext context) {
|
|
D.assert(MaterialD.debugCheckHasMaterialLocalizations(context));
|
|
return new IconButton(
|
|
icon: new Icon(Icons.close),
|
|
tooltip: MaterialLocalizations.of(context).closeButtonTooltip,
|
|
onPressed: () => { Navigator.maybePop(context); });
|
|
}
|
|
}
|
|
}
|