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.
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
- โข
httpfor API calls;flutter_secure_storagefor tokens - โข
cached_network_imagefor image caching - โข
intlfor date/number formatting and localization - โข
shimmerfor skeleton loading effects - โข
google_fontsfor typography - โข
image_pickerfor profile photo upload - โข
url_launcherfor 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
- User submits email and password on the Login screen.
- App calls
POST /api/loginwith credentials. - Backend returns a Sanctum bearer token.
- Token is stored securely using
flutter_secure_storageunder the keyauth_token. - All subsequent requests include the token in the
Authorization: Bearerheader. - 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/jsonandContent-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
- The app fetches available languages from
GET /api/languageson the Language screen. - When the user selects a language, the app fetches the full translation key-value file from
GET /api/languages-files?lang=xx. - The selected language code is stored in SharedPreferences.
- On the next launch, the stored language is applied automatically.
Adding a New Language
- Open the LibraryHub admin panel.
- Go to Settings โ Languages and add the new language.
- Add or import the translation key-value pairs for the new language.
- 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.baseUrlupdated to production HTTPS URL - โ App name updated in
constants.dart,AndroidManifest.xml, andInfo.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 installin theios/folder)
15. FAQ / Troubleshooting
App shows "No internet connection" even when connected
- Confirm
ApiEndpoints.baseUrlinlib/utils/constants.dartis 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,
localhostrefers 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_DOMAINSdoes not need to include mobile app domains).
Images not loading (books, sliders, profile photo)
- Confirm that
php artisan storage:linkhas been run on the backend and thepublic/storagesymlink exists. - Check that
APP_URLin the backend.envmatches 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 cleanthenflutter pub getagain. - Make sure your Flutter SDK version is 3.x or higher:
flutter --version. - Delete
.dart_tool/andbuild/directories and retry.
flutter clean
flutter pub get
iOS build fails with CocoaPods error
- Run
pod installinside theios/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 --allthenpod install.
Profile photo upload fails
- Confirm camera and photo library permissions are granted on the device.
- On iOS, ensure the app's
Info.plistincludesNSCameraUsageDescriptionandNSPhotoLibraryUsageDescription. - Check backend storage folder permissions (
chmod -R 775 storage). - Verify the backend's
upload_max_filesizeandpost_max_sizeinphp.iniare sufficient.
App icon not updating after running flutter_launcher_icons
- Run
flutter cleanfollowed byflutter 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.pngis 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:
- โข CodeCanyon item support tab (preferred)
- โข Email: rostomali4444@gmail.com
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