hkqr_fps 0.0.2 hkqr_fps: ^0.0.2 copied to clipboard
Codec between fps information and hkqr code string.
import 'package:example/scan_and_decode_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'qr_encode_page.dart';
import 'qr_string_decode_page.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
void encode() {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => QrEncodePage(),
),
);
}
void scanAndDecode() {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => ScanAndDecodePage(),
),
);
}
void decodeString() async {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => QrStringDecodePage(),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(onPressed: encode, child: Text('Encode')),
SizedBox(height: 48),
ElevatedButton(onPressed: decodeString, child: Text('Decode')),
if (!kIsWeb) ...[
SizedBox(height: 48),
ElevatedButton(onPressed: scanAndDecode, child: Text('Scan & Decode')),
],
],
),
),
);
}
}