mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-01 09:42:52 +08:00
64 lines
1.9 KiB
Dart
64 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hbb/desktop/pages/desktop_home_page.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'common.dart';
|
|
import 'mobile/pages/home_page.dart';
|
|
import 'mobile/pages/server_page.dart';
|
|
import 'mobile/pages/settings_page.dart';
|
|
import 'models/model.dart';
|
|
|
|
Future<Null> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await FFI.ffiModel.init();
|
|
// await Firebase.initializeApp();
|
|
if (isAndroid) {
|
|
toAndroidChannelInit();
|
|
}
|
|
refreshCurrentUser();
|
|
if (isDesktop) {
|
|
print("desktop mode: starting service");
|
|
FFI.serverModel.startService();
|
|
}
|
|
runApp(App());
|
|
}
|
|
|
|
class App extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// final analytics = FirebaseAnalytics.instance;
|
|
return MultiProvider(
|
|
providers: [
|
|
ChangeNotifierProvider.value(value: FFI.ffiModel),
|
|
ChangeNotifierProvider.value(value: FFI.imageModel),
|
|
ChangeNotifierProvider.value(value: FFI.cursorModel),
|
|
ChangeNotifierProvider.value(value: FFI.canvasModel),
|
|
],
|
|
child: MaterialApp(
|
|
navigatorKey: globalKey,
|
|
debugShowCheckedModeBanner: false,
|
|
title: 'RustDesk',
|
|
theme: ThemeData(
|
|
primarySwatch: Colors.blue,
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
),
|
|
home: isDesktop
|
|
? DesktopHomePage()
|
|
: !isAndroid
|
|
? WebHomePage()
|
|
: HomePage(),
|
|
navigatorObservers: [
|
|
// FirebaseAnalyticsObserver(analytics: analytics),
|
|
FlutterSmartDialog.observer
|
|
],
|
|
builder: FlutterSmartDialog.init(
|
|
builder: isAndroid
|
|
? (_, child) => AccessibilityListener(
|
|
child: child,
|
|
)
|
|
: null)),
|
|
);
|
|
}
|
|
}
|