Magnifier class

A Material-styled magnifying glass.

This magnifying glass is useful for scenarios on mobile devices where the user's finger may be covering part of the screen where a granular action is being performed, such as navigating a small cursor with a drag gesture, on an image or text.

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.

Inheritance

Constructors

Magnifier({Key? key, Offset additionalFocalPointOffset = Offset.zero, BorderRadius borderRadius = const BorderRadius.all(Radius.circular(_borderRadius)), Color filmColor = const Color.fromARGB(8, 158, 158, 158), List<BoxShadow> shadows = const <BoxShadow>[BoxShadow(blurRadius: 1.5, offset: Offset(0.0, 2.0), spreadRadius: 0.75, color: Color.fromARGB(25, 0, 0, 0))], Clip clipBehavior = Clip.hardEdge, Size size = Magnifier.kDefaultMagnifierSize})
Creates a RawMagnifier in the Material style.
const

Properties

additionalFocalPointOffset Offset
Any additional offset the focal point requires to "point" to the correct place.
final
borderRadius BorderRadius
The border radius for this magnifier.
final
clipBehavior Clip
Whether and how to clip the shadows that render inside the loupe.
final
filmColor Color
The color to tint the image in this Magnifier.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadows List<BoxShadow>
A list of shadows cast by the Magnifier.
final
size Size
The Size of this Magnifier.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

kDefaultMagnifierSize → const Size
The default size of this Magnifier.
kStandardVerticalFocalPointShift → const double
The vertical distance that the magnifier should be above the focal point.