gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 07:18:23 40 4
gpt4 key购买 nike

步进器小部件的背景颜色在垂直类型下是透明的。当像 StepperType.horizo​​ntal 这样改变类型时,步进器具有白灰色背景色。我怎样才能改变水平轴上的背景颜色?

Here is my sample code:

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."),
),
],
),
),

最佳答案

要更改步进器小部件的背景颜色,请将其包装到主题中并为其指定 Canvas 颜色。

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."),
),
],
),
),
),

关于flutter - 如何将 Stepper 小部件的背景色更改为透明色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56599977/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com