117 lines
6.5 KiB
Markdown
117 lines
6.5 KiB
Markdown
# Mobile Project Structure / Mobil Proje Yapısı
|
||
|
||
Bu doküman, Stellar mobil uygulamasının teknik mimarisini, klasör yapısını ve kullanılan teknolojileri hem Türkçe hem de İngilizce olarak açıklar.
|
||
This document explains the technical architecture, folder structure, and technologies used in the Stellar mobile application in both Turkish and English.
|
||
|
||
---
|
||
|
||
## 1. Technology Stack / Teknoloji Yığını
|
||
|
||
- **Framework:** Flutter (Darta)
|
||
- **State Management:** Riverpod (with Code Generation)
|
||
- **Networking:** Dio
|
||
- **Dependency Injection:** GetIt & Injectable
|
||
- **UI Components:** Syncfusion DataGrid, Material Design
|
||
- **Local Storage:** Flutter Secure Storage, Shared Preferences
|
||
|
||
---
|
||
|
||
## 2. Project Hierarchy / Proje Hiyerarşisi
|
||
|
||
```text
|
||
lib/
|
||
├── core/ # Core functionalities (API, DI, Config, Services) / Çekirdek işlevler
|
||
│ ├── api/ # API Client (Dio) and interceptors / API İstemcisi ve interceptorlar
|
||
│ ├── config/ # App configuration / Uygulama yapılandırması
|
||
│ ├── constants/ # App-wide constants / Uygulama genelindeki sabitler
|
||
│ ├── di/ # Dependency Injection setup / Bağımlılık Enjeksiyonu kurulumu
|
||
│ └── services/ # Global services (Storage, etc.) / Global servisler
|
||
├── common/ # Shared entities, widgets, and utilities / Ortak öğeler, widgetlar ve araçlar
|
||
├── features/ # Feature-based modules / Özellik bazlı modüller
|
||
│ ├── auth/ # Authentication feature / Kimlik doğrulama özelliği
|
||
│ ├── data/ # General data viewing features / Genel veri görüntüleme özellikleri
|
||
│ ├── field_entry/ # Field data entry modules / Saha veri giriş modülleri
|
||
│ └── ... # Other features (rfi, ndt, fitup, etc.) / Diğer özellikler
|
||
└── main.dart # App entry point / Uygulama giriş noktası
|
||
```
|
||
|
||
---
|
||
|
||
## 3. Feature Architecture (Clean Architecture) / Özellik Mimarisi
|
||
|
||
Her özellik, **Clean Architecture** prensiplerine göre üç ana katmana ayrılmıştır:
|
||
Each feature is divided into three main layers based on **Clean Architecture** principles:
|
||
|
||
### A. Data Layer / Veri Katmanı
|
||
- **DataSources:** Raw API calls using Dio. / Dio kullanarak ham API çağrıları.
|
||
- **DTOs (Models):** JSON serialization and data transfer objects. / JSON serileştirme ve veri transfer nesneleri.
|
||
- **Repositories (Impl):** Concrete implementation of data logic. / Veri mantığının somut uygulaması.
|
||
|
||
### B. Domain Layer / Alan Katmanı
|
||
- **Entities:** Pure business logic objects. / Saf iş mantığı nesneleri.
|
||
- **Repositories (Interface):** Abstract definitions of data operations. / Veri operasyonlarının soyut tanımları.
|
||
|
||
### C. Presentation Layer / Sunum Katmanı
|
||
- **Screens/Pages:** UI widgets. / Kullanıcı arayüzü bileşenleri.
|
||
- **Providers:** Riverpod providers for state management. / Durum yönetimi için Riverpod sağlayıcıları.
|
||
- **Widgets:** Feature-specific reusable UI components. / Özelliğe özel tekrar kullanılabilir bileşenler.
|
||
|
||
---
|
||
|
||
## 4. UI Components & Widgets / Arayüz Bileşenleri ve Widgetlar
|
||
|
||
### A. Navigation & Menu / Navigasyon ve Menü
|
||
- **SidebarMenu:** `lib/features/data/presentation/widgets/sidebar_menu.dart`
|
||
- Bu bileşen uygulamanın ana **Drawer** menüsüdür. / This is the main **Drawer** menu.
|
||
- Modülleri aramak için bir arama çubuğu ve kullanıcı bilgilerini gösteren bir başlık içerir. / Includes a search bar for modules and a header with user info.
|
||
- Modül sluglarına göre ilgili ekranlara yönlendirme yapar. / Routes to specific screens based on module slugs.
|
||
|
||
### B. Filtering System / Filtreleme Sistemi
|
||
- **ModuleDataScreen Filters:** `lib/features/data/presentation/screens/module_data_screen.dart`
|
||
- **_buildFilterHeader:** Listenin üstünde bulunan, aktif filtreleri ve "Sort/Filter" butonlarını içeren kısımdır. / The header above the list containing active filters and "Sort/Filter" buttons.
|
||
- **_FilterSheet:** Çoklu kriterlere göre filtreleme yapılmasını sağlayan bottom sheet bileşenidir. / A bottom sheet component for multi-criteria filtering.
|
||
- Filtreler JSON formatında backend'e gönderilir. / Filters are sent to the backend in JSON format.
|
||
|
||
### C. Actions & Inspections / Aksiyonlar ve Muayeneler
|
||
- **InspectionDockedFab:** `lib/features/data/presentation/widgets/inspection_fab.dart`
|
||
- Veri listesi (`ModuleDataScreen`) ve detay sayfalarında bulunan ana aksiyon butonudur. / The main action button in `ModuleDataScreen` and detail sheets.
|
||
- Fotoğraf yükleme ve yorum ekleme işlevlerini yönetir. / Manages photo upload and comment addition.
|
||
- **InspectionHistorySheet:**
|
||
- `lib/features/data/presentation/widgets/inspection_history_sheet.dart`
|
||
- Seçili kayda ait muayene fotoğraflarını ve geçmişini listeler. / Lists inspection photos and history for the selected record.
|
||
|
||
### D. Data Display / Veri Gösterimi
|
||
- **ModuleDataScreen:** Genel veri listeleme ekranıdır. Sayfalama (Infinite Scroll) ve PDF görüntüleme desteği sunar. / Generic data listing screen with infinite scroll and PDF viewing support.
|
||
- **_buildListItem:** Her bir veri satırını (Card) özelleştirilmiş icon ve badge'lerle oluşturur. / Builds each record card with customized icons and badges.
|
||
|
||
---
|
||
|
||
## 5. State Management / Durum Yönetimi
|
||
|
||
The project uses **Riverpod** with code generation (`@riverpod` annotation).
|
||
Projede kod üretimi (`@riverpod` anotasyonu) ile **Riverpod** kullanılmaktadır.
|
||
|
||
- **Sync State:** Simple state variables. / Basit durum değişkenleri.
|
||
- **Async State:** `FutureProvider` or `Notifier` for API data. / API verileri için `FutureProvider` veya `Notifier`.
|
||
|
||
---
|
||
|
||
## 5. API Handling / API Yönetimi
|
||
|
||
- **ApiClient:** Located in `lib/core/api/`, it handles base URLs, headers, and token injection.
|
||
- **ApiClient:** `lib/core/api/` altında bulunur, base URL, headerlar ve token enjeksiyonunu yönetir.
|
||
- **Interceptors:** Automatically adds Bearer tokens to requests from `StorageService`.
|
||
- **Interceptorlar:** `StorageService` üzerinden gelen Bearer tokenları otomatik olarak isteklere ekler.
|
||
|
||
---
|
||
|
||
## 6. Dependency Injection / Bağımlılık Enjeksiyonu
|
||
|
||
We use **GetIt** combined with **Injectable**.
|
||
**GetIt** ve **Injectable** kombinasyonunu kullanıyoruz.
|
||
|
||
- annotate classes with `@injectable` or `@singleton`.
|
||
- Sınıfları `@injectable` veya `@singleton` ile işaretleyin.
|
||
- Run `build_runner` to generate injection code.
|
||
- Enjeksiyon kodunu oluşturmak için `build_runner` çalıştırın.
|