How rrifafauzikomara/flutter_modularization works
1. Repository purpose
- This is a Flutter mobile app demonstrating “modularization” by splitting the codebase into clear feature and infrastructure folders.
- The app is a movie-catalog style UI, with list and detail views, and the README indicates it was used to explore different modularization approaches across branches.
2. Top-level runtime boundary
- The actual app runtime is the Flutter framework, with a single Dart entrypoint at lib/main.dart.
- Native Android and iOS folders are standard Flutter host shells; they mainly provide app launch/configuration and do not appear to contain business logic.
3. Presentation layer
- lib/ui/ contains the main screens:
- home_page.dart for the primary browse/list experience
- detail_page.dart for the selected movie’s detail view
- This is the topmost UI boundary where app navigation and screen composition happen.
4. Reusable UI components
- lib/widget/ holds reusable, presentation-only building blocks such as:
- movie cards and posters
- genre chips
- rating and storyline sections
- detail header/banner elements
- These widgets reduce duplication and keep screen files focused on layout and orchestration rather than raw UI rendering.
5. Data and network boundary
- lib/network/api/api_provider.dart is the key integration point for fetching movie data from an external API.
- This layer is separated from the UI, so screens consume data through a network abstraction rather than embedding request logic directly.
6. Domain/data models
- lib/network/model/movie.dart and lib/network/model/genres.dart define the structured data consumed by the UI.
- These model classes form the contract between API responses and visual components, helping keep parsing/representation isolated from widget code.
7. Shared utilities
- lib/common/color_helper.dart centralizes color-related constants or helpers used across the UI.
- This is a small shared utility boundary for consistency and theming.
8. Likely data flow through the app
- main.dart boots the app and routes into the screen tree.
- The home screen obtains movie data via ApiProvider, maps it into model objects, and renders a list using reusable widgets.
- Selecting an item navigates to detail_page.dart, which composes multiple detail widgets using the same model data.
9. State and architecture style
- From the file structure, this is a relatively lightweight Flutter architecture: screen widgets orchestrate data retrieval and composition, while the network/model layer is separated but not deeply layered into repositories/use-cases.
- The README references a BLoC branch, but this tree itself looks like the simpler, non-BLoC modularized version.
10. Platform-specific shells
- android/ and ios/ only contain generated app scaffolding, launch assets, manifests, and entry classes (MainActivity.kt, AppDelegate.swift).
- They are important for deployment, but the app’s functional architecture lives in Dart under lib/.
11. Testing
- test/widget_test.dart provides the standard Flutter test entrypoint, suggesting minimal automated coverage in this snapshot.
- No separate backend, service, or local persistence subsystem is visible in this repository layout.
12. Diagram takeaway
- The cleanest architecture view is: Flutter app entrypoint → UI screens → reusable widgets, with screens depending on the network API layer and model layer, plus a small shared utility layer for common styling.
Main entry points: detail_page.dart Detail page · home_page.dart Home page · main.dart App entry · api_provider.dart API provider
Components 17
lib
Flutter application code
- App entry · Bootstraps the app and hands off into the screen tree.
lib/main.dart - Home page · Primary browse screen for listing movies.
lib/ui/home_page.dart - Detail page · Movie detail screen composed from shared widgets.
lib/ui/detail_page.dart - API provider · External movie data access and request boundary.
lib/network/api/api_provider.dart - Movie model · Structured movie data consumed by the UI.
lib/network/model/movie.dart - Genres model · Structured genre data used by screens and widgets.
lib/network/model/genres.dart - Color helper · Common color constants or helpers for consistent styling.
lib/common/color_helper.dart - Movie card · Reusable list item presentation for movie browsing.
lib/widget/card_list_movie.dart - Poster · Poster and artwork rendering component.
lib/widget/poster.dart - Genre chip · Chip-style genre display used in movie views.
lib/widget/chip_genre_movie.dart - Detail header · Top banner/header composition for the detail page.
lib/widget/movie_detail_header.dart - Banner image · Arc/banner image treatment used in detail layouts.
lib/widget/arc_banner_image.dart - Rating info · Displays movie rating and related metadata.
lib/widget/rating_information.dart - Story line · Synopsis and storyline presentation block.
lib/widget/story_line.dart
android
Android host shell
- Android shell · Generated Android launcher, manifest, and native entrypoint scaffolding.
android/app/src/main/kotlin/com/rifafauzi/flutter_modularization/MainActivity.kt
ios
iOS host shell
- iOS shell · Generated iOS launcher, plist, and native app scaffolding.
ios/Runner/AppDelegate.swift
test
Flutter test entrypoint
- Widget test · Standard Flutter test harness for the app.
test/widget_test.dart
Connections 18
- App entry → Home page: boots · Application startup routes into the main browsing UI.
- Home page → API provider: loads data · Home screen fetches movie data through the API boundary.
- Home page → Movie model: renders · Home screen consumes movie records for list presentation.
- Home page → Movie card: uses · List items are rendered with reusable movie card widgets.
- Home page → Color helper: styles · Shared color helpers support consistent presentation.
- Detail page → Movie model: consumes · Detail screen receives the selected movie data.
- Detail page → Detail header: composes · Top section is built from dedicated header widgets.
- Detail page → Poster: shows · Uses poster rendering for artwork display.
- Detail page → Genre chip: shows · Displays genre metadata with chip widgets.
- Detail page → Rating info: shows · Displays rating information as a dedicated block.
- Detail page → Story line: shows · Displays synopsis content in its own section.
- Detail page → Banner image: shows · Uses banner artwork treatment in the detail layout.
- Detail page → Color helper: styles · Shared color helpers support consistent presentation.
- API provider → Movie model: maps to · API responses are converted into movie model objects.
- API provider → Genres model: maps to · API responses are converted into genre model objects.
- Android shell → App entry: launches · Native Android shell launches the Flutter entrypoint.
- iOS shell → App entry: launches · Native iOS shell launches the Flutter entrypoint.
- Widget test → App entry: exercises · Standard test harness targets the app bootstrap.