A Flutter application that allows users to browse and search books from the Project Gutenberg library using the Gutendex API.
You can watch the app demo here.
This project contains three branches:
-
main & caching: The main and caching branches that include the full code with both caching and no caching functionality. The app fetches and displays books from the API and also provides the option for offline caching. -
book-list: This branch contains the book list without caching. It implements all the core features of the book list screen but does not use offline caching.
To switch between branches:
git checkout <branch-name>git clone https://github.com/salma234-del/books
cd booksflutter pub getflutter run- Clean Architecture: Organized into core, data, domain, and presentation layers.
- State Management: Built using
Cubit(flutter_blocpackage). - Dependency Injection: Implemented using
get_it. - Network Layer: Handled using
dioand functional programming withdartz. - Caching: Offline support with
SharedPreferencesand image caching withcached_network_image. - Pagination: Infinite scroll functionality for book browsing.
- Responsive UI: Built with
flutter_screenutilfor different screen sizes. - Skeleton Loading: Enhanced UX using
skeletonizerpackage.
- 🔍 Search for books by title.
- 📚 View the list of books.
- 📜 Expand/Collapse long descriptions using Read More/Less.
- 🖼️ Load and cache book cover images.
- ♻️ Infinite scrolling with automatic pagination.
- ⚡ Offline caching of book list for better performance.
- 🎨 Customized typography with Google Fonts.
- 📱 Responsive design for mobile and tablet screens.
- 🚫 Robust error handling for network and API errors.
| Package | Purpose |
|---|---|
dio |
HTTP client for API requests |
equatable |
Simplify object equality comparison |
get_it |
Dependency injection |
dartz |
Functional programming tools (Either) |
flutter_screenutil |
Responsive and adaptive UI design |
cached_network_image |
Network image caching |
readmore |
Expandable and collapsible text widgets |
google_fonts |
Google Fonts integration |
skeletonizer |
Skeleton loaders for a better loading experience |
shared_preferences |
Local data caching for offline access |
- Base URL:
https://gutendex.com/books - Authentication: No authentication required.
- Pagination: Controlled via
nextandpreviousfields in the API response.
- Books are fetched page by page using infinite scroll.
- Search functionality replaces the book list with search results.
- Cached data is used when offline, providing a fallback experience.
- Book descriptions are neatly expandable using the
readmorewidget. - Skeleton loading animations improve user experience while data loads.
- All layers follow SOLID principles for maintainability and scalability.
lib/
│
├── core/
│
├── data/
│ ├── datasources/
│ ├── models/
│ └── repositories/
│
├── domain/
│ ├── entities/
│ ├── repositories/
│ └── usecases/
│
├── presentation/
│ ├── cubits/
│ ├── screens/
│ └── widgets/
│
└── main.dart