在Flutter中,我有LinearProgressIndicator。可以,但是我想在此栏内添加文本(进度)。
我尝试这样的事情
SafeArea(
child: Row(children: <Widget>[
Center(
child: Text(DateFormat.ms()
.format(DateTime.fromMillisecondsSinceEpoch(
minuteSecond * 1000))
.toString())),
Expanded(
child: LinearProgressIndicator(
semanticsLabel: (animation.value * 100.0).toStringAsFixed(1).toString(),
semanticsValue: (animation.value * 100.0).toStringAsFixed(1).toString(),
value: animation.value,
backgroundColor: Colors.white,
valueColor:
AlwaysStoppedAnimation<Color>(Colors.red))),
])),
但是很明显,这会将文本添加到栏的同一行中,而不是内部。
所以:有人知道如何在此条形图内添加中心(居中)?使用stack元素?
UPDATE
任何人都知道如何在ProgressBar内垂直对齐文本吗?
您必须使用Stack
,请尝试以下操作:
使用它,我增加了进度指示器的高度,因为文本不适合。
回答您更新的帖子: