Scaffold.of(context).showSnackBar(SnackBar(...))
모든 스텍바를 관리하기 위해 ScaffoldMessaer 클래스가 새로 나옴.
변경된 버튼
TextButton(
// onPressed: (){
// print('text button');
// },
onLongPress: () {
print('text button');
},
child: Text(
'Text button',
style: TextStyle(fontSize: 20.0),
),
style: TextButton.styleFrom(
primary: Colors.red,
//backgroundColor: Colors.blue
),
),
ElevatedButton(
onPressed: () {
print('Elevated button');
},
child: Text('Elevated button'),
style: ElevatedButton.styleFrom(
primary: Colors.orangeAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
elevation: 0.0),
),
OutlinedButton(
onPressed: () {
print('Outlined button');
},
child: Text('Outlined button'),
style: OutlinedButton.styleFrom(
primary: Colors.green,
// side: BorderSide(
// color: Colors.black87,
// width: 2.0
// )
),
),
TextButton.icon(
onPressed: null, // null값을 주면 비활성화 된다.
icon: Icon(Icons.home),
label: Text('GO to home'),
style: TextButton.styleFrom(
primary: Colors.purple,
onSurface: Colors.pink, // 비활성화된 버튼 색상도 바꿔줄 수 있음
),
),
ButtonBar(
alignment: MainAxisAlignment.center,
buttonPadding: EdgeInsets.all(20),
children: [
TextButton(
onPressed: () {
},
child: Text('TextButton'),
),
ElevatedButton(
onPressed: () {
},
child: Text('ElevatedButton'),
),
],
)
ButtonBar - 버튼들을 자동으로 정렬해주는 기능