rustdesk/lib/main.dart
2022-02-25 21:54:05 +08:00

52 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:provider/provider.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart';
import 'model.dart';
import 'home_page.dart';
import 'server_page.dart';
Future<Null> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
toAndroidChannelInit();
runApp(App());
}
final globalKey = GlobalKey<NavigatorState>();
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
final analytics = FirebaseAnalytics();
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: HomePage(title: 'RustDesk'),
routes: {
"server_page": (context) => ServerPage(),
},
navigatorObservers: [
FirebaseAnalyticsObserver(analytics: analytics),
],
builder: EasyLoading.init(),
),
);
}
}