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

checklist_item

parent b059acb9
Branches
No related tags found
No related merge requests found
// checklist_item.dart
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> {
@override
Widget build(BuildContext context) {
return GestureDetector(
child: Container(
child: Text('widget.title'),
)
);
}
}
// checklist_view.dart // checklist_view.dart
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_application_1/checklist_item.dart';
class ChecklistView extends StatefulWidget { class ChecklistView extends StatefulWidget {
@override @override
State<StatefulWidget> createState() => _ChecklistView(); State<StatefulWidget> createState() {
return _ChecklistView();
}
} }
class _ChecklistView extends State<ChecklistView> { class _ChecklistView extends State<ChecklistView> {
List<String> checklist = [
"실전코딩 과제",
"실전코딩 복습",
"게임"
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('checklist')), appBar: AppBar(title: const Text('Checklist')),
body: Container( body: Container(
child: Column(
) children: List<Widget>.generate(checklist.length, (index) {
return ChecklistItem(title: checklist[index]);
}),
),
),
); );
} }
} }
\ No newline at end of file
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_application_1/view.dart'; import 'package:flutter_application_1/checklist_view.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment