From a9cc43cfe9d22e79341dd624655f235d7c4276e7 Mon Sep 17 00:00:00 2001
From: jhm991231 <jhm991231@ajou.ac.kr>
Date: Wed, 30 Apr 2025 18:07:37 +0900
Subject: [PATCH] =?UTF-8?q?onTab=20=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/checklist_item.dart | 35 +++++++++++++++++++++++++++++++++++
 lib/checklist_view.dart | 11 ++++++++++-
 lib/main.dart           |  1 -
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/lib/checklist_item.dart b/lib/checklist_item.dart
index e69de29..602beec 100644
--- a/lib/checklist_item.dart
+++ b/lib/checklist_item.dart
@@ -0,0 +1,35 @@
+import 'package:flutter/material.dart';
+
+class ChecklistItem extends StatefulWidget {
+  final String title;
+  ChecklistItem({required this.title});
+
+  @override
+  State<StatefulWidget> createState() => _ChecklistItem();
+}
+
+class _ChecklistItem extends State<ChecklistItem> {
+  bool _isChecked = false;
+
+  void _check() {
+    setState(() {
+      _isChecked = !_isChecked;
+    });
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return GestureDetector(
+      onTap: _check,
+      child: Container(
+        child: Text(
+          widget.title,
+          style: TextStyle(
+            color: _isChecked ? Colors.grey : Colors.black,
+            decoration: _isChecked ? TextDecoration.lineThrough : null,
+          ),
+        ),
+      ),
+    );
+  }
+}
diff --git a/lib/checklist_view.dart b/lib/checklist_view.dart
index 1692fa4..09a104e 100644
--- a/lib/checklist_view.dart
+++ b/lib/checklist_view.dart
@@ -1,4 +1,5 @@
 import 'package:flutter/material.dart';
+import 'package:second_flutter/checklist_item.dart';
 
 class ChecklistView extends StatefulWidget {
   @override
@@ -8,11 +9,19 @@ class ChecklistView extends StatefulWidget {
 }
 
 class _ChecklistView extends State<ChecklistView> {
+  List<String> checklist = ["집가고싶다", "과제해야돼", "으아아아악"];
+
   @override
   Widget build(BuildContext context) {
     return Scaffold(
       appBar: AppBar(title: const Text('checklist')),
-      body: Container(),
+      body: Container(
+        child: Column(
+          children: List<Widget>.generate(checklist.length, (index) {
+            return ChecklistItem(title: checklist[index]);
+          }),
+        ),
+      ),
     );
   }
 }
diff --git a/lib/main.dart b/lib/main.dart
index a58831b..45c5921 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,7 +1,6 @@
 // main.dart
 
 import 'package:flutter/material.dart';
-import 'package:second_flutter/checklist_item.dart';
 import 'package:second_flutter/checklist_view.dart';
 
 void main() {
-- 
GitLab