LoginSignup
35
17

More than 3 years have passed since last update.

Flutterの1行で複数の要素を左寄せと右寄せにする

Posted at

Flutterの1行で複数の要素を左寄せと右寄せにする

IconとTextとButtonで以下のような配置にしたいときに少し迷ったのでメモ

スクリーンショット 2019-11-04 10.31.29.png

ContainerでひとかたまりにしてからRowなどで配置する

Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween, // これで両端に寄せる
      children: <Widget>[
        Container(
          child: Row(
            children: <Widget>[
              Icon(Icons.access_time),
              Text(
                "alpha",
                style: TextStyle(
                    color: Colors.black,
                    fontSize: 25,
                    fontWeight: FontWeight.bold),
              ),
            ],
          ),
        ),
        RaisedButton(
          onPressed: null, // 押した時の処理
          color: Colors.blue,
          child: const Text(
            '更新',
            style: TextStyle(
                color:Colors.white,
                fontSize: 20.0
            ),),
        )
      ]);
35
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
17