fps_qr_code_generator 1.0.0+1 copy "fps_qr_code_generator: ^1.0.0+1" to clipboard
fps_qr_code_generator: ^1.0.0+1 copied to clipboard

fps qr code generator

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fps_qr_code_generator/fps_qr_code_generator.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _fpsQrCodeGeneratorPlugin = FpsQrCodeGenerator();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
      platformVersion = await _fpsQrCodeGeneratorPlugin.getPlatformVersion() ??
          'Unknown platform version';
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    final emv = EMV(
      fps_id: '1234567890',
      mcc: '0000',
      currency: '344',
      amount: '123456789012345',
      account: '02',
      reference: '8999888999',
    );

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              Text('Running on: $_platformVersion\n'),
              Text(
                  'QR Code: ${_fpsQrCodeGeneratorPlugin.generateQrCodeString(emv)}'),
              _fpsQrCodeGeneratorPlugin.generateQrCodeImage(
                size: 300,
                isShowFPSLogo: true,
                emv: emv,
                eyeStyle: const QrEyeStyle(
                  eyeShape: QrEyeShape.square,
                  color: Colors.black,
                ),
                // embeddedImage: const AssetImage('images/fps-icon.png'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}