app.dart 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import 'package:fluro/fluro.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/services.dart';
  5. import 'package:flutter_localizations/flutter_localizations.dart';
  6. import 'package:provider/provider.dart';
  7. import 'package:sport/pages/home_page.dart';
  8. import 'package:sport/provider/bluetooth.dart';
  9. import 'package:sport/provider/message_model.dart';
  10. import 'package:sport/utils/CupertinoLocalizationsDelegate.dart';
  11. import 'application.dart';
  12. import 'provider/user_model.dart';
  13. import 'router/routes.dart';
  14. class MyApp extends StatelessWidget {
  15. @override
  16. Widget build(BuildContext context) {
  17. final router = Router();
  18. Routes.configureRoutes(router);
  19. Application.router = router;
  20. return MultiProvider(
  21. providers: [
  22. ChangeNotifierProvider<UserModel>(
  23. create: (_) => UserModel(),
  24. lazy: false,
  25. ),
  26. ChangeNotifierProvider<Bluetooth>(
  27. create: (_) => Bluetooth(),
  28. ),
  29. ChangeNotifierProvider<MessageModel>(
  30. create: (_) => MessageModel(),
  31. ),
  32. ],
  33. child: MaterialApp(
  34. debugShowCheckedModeBanner: false,
  35. // title: 'Flutter Demo',
  36. onGenerateRoute: Application.router.generator,
  37. localizationsDelegates: [
  38. CupertinoLocalizationsDelegate(),
  39. GlobalMaterialLocalizations.delegate,
  40. GlobalWidgetsLocalizations.delegate,
  41. ],
  42. supportedLocales: [const Locale('zh', 'CH'), const Locale('en', 'US')],
  43. navigatorObservers: [routeObserver],
  44. theme: ThemeData(
  45. platform: TargetPlatform.iOS,
  46. brightness: Brightness.light,
  47. primaryColor: Colors.white,
  48. accentColor: Color(0xffFFC400),
  49. // splashColor: Colors.transparent,
  50. backgroundColor: Color(0xffF1F1F1),
  51. scaffoldBackgroundColor: Color(0xffF1F1F1),
  52. textTheme: TextTheme(
  53. headline1: TextStyle(fontSize: 18.0, color: Color(0xff333333), fontWeight: FontWeight.w600),
  54. headline2: TextStyle(fontSize: 25.0, color: Color(0xff333333), fontWeight: FontWeight.w600),
  55. headline3: TextStyle(fontSize: 16.0, color: Color(0xff333333), fontWeight: FontWeight.w600),
  56. headline4: TextStyle(fontSize: 16.0, color: Color(0xffffffff), fontWeight: FontWeight.w600),
  57. headline6: TextStyle(fontSize: 14.0, color: Color(0xffffffff), fontWeight: FontWeight.normal),
  58. subtitle1: TextStyle(fontSize: 14.0, color: Color(0xff333333), fontWeight: FontWeight.normal),
  59. subtitle2: TextStyle(fontSize: 12.0, color: Color(0xff333333), fontWeight: FontWeight.normal),
  60. bodyText1: TextStyle(fontSize: 12.0, color: Color(0xff999999), fontWeight: FontWeight.normal),
  61. bodyText2: TextStyle(fontSize: 14.0, color: Color(0xff999999), fontWeight: FontWeight.normal),
  62. ),
  63. dividerTheme: DividerThemeData(color: Color(0xffDCDCDC)),
  64. tabBarTheme: TabBarTheme(
  65. indicatorSize: TabBarIndicatorSize.label,
  66. labelColor: Color(0xffFFC400),
  67. unselectedLabelColor: Color(0xff333333),
  68. labelStyle: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600),
  69. unselectedLabelStyle: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600)),
  70. appBarTheme: AppBarTheme(
  71. elevation: 0,
  72. ),
  73. popupMenuTheme: PopupMenuThemeData(textStyle:TextStyle(fontSize: 14.0, color: Color(0xff666666), fontWeight: FontWeight.normal), shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10.0))))),
  74. home: HomePage(),
  75. ),
  76. );
  77. }
  78. }