import 'package:fluro/fluro.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:get_it/get_it.dart'; import 'package:provider/provider.dart'; import 'package:sport/config_inject.dart'; import 'package:sport/pages/splash_page.dart'; import 'package:sport/provider/bluetooth.dart'; import 'package:sport/provider/game_model.dart'; import 'package:sport/provider/message_model.dart'; import 'package:sport/router/routes.dart'; import 'package:umeng_common_sdk/umeng_common_sdk.dart'; import 'application.dart'; import 'provider/user_model.dart'; import 'utils/CupertinoLocalizationsDelegate.dart'; class MyApp extends StatelessWidget with ConfigInject { @override Widget build(BuildContext context) { final router = FluroRouter(); Routes.configureRoutes(router); Application.router = router; final color = const Color(0xffFFC400); final backgroundColor = const Color(0xffF1F1F1); return MultiProvider( providers: [ ChangeNotifierProvider( create: (_) => UserModel(), lazy: false, ), ], child: MaterialApp( debugShowCheckedModeBanner: false, // supportedLocales: [const Locale('zh', 'CH'), const Locale('en', 'US')], localizationsDelegates: [ CupertinoLocalizationsDelegate(), GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, ], localeResolutionCallback: (deviceLocale, supportedLocales) { locale = deviceLocale; return deviceLocale; }, onGenerateRoute: Application.router?.generator, navigatorObservers: [routeObserver], theme: ThemeData( platform: TargetPlatform.iOS, brightness: Brightness.light, primaryColor: Colors.white, accentColor: color, // splashColor: Colors.transparent, backgroundColor: backgroundColor, scaffoldBackgroundColor: backgroundColor, textTheme: TextTheme( headline1: TextStyle(fontSize: 18.0, color: const Color(0xff333333), fontWeight: FontWeight.w600, height: 1.2), headline2: TextStyle(fontSize: 25.0, color: const Color(0xff333333), fontWeight: FontWeight.w600, height: 1.2), headline3: TextStyle(fontSize: 16.0, color: const Color(0xff333333), fontWeight: FontWeight.w600, height: 1.2), headline4: TextStyle(fontSize: 16.0, color: const Color(0xffffffff), fontWeight: FontWeight.w600, height: 1.2), headline6: TextStyle(fontSize: 14.0, color: const Color(0xffffffff), fontWeight: FontWeight.normal, height: 1.2), subtitle1: TextStyle(fontSize: 14.0, color: const Color(0xff333333), fontWeight: FontWeight.normal, height: 1.2), subtitle2: TextStyle(fontSize: 12.0, color: const Color(0xff333333), fontWeight: FontWeight.normal, height: 1.2), bodyText1: TextStyle(fontSize: 12.0, color: const Color(0xff999999), fontWeight: FontWeight.normal, height: 1.2), bodyText2: TextStyle(fontSize: 14.0, color: const Color(0xff999999), fontWeight: FontWeight.normal, height: 1.2), ), colorScheme: ColorScheme.light(primary: Colors.white, secondary: color, ), textSelectionTheme: TextSelectionThemeData(cursorColor: color), progressIndicatorTheme: ProgressIndicatorThemeData(color: color), sliderTheme: SliderThemeData(thumbColor: color, activeTrackColor: color), dividerTheme: DividerThemeData(color: const Color(0xffDCDCDC)), tabBarTheme: TabBarTheme(indicatorSize: TabBarIndicatorSize.label, labelColor: color, unselectedLabelColor: Color(0xff333333), labelStyle: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600), unselectedLabelStyle: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600)), appBarTheme: AppBarTheme( elevation: 0, ), popupMenuTheme: PopupMenuThemeData(textStyle: TextStyle(fontSize: 14.0, color: Color(0xff666666), fontWeight: FontWeight.normal), shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10.0))))), home: SplashPage(), ), ); } }