๐Ÿ“ฑ LibraryHub App Documentation
๐Ÿ“ฆ CodeCanyon Item Documentation

LibraryHub App โ€” Flutter Library Companion App

Official documentation for setting up, configuring, customizing, and building the LibraryHub Flutter mobile app. This app connects to the LibraryHub Laravel backend via REST API and provides members with a full-featured mobile library experience.

Flutter 3.29.x + Dart 3.7+ Provider State Management Android & iOS LibraryHub API Sanctum Auth Multi-language
๐Ÿ“–

1. Introduction

The LibraryHub App is a Flutter mobile application designed as the member-facing companion to the LibraryHub Laravel backend. It gives library patrons a modern, fast, and intuitive way to browse the book catalog, view and manage their borrowings, download e-books, check their account status, and explore the library's offerings โ€” all from their phone.

Requires LibraryHub Backend: This Flutter app is a companion product. It requires a running instance of the LibraryHub Laravel backend (sold separately on CodeCanyon). The app connects exclusively via the LibraryHub REST API. Without a running backend, the app will not function.

๐Ÿ“š

Book Catalog

Browse, search, and filter the full library catalog with real-time availability.

๐Ÿ“•

E-Books

Browse and open downloadable e-books assigned to the member's account.

๐Ÿ“‹

My Borrowings

View active borrow records, due dates, overdue status, and full issue history.

๐Ÿ‘ค

Profile & Account

Edit profile photo, personal details, and change password securely.

Tech Stack

  • โ€ข Flutter SDK 3.29.x / Dart SDK >=3.7.0
  • โ€ข Provider for state management
  • โ€ข http for API calls; flutter_secure_storage for tokens
  • โ€ข cached_network_image for image caching
  • โ€ข intl for date/number formatting and localization
  • โ€ข shimmer for skeleton loading effects
  • โ€ข google_fonts for typography
  • โ€ข image_picker for profile photo upload
  • โ€ข url_launcher for opening e-book and external links

Demo Credentials

This is the member-facing app. Use the member account on the live demo backend to explore it:

Member

member@example.com / 12345678

โœ…

2. Requirements

Make sure your development environment and target devices meet the following requirements before starting.

Development Environment

  • โœ“ Flutter SDK 3.29.x or higher
  • โœ“ Dart SDK >=3.7.0 (included with Flutter)
  • โœ“ Android Studio or VS Code with Flutter extension
  • โœ“ Android SDK (for Android builds)
  • โœ“ Xcode 15+ (for iOS builds, macOS only)
  • โœ“ CocoaPods (for iOS dependency management)

Target Devices

  • โœ“ Android: API Level 21 (Android 5.0) or higher
  • โœ“ iOS: iOS 12.0 or higher
  • โœ“ Internet connection required (API-driven app)

Backend Requirement

  • โš  A running LibraryHub Laravel backend (v1.0.0+) with HTTPS enabled
  • โš  The backend must be publicly accessible from the internet (not localhost) for the app to connect
  • โš  The backend REST API must be enabled and a valid member account must exist for testing
๐Ÿš€

3. Project Setup

Follow these steps to get the Flutter project running on your development machine.

Step 1. Extract the project files

Unzip the downloaded package and open the project folder in your IDE.

unzip library-hub-app.zip
cd library-hub-app

Step 2. Verify Flutter installation

flutter --version
flutter doctor

Resolve any issues reported by flutter doctor before continuing.

Step 3. Configure the backend URL

Open lib/utils/constants.dart and update ApiEndpoints.baseUrl to point to your LibraryHub backend:

class ApiEndpoints {
  static const String baseUrl = 'https://your-domain.com/api';
  // ... rest of endpoints remain unchanged
}

The URL must end with /api and use HTTPS in production. See Section 4 for full configuration details.

Step 4. Install dependencies

flutter pub get

Step 5. Run on a device or emulator

# List available devices
flutter devices

# Run on a specific device
flutter run -d <device-id>

# Run in debug mode (default)
flutter run

For iOS, you may need to run pod install inside the ios/ folder first if using a physical device or the iOS Simulator.

iOS: Install CocoaPods dependencies

cd ios
pod install
cd ..
flutter run
๐Ÿ”—

4. Backend Connection

The entire app is driven by the LibraryHub REST API. All configuration for the API connection lives in a single file.

Configuration File

File: lib/utils/constants.dart

class ApiEndpoints {
  // โœ๏ธ CHANGE THIS to your LibraryHub backend URL
  static const String baseUrl = 'https://your-domain.com/api';

