更改BottomSheet的灰色叠加背景

S.D*_*.D. 12 dart flutter

有没有办法在使用时更改叠加背景颜色showModalBottomSheet

现在颜色总是灰色,但我想使用不同的颜色,如绿色,如下所示。

改变颜色

这是演示中使用的代码以供参考

        showModalBottomSheet<void>(context: context, builder: (BuildContext context) {
          return Container(
            child: Padding(
              padding: const EdgeInsets.all(32.0),
              child: Text('This is the modal bottom sheet. Tap anywhere to dismiss.',
                textAlign: TextAlign.center,
                style: TextStyle(
                  color: Theme.of(context).accentColor,
                  fontSize: 24.0
                )
              )
            )
          );
        });
Run Code Online (Sandbox Code Playgroud)

LP *_*are 14

新的颤振更新允许您更改barrierColorshowModalBottomSheet()

showModalBottomSheet(
      barrierColor: Colors.yellow.withOpacity(0.5),
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

4252 次

最近记录:

5 年,5 月 前