import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'package:video/model/refreshModel.dart'; import 'package:video/model/urlModel.dart'; import 'package:video/providers/providerManager.dart'; import 'package:video/utils/router.dart' as router; import 'screen/loading.dart'; void main() { runApp(MyApp()); if (Platform.isAndroid) { // 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。 SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor: Colors.transparent); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MultiProvider( providers: providers, //监听共享实例 child: Consumer2( builder: (context, themeModel, localeModel, child) { return MaterialApp( debugShowCheckedModeBanner: false, title: '电影', theme: ThemeData( primarySwatch: Colors.blueGrey, ), onGenerateRoute: router.generateRoute, home: new LoadingPage(), ); }, ), ); } }