  // Public endpoints (no auth required)
  static const String basicInfo      = '/basic-info';
  static const String categories     = '/categories';
  static const String sliders        = '/sliders';
  static const String faqs           = '/faqs';
  static const String languages      = '/languages';
  static const String languageFiles  = '/languages-files';
  static const String contact        = '/contact';

  // Auth endpoints
  static const String login          = '/login';
  static const String register       = '/register-member';
  static const String me             = '/me';
  static const String logout         = '/logout';

  // Profile
  static const String profile        = '/profile';
  static const String changePassword = '/change-password';

  // Dashboard
  static const String dashboardStats = '/dashboard/stats';

  // Library
  static const String circulationSetting = '/circulation-setting';
  static const String books          = '/books';
  static const String bookIssues     = '/book-issues';
  static const String ebooks         = '/ebooks';
  static const String racks          = '/racks';
}

Authentication Flow

  1. User submits email and password on the Login screen.
  2. App calls POST /api/login with credentials.
  3. Backend returns a Sanctum bearer token.
  4. Token is stored securely using flutter_secure_storage under the key auth_token.
  5. All subsequent requests include the token in the Authorization: Bearer header.
  6. On logout, the token is deleted from secure storage and the user is returned to the login screen.

API Request Behaviour

  • โ€ข All requests include Accept: application/json and Content-Type: application/json.
  • โ€ข Request timeout is set to 30 seconds.
  • โ€ข A 401 response automatically shows a "session expired" message and redirects to login.
  • โ€ข A 422 response displays the first validation error message from the backend.
  • โ€ข Network errors display user-friendly messages with retry options.

CORS requirement: The LibraryHub backend must allow cross-origin requests from mobile clients. Ensure the backend's CORS configuration allows the app's requests. The default LibraryHub installation is pre-configured for this.

โœจ

5. Features Overview

Splash Screen

Auto-launches on app open. Checks for a stored auth token and routes to Home (if logged in) or Login (if not). Displays the library logo with a smooth fade transition.

Authentication

Login with email and password. Register a new member account. Tokens stored securely with flutter_secure_storage. Session persists across app restarts.

Home Dashboard

Banner slider from backend, stat cards (Borrowed / Overdue / Total Books), quick-action shortcuts, recent borrowed books list, and recent book catalog grid. Pull-to-refresh supported.

Book Catalog

Paginated list of books with search, category filter, and shimmer skeleton loading. Book cards show cover image, title, author, and availability badge.

Book Detail

Full-screen book detail with cover, ISBN, author, publisher, category, rack location, availability count, and description. Shimmer loading while fetching.

E-Books

Browse the library's e-book catalog. Open and download e-book files via url_launcher. Cover images and titles displayed in a card grid.

My Borrowings

Full list of the member's book issue records. Active, overdue, and returned items with colour-coded status badges. Tap any item to see the full borrow detail.

Issue Detail

Book cover, title, issue date, due date, return date, fine amount, and current status. Overdue items are highlighted in red. Return history clearly visible.

Profile

View and edit member profile: name, email, phone, address, and profile photo. Upload a new photo from the camera or gallery using image_picker.

Change Password

Secure in-app password change using current password + new password confirmation. Calls the backend change-password endpoint with validation feedback.

Language Selection

Switch the app language from a list fetched from the backend. Supported languages are driven by what the LibraryHub backend has configured. Selection is persisted across sessions.

Circulation Settings

View the library's active borrowing rules: maximum books allowed, loan duration, renewal limits, and daily fine rates โ€” fetched live from the backend settings.

FAQs

Displays the library's FAQ entries fetched from the backend FAQ management module. Expandable accordion layout for each question/answer pair.

Contact

In-app contact form that submits name, email, subject, and message to the LibraryHub backend contact endpoint.

Pull-to-Refresh & Shimmer Loading

All list and detail screens support pull-to-refresh for live data updates. Shimmer skeleton placeholders replace blank screens while data loads, maintaining a polished user experience throughout.

๐Ÿ 

6. Home Dashboard

The Home screen is the app's entry point after login. It loads four data sources simultaneously and composes them into a single scrollable dashboard.

Data Loaded on Home

  • 1. Sliders โ€” banner images from GET /api/sliders
  • 2. Books โ€” recent 6 books from GET /api/books
  • 3. My Issues โ€” active/recent 3 borrowings from GET /api/book-issues
  • 4. Stats โ€” dashboard counts from GET /api/dashboard/stats

