主题
BorderSide
创建边框的一条边。
默认情况下,边框宽 1.0 个逻辑像素,颜色为纯黑色。
要省略(不显示)某条边,可将 style 设为 NONE。此时会跳过边框绘制,但该边仍保留 width。
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
width | Number | 1.0 | The width of this side of the border, in logical pixels. Setting width to 0.0 will result in a hairline border. This means that the border will have the width of one physical pixel. Hairline rendering takes shortcuts when the path overlaps a pixel more than once. This means that it will render faster than otherwise, but it might double-hit pixels, giving it a slightly darker/lighter result. Tip: To omit the border entirely, set the style to NONE. Raises: ValueError: If it is not greater than or equal to 0. |
color | ColorValue | Colors.BLACK | The color of this side of the border. |
stroke_align | 'BorderSideStrokeAlignValue' | BorderSideStrokeAlign.INSIDE | The relative position of the stroke on a BorderSide in an OutlinedBorder or Border. |
style | BorderStyle | BorderStyle.SOLID | The style of this side of the border. |
只读属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
stroke_inset | — | — | The amount of the stroke width that lies inside this BorderSide. For example, this will return the width for a stroke_align of -1, half the width for a stroke_align of 0, and 0 for a stroke_align of 1. |
stroke_outset | — | — | The amount of the stroke width that lies outside this BorderSide. For example, this will return 0 for a stroke_align of -1, half the width for a stroke_align of 0, and the width for a stroke_align of 1. |
stroke_offset | — | — | The offset of the stroke, taking into account the stroke alignment. For example, this will return the negative width of the stroke for a stroke_align of -1, 0 for a stroke_align of 0, and the width for a stroke_align of -1. |
方法
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
copy | 'BorderSide' | — | 返回此对象的副本,可覆盖指定属性。 |
none | 'BorderSide' | — | Creates a border side that is not rendered. Returns: A hairline black BorderSide with style set to NONE. |