fps_qr_code_generator 1.0.1+2 copy "fps_qr_code_generator: ^1.0.1+2" to clipboard
fps_qr_code_generator: ^1.0.1+2 copied to clipboard

FPS QR Code Generator plugin for flutter. The Faster Payment System (FPS) is a payment financial infrastructure introduced in 2018 by the Hong Kong Monetary Authority (HKMA) and operated by Hong Kong [...]

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(
      fpsId: '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'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
0
points
18
downloads

Publisher

unverified uploader

Weekly Downloads

FPS QR Code Generator plugin for flutter. The Faster Payment System (FPS) is a payment financial infrastructure introduced in 2018 by the Hong Kong Monetary Authority (HKMA) and operated by Hong Kong Interbank Clearing Limited (HKICL).

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface, qr_flutter

More

Packages that depend on fps_qr_code_generator

Packages that implement fps_qr_code_generator