UI Components

  • โ€ข Collapsible gradient app bar with user name and avatar
  • โ€ข Auto-scrolling PageView banner slider with dot indicators
  • โ€ข Stat cards: Borrowed / Overdue / Total Books
  • โ€ข Quick action buttons: Books, E-Books, My Issues, FAQs
  • โ€ข Horizontal issue cards with overdue highlighting
  • โ€ข 2-column book grid with cover images and availability

Overdue Highlighting

Book issue cards on the Home screen use a red border and red "Overdue" badge when the borrow's due date has passed and the book has not been returned. The stat card also shows the overdue count. No configuration is required โ€” the app derives overdue status from the due_date field returned by the API.

๐Ÿ“š

7. Book Catalog

The Books screen shows the library's full catalog, fetched from GET /api/books. It supports pagination, search, and category filtering.

Catalog Features

  • โœ“ Paginated book list with load-more on scroll
  • โœ“ Real-time search by title, author, or ISBN
  • โœ“ Category filter chips (from GET /api/categories)
  • โœ“ Shimmer skeleton loading on first load
  • โœ“ Pull-to-refresh for live data
  • โœ“ Book card: cover image, title, author, category badge

Book Detail Screen

  • โœ“ Full-size cover image with hero transition
  • โœ“ Title, author(s), publisher, category, ISBN
  • โœ“ Rack / shelf location
  • โœ“ Total copies and available copies count
  • โœ“ Availability badge (Available / Unavailable)
  • โœ“ Book description / summary

Cover Image Handling

Cover images are served from the LibraryHub backend's storage. The app constructs image URLs from the base URL: baseUrl.replaceAll('/api', '') + '/storage/' + imagePath. If no cover is available, a branded placeholder icon is shown. Images are cached with cached_network_image to avoid repeated downloads.

๐Ÿ“•

8. E-Books

The E-Books screen fetches the list from GET /api/ebooks and displays downloadable digital titles. Tapping an e-book opens or downloads the file using url_launcher.

E-Book Screen Features

  • โœ“ Grid of e-book cards with cover and title
  • โœ“ Tap to open/download via url_launcher
  • โœ“ Shimmer loading and pull-to-refresh
  • โœ“ Empty state message when no e-books exist

Backend Dependency

E-books must be uploaded and published in the LibraryHub backend before they appear in this screen. The app shows only what the backend provides. Access control (which membership types can download) is enforced by the backend, not the app.

๐Ÿ“‹

9. My Borrowings

The My Issues screen shows the authenticated member's full borrowing history, loaded from GET /api/book-issues with pagination.

Issue List Features

  • โœ“ Paginated list of all book issues for the logged-in member
  • โœ“ Status badges: Active Overdue Returned
  • โœ“ Book cover thumbnail, title, and due date in each card
  • โœ“ Overdue cards highlighted with red border
  • โœ“ Tap any card to open the full issue detail screen

Issue Detail Screen

  • โœ“ Book cover, title, and ISBN
  • โœ“ Issue date and due date
  • โœ“ Return date (if returned)
  • โœ“ Current status with colour badge
  • โœ“ Fine amount (if any)
  • โœ“ Days overdue (calculated client-side from due date)
๐Ÿ‘ค

10. Profile & Account

The Profile section lets members view and update their personal information. It also provides access to password change and logout.

Profile Screen

  • โœ“ Display profile photo, name, email, and role
  • โœ“ Navigate to Edit Profile, Change Password, Language, FAQs, and Contact
  • โœ“ Logout button clears stored token and navigates to Login

Edit Profile Screen

  • โœ“ Update name, email, phone, and address
  • โœ“ Upload a new profile photo from camera or gallery (image_picker)
  • โœ“ Changes submitted via multipart POST to /api/profile
  • โœ“ Validation errors displayed inline beneath each field

Change Password

The Change Password screen collects the current password and a new password (with confirmation). It posts to POST /api/change-password. On success, the member is shown a confirmation and remains logged in with the new credentials.

โš™๏ธ

11. Settings & Preferences

Language Selection

Route: AppRoutes.language โ†’ language_screen.dart

  • โ€ข Fetches available languages from GET /api/languages
  • โ€ข Downloads the selected language's translation file from GET /api/languages-files
  • โ€ข Language preference is stored in SharedPreferences and applied on next launch
  • โ€ข Supported languages are driven by the LibraryHub backend configuration

Circulation Settings

Route: AppRoutes.circulationSetting โ†’ circulation_setting_screen.dart

  • โ€ข Shows the member's active borrowing rules from the backend
  • โ€ข Displays: max books, loan days, renewal limit, and daily fine rate
  • โ€ข Fetched from GET /api/circulation-setting
  • โ€ข Read-only display โ€” rules are configured in the admin panel

