gpt4 book ai didi

flutter - 如何根据进度条的百分比对齐图标?

转载 作者:行者123 更新时间:2023-12-03 04:13:17 25 4
gpt4 key购买 nike

我正在使用百分比指标库,我需要根据进度栏的百分比来对齐图标。
enter image description here

最佳答案

不确定如何将图标放置在进度栏顶部,但是如果您使用的是Stack,则可能会有所帮助

Stack(
children: [
LinearProgressIndicator(
value: _value,
valueColor: AlwaysStoppedAnimation<Color>(Colors.red),
backgroundColor: Colors.grey,
minHeight: 40
),
LayoutBuilder(
builder: (context, constrains) {
//5 is just the right padding
var leftPadding = constrains.maxWidth * _value - _iconSize - 5;
var topPadding = (constrains.maxHeight - _iconSize) / 2;
return Padding(
padding: EdgeInsets.only(left: leftPadding, top: topPadding),
child: Icon(
Icons.airplanemode_active,
size: _iconSize.toDouble()
),
);
}
)
]
),
看看这个codepen https://codepen.io/fcontreras-the-bashful/pen/GRZpRyg

关于flutter - 如何根据进度条的百分比对齐图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63349041/

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