머티리얼 디자인을 적용하는 위젯이다. -> 안드로이드 앱
theme: ThemeData(
primarySwatch: Colors.pink, //기본 색상 pink 설정
appBarTheme: const AppBarTheme(
backgroundColor: Colors.orange, //appBar 배경 색은 오렌지로 할게요
foregroundColor: Colors.black, //특정 위젯 색상 설정 가능
),
),
import 'package:flutter/material.dart';
void main() {
runApp(const ch13_1());
}
class ch13_1 extends StatelessWidget {
const ch13_1({super.key});
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.pink,
appBarTheme: const AppBarTheme(
backgroundColor: Colors.orange,
foregroundColor: Colors.black,
),
),
home: Scaffold(
appBar: AppBar(
title: const Text('practice'),
centerTitle: true,
),
body: Center(
child: Column(
children: [
const SizedBox(
height: 20,
),
ElevatedButton(
onPressed: () {},
child: const Text(
'Button',
),
),
Checkbox(
value: true,
onChanged: (value) {},
),
const Text(
'Hello world',
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {},
child: const Icon(Icons.add),
),
),
);
}
}