Flutter-LinearProgressIndicator中的文本

问题描述 投票:2回答:3

在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内垂直对齐文本吗?

Not center

flutter flutter-layout
3个回答
3
投票

您必须使用Stack,请尝试以下操作:


1
投票

使用它,我增加了进度指示器的高度,因为文本不适合。


0
投票

回答您更新的帖子:

© www.soinside.com 2019 - 2024. All rights reserved.