12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- 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;
- UmengCommonSdk.initCommon("60f23987a6f90557b7bc7505", "60f23a652a1a2a58e7db1b21", "ouj");
- return MultiProvider(
- providers: [
- ChangeNotifierProvider<UserModel>(
- create: (_) => UserModel(),
- lazy: false,
- ),
- ChangeNotifierProvider<Bluetooth>(
- create: (_) => Bluetooth(),
- ),
- ChangeNotifierProvider<MessageModel>(
- create: (_) => MessageModel(),
- ),
- ChangeNotifierProvider<GameModel>(
- create: (_) => GetIt.I<GameModel>(),
- ),
- ],
- 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: const Color(0xffFFC400),
- // splashColor: Colors.transparent,
- backgroundColor: const Color(0xffF1F1F1),
- scaffoldBackgroundColor: const Color(0xffF1F1F1),
- 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: const Color(0xffFFC400)),
- textSelectionTheme: TextSelectionThemeData(cursorColor: const Color(0xffFFC400)),
- progressIndicatorTheme: ProgressIndicatorThemeData(color: const Color(0xffFFC400)),
- sliderTheme: SliderThemeData(thumbColor: const Color(0xffFFC400), activeTrackColor: const Color(0xffFFC400)),
- dividerTheme: DividerThemeData(color: const Color(0xffDCDCDC)),
- tabBarTheme: TabBarTheme(indicatorSize: TabBarIndicatorSize.label, labelColor: Color(0xffFFC400), 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(),
- ),
- );
- }
- }
|