body: Container(
margin: EdgeInsets.fromLTRB(left, top, right, bottom)
padding: EdgeInsets.fromLTRB(10, 20, 30, 40),
child: Text('안녕'),
),
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
Widget build(BuildContext context) {
return MaterialApp(
//Image.asset('assets/dog.png')
home: Scaffold(
appBar: AppBar(title: Text('앱임'),),
body: Container(
width: 150, height: 50,
margin: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.blue,
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(10),
),
child: Text('test'),
)
),
);
}
}
decoration을 선언했다면 Container바로 아래의 color를 선언하였을 시 에러가 발생.
color 속성은 decoration 내부에 선언할 것.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
Widget build(BuildContext context) {
return MaterialApp(
//Image.asset('assets/dog.png')
home: Scaffold(
appBar: AppBar(title: Text('앱임'),),
body: Align(
alignment: Alignment.centerLeft,
child: Container(
width: 150, height: 50, color: Colors.blue,
),
)
),
);
}
}
TextButton( child: Text('버튼임'), onPressed: (){} )
ElevatedButton( child: Text('버튼임'), onPressed: (){} )
IconButton( icon: Icon(), onPressed: (){} )
버튼 안의 파라미터는 child, onPressed 두 개 있어야함