diff --git a/lib/checklist_Item.dart b/lib/checklist_Item.dart new file mode 100644 index 0000000000000000000000000000000000000000..916518dd21152b007294f047d9736c1867b77b68 --- /dev/null +++ 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( + height: 32, + child: Text(widget.title, + style: TextStyle( + color: _isChecked ? Colors.grey : Colors.black, + decoration: _isChecked ? TextDecoration.lineThrough : null + ),), + ), + ); + } +} \ No newline at end of file diff --git a/lib/checklist_view.dart b/lib/checklist_view.dart index 3e8d32e4f29abc0fc791bf719aeff2f84cdc8e95..770d4b7dc5fb42fd8ecdb6692e827dc68233a4a5 100644 --- a/lib/checklist_view.dart +++ b/lib/checklist_view.dart @@ -1,5 +1,6 @@ // checklist_view.dart import 'package:flutter/material.dart'; +import 'package:flutter_application_0430/checklist_Item.dart'; class ChecklistView extends StatefulWidget { const ChecklistView({super.key}); @@ -9,12 +10,31 @@ class ChecklistView extends StatefulWidget { } class _ChecklistViewState extends State<ChecklistView> { + + + List<String> checkList = [ + "실전코딩 플러터 기본 과제", + "PPT 만들기", + "재맞고 수료증 출력 후 제출" + ]; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('checklist')), - body: Container(), + body: Container( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.symmetric(horizontal: 40,vertical: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: List<Widget>.generate(checkList.length,(index) { + return CheckListItem(title: checkList[index]); + },), + ), + ), ); } } +class string { +} +