22
8

More than 5 years have passed since last update.

FlutterでTextFieldを最下部に配置する

Last updated at Posted at 2018-07-01

こんなのを作る

どうやるのか

TextFiledを最下部に配置するには、以下のように全体をColumnでwrapし、TextFiledの上に配置するWidgetをExpandedでwrapします。

new Column(
  children: <Widget>[
    new Expanded(
      child: new SingleChildScrollView(
        child: new Column(
          children: <Widget>[
            new Container(
              padding: new EdgeInsets.all(5.0),
              child: new Text(
                "Test",
                style: new TextStyle(fontWeight: FontWeight.bold),
              ),
            ),
            new Container(
              padding: new EdgeInsets.all(5.0),
              child: new Text(
                "Test",
                style: new TextStyle(fontWeight: FontWeight.bold),
              ),
            ),
          ],
        ),
      ),
    ),
    new TextField(
      autofocus: true,
      style: new TextStyle(
        fontSize: 20.0,
        color: Colors.black,
      ),
      controller: _controller,
      decoration: new InputDecoration(
        border: InputBorder.none,
        hintText: 'コメントを追加',
      ),
    ),
  ],
)
22
8
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
22
8