Flutter Mobile App Project Template by Zalisoft (flutter_bloc, provider, riverpod, go_router, vexana, url_launcher, json_serializable, easy_localization bot_toast, flutter_secure_storage, connectivity_plus, intl, sizer, google_fonts, flutter_native_splash, flutter_launcher_icons and other generally used features and tools in production.)
This is a battery included Flutter project template. To the default setup have been added:
- flutter_bloc - Predictable and Highly testable state management library for Dart.
- provider - Functional state management library using InheritedWidget, which is the most preferred next to BLoC.
- go_router - Robust and customizable Flutter navigation package.
- vexana - A powerful http client package overwritten by the dio package.
- url_launcher - Flutter plugin for launching a URL. Supports web, phone, SMS, and email schemes.
- connectivity_plus - This plugin allows Flutter apps to discover network connectivity and configure themselves accordingly. It can distinguish between cellular vs WiFi connection.
- json_serializable - Generates to/from json serialization code for our data models.
- easy_localization - Easy and Fast internationalization.
- bot_toast - Feature-Rich Toast/alert/notification/popup library for Flutter.
- flutter_secure_storage - A Flutter plugin to store data in secure storage (encrypted, not in plain text like shared_preferences). Eg. for storing user credentials, tokens...
- intl - Provides internationalization and localization facilities, including message translation, plurals and genders, date/number formatting and parsing, and bidirectional text.
- sizer - A package for adapting screen and font size.
- flutter_svg - For rendering SVG assets.
- google_fonts - A Flutter package to use fonts from fonts.google.com.
- auto_size_text - Flutter widget that automatically resizes text to fit perfectly within its bounds.
- flutter_native_splash - Generates iOS, Android, and Web-native code for customizing the native splash screen background color and splash image.
- flutter_launcher_icons - Fully flexible toolset for updating your Flutter app's launcher icons (Android and Ios).
- rename - Change your flutter project's AppName and BundleId (IOS, Android, macOS and Web).
- change_app_package_name - Complementary to rename package, for changing app package name in Android and renaming correctly directories (which rename doesn't do).
All the necessary config and dependencies have already been set and ready for use but there is an explanation of each step if you want to know more about the pre-config or customize it.
Initialize the Flutter project, add all the necessary dependencies mentioned above in the pubspec.yaml configuration file and run pub get
.
pubspec.yaml
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.5
#Text
google_fonts: ^3.0.1
auto_size_text: ^3.0.0
#Responsive
sizer: ^2.0.15
#Image
flutter_svg: ^1.1.6
#Design
sensors_plus: ^1.4.0
#JsonAnnotation
json_annotation: ^4.7.0
#Equality Operator
equatable: ^2.0.5
#Network
vexana: ^3.0.1
url_launcher: ^6.1.6
connectivity_plus: ^2.3.5
#Locale Storage
flutter_secure_storage: ^6.0.0
#Navigation
go_router: ^5.1.1
#Localization
intl: ^0.17.0
easy_localization: ^3.0.1
bot_toast: ^4.0.3
#State Management
provider: ^6.0.4
flutter_riverpod: ^2.1.3
flutter_bloc: ^8.1.1
#Native Splash Screen
flutter_native_splash: ^2.2.13
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
# Code generation
build_runner: ^2.2.0
# Json serialization code generation
json_serializable: ^6.3.1
# Native Launcher Icons generator
flutter_launcher_icons: ^0.10.0
# Change app package name/bundle id and app name
change_app_package_name: ^1.1.0
rename: ^2.0.1
Change the app name to your own one.
flutter pub run rename --appname "YourAppName"
Change the package name/bundle id to your own one.
flutter pub run change_app_package_name:main com.company.name &&
flutter pub run rename --bundleId com.company.name
Add flutter_native_splash.yaml config file to the project root directory. (See the concerned for more information)
flutter_native_splash:
# ...
color: "#ffffff"
background_image: "assets/background.png"
image: assets/splash.png
# ...
Generate the splash screens after you have added your own configuration.
flutter pub run flutter_native_splash:create
Add flutter_launchers_icons.yaml config file to the project root directory. (See the concerned for more information)
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icons/launcher_icon.png"
# Icons with alpha channel are not allowed in the Apple App Store.
remove_alpha_ios: true
# ...
Generate the launcher icons after you have added your own configuration.
flutter pub run flutter_launcher_icons:main
The android minSdKVersion is set to Android API level 21 to comply to modern libraries requirements support. Eg. flutter_secure_storage (requires Android API level 18).
android/app/build.gradle
android {
//...
defaultConfig {
//...
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
//...
}
Change package name/bundle id
flutter pub run change_app_package_name:main com.new.package.name && flutter pub run rename --bundleId com.new.package.name
Change App Name
flutter pub run rename --appname "NewAppName"
Run build_runner to generate/regenerate code from code generating packages (easy_localization, json_serializable, etc.)
flutter pub run build_runner build
Generate while overriding old outputs
flutter packages pub run build_runner build --delete-conflicting-outputs
Watch and regenerate after each change
flutter pub run build_runner watch
Generate easy_localization translation string keys for usage in code
flutter pub run easy_localization:generate -O lib/core/ -f keys -o locale_keys.g.dart --source-dir assets/translations
Generate native launcher icons from config.
flutter pub run flutter_launcher_icons:main
Generate native splash screens from config
flutter pub run flutter_native_splash:create
Main folders structure
π assets
π icons
π images
π translations
π en.json
...π {locale}.json
π lib
π src
π core
π base
π bloc
π auth
π {auth_bloc}.dart
π {auth_event}.dart
π {auth_state}.dart
π app_bloc_observer.dart
π functions
π base_functions.dart
π models
π auth_response_model.dart
π auth_response_model.g.dart
π services
π auth
π auth_service.dart
π singleton
π base_singleton.dart
π components
π animations
π animatedLists
π animated_grid_view.dart
π animated_horizontal_list_view.dart
π animated_list_view.dart
π animated_scroll_view_item.dart
π animationUtils
π animate_in_effect.dart
π animated_scale.dart
π animated_text_wrapper.dart
π animated_text.dart
π auto_fade.dart
π fade_in_effect.dart
π gyroscope_effect_stream_builder.dart
π list_item_wrapper_widget.dart
π mouse_region_effect.dart
π provider
π appbar
π custom_app_bar.dart
π button
π button_widget.dart
π noNetwork
π no_network_widget.dart
π popup
π main_popup.dart
π scaffold
π custom_scaffold.dart
π text
π custom_text.dart
π textFormField
π text_form_field_widget.dart
π validate_operations.dart
π constants
π app
π app_constants.dart
π color_constants.dart
π enums
π icon_enums.dart
π network_enums.dart
π network_results_enums.dart
π route_enums.dart
π extensions
π context_extensions.dart
π iterable_extensions.dart
π logging_extension.dart
π network_extensions.dart
π num_extensions.dart
π string_extensions.dart
π init
π language
π local_storage
π local_storage_manager.dart
π main_build
π main_build.dart
π network
π network_change_manager.dart
π no_network_widget.dart
π vexana_manager.dart
π routes
π routes.dart
π theme
π app_theme.dart
π utils
π typedefs.dart
π dependency_injector.dart
π mixins
π launch_mixin.dart
π safe_context_mixin.dart
π state_mixin.dart
π locale_keys.g.dart
π view
π auth
π login
π login_view.dart
π register
π register_view.dart
π home
π bloc
π {home_bloc}.dart
π {home_event}.dart
π {home_state}.dart
π model
π home_model.dart
π home_model.g.dart
π service
π home_service.dart
π widgets
π home_card.dart
π home_view.dart
π main.dart
π scripts
π build.sh
π test
π auth
π auth_service_test.dart
π flutter_launcher_icons.yaml
π flutter_native_splash.yaml
π pubspec.yaml
π README.md
- Flutter - Flutter framework official website.
- Flutter Docs - Flutter official documentation.