AppBar

279 阅读1分钟
AppBar({
    Key key,
    this.leading, // 在标题前面显示的一个控件
    this.automaticallyImplyLeading = true, // leading组件是否消失,为true时并且leading为null,自动推导显示内容,为false时,如果leading不为null,则该属性失效
    this.title, // 标题 
    this.actions, // 按钮
    this.flexibleSpace, // 一个显示在 AppBar 下方的控件,高度和 AppBar 高度一样,可以实现一些特殊的效果,该属性通常在 SliverAppBar 中使用
    this.bottom, // 一个 AppBarBottomWidget 对象,通常是 TabBar。用来在 Toolbar 标题下面显示一个 Tab 导航栏
    this.elevation, // 控件的 z 坐标顺序,默认值为 4,对于可滚动的 SliverAppBar,当 SliverAppBar 和内容同级的时候,该值为 0, 当内容滚动 SliverAppBar 变为 Toolbar 的时候,修改 elevation 的值
    this.shape, // 设置边框
    this.backgroundColor, // Appbar 的颜色,默认值为 ThemeData.primaryColor
    this.brightness, // 电池栏有白色和黑色两种主题
    this.iconTheme, // Appbar 上图标的颜色、透明度、和尺寸信息
    this.actionsIconTheme,
    this.textTheme, // Appbar 上的文字样式
    this.primary = true,
    this.centerTitle, // 标题是否居中
    this.titleSpacing = NavigationToolbar.kMiddleSpacing,
    this.toolbarOpacity = 1.0,
    this.bottomOpacity = 1.0,
  })