どうも、ちょげ(@chogetarou)です。
LinearProgressIndicator内にテキストを表示する方法を紹介します。
方法

LinearProgressindicator内にテキストを表示するには、Stackウェジェットを使います。
まず、Stackの引数「children」のリストにLinearProgressIndicatorを追加します。
そして、LinearProgressIndicatorの後にTextを追加します。
Stack(
children: [
LinearProgressIndicator(),
Text('テキスト'),
],
),
Stackを使えば、LinearProgressIndicator内にテキストを表示することが出来ます。
使用例
以下は、使用例です。

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SizedBox(
height: 20,
child: Stack(
children: [
Align(
child: SizedBox(
width: 300,
height: 20,
child: LinearProgressIndicator(
value: 0.75,
),
),
alignment: Alignment.center,
),
Align(
alignment: Alignment.topCenter,
child: Text(
'Loading....',
style: TextStyle(color: Colors.white),
),
)
],
),
),
),
);
}

[Flutter]CircularProgressIndicatorの色を設定するには?
CircularProgressIndicatorの色を設定する方法を紹介します。

[Flutter]LinearProgressIndicatorの色を設定するには?
LinearProgressIndicatorの色を設定する方法を紹介します。

[Flutter]LinearProgressIndicatorの高さを設定するには?
LinearProgressIndicatorの高さを設定する方法を紹介します。

[Flutter]LinearProgressIndicatorの背景色を設定するには?
LinearProgressIndicatorの背景色を設定する方法を紹介します。
コメント