Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
eoefans-mobile-flutter/lib/main.dart
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
63 lines (59 sloc)
2.43 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'package:EOEFANS/models/videoPageTab.dart'; | |
import 'package:EOEFANS/routes/mainPage.dart'; | |
import 'package:EOEFANS/routes/setting/aboutUs.dart'; | |
import 'package:EOEFANS/routes/setting/settingPage.dart'; | |
import 'package:EOEFANS/routes/setting/settingTheme.dart'; | |
import 'package:EOEFANS/routes/splashPage.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:EOEFANS/states/ProfileChangeNotifier.dart'; | |
import 'package:flutter/services.dart'; | |
import 'package:provider/provider.dart'; | |
import 'package:sentry_flutter/sentry_flutter.dart'; | |
import 'package:EOEFANS/common/Api.dart'; | |
import 'package:EOEFANS/models/videoPageTab.dart'; | |
import 'package:EOEFANS/common/Global.dart'; | |
Future<void> main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
if (Platform.isAndroid) { | |
// 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。 | |
SystemUiOverlayStyle systemUiOverlayStyle = | |
SystemUiOverlayStyle(statusBarColor: Colors.transparent); | |
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); | |
} | |
await SentryFlutter.init( | |
(options) { | |
options.dsn = | |
'https://af432d5302db4e71801cf78e91fd5b78@sentry.vtb.link/4'; | |
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. | |
// We recommend adjusting this value in production. | |
options.tracesSampleRate = 1.0; | |
}, | |
appRunner: () => Global.init().then((e) => runApp(MyApp())), | |
); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MultiProvider( | |
providers: [ | |
ChangeNotifierProvider.value(value: ThemeModel()), | |
], | |
child: Consumer<ThemeModel>( | |
builder: (BuildContext context, themeModel, Widget? child) { | |
return MaterialApp( | |
initialRoute: '/splash', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
routes: { | |
'/main': (BuildContext context) => MainPage(), | |
'/splash': (BuildContext context) => SplashScreen(), | |
'/setting': (BuildContext context) => const SettingPage(), | |
'/theme': (BuildContext context) => const SettingTheme(), | |
'/about': (BuildContext context) => const AboutUs(), | |
}, | |
); | |
})); | |
} | |
} |