更改 BottomSheet 的灰色叠加背景

2024-02-08

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

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

下面是demo中使用的代码,供参考

        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
                )
              )
            )
          );
        });

新的 Flutter UPDATE 允许您更改barrierColor in showModalBottomSheet()

showModalBottomSheet(
      barrierColor: Colors.yellow.withOpacity(0.5),
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

更改 BottomSheet 的灰色叠加背景 的相关文章

随机推荐