Skip to content

Commit ee3f34c

Browse files
committed
const 키워드 추가
1 parent f0aec5d commit ee3f34c

File tree

5 files changed

+50
-42
lines changed

5 files changed

+50
-42
lines changed

lib/main.dart

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ Future<void> main() async {
2424
);
2525
await signInAnonymously();
2626

27-
runApp(MyApp());
27+
runApp(const MyApp());
2828
}
2929

3030
class MyApp extends StatelessWidget {
31+
const MyApp({super.key});
32+
3133
@override
3234
Widget build(BuildContext context) {
3335
return MaterialApp(
@@ -47,9 +49,9 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
4749
String _seletedMenu = "Posts";
4850

4951
static final List<Widget> _widgetOptions = <Widget>[
50-
Page1(),
51-
Projectpage(),
52-
Page3(),
52+
const Page1(),
53+
const Projectpage(),
54+
const Page3(),
5355
GuestBook(),
5456
];
5557

@@ -118,7 +120,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
118120
child: Stack(
119121
alignment: Alignment.bottomCenter,
120122
children: [
121-
Center(
123+
const Center(
122124
child: Text("Posts"),
123125
),
124126
Visibility(
@@ -132,7 +134,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
132134
),
133135
),
134136
),
135-
SizedBox(width: 10),
137+
const SizedBox(width: 10),
136138
GestureDetector(
137139
onTap: () => _onItemTapped(1, "Projects"),
138140
child: Container(
@@ -148,7 +150,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
148150
child: Stack(
149151
alignment: Alignment.bottomCenter,
150152
children: [
151-
Center(child: Text("Projects")),
153+
const Center(child: Text("Projects")),
152154
Visibility(
153155
visible: _selectedIndex == 1 ? true : false,
154156
child: Container(
@@ -160,7 +162,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
160162
),
161163
),
162164
),
163-
SizedBox(width: 10),
165+
const SizedBox(width: 10),
164166
GestureDetector(
165167
onTap: () => _onItemTapped(2, "About"),
166168
child: Container(
@@ -176,7 +178,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
176178
child: Stack(
177179
alignment: Alignment.bottomCenter,
178180
children: [
179-
Center(child: Text("About")),
181+
const Center(child: Text("About")),
180182
Visibility(
181183
visible: _selectedIndex == 2 ? true : false,
182184
child: Container(
@@ -188,7 +190,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
188190
),
189191
),
190192
),
191-
SizedBox(width: 10),
193+
const SizedBox(width: 10),
192194
GestureDetector(
193195
onTap: () => _onItemTapped(3, "GuestBook"),
194196
child: Container(
@@ -204,7 +206,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
204206
child: Stack(
205207
alignment: Alignment.bottomCenter,
206208
children: [
207-
Center(child: Text("GuestBook")),
209+
const Center(child: Text("GuestBook")),
208210
Visibility(
209211
visible: _selectedIndex == 3 ? true : false,
210212
child: Container(
@@ -271,10 +273,10 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
271273
children: <Widget>[
272274
Container(
273275
height: 180,
274-
decoration: BoxDecoration(
276+
decoration: const BoxDecoration(
275277
color: Colors.transparent,
276278
),
277-
child: Center(
279+
child: const Center(
278280
child: Text(
279281
' Sando`s Diary',
280282
style: TextStyle(
@@ -307,7 +309,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
307309
child: Container(
308310
color: const Color(0xFFAA9AF7),
309311
padding: const EdgeInsets.all(12),
310-
child: Text('Posts')),
312+
child: const Text('Posts')),
311313
),
312314
],
313315
)),
@@ -336,7 +338,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
336338
child: Container(
337339
color: const Color(0xFFBBF5D4),
338340
padding: const EdgeInsets.all(12.0),
339-
child: Text('Projects'))),
341+
child: const Text('Projects'))),
340342
],
341343
)),
342344
),
@@ -364,7 +366,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
364366
child: Container(
365367
color: const Color(0xFFECF6BD),
366368
padding: const EdgeInsets.all(12.0),
367-
child: Text('About'))),
369+
child: const Text('About'))),
368370
],
369371
)),
370372
),
@@ -392,7 +394,7 @@ class _CustomAppBarScreenState extends State<CustomAppBarScreenTest> {
392394
child: Container(
393395
color: const Color(0xFFBEE7FE),
394396
padding: const EdgeInsets.all(12.0),
395-
child: Text('GuestBook'))),
397+
child: const Text('GuestBook'))),
396398
],
397399
)),
398400
),
@@ -438,7 +440,7 @@ class Page3 extends StatelessWidget {
438440
class Page4 extends StatelessWidget {
439441
@override
440442
Widget build(BuildContext context) {
441-
return Center(
443+
return const Center(
442444
child: Text(
443445
'Page 4',
444446
style: TextStyle(fontSize: 24),

lib/pages/about_page.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import 'package:flutter/material.dart';
22

33
class AboutPage extends StatelessWidget {
4+
const AboutPage({super.key});
5+
46
@override
57
Widget build(BuildContext context) {
68
return Scaffold(
79
appBar: AppBar(
8-
title: Text('About Me'),
10+
title: const Text('About Me'),
911
),
1012
body: Padding(
1113
padding: const EdgeInsets.all(16.0),
1214
child: Column(
1315
crossAxisAlignment: CrossAxisAlignment.start,
1416
children: [
15-
Center(
17+
const Center(
1618
child: CircleAvatar(
1719
radius: 50,
1820
backgroundImage:
1921
AssetImage('assets/profile.WEBP'), // 프로필 이미지 경로
2022
),
2123
),
22-
SizedBox(height: 20),
23-
Text(
24+
const SizedBox(height: 20),
25+
const Text(
2426
'Sando, ', // 이름 입력
2527
style: TextStyle(
2628
fontSize: 24,
@@ -34,8 +36,8 @@ class AboutPage extends StatelessWidget {
3436
color: Colors.grey[600],
3537
),
3638
),
37-
SizedBox(height: 20),
38-
Text.rich(
39+
const SizedBox(height: 20),
40+
const Text.rich(
3941
TextSpan(
4042
children: [
4143
TextSpan(text: "안녕하세요! 모바일 개발자 산도입니다.\n"),

lib/pages/guestbook_page.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class _GuestBookState extends State<GuestBook> {
8989
stream: getMessages(),
9090
builder: (ctx, snapshot) {
9191
if (!snapshot.hasData) {
92-
return Center(child: CircularProgressIndicator());
92+
return const Center(child: CircularProgressIndicator());
9393
}
9494

9595
final docs = snapshot.data!.docs;
@@ -140,12 +140,13 @@ class _GuestBookState extends State<GuestBook> {
140140
Text(
141141
doc['userName'] ?? 'Anonymous',
142142
// 저장된 사용자 이름 표시
143-
style: TextStyle(fontWeight: FontWeight.bold),
143+
style: const TextStyle(
144+
fontWeight: FontWeight.bold),
144145
),
145146
const SizedBox(height: 4),
146147
Text(
147148
doc['text'],
148-
style: TextStyle(fontSize: 16),
149+
style: const TextStyle(fontSize: 16),
149150
),
150151
],
151152
),
@@ -174,7 +175,7 @@ class _GuestBookState extends State<GuestBook> {
174175
),
175176
),
176177
IconButton(
177-
icon: Icon(Icons.send),
178+
icon: const Icon(Icons.send),
178179
onPressed: () {
179180
sendMessage(messageController.text,
180181
userName); // Firestore에 저장된 이름으로 메시지 전송

lib/pages/project_list_page.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class _ProjectpageState extends State<Projectpage> {
4343
];
4444

4545
final Map<String, Color> tagColors = {
46-
'Flutter': Color(0xFF027DFD),
47-
'Android': Color(0xFF3DDC84),
48-
'iOS': Color(0xFF555555),
46+
'Flutter': const Color(0xFF027DFD),
47+
'Android': const Color(0xFF3DDC84),
48+
'iOS': const Color(0xFF555555),
4949
'Web': Colors.white,
5050
};
5151

@@ -87,7 +87,7 @@ class _ProjectpageState extends State<Projectpage> {
8787
data: currentProject.content,
8888
config: MarkdownConfig(configs: [
8989
LinkConfig(
90-
style: TextStyle(
90+
style: const TextStyle(
9191
color: Colors.cyan,
9292
decoration: TextDecoration.underline,
9393
),
@@ -166,7 +166,7 @@ class _ProjectpageState extends State<Projectpage> {
166166
},
167167
child: Row(
168168
children: [
169-
Placeholder(),
169+
const Placeholder(),
170170
Padding(
171171
padding: const EdgeInsets.only(
172172
left: 12,
@@ -182,7 +182,8 @@ class _ProjectpageState extends State<Projectpage> {
182182
children: [
183183
Text(
184184
cardData.title,
185-
style: TextStyle(fontSize: 25),
185+
style:
186+
const TextStyle(fontSize: 25),
186187
),
187188
Expanded(
188189
child: Text(cardData.description),
@@ -298,9 +299,10 @@ class _ProjectpageState extends State<Projectpage> {
298299
children: [
299300
Text(
300301
cardData.title,
301-
style: TextStyle(fontSize: 25),
302+
style:
303+
const TextStyle(fontSize: 25),
302304
),
303-
SizedBox(
305+
const SizedBox(
304306
height: 8,
305307
),
306308
Row(

lib/widget/sticky_note.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import 'dart:math';
33
import 'package:flutter/material.dart';
44

55
class StickyNote extends StatelessWidget {
6-
StickyNote({required this.child, required this.color, required this.isMe});
6+
const StickyNote(
7+
{required this.child, required this.color, required this.isMe});
78

89
final Widget child;
910
final Color color;
@@ -85,21 +86,21 @@ class StickyNotePainter extends CustomPainter {
8586
}
8687

8788
Paint _createGradientPaint(Size size) {
88-
Paint paint = new Paint();
89+
Paint paint = Paint();
8990

9091
Rect rect = Rect.fromLTWH(0, 0, size.width, size.height);
91-
RadialGradient gradient = new RadialGradient(
92+
RadialGradient gradient = RadialGradient(
9293
colors: [brighten(color), color],
9394
radius: 1.0,
94-
stops: [0.5, 1.0],
95+
stops: const [0.5, 1.0],
9596
center: isMe ? Alignment.bottomLeft : Alignment.bottomRight);
9697
paint.shader = gradient.createShader(rect);
9798
return paint;
9899
}
99100

100101
void _drawShadow(Size size, Canvas canvas) {
101102
Rect rect = Rect.fromLTWH(12, 12, size.width - 24, size.height - 24);
102-
Path path = new Path();
103+
Path path = Path();
103104
path.addRect(rect);
104105
canvas.drawShadow(path, Colors.black.withOpacity(0.7), 12.0, true);
105106
}
@@ -127,4 +128,4 @@ Color darker(Color c, [int percent = 30]) {
127128
(c.green * (1 - p)).round(),
128129
(c.blue * (1 - p)).round(),
129130
);
130-
}
131+
}

0 commit comments

Comments
 (0)