[Flutter]AppBarのactionsにテキストを表示するには?

Flutter

どうも、ちょげ(@chogetarou)です。

AppBarのactionsにテキストを表示するには、どうしたらいいのでしょうか?

スポンサーリンク

方法

appBar: AppBar(
    title: Text('Sample'),
       actions: [
            Center(
                child: Padding(
                       padding: const EdgeInsets.all(8.0),
                       child: Text('Go'),
                 )
            )
      ],
),

AppBarのactionsにテキストを使うには、Cneterウェジェットを使います。

Centerのchildに、Textを指定することで、テキストを表示することが出来るようになります。

コメント

タイトルとURLをコピーしました