A simple Todo List application that demonstrates Flutter component composition and data exchange patterns.
- Add new todo items
- Mark todos as complete/incomplete
- Delete todos
- Clean and maintainable component structure
- Demonstrates various Flutter patterns for component communication
lib/
├── models/
│ └── todo_item.dart # Data model for todo items
├── widgets/
│ ├── todo_item_widget.dart # Widget for displaying a single todo
│ └── add_todo_form.dart # Form widget for adding new todos
└── main.dart # Main application file
This project demonstrates several important Flutter patterns:
-
Callback Pattern
- Child-to-parent communication using callbacks
- Example:
TodoItemWidgetusesonToggleandonDeletecallbacks
-
State Management
- Local state management using
setState - State is maintained in the parent component and passed down to children
- Local state management using
-
Form Handling
- Text input management using
TextEditingController - Form submission handling
- Text input management using
- Flutter SDK (latest version recommended)
- Dart SDK
- IDE (VS Code, Android Studio, or IntelliJ IDEA)
- Clone the repository:
git clone https://github.com/Aroxed/flutter_component_tutorial
cd flutter_component_tutorial- Get dependencies:
flutter pub get- Run the app:
flutter run-
Add a new todo:
- Type your todo in the text field at the top
- Press Enter or click the "Add" button
-
Manage todos:
- Click the checkbox to toggle completion status
- Click the delete icon to remove a todo
The application follows a simple but effective architecture:
- Models: Data classes that represent the application's data structure
- Widgets: Reusable UI components
- Screens: Container components that manage state and compose other widgets
Feel free to submit issues and enhancement requests!