FAQs Screen

Route: AppRoutes.faqs โ†’ faqs_screen.dart

Fetches and displays FAQ entries from GET /api/faqs in an expandable accordion layout. Content is managed via the LibraryHub admin panel FAQ module.

Contact Screen

Route: AppRoutes.contact โ†’ contact_screen.dart

In-app contact form with name, email, subject, and message fields. Submits to POST /api/contact. Shows a success confirmation on submission.

๐ŸŽจ

12. Branding & Customization

All branding, color, and app identity settings are centralized in two files, making customization straightforward.

App Name

The display app name lives in lib/utils/constants.dart:

class AppStrings {
  static const String appName = 'LibraryHub';  // โœ๏ธ Change this
  ...
}

Also update the native app name for each platform:

# Android โ€” android/app/src/main/AndroidManifest.xml
android:label="LibraryHub"  # โœ๏ธ Change this

# iOS โ€” ios/Runner/Info.plist
<key>CFBundleDisplayName</key>
<string>LibraryHub</string>  # โœ๏ธ Change this

App Colors

All UI colors are defined in lib/utils/constants.dart under AppColors:

class AppColors {
  static const Color primary     = Color(0xFFE91E63);  // โœ๏ธ Main brand color
  static const Color primaryDark = Color(0xFFC2185B);  // โœ๏ธ Darker shade (app bar gradient)
  static const Color primaryLight = Color(0xFFF8BBD9); // โœ๏ธ Light tint (badges)
  static const Color secondary   = Color(0xFF673AB7);  // โœ๏ธ Accent (e-books, secondary actions)
  static const Color accent      = Color(0xFFFF9800);  // โœ๏ธ Warning / overdue color
}

All screens and widgets reference AppColors directly, so changing these values updates the entire app theme.

App Icon

The app icon source is at assets/icons/library-hub.png. Replace it with your own icon (1024ร—1024 PNG, no alpha for iOS) and regenerate:

flutter pub run flutter_launcher_icons

The launcher icon config in pubspec.yaml targets both Android and iOS automatically. Minimum Android icon size is API 21-compatible.

Package Name / Bundle ID

Change the Android package name in android/app/build.gradle.kts:

applicationId = "com.yourcompany.libraryapp"  // โœ๏ธ Change this

Change the iOS bundle identifier in Xcode or in ios/Runner/Info.plist:

<key>CFBundleIdentifier</key>
<string>com.yourcompany.libraryapp</string>  # โœ๏ธ Change this
๐ŸŒ

13. Localization

The LibraryHub App's localization is backend-driven. Translation strings are fetched from the LibraryHub backend's language files rather than being bundled in the app, so adding a new language only requires adding it in the backend admin panel.

How It Works

  1. The app fetches available languages from GET /api/languages on the Language screen.
  2. When the user selects a language, the app fetches the full translation key-value file from GET /api/languages-files?lang=xx.
  3. The selected language code is stored in SharedPreferences.
  4. On the next launch, the stored language is applied automatically.

Adding a New Language

  1. Open the LibraryHub admin panel.
  2. Go to Settings โ†’ Languages and add the new language.
  3. Add or import the translation key-value pairs for the new language.
  4. The new language appears automatically in the app's Language screen on next fetch โ€” no app update required.

Built-in languages from the backend: English, Bengali, German, Spanish, and Hindi. All five appear in the Language screen automatically when connected to a configured LibraryHub backend.

๐Ÿ“ฆ

14. Build & Release

Before building for release, ensure you have updated the backend URL, app name, package name, and app icon. Then follow the platform-specific build steps below.

Pre-Build Checklist

  • โœ“ ApiEndpoints.baseUrl updated to production HTTPS URL
  • โœ“ App name updated in constants.dart, AndroidManifest.xml, and Info.plist
  • โœ“ Package name / bundle ID changed from default
  • โœ“ App icon replaced and regenerated with flutter_launcher_icons
  • โœ“ Tested on a real device against the production backend

Android โ€” APK (direct install)

flutter build apk --release

Output: build/app/outputs/flutter-apk/app-release.apk

Android โ€” App Bundle (Play Store)

flutter build appbundle --release

Output: build/app/outputs/bundle/release/app-release.aab โ€” upload this to Google Play Console.

Android โ€” Signing with a Keystore

For Play Store submission, sign the app with your keystore:

