Flutter MaterialApp组件属性及描述

7 min read
属性名 类型 说明 默认值 取值
title String 任务管理窗口中所显示的应用名
theme ThemeData 应用的主题颜色
color Color 应用的主要颜色值(primary color)
home Widget 应用打开时所显示的界面
routes Map<String, WidgetBuilder> 应用页面跳转规则
initialRoute String 初始化路由,默认值为Window.defaultRouteName
onGenerateRoute RouteFactory 路由回调函数。当通过Navigator.of(context).pushNamed跳转路由时,在routes查找不到时,会触发这个回调
onLocaleChanged 当系统修改语言的时候,会触发这个回调
navigatorObservers List 应用Navigator的监听器
debugShowMaterialGrid bool 是否显示基础布局网格,用来调试UI的工具
showPerformanceOverlay bool 显示性能标签