This guide helps agents understand and work with the FLauncher codebase effectively.
FLauncher is an open-source Android TV launcher built with Flutter. It replaces the default Android TV home screen with a customizable interface that organizes apps into categories, manages wallpapers, and provides TV-optimized navigation.
Key Characteristics:
- Flutter 3.35.2 with Material Design 3
- TV-optimized UI with D-pad navigation support
- Provider-based state management
- Drift ORM for SQLite database
- Multi-language support (English, Spanish, Dutch)
- Platform-specific Android integration via method channels
- Flutter: 3.35.2 (managed by mise)
- Java: Zulu 23.32.11 (managed by mise)
- Kotlin: 1.9.0 (managed by mise)
- mise: For dependency management
# Install dependencies with mise
mise install
# Load environment variables (contains Unsplash API key)
cp .env.example .env # Edit .env with your API key# Run development build
mise run run:dev
# Build production APK
mise run build
# Install production APK
mise run run:prod
# Uninstall development version
mise run clean:devThe app uses Provider pattern with 5 main services:
-
SettingsService (
lib/providers/settings_service.dart)- User preferences and app configuration
- Persists to SharedPreferences
-
AppsService (
lib/providers/apps_service.dart)- Application management and categorization
- Database operations for apps and categories
-
WallpaperService (
lib/providers/wallpaper_service.dart)- Wallpaper management (gradients, custom images, Unsplash)
- Settings persistence
-
NetworkService (
lib/providers/network_service.dart)- Network status monitoring
- Connection state display
-
LauncherState (
lib/providers/launcher_state.dart)- Launcher visibility and back button handling
- Alternative view management
ORM: Drift with SQLite Schema Version: 7 (with migration support)
Tables:
apps- Application metadata (package name, version, hidden flag)categories- Category configuration (name, type, dimensions, order)apps_categories- Many-to-many relationship with orderinglauncher_spacers- Visual spacing between sections
Models: App and Category classes in lib/models/
FLauncherChannel (lib/flauncher_channel.dart)
- Method channel for app management and launching
- Event channels for app changes and network monitoring
- Native Android implementation in
MainActivity.java
lib/main.dart- App initialization and dependency injectionlib/flauncher_app.dart- Root MaterialApp configurationlib/flauncher.dart- Main launcher UI with wallpaper and sections
lib/providers/- All state management serviceslib/flauncher_channel.dart- Platform channel communication
lib/database.dart- Database definition and connectionlib/database.drift.dart- Generated database code (don't edit)drift_schemas/- Database schema versions for migrations
lib/widgets/apps_grid.dart- Grid layout for applicationslib/widgets/category_row.dart- Horizontal row layoutlib/widgets/app_card.dart- Individual application cardlib/widgets/settings/- Comprehensive settings panels
lib/models/app.dart- Application data modellib/models/category.dart- Category configuration model
android/app/src/main/java/me/efesser/flauncher/MainActivity.java- Android-specific implementations for app discovery and launching
lib/l10n/- Translation files and generated classesl10n.yaml- Localization configuration
- Follows Flutter/Dart conventions with flutter_lints
- Custom rule:
await_only_futuresenforced - Generated files excluded from analysis (see
analysis_options.yaml)
- Unit tests:
test/providers/ - Widget tests:
test/widgets/ - Database tests:
test/database_*.dart - Test helpers:
test/helpers.dart - Mocks:
test/mocks.dartandtest/mocks.mocks.dart
- Development flavor:
com.geert.flauncher.dev - Production flavor:
com.geert.flauncher - Build flavors configured in
android/app/build.gradle
- Custom focus management:
RowByRowTraversalPolicy - D-pad optimized with
FocusTraversalGroup - Sound feedback and visual focus indicators
- Add property to
SettingsService - Update SharedPreferences persistence
- Add UI control in appropriate settings panel
- Add localization strings
- Update
Categorymodel if needed - Modify database schema in
database.dart - Update migration logic
- Adjust UI components (
CategoryRoworAppsGrid)
- Extend
WallpaperServicewith new type - Add UI controls in
wallpaper_panel_page.dart - Update wallpaper rendering logic in
flauncher.dart
- Update method signatures in
FLauncherChannel - Modify native implementation in
MainActivity.java - Update event stream handling if needed
flutter test
flutter test test/providers/apps_service_test.dart # Specific test- Use
mockitofor service mocking - Use
network_image_mockfor UI tests with images - Test database migrations with schema versions
- Widget tests use
test/helpers.dartfor common finders
- Test all migrations in
database_migration_test.dart - Use in-memory database for unit tests
- Verify schema consistency with generated files
- Update ARB files in
lib/l10n/ - Run
flutter gen-l10nto generate classes - Use
AppLocalizationsin UI code
- English (default)
- Spanish
- Dutch
.envfile contains Unsplash API key- Required for wallpaper functionality
- Add to
.gitignore(already included)
- Always create new migration when schema changes
- Test migrations thoroughly
- Keep schema versions in
drift_schemas/
- All UI must work with D-pad navigation
- Focus management is critical
- Test on actual Android TV device when possible
- Consider screen size and viewing distance
- Use lazy loading for large app lists
- Optimize image loading and caching
- Consider memory usage for wallpaper images
- Build failures: Check Flutter version and mise configuration
- Database errors: Verify migrations and schema consistency
- Platform channel issues: Check method signatures between Dart and Java
- Navigation problems: Verify focus management and TV optimization
# Check Flutter environment
flutter doctor -v
# Clean build
flutter clean && mise run run:dev
# Database inspection
# Use drift_local_storage_inspector in dev buildsThis documentation should help future agents understand the codebase structure and work effectively with FLauncher.