Flutter/튜토리얼
Flutter Button
DGL
2022. 2. 1. 11:15
버튼의 종류
TextButton: 텍스트 버튼
IconButton: 아이콘 버튼
ElevatedButton: 예쁜 버튼
속성
child: Text같은거 지정
onPressed: 버튼이 눌렸을 때, 어떻게 동작하는가
style: 버튼의 스타일
예제 코드:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('My App'),),
body: SizedBox(
child: ElevatedButton(child: Text('example button'), onPressed: (){},),
),
));
}
}
참고 자료:
https://www.youtube.com/watch?v=ShmXbPpmIMU