A initial flutter project by Nikesh Maharjan to app developement team. This project uses getIt for dependency injection and flavors for dev, uat & prod built. While working in new project it takes around 4 hours to setup the project. To save the time of creating project and updating project to up-to-date this initial project concept has been created.
- Fork Project from the original repository
- setup upstream (optional)
- Replace package name
com.organization.initialproject
with yourcom.yourorganization.yourprojectname
. (shift+cmd+R in Android Studio and shift+cmd+H in vscode IDE) - Android creates folder according to package name so we need to change that as well which is located at
/android/app/src/main/kotlin
- Define flavor arguments for project if not already, pass
dev
,uat
orprod
in arguments field or you can run though commandflutter run --flavor dev
- Clean the project with
flutter clean
^_^ - Run
main.dart
and you should see printed on the screen with the enviornment you're using.
- Router
- Using auto_route takes flutter navigation to one step further on authenticating.
Usage: Register the page inside
lib/core/routes/app_router
enable guards if needed (can be custom logic with custom class). For example look atcore/routes/auth_guard
onNavigation override method, where it can write custom login & navigate to different page from here this keeps navigation business logic in it's own way, maintains project clean architecture. Don't forget to run the build_runner command. ^_^
- User Interface
- Use of
ThemeData
for UI styling, configuring colors, sizes, replace default styling in flutter widget. see some of already used sample/lib/config/app_theme.dart
- While creating reusable widget use
app_widget_name
to make better naming. for example app_text_field, app_button, etc also keep in mind, you can modify widget with.copywith(parms)
for modifying params in widget. also make sure to place them insidecore/widgets/
- You can use of styled_widget to make UI code shorter & clearer to understand. But I recommend not to use
Row
andColumn
widget from styled widget because dart widget inspection has problem recognizing it.