MagnifyingGlass Flutter plugin

Flutter real-time magnifying glass lens widget with Barrel/Pincushion distortion. Works on Android, iOS and desktop. Doesn't work yet on web (help needed with web FFI).


Getting Started

Make MagnifyingGlass widget as the parent of the widget you wish to be used (usually MyHomePage).

    Widget build(BuildContext context) {
    MagnifyingGlassController magnifyingGlassController = MagnifyingGlassController();
    return MagnifyingGlass(
      controller: magnifyingGlassController,
      glassPosition: GlassPosition.touchPosition,
      glassParams: GlassParams(
        startingPosition: Offset(150, 150),
        diameter: 150,
        distortion: 1.0,
        magnification: 1.2,
        padding: EdgeInsets.all(10),
      child: Scaffold( 
        body: ...,

        floatingActionButton: FloatingActionButton(
          onPressed: () => magnifyingGlassController.openGlass(),
          child: const Icon(,

MagnifyingGlass properties

controllerMagnifyingGlassControllerLet you control the glass state and parameters:
setDistortion( double distortion, double magnification )
setDiameter( int diameter )
glassPositionenumGlassPosition enum to set the touch behavior or sticky position
glassParamsGlassParamsGlassParams class to set lens parameters

GlassPosition class

touchPositionmove the glass with finger touch
topLeftsticky position to top left corner of the screen
topRightsticky position to top rigth corner of the screen
bottomLeftsticky position to bottom left corner of the screen
bottomRightsticky position to bottom right corner of the screen

GlassParams class

startingPositionthe startin glass position. If not given the lens will be placed at the center of the screen.
diameterthe diameter of the glass
magnificationthe magnification of the lens
1 means no magnification
>1 means magnification
<1 means shrinking
distortionBarrel/Pincushion distortion power
0 means no distortion
paddingthe padding surrounding the glass to enlarge touching area
distorsion 0.5
mag 1.0
distorsion 0.5
mag 1.4
distorsion 2.0
mag 1.7