pub struct PhysicalShape {
pub key: Option<KeyRef>,
pub clipper: Rc<dyn CustomClipper<Path>>,
pub clip_behavior: Clip,
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 path.
Physical layers cast shadows based on an elevation which is nominally
in logical pixels, coming vertically out of the rendering surface.
PhysicalModel does the same but only supports shapes that can be expressed
as rectangles with rounded corners.
See also:
ShapeBorderClipper, which converts aShapeBorderto aCustomClipper, as needed by this widget.
Fields§
§key: Option<KeyRef>§clipper: Rc<dyn CustomClipper<Path>>Determines which clip to use.
If the path in question is expressed as a ShapeBorder subclass,
consider using the ShapeBorderClipper delegate class to adapt the
shape for use with this widget.
clip_behavior: ClipThe content will be clipped (or not) according to this option.
Defaults to Clip::None.
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: AnyColorWhen elevation is non zero the color to use for the shadow color.
child: Option<WidgetRef>The widget below this widget in the tree.
Implementations§
Source§impl PhysicalShape
impl PhysicalShape
Sourcepub fn new(
clipper: Rc<dyn CustomClipper<Path>>,
color: impl Into<AnyColor>,
) -> PhysicalShape
pub fn new( clipper: Rc<dyn CustomClipper<Path>>, color: impl Into<AnyColor>, ) -> PhysicalShape
Creates a physical model with an arbitrary shape clip; Dart’s optional named arguments are the setters.
Dart’s defaults: clip_behavior Clip::None, elevation 0, shadow_color opaque
black.
Sourcepub fn key(self, key: KeyRef) -> PhysicalShape
pub fn key(self, key: KeyRef) -> PhysicalShape
Dart PhysicalShape(key:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> PhysicalShape
pub fn clip_behavior(self, clip_behavior: Clip) -> PhysicalShape
Dart PhysicalShape(clipBehavior:).
Sourcepub fn elevation(self, elevation: f64) -> PhysicalShape
pub fn elevation(self, elevation: f64) -> PhysicalShape
Dart PhysicalShape(elevation:).
Sourcepub fn shadow_color(self, shadow_color: impl Into<AnyColor>) -> PhysicalShape
pub fn shadow_color(self, shadow_color: impl Into<AnyColor>) -> PhysicalShape
Dart PhysicalShape(shadowColor:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> PhysicalShape
pub fn child<K>(self, child: impl IntoWidget<K>) -> PhysicalShape
Dart PhysicalShape(child:).
Trait Implementations§
Source§impl Debug for PhysicalShape
impl Debug for PhysicalShape
Source§impl RenderObjectWidget for PhysicalShape
impl RenderObjectWidget for PhysicalShape
Source§type RenderObject = RenderPhysicalShape
type RenderObject = RenderPhysicalShape
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<RenderPhysicalShape>,
)
fn update_render_object( &self, app: &mut App, _context: BuildContext, render_object: RenderHandle<RenderPhysicalShape>, )
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 PhysicalShape
impl !Send for PhysicalShape
impl !Sync for PhysicalShape
impl !UnwindSafe for PhysicalShape
impl Forget for PhysicalShape
impl Freeze for PhysicalShapewhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn CustomClipper<Path>> is !null: Freeze,
PhantomData<RcInner<dyn CustomClipper<Path>>>: 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 PhysicalShape
impl Unpin for PhysicalShapewhere
Rc<dyn Key>: Unpin,
Rc<dyn CustomClipper<Path>>: Unpin,
&'static dyn ColorExtension: Unpin,
Rc<dyn ColorExtension>: Unpin,
Rc<dyn Widget>: Unpin,
impl UnsafeUnpin for PhysicalShapewhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn CustomClipper<Path>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn CustomClipper<Path>>>: 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.