import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'connect_screen.dart'; import 'rust/frb_generated.dart'; import 'theme.dart'; /// Entry point. /// /// Before the first widget builds we initialise flutter_rust_bridge, which /// loads the native `netdesk_frb` library (built from the Rust `netdesk-frb` /// crate over `netdesk-core`). All session work — signaling, the transport, /// input injection and the H.264 decode — runs behind that FFI layer; the Dart /// side only paints frames and forwards input. /// /// If the engine fails to load we still start the app, surfacing the error on /// the connect screen instead of crashing to a black window. Future main() async { WidgetsFlutterBinding.ensureInitialized(); // Behave like a true Android app: allow every orientation (tablets are used // in landscape), and draw behind the system bars for an edge-to-edge look. await SystemChrome.setPreferredOrientations(const [ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); String? initError; try { await RustLib.init(); } catch (e) { initError = '$e'; } runApp(NetDeskApp(initError: initError)); } /// Root application widget. /// /// NetDesk is Akronlogic's premium cross-platform remote-desktop client. This /// Flutter layer is the touch-native front-end; it binds to the Rust /// `netdesk-core` crate via flutter_rust_bridge to drive the whole session. class NetDeskApp extends StatelessWidget { const NetDeskApp({super.key, this.initError}); /// Non-null when the native engine could not be loaded at startup. final String? initError; @override Widget build(BuildContext context) { return MaterialApp( title: 'NetDesk', debugShowCheckedModeBanner: false, theme: NetDeskTheme.dark, darkTheme: NetDeskTheme.dark, themeMode: ThemeMode.dark, home: ConnectScreen(initError: initError), ); } }