pub struct Magnifier {
pub key: Option<KeyRef>,
pub additional_focal_point_offset: Offset,
pub border_radius: BorderRadius,
pub film_color: Color,
pub shadows: Vec<BoxShadow>,
pub clip_behavior: Clip,
pub size: Size,
}Expand description
A Material-styled magnifying glass.
This widget focuses on mimicking the style of the magnifier on material.
For a widget that is focused on mimicking the behavior of a material
magnifier, see TextMagnifier, which uses Magnifier.
The styles implemented in this widget were based on the Android 12 source code, where possible, and on eyeballing a Pixel 6 running Android 12 otherwise.
Fields§
§key: Option<KeyRef>§additional_focal_point_offset: OffsetAny additional offset the focal point requires to “point” to the correct place.
This value is added to K_STANDARD_VERTICAL_FOCAL_POINT_SHIFT
to obtain the actual offset.
This is useful for instances where the magnifier is not pointing to something directly below it.
border_radius: BorderRadiusThe border radius for this magnifier.
The magnifier’s shape is a RoundedRectangleBorder with this radius.
film_color: ColorThe color to tint the image in this Magnifier.
On native Android, there is a almost transparent gray tint to the magnifier, in order to better distinguish the contents of the lens from the background.
shadows: Vec<BoxShadow>A list of shadows cast by the Magnifier.
If the shadows use a BlurStyle that paints inside the shape, or if they
are offset, then a clip_behavior that enables clipping (such as the
default Clip::HardEdge) is recommended, otherwise the shadow will occlude
the magnifier (the shadow is drawn above the magnifier so as to not be
included in the magnified image).
By default, the shadows are offset vertically by two logical pixels, so clipping is recommended.
A shadow that uses BlurStyle::Outer and is not offset does not need
clipping; in that case, consider setting clip_behavior to Clip::None.
clip_behavior: ClipWhether and how to clip the shadows that render inside the loupe.
Defaults to Clip::HardEdge.
A value of Clip::None can be used if the shadow will not paint where the
magnified image appears, or if doing so is intentional (e.g. to blur the
edges of the magnified image).
See the discussion at shadows.
size: SizeImplementations§
Source§impl Magnifier
impl Magnifier
Sourcepub const K_DEFAULT_MAGNIFIER_SIZE: Size
pub const K_DEFAULT_MAGNIFIER_SIZE: Size
The default size of this Magnifier.
The size of the magnifier may be modified through the constructor;
K_DEFAULT_MAGNIFIER_SIZE is extracted from the default
parameter of Magnifier’s constructor so that positioners may depend on it.
Sourcepub const K_STANDARD_VERTICAL_FOCAL_POINT_SHIFT: f64 = 22.0
pub const K_STANDARD_VERTICAL_FOCAL_POINT_SHIFT: f64 = 22.0
The vertical distance that the magnifier should be above the focal point.
The K_STANDARD_VERTICAL_FOCAL_POINT_SHIFT
value is a constant so that positioning of this Magnifier can be done with a guaranteed
size, as opposed to an estimate.
Sourcepub fn new() -> Magnifier
pub fn new() -> Magnifier
Creates a RawMagnifier in the Material style.
Sourcepub fn additional_focal_point_offset(
self,
additional_focal_point_offset: Offset,
) -> Magnifier
pub fn additional_focal_point_offset( self, additional_focal_point_offset: Offset, ) -> Magnifier
Dart Magnifier(additionalFocalPointOffset:).
Sourcepub fn border_radius(self, border_radius: BorderRadius) -> Magnifier
pub fn border_radius(self, border_radius: BorderRadius) -> Magnifier
Dart Magnifier(borderRadius:).
Sourcepub fn film_color(self, film_color: Color) -> Magnifier
pub fn film_color(self, film_color: Color) -> Magnifier
Dart Magnifier(filmColor:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> Magnifier
pub fn clip_behavior(self, clip_behavior: Clip) -> Magnifier
Dart Magnifier(clipBehavior:).
Trait Implementations§
Source§impl StatelessWidget for Magnifier
impl StatelessWidget for Magnifier
Source§fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
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 debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl !RefUnwindSafe for Magnifier
impl !Send for Magnifier
impl !Sync for Magnifier
impl !UnwindSafe for Magnifier
impl Forget for Magnifier
impl Freeze for Magnifier
impl Move for Magnifier
impl Unpin for Magnifier
impl UnsafeUnpin for Magnifierwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<BoxShadow>: 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<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.