Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB

3 years ago
import 'package:flutter/material.dart';
import 'package:flutter_zxing/flutter_zxing.dart';
3 years ago
void main() {
3 years ago
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
FlutterZxing.setLogEnabled(true);
return MaterialApp(
title: 'Flutter Zxing Example',
home: DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
title: const Text('Flutter Zxing Example'),
bottom: const TabBar(
tabs: [
Tab(text: 'Scan Code'),
Tab(text: 'Create Code'),
],
),
),
body: TabBarView(
3 years ago
physics: const NeverScrollableScrollPhysics(),
children: [
ReaderWidget(
3 years ago
onScan: (value) {
debugPrint(value.textString ?? '');
},
),
WriterWidget(
onSuccess: (result, bytes) {},
onError: (error) {},
),
],
),
),
),
3 years ago
);
}
}