반응형
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SomeScreen(),
),
);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
),
child: const Padding(
padding: EdgeInsets.all(20.0),
child: Icon(
Icons.play_arrow,
size: 50.0,
color: Colors.white,
),
),
)
위 코드는 ElevatedButton을 이용해서 모서리가 둥글고 아이콘이 적용된 버튼입니다.
버튼을 클릭하면 SomeScreen으로 이동하는 이벤트가 동작됩니다.
아이콘은 play arrow( ▷ ) 입니다.
ElevatedButton 외형적이 특징은 style에 styleFrom을 이용합니다.
styleFrom에 대한 기술 문서는 아래를 참고 바랍니다.
https://api.flutter.dev/flutter/material/ElevatedButton/styleFrom.html
styleFrom method - ElevatedButton class - material library - Dart API
ButtonStyle styleFrom({Color? foregroundColor, Color? backgroundColor, Color? disabledForegroundColor, Color? disabledBackgroundColor, Color? shadowColor, Color? surfaceTintColor, double? elevation, TextStyle? textStyle, EdgeInsetsGeometry? padding, Size?
api.flutter.dev
반응형
'프로그램 개발해서 돈벌기 > flutter' 카테고리의 다른 글
flutter iOS에 권한 요청 방법 : 주소록에 접근 권한 요청하기 (0) | 2023.09.20 |
---|---|
flutter에서 iOS 기기에 릴리즈(Release) 모드로 커맨드라인(command line)에서 실행하기 (0) | 2023.09.15 |
firebase cli 사용 시 로그인은 되어 있다고 하는데 firebase 프로젝트 리스트 못가져 올때 (0) | 2023.08.04 |
flutter 프로젝트에 firebase 플러그인 설치 방법 (0) | 2023.08.04 |
[flutter] Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies. 해결 방법 (0) | 2023.05.30 |
댓글