This open-source project shows how to build a Flutter app with:
A lot of other topics are also covered by this project:
Boobook is a simple book library manager designed for teachers, to manage book loans to pupils. The application is composed by five primary screens: Loans, Books, Scan, Pupils, and Settings.
On the first launch, the app asks the user to sign-in. This step can be skiped by selecting "Continue without account", which leads to the creation of an anonymous user on Firebase.
The Loans page displays the books which are currently loaned, with the remaining time before the expected return of the book. This time is displayed in green if it's far away, in orange for the last days, and in red if the date has been exceeded. Tap on a loan opens some options that allow you to end up the loan, or to extend it if needed.
Open the Books page to see the list of your books. A colored dot indicates whether the book is available or not. Tap on a book to edit its name or its cover picture.
In the Pupils page, you can see the list of your pupils, with the number of current loans. You can print all the membership cards at once by tapping on the top-right button. Tap on a pupil to edit his name or his card picture, or also to print his member card.
Use the Scan page to open your device camera and be able to scan a book. If the book is not yet in your book list, you will be offered to add it, and if it's already added, you will be offered to scan a pupil card or pick a pupil in your list, to create a new loan.
Finally, the Settings page allows you to setup some features: the max number of simultaneous loans, the default duration for a loan, the title on the membership cards. Some appearance settings are also available, such as the default language displayed and the theming of the app (light or dark).
The project folders are structured like this:
/controllers
/models
/l10n
/presentation
/common_widgets
/routes
/theme
/views
/home
/codes
/loans
/pupils
/scan
/settings
/subscription
/sign_in
/splash
/repositories
lib
folder only contains main.dart which contains the main Widget to make the app launchable, and common_providers.dart which includes some providers reused all accross the code.
Then inside lib
you will find:
controllers
which contains our "freezed" state filesmodels
which contains all the models (generated with Freezed)l10n
with contains the arb files for localizationpresentation
with all the ui stuff (subfolders detailed below)repositories
which contains the repositories used to access the databasepresentation
is divided in subfolders:
common_widgets
with all the widgets which are used more than onceroutes
which contains the app routertheme
which contains the layout stuffviews
which contains the pages.views
is also divided in subfolders:
home
which contains the content of the app once the user is logged insign_in
which contains the sign in pagesplash
which contains the splash page, ie the first view loaded when the app startshome
is generally divided with subfolders for each part of the app, usually once per tab when using a TabScaffold.
Some files are voluntary missing in the repository, for security reasons:
android/app/google-services.json
which is the file to make Firebase work on Android devicesios/Runner/GoogleService-Info.plist
which is the file to make Firebase work on iOS devicesios/Runner/Info.plist
which I decided to hide because it clearly displays the Facebook app secret for Facebook Loginlib/config.dart
which is detailed belowThe app requires this dart file to work:
final isbnApiKey = "your_isbndb_api_key";
const purchasesApiKey = 'your_revenuecat_api_key';
const entitlementId = 'your_purchase_entitlement';
const privacyPolicyURL = "https://boobook.app/privacy";
const termsURL = "https://www.apple.com/legal/internet-services/itunes/dev/stdeula/";
class FirestorePath {
static String pupils = "pupils";
static String books = "books";
static String loans = "loans";
static String users = "users";
}
class StoragePath {
static String users = "users";
static String pupils = "pupils";
static String books = "books";
}
This source code refers to a lot of personal Flutter packages hosted on my GitHub repository. These packages have been created for my personal Flutter projects because I reuse a lot of code accross all my Flutter projects to avoid too much copy and paste across all my projects. If you want to understand all the source code of Boobook, you will need to have a look to each package the code refers to:
firebase_storage_service
These packages are hosted on my GitHub repository and not as official packages on pub.dev because they are built only to fit my personal needs and I regulary make important breaking changes.