Skip to content
Snippets Groups Projects
Commit db75ebfb authored by wonbin's avatar wonbin
Browse files

checklist_item update

parent b42693b2
No related branches found
No related tags found
No related merge requests found
...@@ -5,18 +5,40 @@ import 'package:flutter/material.dart'; ...@@ -5,18 +5,40 @@ import 'package:flutter/material.dart';
class ChecklistItem extends StatefulWidget { class ChecklistItem extends StatefulWidget {
final String title; final String title;
ChecklistItem({required this.title}); ChecklistItem({required this.title});
@override @override
State<StatefulWidget> createState() => _ChecklistItem(); State<StatefulWidget> createState() => _ChecklistItem();
} }
class _ChecklistItem extends State<ChecklistItem> { class _ChecklistItem extends State<ChecklistItem> {
bool _isChecked = false;
void _Check() {
setState(() {
_isChecked = !_isChecked;
});
if (_isChecked) {
print('체크됨');
} else {
print('체크 해제됨');
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: _Check,
child: Container( child: Container(
child: Text('widget.title'), padding: const EdgeInsets.all(8.0),
) child: Text(
widget.title, // 문자열 처리 수정
style: TextStyle(
fontSize: 20,
color: _isChecked ? Colors.green : Colors.black,
decoration: _isChecked ? TextDecoration.lineThrough : TextDecoration.none, // Null 대신 TextDecoration.none 사용
),
),
),
); );
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment