微信交流群

# MaterialBannerTheme

用于控制MaterialBanner组件的样式。

MaterialBannerTheme(
  data: MaterialBannerTheme.of(context)
      .copyWith(backgroundColor: Colors.red),
  child: MaterialBanner(
    content: Text('老孟'),
    actions: <Widget>[
      IconButton(
        icon: Icon(Icons.add),
        onPressed: () {},
      ),
      IconButton(
        icon: Icon(Icons.close),
        onPressed: () {},
      )
    ],
  ),
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

image-20200528190845576

# MaterialBannerThemeData

属性说明如下:

const MaterialBannerThemeData({
  this.backgroundColor,//背景颜色
  this.contentTextStyle,//内容文本样式
  this.padding,//内边距
  this.leadingPadding,// leading 内边距
})
1
2
3
4
5
6