728x90
기존에는 일반 OutlinedButton을 사용했는데
아이콘과 함께 들어있는 버튼을 사용해보자
기존 코드
import 'package:flutter/material.dart';
class StartScreen extends StatelessWidget {
const StartScreen({super.key});
@override
Widget build(context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
"assets/images/quiz-logo.png",
height: 500,
),
const SizedBox(
height: 30,
),
Text(
'Learn Flutterthe fun way!',
style: TextStyle(color: Colors.white, fontSize: 24),
),
const SizedBox(
height: 30,
),
OutlinedButton(
onPressed: () {},
style: OutlinedButton.styleFrom(foregroundColor: Colors.white),
child: Text('StartQuiz'),
)
],
);
}
}
변경 코드
import 'package:flutter/material.dart';
class StartScreen extends StatelessWidget {
const StartScreen({super.key});
@override
Widget build(context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
"assets/images/quiz-logo.png",
height: 500,
),
const SizedBox(
height: 30,
),
Text(
'Learn Flutterthe fun way!',
style: TextStyle(color: Colors.white, fontSize: 24),
),
const SizedBox(
height: 30,
),
OutlinedButton.icon( //요기 변경
onPressed: () {},
style: OutlinedButton.styleFrom(foregroundColor: Colors.white),
icon: const Icon(Icons.yard), //요기 변경
label: Text('StartQuiz'), //요기 변경
)
],
);
}
}
'Flutter' 카테고리의 다른 글
flutter) 이미지 사용 (1) | 2024.03.22 |
---|---|
flutter) Image asset > png 투명도 설정 (0) | 2024.02.25 |
flutter) 기본적인 플러터 구조 숙지를 위한 단순반복연습 (0) | 2024.02.15 |
flutter) dart math패키지사용하기, 문자열+변수 사용하기 (0) | 2024.02.13 |
flutter) StatefulWidget으로 re-excute build하기 (0) | 2024.02.12 |