Flutter Containerのchildを左下に表示するサンプル

環境
Windows11 pro 64bit
Flutter 3.3.7

構文
Container(
alignment: Alignment.bottomLeft,
child: /*ウェジェット*/,
Containerのchildを左下に表示するには、
Containerの引数「alignment」に「Aallignment.bottomLeft」を指定します。
Containerのchildが左下に表示されるようになります。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
alignment: Alignment.bottomLeft,
width: 250,
height: 250,
color: Colors.blue,
child: Container(
color: Colors.red,
width: 100,
height: 100,
),
),
),
);
}
@override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( alignment: Alignment.bottomLeft, width: 250, height: 250, color: Colors.blue, child: Container( color: Colors.red, width: 100, height: 100, ), ), ), ); }
@override
 Widget build(BuildContext context) {
   return Scaffold(
     body: Center(
       child: Container(
         alignment: Alignment.bottomLeft,
         width: 250,
         height: 250,
         color: Colors.blue,
         child: Container(
           color: Colors.red,
           width: 100,
           height: 100,
         ),
       ),
     ),
   );
 }

 

IT

Posted by arkgame