A simple mobile app for browsing movies from TMDB
The code of the app implements clean architecture to separate the UI, domain and data layers with a features-first approach for folder structure.
lib
├── app
├── core
│ ├── animations
│ ├── app_state
│ ├── configs
│ ├── errors
│ ├── extensions
│ ├── models
│ ├── routes
│ ├── services
│ │ ├── http
│ │ └── storage
│ ├── theme
│ ├── utils
│ ├── widgets
│ │ └── loaders
├── features
│ ├── auth
│ │ ├── application
│ │ ├── infrastructure
│ │ │ ├── models
│ │ │ └── repositories
│ │ └── presentation
│ │ ├── pages
│ │ └── widgets
│ ├── movies
│ │ ├── application
│ │ ├── infrastructure
│ │ │ ├── models
│ │ │ └── repositories
│ │ └── presentation
│ │ ├── pages
│ │ └── widgets
├── firebase_options.dart
└── main.dart
-
main.dart
file has services initialization code and wraps the rootMovieApp
with aProviderScope
. -
firebase_options.dart
is auto-generated file byflutterfire CLI
which contains all the nessary configuration forfirebase
. integration. -
The
app
folder withtmdb_movieapp
has the rootMaterialApp
which injects thetheme data
andnavigation data
entire all the widget tree. -
The
core
folder contains code shared across features :-
animations
folder contains the code to animate the widgets. -
app_state
folder contains the model that represents the state of app during api calli.e initial, loading, loaded, success, error
. -
configs
contains the configuration of app such asbase_url
for api call. -
constants
folder is where all the constant values used across the app such asapp_assets
with list of the path forassets
are declared. -
errors
folder contains the model that parsesexceptions
anddio_error
and returnsfailure
object. -
extensions
folder contains all the extension methods such assnackbar_extension
that shows snackbar when called likecontext.showSnackbar()
. -
models
folder contains the core models forpagination
andcaching
the api response. -
routes
folders contains the list ofroute_paths
andgo_router
navigation configurations. -
services
folder abstract app-level services with their implementations -
theme
folder contain general styles (colors, themes & text styles) -
utils
folder contain the helper methods such asvalidators
forforms
. -
widgets
folder contains all thecore-widgets
that are rendered in similar state across the app, such asshimmer
,error_view
,buttons
,text-fields
,loading-indicators
, etc.
-
-
The
features
folder: the repository pattern is used to decouple logic required to access data sources from the domain layer.application
folder also known asdomain layer
that contains all the business logic of the particular feature for examplelatest_movie_provider
controls theapp state
fromloading
tosuccess
orerror
based onAPI
response and sends it back toUI
where thelisteners
andbuilders
renders the components based on data provided.intrastructure
folder also known asdata layer
: The repository pattern is used to decouple logic required to access data sources from the domain layer.models
folder contains all the data class model generated usingFreezed
with support for parsingjson
todart object
,copy-with
method, and more.repositories
folder contains theabstract-class
and it'simplementation
which interact withnetwork calls
parses data and sends back todomain
layer.
-
The
presentation
folder also known aspresentation layer
which contains all theUI
components.
Clone
from the provided repo link.- Run command
flutter pub get
. - Create
firebase
project and set it up, also enablegoogle
sign-in & set up SHA1 or 256 fingerprint andemail and password
signin. - Run the project, via command
flutter run
orIDE
.
- lottie: ^2.1.0
- flutter_vector_icons: ^2.0.0
- flutter_svg: ^1.1.6
- flex_color_scheme: ^6.1.1
- flutter_launcher_icons: ^0.11.0