bookpalm
A modern Flutter application for browsing and managing books from the Project Gutenberg digital library. BookPalm provides an intuitive interface for discovering, searching, and bookmarking free eBooks with comprehensive filtering and categorization features.
BookPalm
A modern Flutter application for browsing and managing books from the Project Gutenberg digital library. BookPalm provides an intuitive interface for discovering, searching, and bookmarking free eBooks with comprehensive filtering and categorization features.
#Features
- Book Discovery: Browse thousands of free books from Project Gutenberg
- Advanced Search: Search books by title, author, or subject
- Smart Filtering: Filter by categories, languages, and download count
- Bookmark Management: Save favorite books for easy access
- Enhanced Book Detail UI: Beautiful book cover displays with subtle background gradients and optimized floating action buttons
- Comprehensive Offline Support: Full offline functionality with intelligent caching
- Real-time Sync: Automatic data synchronization when connection is restored
- Cache Management: Built-in tools to manage offline data storage
- Modern UI: Material Design 3 with responsive layouts and nature-inspired color palette
- Multi-platform: Supports Android, iOS, Web, Windows, macOS, and Linux
- Internationalization: Full multi-language support with instant language switching
#π¨ Design System
BookPalm features a carefully crafted design system with a nature-inspired color palette that creates a calming and professional reading environment.
##Color Palette
- Primary Green (
#2F5249
): Represents stability, growth, and knowledge - Secondary Green (
#437057
): Provides harmony and balance in the interface - Accent Green (
#97B067
): Suggests wisdom and tranquility for focused reading - Highlight Yellow (
#E3DE61
): Adds warmth and highlights important information - Background (
#FBFBFB
): Creates a clean, paper-like reading experience
##Typography
BookPalm uses Poppins, a modern geometric sans-serif typeface that provides:
- Excellent multilingual support for our international user base
- High readability at all sizes
- Modern, friendly appearance
- Perfect support for English, Indonesian, German, Japanese, Chinese, and Korean
##Recent UI Improvements
###Book Detail Page Enhancements
- Book Cover Background: Added subtle gradient background with green tint at 0.15 opacity for enhanced visual appeal
- Optimized Floating Action Button: Simplified from extended text button to clean icon-only design
- Uses intuitive bookmark icons (bookmark_add/bookmark_remove)
- Color-coded: Green for adding bookmarks, Red for removing
- Eliminates text overflow issues while maintaining clear functionality
#π Localization & Internationalization
BookPalm supports multiple languages with a comprehensive localization system that allows instant language switching throughout the entire app.
##Supported Languages
- English (en) - Default language
- Indonesian (id) - Bahasa Indonesia
- German (de) - Deutsch
- Japanese (ja) - ζ₯ζ¬θͺ
- Chinese (zh) - δΈζ
- Korean (ko) - νκ΅μ΄
##Key Localization Features
- π Instant Language Switching: Changes apply immediately across the entire app
- πΎ Persistent Selection: Language preference is saved and restored on app restart
- π― Complete Coverage: All UI strings, buttons, messages, and content are localized
- β‘ Reactive Updates: All screens and widgets update automatically when language changes
- π οΈ Easy Maintenance: JSON-based translation system for easy content management
- π Parameter Support: Dynamic content with placeholders (e.g., "Welcome, {name}!")
##How to Change Language
- Open the app and navigate to the Settings tab
- Tap on Language option
- Select your preferred language from the dropdown
- The app will instantly switch to the selected language
- Your choice is automatically saved for future app launches
##Technical Implementation
###Translation Files Structure
assets/translations/
βββ en.json # English (default)
βββ id.json # Indonesian
βββ de.json # German
βββ ja.json # Japanese
βββ zh.json # Chinese
βββ ko.json # Korean
###Translation Keys Organization
{
"app": {
"title": "BookPalm",
"subtitle": "Discover Free Books"
},
"navigation": {
"home": "Home",
"bookmarks": "Bookmarks",
"settings": "Settings"
},
"actions": {
"search": "Search",
"filter": "Filter",
"bookmark": "Bookmark",
"share": "Share"
},
"messages": {
"loading": "Loading...",
"error": "An error occurred",
"success": "Operation completed successfully",
"offline": "You're offline. Showing cached content.",
"connection_restored": "Connection restored. Syncing data..."
}
}
###LocalizationService Features
The
LocalizationService
provides:- Reactive Translation: Using GetX for instant UI updates
- Parameter Interpolation: Support for dynamic content like
"Hello, {name}!"
- Fallback Mechanism: Falls back to English if translation is missing
- Type Safety: Compile-time checking of translation keys
- Performance: Efficient caching of loaded translations
###Usage in Code
// Simple translation
Text(LocalizationService.instance.translate('navigation.home'))
// Translation with parameters
Text(LocalizationService.instance.translate('messages.welcome', {'name': 'John'}))
// Using GetX for reactive updates
Obx(() => Text(LocalizationService.instance.translate('app.title')))
##For Developers & Contributors
###Adding New Languages
- Create Translation File: Add a new JSON file in
assets/translations/
(e.g.,fr.json
for French) - Copy Structure: Use
en.json
as a template and translate all values - Update LocalizationService: Add the new language to
supportedLanguages
list - Update Settings: Add the language option to the settings dropdown
- Test: Verify all UI elements display correctly in the new language
###Adding New Translation Keys
- Add to English: First add the new key-value pair to
en.json
- Translate: Add the same key with translated values to all other language files
- Use in Code: Reference the new key in your widgets/controllers
- Test: Verify the translation appears correctly in all supported languages
###Translation Guidelines
- Keep Keys Descriptive: Use hierarchical keys like
settings.language.title
- Maintain Consistency: Use the same key structure across all language files
- Handle Pluralization: Use parameters for dynamic content that changes based on count
- Consider Context: Some words may have different translations in different contexts
- Test Thoroughly: Always test UI layout with longer/shorter translated text
##Localization Assets Setup
Update
pubspec.yaml
to include translation assets:flutter:
assets:
- assets/translations/
##Dependencies for Localization
dependencies:
get: ^4.6.6 # State management and reactivity
shared_preferences: ^2.3.2 # Persistent language storage
##Future Localization Enhancements
Planned features for future releases:
- Right-to-Left (RTL) Support: For Arabic, Hebrew, and other RTL languages
- Pluralization Rules: Advanced plural forms for different languages
- Date/Number Formatting: Locale-specific formatting
- Currency Support: Multi-currency display for paid content
- Dynamic Translation Loading: Download translations on-demand
- Translation Management: Admin interface for managing translations
##Troubleshooting Localization
###Common Issues and Solutions
- Missing Translations: If text appears as keys (e.g., "settings.title"), check if the key exists in the current language file
- Layout Issues: Some languages may have longer text - ensure UI components can accommodate varying text lengths
- Special Characters: Ensure proper UTF-8 encoding in JSON files for special characters
- Parameter Issues: When using parameters, ensure the placeholder names match exactly
For detailed localization development information, see
LOCALIZATION_GUIDE.md
.#π Offline Mode
BookPalm features comprehensive offline functionality, ensuring users can continue reading and browsing even without an internet connection.
##Key Offline Features
- π± Seamless Offline Experience: Continue using the app when internet is unavailable
- πΎ Intelligent Caching: Automatically cache books and search results for offline access
- π Offline Search: Browse previously cached search results without internet
- π Offline Bookmarks: Access all bookmarked books regardless of connection status
- β‘ Fast Loading: Cached content loads instantly without network delays
- π Auto-Sync: Automatically sync new data when connection is restored
- βοΈ Cache Management: Full control over cached data through settings
##How Offline Mode Works
###When Online:
- App fetches fresh data from Project Gutenberg API
- Successful responses are automatically cached in local SQLite database
- Users can browse, search, and bookmark normally
- Connection status displays "Connected to Internet" in settings
###When Offline:
- App detects loss of internet connection
- Orange banner appears: "You're offline. Showing cached content."
- App serves previously cached data instead of showing errors
- All core functionality remains available:
- Browse previously viewed books
- Access complete bookmark collection
- View cached search results
- Read detailed book information
- Navigate between all cached content
###When Connection Restored:
- Green notification appears: "Connection restored. Syncing data..."
- App automatically resumes online operation
- New requests fetch fresh data from the internet
- Cache is updated with latest content
##Technical Implementation
###Database & Caching
-- Cached individual books
CREATE TABLE cached_books (
id INTEGER PRIMARY KEY,
book_data TEXT NOT NULL,
cached_at INTEGER NOT NULL
);
-- Cached book list responses (search results)
CREATE TABLE cached_book_lists (
list_key TEXT PRIMARY KEY,
list_data TEXT NOT NULL,
page INTEGER NOT NULL,
cached_at INTEGER NOT NULL
);
###Cache Strategy
- Network First: Always attempt to fetch fresh data when online
- Cache on Success: Store all successful API responses locally
- Fallback to Cache: Serve cached data when network is unavailable
- Smart Expiration: Automatically clean up cache entries older than 7 days
- Selective Caching: Cache both individual books and search result lists
###Architecture Components
- DatabaseHelper: SQLite database management for offline storage
- ConnectionService: Real-time connectivity monitoring with GetX
- Enhanced Repository Pattern: Network-first with intelligent cache fallbacks
- Offline Indicators: Visual feedback for connection status
##Settings & Cache Management
Access comprehensive cache management through the Settings tab:
###Connection Status
- Real-time display of internet connectivity
- Visual indicators for online/offline state
- Connection history and status changes
###Cache Statistics
- Number of cached books
- Number of cached search lists
- Total cache size information
- Last cache update timestamp
###Cache Controls
- Refresh Stats: Update cache statistics display
- Clear All Cache: Remove all cached content (preserves bookmarks)
- Automatic Cleanup: Configure cache expiration settings
##Dependencies for Offline Mode
dependencies:
sqflite: ^2.4.1 # Local SQLite database
path: ^1.9.0 # Database path utilities
connectivity_plus: ^6.0.5 # Connection monitoring
shared_preferences: ^2.3.2 # Persistent bookmark storage
##Testing Offline Functionality
-
Populate Cache:
- Run app with internet connection
- Browse several books and perform searches
- Add bookmarks to test offline bookmark access
-
Test Offline Mode:
- Disable internet connection on device
- Navigate through the app
- Verify cached content loads properly
- Check offline indicator appears
-
Test Connection Restoration:
- Re-enable internet connection
- Verify "Connection restored" notification
- Confirm fresh data fetching resumes
##Performance Benefits
- β‘ Instant Loading: Cached content loads without network latency
- π Reduced Data Usage: Fewer API calls for repeated content
- π Battery Efficiency: Less network activity preserves device battery
- π Poor Connection Handling: Graceful degradation in low-connectivity areas
- πΎ Smart Storage: Automatic cache management prevents storage bloat
#Architecture
BookPalm follows Clean Architecture principles with clear separation of concerns:
##Project Structure
lib/
βββ core/ # Core functionality and utilities
β βββ database/ # SQLite database management
β βββ localization/ # Internationalization support and translation service
β βββ logging/ # Centralized logging system
β βββ network/ # Network connectivity utilities
β βββ services/ # Core services (connection monitoring)
βββ data/ # Data layer implementation
β βββ datasources/ # API and local data sources (with caching)
β βββ models/ # Data models and JSON serialization
β βββ repositories/ # Repository implementations (offline-enabled)
βββ domain/ # Business logic layer
β βββ entities/ # Core business entities
β βββ repositories/ # Repository interfaces
β βββ usecases/ # Business use cases
βββ presentation/ # UI layer
βββ controllers/ # State management controllers (including localization)
βββ pages/ # Application screens (including multilingual settings)
βββ routes/ # Navigation configuration
βββ widgets/ # Reusable UI components (with localization support)
assets/
βββ translations/ # Localization files (JSON format)
βββ en.json # English (default)
βββ id.json # Indonesian
βββ de.json # German
βββ ja.json # Japanese
βββ zh.json # Chinese
βββ ko.json # Korean
test/ # Comprehensive test suite
βββ core/ # Core functionality tests (including localization)
βββ data/ # Data layer tests
βββ domain/ # Domain layer tests
βββ presentation/ # UI and controller tests
##Architecture Patterns
- Clean Architecture: Separation of concerns with clear layer boundaries
- Repository Pattern: Abstraction of data sources
- UseCase Pattern: Encapsulation of business logic
- Dependency Injection: Using GetIt for dependency management
- State Management: GetX for reactive state management
- Navigation: GoRouter for declarative routing
#Technology Stack
##Core Framework
- Flutter: ^3.8.1 - Cross-platform UI framework
- Dart: Modern programming language
##State Management & Architecture
- GetX: ^4.6.6 - State management, dependency injection, routing, and localization reactivity
- GetIt: ^7.7.0 - Service locator for dependency injection
- GoRouter: ^14.2.7 - Declarative routing
##Networking & Data
- HTTP: ^1.2.2 - HTTP client for API calls
- JSON Annotation: ^4.9.0 - JSON serialization
- Shared Preferences: ^2.3.2 - Local data persistence
- SQLite: ^2.4.1 - Local database for offline caching
- Path: ^1.9.0 - File system path utilities
##UI & UX
- Material Design 3: Modern design system
- Cached Network Image: ^3.4.1 - Efficient image loading and caching
- Connectivity Plus: ^6.0.5 - Network connectivity monitoring
##Development Tools
- Flutter Lints: ^5.0.0 - Code quality and style enforcement
- Build Runner: ^2.4.12 - Code generation
- Mockito: ^5.4.4 - Test mocking framework
#Installation
##Prerequisites
- Flutter SDK (>=3.8.1)
- Dart SDK (included with Flutter)
- Android Studio / Xcode (for mobile development)
- VS Code or Android Studio (recommended IDEs)
##Setup
-
Clone the repository
git clone https://github.com/nerufuyo/bookpalm.git cd bookpalm
-
Install dependencies
flutter pub get
-
Generate code
flutter packages pub run build_runner build
-
Configure localization assets (already included in pubspec.yaml)
flutter: assets: - assets/translations/
-
Run the application
flutter run
##First Run Setup
When running BookPalm for the first time:
- Internet Connection Required: Initial setup requires internet to fetch book data
- Language Selection: Choose your preferred language in Settings β Language
- Automatic Cache Population: Browse books to automatically build offline cache
- Bookmark Setup: Add bookmarks for guaranteed offline access
- Settings Configuration: Visit Settings tab to view cache status and manage offline data
##Testing Localization
To test the multi-language functionality:
- Language Switching: Go to Settings β Language and try different languages
- UI Coverage: Navigate through all screens to verify complete translation
- Persistence: Close and reopen app to confirm language selection is saved
- Reactivity: Change language and observe instant UI updates without restart
- Parameter Testing: Look for dynamic content like error messages and notifications
##Offline Mode Testing
To test offline functionality:
- Build Cache: Use app online to cache content
- Disable Network: Turn off WiFi/cellular data
- Test Offline: Navigate app with offline indicator
- Restore Network: Re-enable connection to see sync notifications
##Development Setup
For development with hot reload:
flutter run --debug
For production builds:
# Android
flutter build apk --release
# iOS
flutter build ios --release
# Web
flutter build web --release
#Testing
BookPalm includes a comprehensive test suite with 147+ tests covering unit tests, widget tests, and integration tests.
##Run All Tests
flutter test
##Run Specific Test Categories
# Unit tests only
flutter test test/domain/ test/data/
# Widget tests only
flutter test test/presentation/widgets/
# Controller tests only
flutter test test/presentation/controllers/
##Test Coverage
# Generate coverage report
flutter test --coverage
genhtml coverage/lcov.info -o coverage/html
##Using Automation Scripts
# Use provided Makefile
make test
# Use test script
./test_all.sh
#Code Quality
##Static Analysis
flutter analyze
##Code Formatting
dart format .
##Linting
The project follows Flutter's recommended linting rules defined in
analysis_options.yaml
.#API Integration
BookPalm integrates with the Project Gutenberg API with intelligent offline fallbacks:
- Base URL:
https://gutendex.com/
- Books Endpoint:
/books/
- Search: Query parameters for filtering and search
- Pagination: Supports offset-based pagination
- Offline Caching: All successful API responses are automatically cached
- Fallback Strategy: Serves cached data when API is unavailable
##Offline API Behavior
- Online: Direct API calls with automatic caching of responses
- Offline: Serves cached API responses transparently
- Partial Connectivity: Graceful fallback when API requests fail
- Connection Restoration: Automatic sync when connectivity returns
#Contributing
We welcome contributions to BookPalm! Here's how you can help:
##General Contributions
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature
- Make your changes and add tests
- Ensure all tests pass:
flutter test
- Ensure code quality:
flutter analyze
- Commit your changes:
git commit -m 'feat: add new feature'
- Push to the branch:
git push origin feature/new-feature
- Submit a pull request
##Localization Contributions
We especially welcome contributions for:
- New Language Support: Help us add more languages to BookPalm
- Translation Improvements: Better translations for existing languages
- Localization Features: RTL support, pluralization, date formatting
To contribute translations:
- Add New Language: Create a new JSON file in
assets/translations/
- Follow Guidelines: Use the detailed guidelines in
LOCALIZATION_GUIDE.md
- Test Thoroughly: Ensure UI layouts work well with the new language
- Update Code: Add the new language to supported languages list
- Submit PR: Include screenshots showing the new language in action
##Translation Quality Standards
- Accuracy: Translations should be contextually appropriate
- Consistency: Use consistent terminology throughout the app
- Cultural Sensitivity: Consider cultural nuances in translations
- UI Testing: Verify that translated text fits well in UI components
#License
This project is licensed under the MIT License - see the LICENSE file for details.
#Acknowledgments
- Project Gutenberg for providing free eBook access
- Flutter team for the excellent framework
- Open source community for the amazing packages