Flutter 删除 Material 步进器的内置框阴影

Flutter remove built in box shadow of Material Stepper

我在带有 Flutter 的桌面应用程序中使用 material 设计中的步进器。但如图所示,Stepper 有一个我想删除的默认 BoxShadow。我已经查看了构建步进器的 stepper.dart 文件,但我找不到任何会导致阴影的装饰。

这是我的 Stepper 实现的摘录:

child: Padding(
  padding: const EdgeInsets.all(80.0),
  child: Stepper(
    steps: steps,
    type: StepperType.horizontal,
    currentStep: currentStep,
    onStepContinue: next,
    onStepCancel: cancel,
    onStepTapped: (step) => goTo(step),
  ),
),

我猜这是 material 设计中的某种配置,它会自动为步进器分配阴影。

有没有办法configure/remove步进器的阴影?

如果您进入源代码,您会看到带有 elevation: 2.0

Material 小部件

所以,我认为你有两个选择:

  1. 根据源代码创建您自己的 Stepper(删除了提升 属性)
  2. 像这样将阴影颜色设置为透明
Theme(
  data: ThemeData(shadowColor: Colors.transparent),
  child: Padding(
    padding: const EdgeInsets.all(80.0),
    child: Stepper(
      steps: steps,
      type: StepperType.horizontal,
      currentStep: currentStep,
      onStepContinue: next,
      onStepCancel: cancel,
      onStepTapped: (step) => goTo(step),
    ),
  ),
),