An interactive educational Flutter application demonstrating 18 software design patterns through the engaging context of a Tower Defense game. This project serves as a comprehensive learning resource for developers to understand, visualize, and implement design patterns in real-world scenarios.
- Presentation Layer: UI components with category-specific architectures
- Domain Layer: Business logic, entities, and use cases
- Data Layer: Data sources, repositories, and models
| Pattern Category | Architecture | State Management | Example Features |
|---|---|---|---|
| Creational | MVC | Cubits (flutter_bloc) | Enemy & Tower Creation |
| Structural | MVP | Blocs (flutter_bloc) | Component Composition |
| Behavioral | MVVM-C | GetX | Game Flow & Events |
| Global App | MVVM | Riverpod | Navigation & Config |
- Factory Method - Dynamic enemy and tower creation
- Abstract Factory - Game element family creation
- Builder - Complex map and evolution tree construction
- Prototype - Tower configuration cloning
- Singleton - GameManager instance control
- Adapter - Legacy tower system compatibility
- Bridge - Separation of game logic and rendering
- Composite - Hierarchical map structure (walls, house, path)
- Decorator - Tower and projectile upgrade system
- Facade - Simplified game engine interface
- Proxy - Lazy resource loading and caching
- Chain of Responsibility - Damage effect processing chain
- Command - Player actions and upgrade commands
- Mediator - Game component communication hub
- Memento - Save/load game state management
- Observer - XP and level change notifications
- State - Enemy and player state machines
- Strategy - Interchangeable AI behaviors
- Template Method - Standardized game turn flow
- Enemies: Ants, Grasshoppers, Cockroaches (each with unique behaviors)
- Towers: Archers (arrows), Stone Throwers (wide stones)
- Environment: Path with walls, defensive structures, player house
- Progression: XP system, level ups, evolution tree upgrades
- Traps: Slow/immobilize effects with strategic placement
Each game mechanic demonstrates specific design patterns in action, providing concrete examples of abstract programming concepts.
- Languages: English, Spanish, French, German
- Auto-detection: System language recognition
- Pattern: Observer + Memento + Singleton implementation
- No hardcoded text: Complete internationalization
- Authentication: Email/Password, Google, Apple Sign-In
- Firestore: User profiles and app configuration
- Storage: Profile image management
- Analytics: Comprehensive learning behavior tracking
- Performance: App performance monitoring
- App Check: Security and abuse protection
- Crashlytics: Real-time error reporting
- Pattern engagement tracking
- Learning behavior analysis
- Performance metrics collection
- Zero personal information storage
- Web 🌐 - Progressive Web App
- Android 🤖 - Native mobile experience
- iOS 🍎 - Native mobile experience
- Minimalist approach: No headers or footers
- Glassmorphism: Elegant transparent components
- Mesh Gradient: Dynamic green/cream background
- Responsive: Adaptive layouts for all screen sizes
Splash Screen
↓
Home (Project Introduction)
↓
Pattern Categories Hub
├── Creational (Tab Layout)
├── Structural (PageView)
└── Behavioral (Flow Cards)
- Multi-language code examples: Flutter, TypeScript, Kotlin, Swift, Java, C#
- Copy to clipboard: One-click code copying
- Syntax highlighting: Language-specific formatting
- Interactive diagrams: Visual pattern representations
- API Documentation: Automated Dart documentation
- UML Diagrams: PlantUML pattern visualizations
- Architecture Diagrams: System overview and relationships
- Pattern Graphs: Visual learning aids integrated in app
- Git History: Complete commit history and development timeline (git_history.md)
design_patterns_rules.md- Implementation rules and pattern matrixdocumentation_tools.md- PlantUML and documentation toolsdependencies_mapping.md- Complete library usage map and integration guidefirebase_setup.md- Firebase configuration guidefirebase_analytics_plan.md- Analytics implementation plangit_commands.md- Git workflow and scriptslegal_documents.md- Privacy policy and terms of useci_cd_proposal.md- CI/CD strategy with GitHub Actions
- Flutter 3.32.4+
- Node.js (for PlantUML)
- Firebase CLI
- Git
# Clone repository
git clone https://github.com/yourusername/design-patterns-flutter-app.git
cd design-patterns-flutter-app
# Install dependencies
flutter pub get
# Install documentation tools
npm install -g node-plantuml
# Generate documentation
./generate_all_docs.ps1 # Windows
./generate_all_docs.sh # Linux/macOS
# Generate git history (run once)
./generate_git_log.ps1 # Windows
./generate_git_log.sh # Linux/macOS
# Run the app
flutter runlib/
├── core/ # Shared utilities and patterns
├── features/ # Feature-based organization
│ ├── creational/ # Creational patterns (MVC + Cubits)
│ ├── structural/ # Structural patterns (MVP + Blocs)
│ ├── behavioral/ # Behavioral patterns (MVVM-C + GetX)
│ ├── game/ # Game logic and mechanics
│ ├── multilang/ # Translation system
│ └── user/ # User management and profiles
docs/
├── diagrams/ # PlantUML source files
├── generated/ # Generated documentation
└── api/ # Dart API documentation
- Minimum 80% coverage across all layers
- Pattern-specific tests: Each pattern has dedicated test suites
- Integration tests: Cross-pattern interaction validation
- Widget tests: UI component testing
- E2E tests: Complete user journey validation
- Maximum 400 lines per file with modularization
- Comprehensive documentation with
///comments - Pattern annotation: Clear WHERE/HOW/WHY documentation
- Clean Architecture compliance
- SOLID principles adherence
- Automated testing on pull requests
- Code quality checks and linting
- Firebase deployment for web platform
- Multi-platform builds (Android, iOS, Web)
- Documentation generation on releases
- Development: Firebase Hosting preview channels
- Staging: Firebase Hosting staging environment
- Production: Firebase Hosting with custom domain
We welcome contributions! Please see our contributing guidelines for:
- Code style and formatting requirements
- Pattern implementation standards
- Testing requirements and coverage
- Documentation expectations
- Pull request process
This project is licensed under the MIT License - see the LICENSE file for details.
If you enjoyed this app, feel free to buy me a coffee. Your support helps me keep creating. It’s not required, but it’s deeply appreciated.
This donation is voluntary and does not imply any compensation or exchange of services.
- GitHub Issues: Bug reports and feature requests
- Discussions: Community Q&A and pattern discussions
- Email: masterjulioleon2004@gmail.com
- Flutter Team - For the amazing cross-platform framework
- Firebase Team - For comprehensive backend services
- Design Patterns Community - For continuous learning resources
- Contributors - Everyone who helps improve this educational tool
Built with ❤️ using Flutter and designed to make design patterns accessible to developers worldwide.