Skip to content

salma234-del/books

Repository files navigation

📚 Books Browser

A Flutter application that allows users to browse and search books from the Project Gutenberg library using the Gutendex API.

🎬 Demo

You can watch the app demo here.

Branches

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>

🚀 Getting Started

1. Clone the Repository

git clone https://github.com/salma234-del/books
cd books

2. Install Dependencies

flutter pub get

3. Run the Application

flutter run

🛠️ Architecture & Tech Stack

  • Clean Architecture: Organized into core, data, domain, and presentation layers.
  • State Management: Built using Cubit (flutter_bloc package).
  • Dependency Injection: Implemented using get_it.
  • Network Layer: Handled using dio and functional programming with dartz.
  • Caching: Offline support with SharedPreferences and image caching with cached_network_image.
  • Pagination: Infinite scroll functionality for book browsing.
  • Responsive UI: Built with flutter_screenutil for different screen sizes.
  • Skeleton Loading: Enhanced UX using skeletonizer package.

✨ Features

  • 🔍 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.

📦 Packages Used

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

📚 API Reference

  • Base URL: https://gutendex.com/books
  • Authentication: No authentication required.
  • Pagination: Controlled via next and previous fields in the API response.

📝 Implementation Notes

  • 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 readmore widget.
  • Skeleton loading animations improve user experience while data loads.
  • All layers follow SOLID principles for maintainability and scalability.

📂 Folder Structure (Simplified)

lib/
│
├── core/
│
├── data/
│   ├── datasources/
│   ├── models/
│   └── repositories/
│
├── domain/
│   ├── entities/
│   ├── repositories/
│   └── usecases/
│
├── presentation/
│   ├── cubits/
│   ├── screens/
│   └── widgets/
│
└── main.dart

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published