magnifier 0.0.4+3

Flutter Android iOS web

A Flutter Package that adds a Magnifying Glass to your App.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:magnifier/magnifier.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool enabled = true;
  double size = 40;
  double scale = 1.2;
  @override
  Widget build(BuildContext context) {
    return Magnifier(
      enabled: enabled,
      scale: scale,
      size: Size(size, size),
      child: MaterialApp(
        title: 'Magnifier Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        home: Scaffold(
          body: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Expanded(child: MyHomePage(title: 'Magnifier Demo')),
              RaisedButton(
                onPressed: () {
                  setState(() {
                    enabled = !enabled;
                  });
                },
                child: Text(enabled ? "Disable" : "Enable"),
              ),
              Text("Size : ${size.toStringAsFixed(2)}"),
              Slider(
                value: size,
                onChanged: (newValue) {
                  setState(() {
                    size = newValue;
                  });
                },
                min: 10,
                max: 300,
              ),
              Text("Size : ${scale.toStringAsFixed(2)}"),
              Slider(
                value: scale,
                onChanged: (newValue) {
                  setState(() {
                    scale = newValue;
                  });
                },
                min: 0,
                max: 5,
              )
            ],
          ),
        ),
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() => _counter++);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
3
likes
100
pub points
46%
popularity

A Flutter Package that adds a Magnifying Glass to your App.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

preetjdpdev@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on magnifier