自分用メモ Flutterでwidgetを親widgetいっぱいに引き伸ばす
flutterのwidgetは子のサイズに合わせて縮むように出来ている
Card(
color:Colors.blue,
child:Text("ぴったり"),
)
Card(
color:Colors.blue,
child:Text("ぴったり"),
)
これを親いっぱいに引き伸ばしたいけど、どこにもそんな引数がない!
正解:SizedBox.expandを使う
Card(
color:Colors.blue,
child:SizedBox.expand(
child:Text("ゆったり"),
),
)
SizedBoxその他
SizedBoxは大きさを指定出来るWidget。デフォルトコンストラクタで呼び出しても引き伸ばし出来る。
width: と height: にそれぞれdouble.infinityを設定。
SizedBox(
width: double.infinity,
height: double.infinity,
child: Text("てにゅうりょく"),
)
Author And Source
この問題について(自分用メモ Flutterでwidgetを親widgetいっぱいに引き伸ばす), 我々は、より多くの情報をここで見つけました https://qiita.com/kemmowner/items/00c1dd4bd60bdab876a2著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .