Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

과제1번 #2

Open
wants to merge 1 commit into
base: todolist-jaeha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md

This file was deleted.

1 change: 1 addition & 0 deletions god-life-guide
Submodule god-life-guide added at 5a054d
117 changes: 117 additions & 0 deletions main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import 'package:flutter/material.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'hello',
theme: ThemeData(
primaryColor: Colors.blue,
),
home: const todoApp(),
);
}
}

class Todo {
final String title;

Todo({required this.title});
}

class todoApp extends StatefulWidget {
const todoApp({Key? key}) : super(key: key);

@override
State<todoApp> createState() => _todoApp();
}

class _todoApp extends State<todoApp> {
String title = "";
List<Todo> todos = [];

@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
color: Color(0xffc7d6c7),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(50),
),
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 80),
child: Column(
children: [
Flexible(
child: SizedBox(
height: 40,
)),
Flexible(
child: Text(
'TO-DO LIST',
style: TextStyle(
fontFamily: 'NanumGothic',
fontWeight: FontWeight.w600,
fontSize: 20,
color: Colors.black),
textAlign: TextAlign.center,
)),
Flexible(
child: SizedBox(
height: 20,
),
),
Row(children: [
Expanded(
child: TextField(
onChanged: (value) {
setState(() {
title = value;
});
},
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: '할 일',
))),
IconButton(
onPressed: () {
setState((){
todos.add(Todo(title: title));
});
},
icon: Icon(Icons.add))
]),
Flexible(
child: ListView.builder(
itemCount: todos.length,
itemBuilder: (_, index) {
return list();
})),
],
),
),
));
}
Widget list(){
return ListTile(
title: Text(title),
trailing: IconButton(
icon: Icon(
Icons.close
),
onPressed: (){
setState((){
});
}
)
);
}
}