content: import 'package:flutter/material.dart';
  
  import 'package:animated_qr_code_scanner/animated_qr_code_scanner.dart';
  import 'package:animated_qr_code_scanner/AnimatedQRViewController.dart';
  
  void main() => runApp(MyApp());
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: TestPage(),
      );
    }
  }
  
  class TestPage extends StatelessWidget {
    final AnimatedQRViewController controller = AnimatedQRViewController();
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Column(
          children: [
            Expanded(
              child: AnimatedQRView(
                squareColor: Colors.green.withOpacity(0.25),
                animationDuration: const Duration(milliseconds: 600),
                onScanBeforeAnimation: (String str) {
                  print('Callback at the beginning of animation: $str');
                },
                onScan: (String str) async {
                  await showDialog(
                    context: context,
                    builder: (context) => AlertDialog(
                      title: Text('Callback at the end of animation: $str'),
                      actions: [
                        FlatButton(
                          child: const Text('OK'),
                          onPressed: () {
                            Navigator.of(context).pop();
                            Navigator.of(context).pop();
                            Navigator.of(context).push(
                              MaterialPageRoute(
                                builder: (context) => Scaffold(
                                  body: Align(
                                    alignment: Alignment.center,
                                    child: Text('$str'),
                                  ),
                                ),
                              ),
                            );
                          },
                        ),
                        FlatButton(
                          child: const Text('Rescan'),
                          onPressed: () {
                            Navigator.of(context).pop();
                            controller.resume();
                          },
                        ),
                      ],
                    ),
                  );
                },
                controller: controller,
              ),
            ),
            Container(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  FlatButton(
                    color: Colors.blue,
                    child: const Text('Flash'),
                    onPressed: () {
                      controller.toggleFlash();
                    },
                  ),
                  const SizedBox(width: 10),
                  FlatButton(
                    color: Colors.blue,
                    child: const Text('Flip'),
                    onPressed: () {
                      controller.flipCamera();
                    },
                  ),
                  const SizedBox(width: 10),
                  FlatButton(
                    color: Colors.blue,
                    child: const Text('Resume'),
                    onPressed: () {
                      controller.resume();
                    },
                  ),
                ],
              ),
            ),
          ],
        ),
      );
    }
  }
  