57 lines
1.7 KiB
Dart
57 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'screens/scanner_screen.dart';
|
|
import 'services/connection_service.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// Prefer portrait orientation for barcode scanning
|
|
await SystemChrome.setPreferredOrientations([
|
|
DeviceOrientation.portraitUp,
|
|
DeviceOrientation.portraitDown,
|
|
]);
|
|
|
|
final connectionService = ConnectionService();
|
|
await connectionService.initialize();
|
|
|
|
runApp(BarcodeReaderApp(connectionService: connectionService));
|
|
}
|
|
|
|
class BarcodeReaderApp extends StatelessWidget {
|
|
final ConnectionService connectionService;
|
|
|
|
const BarcodeReaderApp({super.key, required this.connectionService});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
const primaryColor = Color(0xFF0284C7); // Sky blue / corporate cyan
|
|
|
|
return MaterialApp(
|
|
title: 'Catelli Barcode Scanner',
|
|
debugShowCheckedModeBanner: false,
|
|
themeMode: ThemeMode.dark, // Dark theme provides optimal contrast for scanner viewfinder
|
|
theme: ThemeData(
|
|
useMaterial3: true,
|
|
brightness: Brightness.light,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: primaryColor,
|
|
brightness: Brightness.light,
|
|
),
|
|
),
|
|
darkTheme: ThemeData(
|
|
useMaterial3: true,
|
|
brightness: Brightness.dark,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: primaryColor,
|
|
brightness: Brightness.dark,
|
|
surface: const Color(0xFF0F172A),
|
|
),
|
|
scaffoldBackgroundColor: const Color(0xFF020617),
|
|
),
|
|
home: ScannerScreen(connectionService: connectionService),
|
|
);
|
|
}
|
|
}
|