A flutter boiler plate code for initial project setup
- A folder structure and some widgets
- Theme switch (dark and light mode)
- Pages
- Login page
- Home page
- Some page templates
- easy_localization for localization
- Provider for State management and context based DI
- Dio for http client
- Hive database for structural local storage and
- flutter_secure_storage
- shared_preferences for key value local storage
- get_it for service locator and DI
- Some others useful packages
-
create your own project with Android Studio or flutter create command
-
copy these files and folder into your new project
- assets
- lib
- test
- pubspec.yaml
- analysis_options.yaml (optional)
- README.md (optional)
- if you are using flavor
-
change bundle id and app name in pubspec.yaml
-
run flutter pub run flutter_flavorizr -p assets:download,assets:extract,ios:xcconfig,ios:buildTargets,ios:schema,ios:plist,assets:clean,ide:config,android:buildGradle,android:androidManifest to generate flavor config for ios and android if you're using flavor.
-
copy these files for a different launcher icon base on flavor
- flutter_launcher_icons-prod.yaml
- flutter_launcher_icons-dev.yaml
- flutter_launcher_icons-staging.yaml
-
copy .github folder if you're using github action
-
delete all firebase dependency in pubspec.yaml if you're not using firebase
-
run flutter pub get
-
In [project]/android/app/build.gradle set minSdkVersion to >= 18 to use flutter_secure_storage
-
You can copy any platform configuration setup (example: build.gradle, androidManifest) from this project into your new project
- replace your icon file in assets/image/app-icon.png
- run: flutter pub run flutter_launcher_icons:main
- if there is an error, change minSdkVersion and targetSdkVersion in android app gradle to integer instead
- note: this command will run all flutter_launcher_icon with flavor if you have any
- App Icon isn't dynamic by flavor in ios. you need to replace a String ""$(ASSET_PREFIX)AppIcon";" to ""$(ASSET_PREFIX)AppIcon"-$(ASSET_PREFIX);" in ios/project.pbxproj
- run flutter packages pub run build_runner build to generate Hive TypeAdapter model
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart --flavor dev
- Controllers to manage app state
- constant
- http configuration
- app style (color, theme, textstyle, decoration, size)
- utilities and helper class
- response: your mapping response model from api
- request: your own model class to request api
- db: model for hive or any database's model
- others: custom object model
- Each page has their own folder
- Each folder has a .dart file and a widgets folder that contains a widget that only use specifally in this page
- class that use to fetch data from Data source
- mostly static class for some specific feature
- example:
- notifications service
- database or storage service
- auth service .....
- example:
- global reusable widget and divide to into folder of category such as Dialog, Card, Button, Layout.....etc
-
fonts
this is where you keep your font
-
images
this is where you keep your image asset
-
language
this is where you keep your localization file
-
generator
run this file with dart generator.dart to generate AppAssets class to access your images path, Example usage: Image.asset(AppAssets.icon)