您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
30 行
786 B
30 行
786 B
using System.Drawing;
|
|
using Unity.UIWidgets.foundation;
|
|
|
|
namespace Unity.UIWidgets.widgets {
|
|
|
|
public interface PreferredSizeWidget {
|
|
Size preferredSize { get; }
|
|
}
|
|
|
|
|
|
public class PreferredSize : StatelessWidget, PreferredSizeWidget {
|
|
public PreferredSize(
|
|
Key key = null,
|
|
Widget child = null,
|
|
Size? preferredSize = null) : base(key: key) {
|
|
D.assert(child != null);
|
|
D.assert(preferredSize != null);
|
|
this.child = child;
|
|
this.preferredSize = preferredSize ?? Size.Empty;
|
|
}
|
|
|
|
public readonly Widget child;
|
|
|
|
public Size preferredSize { get; }
|
|
|
|
public override Widget build(BuildContext context) {
|
|
return this.child;
|
|
}
|
|
}
|
|
}
|