Files
nearle_pos/lib/main.dart
2026-07-29 11:41:53 +05:30

38 lines
1.2 KiB
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'app/app.dart';
import 'core/services/sound_service.dart';
import 'data/datasources/local_store.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await _configureChrome();
await LocalStore.instance.init();
await SoundService.instance.preload();
runApp(const ProviderScope(child: NearlePosApp()));
}
/// Locks the terminal into landscape and hides the system bars.
///
/// Both calls are Android/iOS only. On desktop the window manager owns sizing
/// and chrome, so we skip them — invoking them there is at best a no-op and can
/// raise a MissingPluginException on some engine builds.
Future<void> _configureChrome() async {
final isMobile = defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.iOS;
if (kIsWeb || !isMobile) return;
await SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
}