0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Flutter]Containerの幅をいじる方法

Posted at
example.dart
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.teal,
        body: SafeArea(
          child: Column(
            //リストの順序を変更するやりかた
            //verticalDirection: VerticalDirection.up,
            children: <Widget>[
              Container(
                child: Icon(Icons.arrow_back),
                width: double.infinity,
                height: 100,
                color: Colors.white,
              ),
              SizedBox(
                height: 250
              ),
              Container(
                child: Icon(Icons.adb),
                width: double.maxFinite,
                height: 100,
                color: Colors.blue,
              ),
              SizedBox(
                  height: 90
              ),
              Container(
                child: Icon(Icons.arrow_back_ios_new),
                width: double.maxFinite,
                height: 100,
                color: Colors.yellow,
              )
            ],
          ),
        ),
      ),
    );
  }
}

Screenshot_1621759250.png

SizedBoxのheightを決めることでContainer間の幅を決めることが出来る。

また
verticalDirection: VerticalDirection.upのup部分をdownにするなどして画面に表示される
Listの順番を入れ替えることが出来る。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?