Stepper小部件的背景颜色在Vertical类型下是透明的。当更改类型(如StepperType.horizontal)时,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."),
),
],
),
),
答案 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)