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

46 行
1.6 KiB

using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
public class ModalBarrier : StatelessWidget {
public readonly Color color;
public readonly bool dismissible;
public ModalBarrier(Key key = null, Color color = null, bool dismissible = true) : base(key) {
this.color = color;
this.dismissible = dismissible;
}
public override Widget build(BuildContext context) {
return new GestureDetector(
onTapDown: details => {
if (this.dismissible)
Navigator.maybePop(context);
},
behavior: HitTestBehavior.opaque,
child: new ConstrainedBox(
constraints: BoxConstraints.expand(),
child: this.color == null ? null : new DecoratedBox(decoration: new BoxDecoration(this.color))
)
);
}
}
public class AnimatedModalBarrier : AnimatedWidget {
public readonly bool dismissible;
public AnimatedModalBarrier(Key key = null, Animation<Color> color = null,
bool dismissible = true) : base(key, color) {
this.dismissible = dismissible;
}
public Animation<Color> color => (Animation<Color>) this.listenable;
protected internal override Widget build(BuildContext context) {
return new ModalBarrier(color: this.color?.value, dismissible: this.dismissible);
}
}
}