A comprehensive Flutter template workspace with navigation, product management, and push notifications.
- About This Project
- ๐ Getting Started
- ๐ Project Structure
- โจ Features Overview
- ๐ ๏ธ Technical Implementation
- ๐จ Customization Guide
- ๐ฑ Firebase Setup
- ๐ง Development Notes
- ๐ Resources
This project serves as a beginner-friendly Flutter template that demonstrates modern app development practices. It includes:
- Clean Architecture: Well-organized code structure
- Navigation Systems: Multiple navigation patterns
- Product Management: Complete e-commerce-style components
- Push Notifications: Firebase Cloud Messaging integration
- Material Design 3: Modern UI/UX patterns
- Cross-platform Support: Works on all Flutter platforms
Perfect for: Learning Flutter, starting new projects, or understanding best practices.
Before you start, make sure you have:
- Flutter SDK (3.8.1 or higher) - Install Flutter
- Dart SDK (included with Flutter)
- IDE: VS Code, Android Studio, or IntelliJ
- Firebase Account (for push notifications) - Firebase Console
- Clone or download this template
- Install dependencies:
flutter pub get
- Run the app:
flutter run
- Start customizing for your project needs!
# Install dependencies
flutter pub get
# Run the app
flutter run
# Run tests
flutter test
# Clean build files
flutter clean
# Build for production
flutter build apk # Android
flutter build ios # iOS
flutter build web # Web
flutter build windows # Windowslib/
โโโ main.dart # ๐ App entry point & Firebase initialization
โโโ app.dart # โ๏ธ App configuration and routing
โโโ api/ # ๐ฅ Firebase and API services
โ โโโ firebase_api.dart # Firebase Cloud Messaging setup
โโโ models/ # ๐ Data models
โ โโโ models.dart # Barrel export for models
โ โโโ product.dart # Product data model
โโโ sample/ # ๐๏ธ Sample data
โ โโโ img_carousel_data.dart # Image carousel JSON data
โ โโโ product_sample_data.dart # Product showcase JSON data
โโโ features/ # ๐ฏ Feature-based organization
โโโ navigation/ # ๐งญ Navigation components
โ โโโ main_navigation.dart # Bottom navigation bar
โโโ routes/ # ๐บ๏ธ App routing
โ โโโ app_routes.dart # Route definitions
โโโ pages/ # ๐ Application screens
โ โโโ home_page.dart # Home with slider & products
โ โโโ products_page.dart # Products with search & filter
โ โโโ user_info_page.dart # User information form
โ โโโ profile_page.dart # User profile
โ โโโ settings_page.dart # App settings
โ โโโ about_page.dart # About information
โโโ widgets/ # ๐งฉ Reusable components
โโโ hamburger_menu.dart # Navigation drawer
โโโ image_slider.dart # Auto-sliding carousel
โโโ featured_product_list.dart # Horizontal product showcase
โโโ product_card_list.dart # Grid/list product cards
โโโ product_detail_dialog.dart # Product detail modal
โโโ user_info_form.dart # User form widget
โโโ user_info_dialog.dart # User info display
android/
โโโ app/
โ โโโ google-services.json # ๐ฅ Firebase configuration
โ โโโ src/main/AndroidManifest.xml # Android permissions
The app demonstrates multiple navigation patterns:
- ๐ Bottom Navigation: 5-tab navigation for main sections
- ๐ Hamburger Menu: Side drawer with gradient header
- ๐ Programmatic Navigation: Named routes for flexible transitions
- ๐ฑ Global Navigation: Works from anywhere using
navigatorKey
Complete e-commerce-style product system:
- Grid View: 2-column responsive layout
- ๐ Real-time Search: Search by name or category
- ๐ท๏ธ Category Filtering: Dynamic filter chips
- ๐ Statistics: Product count and total price
- โ Empty States: Helpful no-results messages
- Flexible Display: Grid and list view support
- ๐ผ๏ธ Image Loading: Network images with loading states
- โญ Ratings: Star ratings and pricing
- ๐ Tap Actions: View details or custom actions
- ๐ท Large Images: Full-size product photos
- ๐ Detailed Info: Category, rating, price display
- ๐ Add to Cart: Interactive cart functionality
- ๐ฑ Responsive: Proper constraints for all screens
Firebase Cloud Messaging integration:
- Foreground: In-app notifications while using the app
- Background: System notifications when app is minimized
- ๐ฒ Tap Navigation: Dynamic routing based on notification content
- Route by Keywords: Analyzes notification title/body
- Smart Navigation: Routes to relevant pages automatically
- ๐ Fallback Logic: Defaults to home if no match found
Example routing keywords:
productโ Products Pageprofileโ Profile Pagesettingsโ Settings Page
- Local Scheduling: Schedule notifications within the app
- โก Exact Alarms: Precise timing on Android 13+
- ๐ Battery Optimization: Handles device restrictions
- โฏ๏ธ Auto-sliding: Changes slides every 5 seconds
- ๐ Manual Control: Swipe gestures and arrow buttons
- ๐ต Page Indicators: Animated dots show current slide
- ๐๏ธ JSON Integration: Loads from structured data
- โ Validation: Input validation with error messages
- ๐ฌ Dialog Display: Shows entered information
- ๐งน Form Clearing: Reset functionality
- ๐ Feature-based Organization: Code grouped by functionality
- ๐ฏ Single Responsibility: Each component has one clear purpose
- ๐ Separation of Concerns: UI, logic, and data are separated
- ๐ฆ Barrel Exports: Clean imports with
models.dart
// 1. Initialize Firebase
await Firebase.initializeApp();
// 2. Setup notifications
await FirebaseApi().initNotifications();
// 3. Handle incoming messages
FirebaseMessaging.onMessage.listen((message) {
// Show notification while app is open
});
// 4. Handle notification taps
void handleNotif(RemoteMessage? message) {
// Dynamic routing based on content
}- ๐ Permissions: Notification and exact alarm permissions
- ๐ Notification Channels: Proper Android notification setup
- ๐ Battery Optimization: Handles device power management
- ๐จ Modern Theming: Latest Material Design components
- ๐ฑ Responsive Layout: Adapts to different screen sizes
- โฟ Accessibility: Proper semantic labels and navigation
- ๐ Dark Mode Ready: Theme structure supports dark themes
-
Create Feature Folder:
lib/features/your_feature/ โโโ pages/ โโโ widgets/ โโโ data/ -
Add Routes:
// In app_routes.dart static const yourFeature = '/your-feature';
-
Update Navigation:
// Add to bottom navigation or drawer
Add New Product Properties:
// In models/product.dart
class Product {
final String description; // Add new field
final List<String> images; // Multiple images
// ... existing fields
}Modify Product Cards:
- Edit
product_card_list.dartfor layout changes - Update
product_detail_dialog.dartfor detail view - Customize search logic in
products_page.dart
Add New Route Keywords:
// In firebase_api.dart handleNotif method
if (title.contains('orders') || body.contains('orders')) {
route = '/orders';
} else if (title.contains('cart') || body.contains('cart')) {
route = '/cart';
}Custom Notification Channels:
// Create different channels for different notification types
const urgentChannel = AndroidNotificationChannel(
'urgent_channel',
'Urgent Notifications',
importance: Importance.high,
);Change Auto-slide Timing:
// In image_slider.dart
Future.delayed(const Duration(seconds: 3), () {
// Change from 5 to 3 seconds
});Add Custom Transitions:
PageView.builder(
physics: const BouncingScrollPhysics(), // Custom physics
// ... other properties
);-
Create Firebase Project:
- Go to Firebase Console
- Create new project
- Enable Cloud Messaging
-
Android Setup:
# Download google-services.json # Place in android/app/
-
Add Dependencies:
dependencies: firebase_core: ^2.24.2 firebase_messaging: ^14.7.10 flutter_local_notifications: ^16.3.2
-
Get FCM Token:
- Run app and check console for token
- Copy the long token string
-
Send Test Message:
- Go to Firebase Console โ Cloud Messaging
- Click "Send your first message"
- Enter title and body
- Select "Single device" and paste token
-
Test Routing:
- Use keywords like "product", "profile", "settings" in title/body
- App will navigate to appropriate page when tapped
Notifications not appearing?
- Check app is running (not killed)
- Verify device notification permissions
- Test on different devices
- Check battery optimization settings
Navigation not working?
- Ensure routes are registered in
app.dart - Check
navigatorKeyis set inMaterialApp - Verify route names match exactly
- โ Android: Full feature support
- โ iOS: Full feature support
- โ Web: Basic functionality (no push notifications)
- โ Windows/macOS/Linux: UI only
- Uses
IndexedStackto preserve page state - Lazy loading with
ListView.builderfor large lists - Network image caching for better performance
- Proper async/await for smooth UI
- Widget tests for form validation
- Navigation testing examples
- Firebase integration can be mocked for testing
- State management (Provider, Riverpod, Bloc)
- API integration for real data
- User authentication
- Local database (SQLite, Hive)
- Advanced animations and transitions
- Flutter Documentation - Official docs
- Flutter Cookbook - Code examples
- Dart Language Tour - Learn Dart
- Firebase Documentation - Complete guides
- FCM Documentation - Push notifications
- Firebase Console - Project management
- Material Design 3 - Design system
- Flutter Material Components - Widgets
This template is provided as-is for educational and development purposes. Feel free to modify and use according to your project needs.
Happy Coding! ๐
This template is provided as-is for development purposes. Modify and use according to your project needs.