MaterialApp简介

MaterialApp是WidgetsApp基础上继承实现的,其MaterialApp包括了一些列的Material Design风格基础组件,是用于构建Material Design 风格App的应用框架部件。用的比较多的。

MaterialApp属性概要

  1. const MaterialApp({
  2. // 键
  3. Key key,
  4. // 导航键
  5. this.navigatorKey,
  6. // 主页
  7. this.home,
  8. // 路由
  9. this.routes = const <String, WidgetBuilder>{},
  10. // 初始路由
  11. this.initialRoute,
  12. // 生成路由
  13. this.onGenerateRoute,
  14. // 未知路由
  15. this.onUnknownRoute,
  16. // 导航观察器
  17. this.navigatorObservers = const <NavigatorObserver>[],
  18. // 生成器
  19. this.builder,
  20. // 标题
  21. this.title = '',
  22. // 生成标题
  23. this.onGenerateTitle,
  24. // 颜色
  25. this.color,
  26. // 主题
  27. this.theme,
  28. // 暗主题
  29. this.darkTheme,
  30. // 主题模式
  31. this.themeMode = ThemeMode.system,
  32. // 区域
  33. this.locale,
  34. // 本地化委托
  35. this.localizationsDelegates,
  36. // 语言环境列表解析回调
  37. this.localeListResolutionCallback,
  38. // 语言环境解析回调
  39. this.localeResolutionCallback,
  40. // 支持地区
  41. this.supportedLocales = const <Locale>[Locale('en', 'US')],
  42. // 调试显示材料网格
  43. this.debugShowMaterialGrid = false,
  44. // 显示性能叠加
  45. this.showPerformanceOverlay = false,
  46. // 棋盘格光栅缓存图像
  47. this.checkerboardRasterCacheImages = false,
  48. // 棋盘格层
  49. this.checkerboardOffscreenLayers = false,
  50. // 显示语义调试器
  51. this.showSemanticsDebugger = false,
  52. // 调试显示检查模式横幅
  53. this.debugShowCheckedModeBanner = true,
  54. })