pub struct PhysicalModel {
pub key: Option<KeyRef>,
pub shape: BoxShape,
pub clip_behavior: Clip,
pub border_radius: Option<BorderRadius>,
pub elevation: f64,
pub color: AnyColor,
pub shadow_color: AnyColor,
pub child: Option<WidgetRef>,
}Expand description
A widget representing a physical layer that clips its children to a shape.
Physical layers cast shadows based on an elevation which is nominally
in logical pixels, coming vertically out of the rendering surface.
For shapes that cannot be expressed as a rectangle with rounded corners use
PhysicalShape.
See also:
DecoratedBox, which can apply more arbitrary shadow effects.ClipRect, which applies a clip to its child.
Fields§
§key: Option<KeyRef>§shape: BoxShapeThe type of shape.
clip_behavior: ClipThe content will be clipped (or not) according to this option.
Defaults to Clip::None.
border_radius: Option<BorderRadius>The border radius of the rounded corners.
Values are clamped so that horizontal and vertical radii sums do not exceed width/height.
This is ignored if the shape is not BoxShape::Rectangle.
elevation: f64The z-coordinate relative to the parent at which to place this physical object.
The value is non-negative.
color: AnyColorThe background color.
shadow_color: AnyColorThe shadow color.
child: Option<WidgetRef>The widget below this widget in the tree.
Implementations§
Source§impl PhysicalModel
impl PhysicalModel
Sourcepub fn new(color: impl Into<AnyColor>) -> PhysicalModel
pub fn new(color: impl Into<AnyColor>) -> PhysicalModel
Creates a physical model with a rounded-rectangular clip; Dart’s optional named arguments are the setters.
Dart’s defaults: shape BoxShape::Rectangle, clip_behavior Clip::None,
elevation 0, shadow_color opaque black.
Sourcepub fn key(self, key: KeyRef) -> PhysicalModel
pub fn key(self, key: KeyRef) -> PhysicalModel
Dart PhysicalModel(key:).
Sourcepub fn shape(self, shape: BoxShape) -> PhysicalModel
pub fn shape(self, shape: BoxShape) -> PhysicalModel
Dart PhysicalModel(shape:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> PhysicalModel
pub fn clip_behavior(self, clip_behavior: Clip) -> PhysicalModel
Dart PhysicalModel(clipBehavior:).
Sourcepub fn border_radius(self, border_radius: BorderRadius) -> PhysicalModel
pub fn border_radius(self, border_radius: BorderRadius) -> PhysicalModel
Dart PhysicalModel(borderRadius:).
Sourcepub fn elevation(self, elevation: f64) -> PhysicalModel
pub fn elevation(self, elevation: f64) -> PhysicalModel
Dart PhysicalModel(elevation:).
Sourcepub fn shadow_color(self, shadow_color: impl Into<AnyColor>) -> PhysicalModel
pub fn shadow_color(self, shadow_color: impl Into<AnyColor>) -> PhysicalModel
Dart PhysicalModel(shadowColor:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> PhysicalModel
pub fn child<K>(self, child: impl IntoWidget<K>) -> PhysicalModel
Dart PhysicalModel(child:).
Trait Implementations§
Source§impl Debug for PhysicalModel
impl Debug for PhysicalModel
Source§impl RenderObjectWidget for PhysicalModel
impl RenderObjectWidget for PhysicalModel
Source§type RenderObject = RenderPhysicalModel
type RenderObject = RenderPhysicalModel
covariant RenderObject parameter type.Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn create_render_object(
&self,
app: &mut App,
_context: BuildContext,
) -> AnyRenderObject
fn create_render_object( &self, app: &mut App, _context: BuildContext, ) -> AnyRenderObject
RenderObject class that this widget represents, using the
configuration described by this widget. Read moreSource§fn update_render_object(
&self,
app: &mut App,
_context: BuildContext,
render_object: RenderHandle<RenderPhysicalModel>,
)
fn update_render_object( &self, app: &mut App, _context: BuildContext, render_object: RenderHandle<RenderPhysicalModel>, )
create_render_object. Read moreSource§fn to_string_short(&self) -> String
fn to_string_short(&self) -> String
toStringShort, for a widget that names itself apart from its type, as
SizedBox.expand does; see Widget::to_string_short.Source§fn debug_visit_onstage_children(
&self,
app: &App,
children: &[AnyElement],
visitor: &mut dyn FnMut(AnyElement),
)
fn debug_visit_onstage_children( &self, app: &App, children: &[AnyElement], visitor: &mut dyn FnMut(AnyElement), )
debugVisitOnstageChildren of the element this widget makes, for a widget whose
Dart element subclass overrides it only to hide children (_OffstageElement,
_IndexedStackElement): calls visitor for each of children, in order, that is
onstage. Waft’s generic single- and multi-child elements stand in for those subclasses
and ask their widget here; an element of a widget’s own overrides
Element::debug_visit_onstage_children instead.Source§fn did_unmount_render_object(
&self,
app: &mut App,
render_object: RenderHandle<Self::RenderObject>,
)
fn did_unmount_render_object( &self, app: &mut App, render_object: RenderHandle<Self::RenderObject>, )
RenderObject will be of the same type as returned by this object’s
create_render_object.Auto Trait Implementations§
impl !RefUnwindSafe for PhysicalModel
impl !Send for PhysicalModel
impl !Sync for PhysicalModel
impl !UnwindSafe for PhysicalModel
impl Forget for PhysicalModel
impl Freeze for PhysicalModelwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
&'static dyn ColorExtension: Freeze,
*const RcInner<dyn ColorExtension> is !null: Freeze,
PhantomData<RcInner<dyn ColorExtension>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl Move for PhysicalModel
impl Unpin for PhysicalModel
impl UnsafeUnpin for PhysicalModelwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
&'static dyn ColorExtension: UnsafeUnpin,
*const RcInner<dyn ColorExtension> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ColorExtension>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<SingleChildRenderObjectKind> for Wwhere
W: SingleChildRenderObjectWidget,
<W as RenderObjectWidget>::RenderObject: RenderObjectWithChildMixin,
impl<W> IntoWidget<SingleChildRenderObjectKind> for Wwhere
W: SingleChildRenderObjectWidget,
<W as RenderObjectWidget>::RenderObject: RenderObjectWithChildMixin,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.