magnifier 0.0.3 copy "magnifier: ^0.0.3" to clipboard
magnifier: ^0.0.3 copied to clipboard

outdated

A Flutter plackage that 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),
      ),
    );
  }
}
8
likes
0
pub points
27%
popularity

Publisher

verified publisherpreetjdp.dev

A Flutter plackage that a Magnifying Glass to your App.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on magnifier