# Generate a keystore (one-time)
keytool -genkey -v -keystore ~/my-release-key.jks \
  -keyalg RSA -keysize 2048 -validity 10000 \
  -alias my-key-alias

Create android/key.properties (do not commit this file):

storePassword=your_store_password
keyPassword=your_key_password
keyAlias=my-key-alias
storeFile=/Users/you/my-release-key.jks

Reference it in android/app/build.gradle.kts:

val keyPropertiesFile = rootProject.file("key.properties")
val keyProperties = Properties()
keyProperties.load(FileInputStream(keyPropertiesFile))

android {
    signingConfigs {
        create("release") {
            keyAlias = keyProperties["keyAlias"] as String
            keyPassword = keyProperties["keyPassword"] as String
            storeFile = file(keyProperties["storeFile"] as String)
            storePassword = keyProperties["storePassword"] as String
        }
    }
    buildTypes {
        release {
            signingConfig = signingConfigs.getByName("release")
        }
    }
}

iOS โ€” Build for App Store

flutter build ios --release

Then open Xcode, select Product โ†’ Archive, and submit via the Organizer. Ensure you have:

  • โœ“ An Apple Developer account with an active distribution certificate
  • โœ“ A provisioning profile for the bundle ID set in Info.plist
  • โœ“ CocoaPods dependencies installed (pod install in the ios/ folder)
โ“

15. FAQ / Troubleshooting

App shows "No internet connection" even when connected

  • Confirm ApiEndpoints.baseUrl in lib/utils/constants.dart is correct and ends with /api.
  • Ensure the backend is reachable from a browser on the same network.
  • Check that the backend URL uses HTTPS โ€” Android 9+ and iOS block plain HTTP connections by default.
  • On Android emulator, localhost refers to the emulator itself; use your computer's network IP instead.

Login returns 401 Unauthorized

  • Verify the email and password are correct on the backend (test via the web admin panel first).
  • Ensure the user account exists and is active in the LibraryHub backend.
  • Check that the backend's Sanctum token configuration is correct (SANCTUM_STATEFUL_DOMAINS does not need to include mobile app domains).

Images not loading (books, sliders, profile photo)

  • Confirm that php artisan storage:link has been run on the backend and the public/storage symlink exists.
  • Check that APP_URL in the backend .env matches the actual domain โ€” the app constructs image URLs from this.
  • Test image URLs directly in a browser to confirm they resolve.

flutter pub get fails or dependency conflict

  • Run flutter clean then flutter pub get again.
  • Make sure your Flutter SDK version is 3.x or higher: flutter --version.
  • Delete .dart_tool/ and build/ directories and retry.
flutter clean
flutter pub get

iOS build fails with CocoaPods error

  • Run pod install inside the ios/ directory.
  • If pods are outdated, run pod update.
  • Ensure Xcode command-line tools are installed: xcode-select --install.
  • Try resetting the pod cache: pod cache clean --all then pod install.

Profile photo upload fails

  • Confirm camera and photo library permissions are granted on the device.
  • On iOS, ensure the app's Info.plist includes NSCameraUsageDescription and NSPhotoLibraryUsageDescription.
  • Check backend storage folder permissions (chmod -R 775 storage).
  • Verify the backend's upload_max_filesize and post_max_size in php.ini are sufficient.

App icon not updating after running flutter_launcher_icons

  • Run flutter clean followed by flutter pub run flutter_launcher_icons.
  • Uninstall the app from the device or emulator and reinstall โ€” the OS caches the old icon.
  • Ensure the source icon at assets/icons/library-hub.png is at least 1024ร—1024 and has no alpha channel for iOS.
๐Ÿ’ฌ

16. Support

Support is provided for verified buyers according to the Envato item support policy. Have your purchase code ready when contacting the author.

How to Get Help

Reach the author through:

Include your purchase code, Flutter and OS version, device type, exact error message, and steps already tried. This speeds up resolution significantly.

Response Time

Most requests are answered within 1โ€“2 business days. Complex issues may take longer. Response times depend on current workload and timezone.

What's Included in Support

  • โœ“ Help with setup, configuration, and backend connection
  • โœ“ Bug clarification and confirmed defects in the original source
  • โœ“ Questions about how specific screens or features work
  • โœ“ Guidance on building and submitting to app stores

What's Not Included

  • โœ— Custom feature development or UI modifications
  • โœ— Backend server setup or DevOps support
  • โœ— App Store / Play Store account setup or review help
  • โœ— Support for heavily modified versions of the source code
Thank you for choosing LibraryHub App. Keep this file with your release package for quick setup and reference.