如何将Stepper小部件的背景颜色更改为透明颜色?

时间:2019-06-14 14:15:04

标签: flutter

Stepper小部件的背景颜色在Vertical类型下是透明的。当更改类型(如StepperType.horizo​​ntal)时,stepper具有白灰色背景色。如何在水平轴上更改背景颜色?

  

这是我的示例代码:

Container(
   width: _width,
   child: Stepper(
      type: StepperType.horizontal,
      steps: [
        Step(
          title: Text("First"),
          content: Text("This is our first example."),
        ),
        Step(
          title: Text("Second"),
          content: Text("This is our second example."),
        ),
      ],
    ),
  ),

3 个答案:

答案 0 :(得分:1)

您可以尝试添加:

Container(
    color: Colors.transparent,
    ...
),

答案 1 :(得分:1)

要更改步进器小部件的背景颜色,请将其包装到主题中,并以画布颜色为其提供颜色。

Container(
        width: _width,
        child: Theme(
          data: ThemeData(canvasColor: Colors.lightBlue),
          child: Stepper(
            type: StepperType.horizontal,
            steps: [
              Step(
                title: Text("First"),
                content: Text("This is our first example."),
              ),
              Step(
                title: Text("Second"),
                content: Text("This is our second example."),
              ),
            ],
          ),
        ),
      ),

答案 2 :(得分:0)

我对flutter的stepper包进行了更改,以自定义stepper。您可以在 External Libraries / Dart包/Flutter/src/material/stepper.dart 中找到stepper包。这是现在的样子:

Preview