Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
flutterbarcode-generatorbarcode-scannergeneratorqrqrcodeqrcode-generatorqrcode-scannerscannerzxingbarcodezxscanner
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.
62 lines
1.8 KiB
62 lines
1.8 KiB
3 years ago
|
import 'package:convex_bottom_bar/convex_bottom_bar.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
3 years ago
|
import 'package:zxscanner/pages/barcodes_page.dart';
|
||
|
import 'package:zxscanner/pages/help_page.dart';
|
||
|
import 'package:zxscanner/pages/history_page.dart';
|
||
|
import 'package:zxscanner/pages/scanner_page.dart';
|
||
|
import 'package:zxscanner/pages/settings_page.dart';
|
||
3 years ago
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||
|
|
||
|
class HomePage extends StatefulWidget {
|
||
|
const HomePage({Key? key}) : super(key: key);
|
||
|
|
||
|
@override
|
||
|
State<HomePage> createState() => _HomePageState();
|
||
|
}
|
||
|
|
||
|
class _HomePageState extends State<HomePage> {
|
||
|
var selectedIndex = 2;
|
||
|
|
||
3 years ago
|
final barcodesPage = const BarcodesPage();
|
||
3 years ago
|
final historyPage = const HistoryPage();
|
||
|
final scannerPage = const ScannerPage();
|
||
3 years ago
|
final helpPage = const HelpPage();
|
||
3 years ago
|
final settingsPage = const SettingsPage();
|
||
|
|
||
|
dynamic pages() => [
|
||
3 years ago
|
barcodesPage,
|
||
3 years ago
|
historyPage,
|
||
|
scannerPage,
|
||
3 years ago
|
helpPage,
|
||
3 years ago
|
settingsPage,
|
||
|
];
|
||
|
|
||
|
dynamic tabItems() => [
|
||
|
const TabItem(icon: FontAwesomeIcons.barcode),
|
||
|
const TabItem(icon: FontAwesomeIcons.clockRotateLeft),
|
||
|
const TabItem(icon: Icons.qr_code_scanner),
|
||
3 years ago
|
const TabItem(icon: FontAwesomeIcons.circleQuestion),
|
||
3 years ago
|
const TabItem(icon: FontAwesomeIcons.gear),
|
||
|
];
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
body: pages()[selectedIndex],
|
||
|
bottomNavigationBar: ConvexAppBar(
|
||
|
style: TabStyle.fixedCircle,
|
||
|
backgroundColor: Theme.of(context).bottomAppBarColor,
|
||
|
color: Theme.of(context).unselectedWidgetColor,
|
||
|
activeColor: Theme.of(context).colorScheme.primary,
|
||
|
items: tabItems(),
|
||
|
initialActiveIndex: selectedIndex,
|
||
|
onTap: (index) {
|
||
|
setState(() {
|
||
|
selectedIndex = index;
|
||
|
});
|
||
|
},
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|