How gracelium64/kapital5 works
Purpose and Runtime
kapital_5 is a Flutter/Dart GUI collection of daily “Kapital 5” task-sheet examples, intended for display and experimentation across mobile and desktop targets. The shared application lives in lib/; Flutter host shells support Android, iOS, macOS, Linux, Windows, and web.
Application Entry and Composition
• lib/main.dart is the Dart process entry point.
• lib/src/app.dart likely defines the top-level Flutter application and global composition.
• lib/src/main_screen.dart is the probable task-sheet navigation/selection surface.
• lib/src/theme/app_theme.dart and lib/src/theme/palette.dart centralize visual styling.
Control flow is Flutter startup → app/theme construction → main screen → selected feature widget.
Feature-Module Architecture
Task sheets are isolated by lesson-oriented feature directories. Each commonly separates presentation widgets from domain logic:
• Callback and UI-state examples: lib/src/features/5.1.2_callback_functions/presentation/callback_functions.dart
• Form validation: lib/src/features/5.1.4_input_validation/presentation/register.dart, lib/src/features/5.1.4_input_validation/domain/validators.dart
• Async/Future patterns: lib/src/features/5.2.2_futures/presentation/futures.dart, lib/src/features/5.2.3_future_builder/presentation/my_future_builder.dart
• User-input/login flow: lib/src/features/5.3.1_user_input/presentation/login_screen.dart, lib/src/features/5.3.1_user_input/domain/app_user.dart
• Local persistence: lib/src/features/5.3.3_shared_preferences/presentation/shared_prefs.dart
• Network/API example: lib/src/features/5.4.1_simple_api/presentation/simple_api.dart
• Firestore and serialization examples: lib/src/features/6.1.4_firestore_101/presentation/firestore_101.dart, lib/src/features/6.1.5_Serialization/domain/serialization.dart
• A drawing/note-pad interaction module: lib/src/features/ms_paint/presentation/ms_paint.dart
These modules are primarily demonstrators rather than a single integrated business workflow.
Data and Service Boundaries
Repository abstractions distinguish application-facing data operations from implementation:
• Contracts/local abstractions: lib/src/data/authrepository.dart, lib/src/data/databaserepository.dart
• Firebase-backed authentication: lib/src/data/firebase_auth_repository.dart
• Substitute/mock persistence: lib/src/data/mockdatabaserepository.dart
Firebase initialization/configuration is represented by lib/firebase_options.dart, Android android/app/google-services.json, and Apple ios/Runner/GoogleService-Info.plist. Firestore examples cross the app-to-cloud persistence boundary; simple API examples cross an HTTP/network boundary.
State and Interaction Flows
Interactive examples generally follow widget input → feature/domain validation or async work → widget rebuild/render:
• Validation accepts form fields and applies reusable validator functions.
• Login input is mapped to AppUser and rendered in logged-in UI.
• Futures and FutureBuilder examples expose asynchronous completion states.
• Shared-preferences widgets read/write device-local state.
• Firestore forms submit values to Firebase-managed cloud data.
• MS Paint converts pointer-driven input into note/drawing display state.
Platform and Asset Layer
Flutter embeds the same Dart application in native launchers:
• Android: android/app/src/main/kotlin/com/example/kapital_5/MainActivity.kt
• iOS: ios/Runner/AppDelegate.swift
• macOS: macos/Runner/MainFlutterWindow.swift
• Desktop runners: linux/runner/main.cc, windows/runner/main.cpp
• Web bootstrapping: web/index.html
Bundled typography and imagery are under assets/fonts/ and assets/img/; platform icon resources are mirrored in native asset catalogs and Android resources.
Main entry points: main_screen.dart Task-sheet navigator · app.dart App composition · main.dart Dart entry · register.dart Validation form
Components 21
Flutter application
Shared Dart UI and composition.
- Dart entry
lib/main.dart - App composition
lib/src/app.dart - Task-sheet navigator · Selects demonstration widgets.
lib/src/main_screen.dart - Theme and palette
lib/src/theme/app_theme.dart - Fonts and images
assets/fonts
Task-sheet features
Independent lesson-oriented examples.
- Callbacks example
lib/src/features/5.1.2_callback_functions/presentation/callback_functions.dart - Validation form
lib/src/features/5.1.4_input_validation/presentation/register.dart - Validators
lib/src/features/5.1.4_input_validation/domain/validators.dart - Futures examples · Future and FutureBuilder completion-state demonstrations.
lib/src/features/5.2.2_futures/presentation/futures.dart - Login input
lib/src/features/5.3.1_user_input/presentation/login_screen.dart - App user
lib/src/features/5.3.1_user_input/domain/app_user.dart - Shared preferences
lib/src/features/5.3.3_shared_preferences/presentation/shared_prefs.dart - Simple API
lib/src/features/5.4.1_simple_api/presentation/simple_api.dart - Firestore 101
lib/src/features/6.1.4_firestore_101/presentation/firestore_101.dart - MS Paint · Transforms pointer input into drawing state.
lib/src/features/ms_paint/presentation/ms_paint.dart
Data and services
Repository and external-service boundaries.
- Repository contracts
lib/src/data/authrepository.dart - Firebase auth repository
lib/src/data/firebase_auth_repository.dart - Firebase options
lib/firebase_options.dart - Firebase services · Authentication and Firestore persistence.
- HTTP API
Platform hosts
Native and web launch shells.
- Native and web hosts · Embed the shared app across supported targets.
android/app/src/main/kotlin/com/example/kapital_5/MainActivity.kt
Connections 20
- Native and web hosts → Dart entry: launches
- Dart entry → App composition: starts
- App composition → Theme and palette: applies
- App composition → Fonts and images: uses
- App composition → Task-sheet navigator: renders
- Task-sheet navigator → Callbacks example: selects
- Task-sheet navigator → Validation form: selects
- Task-sheet navigator → Futures examples: selects
- Task-sheet navigator → Login input: selects
- Task-sheet navigator → Shared preferences: selects
- Task-sheet navigator → Simple API: selects
- Task-sheet navigator → Firestore 101: selects
- Task-sheet navigator → MS Paint: selects
- Validation form → Validators: validates with
- Login input → App user: maps input to
- Repository contracts → Firebase auth repository: implemented by
- Firebase auth repository → Firebase services: authenticates via
- Firebase options → Firebase services: configures
- Firestore 101 → Firebase services: reads and writes
- Simple API → HTTP API: requests