美文网首页
flutter AlertDialog去掉阴影

flutter AlertDialog去掉阴影

作者: 東玖零 | 来源:发表于2021-09-10 13:56 被阅读0次

以下是AlertDialog的构造方法。

const AlertDialog({
    Key? key,
    this.title,
    this.titlePadding,
    this.titleTextStyle,
    this.content,
    this.contentPadding = const EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0),
    this.contentTextStyle,
    this.actions,
    this.actionsPadding = EdgeInsets.zero,
    this.actionsOverflowDirection,
    this.actionsOverflowButtonSpacing,
    this.buttonPadding,
    this.backgroundColor,
    this.elevation,
    this.semanticLabel,
    this.insetPadding = _defaultInsetPadding,
    this.clipBehavior = Clip.none,
    this.shape,
    this.scrollable = false,
  }) : assert(contentPadding != null),
       assert(clipBehavior != null),
       super(key: key);

title:标题
titlePadding:标题内边距
titleTextStyle:标题样式
content:内容,推荐用SingleChildScrollView包裹
contentPadding:EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0),内容内边距
contentTextStyle:内容样式
actions:按钮
actionsPadding:EdgeInsets.zero,actions内边距
buttonPadding:按钮内边距
backgroundColor:背景色
elevation:阴影
shape:形状
scrollable:滑动

当我们将backgroundColor设置为透明时,会有个阴影,我们如何去掉呢?

我尝试将elevation设置为0,阴影依然在,当我设置为0.0时阴影就消失了。

阴影的定义如下:

  /// {@macro flutter.material.dialog.elevation}
  /// {@macro flutter.material.material.elevation}
  final double? elevation;

相关文章

网友评论

      本文标题:flutter AlertDialog去掉阴影

      本文链接:https://www.haomeiwen.com/subject/dbagwltx.html