3.3 KiB
3.3 KiB
TT-010 — Settings & Export Feature
Type: Story
Priority: Medium
Labels: ui, feature, settings, export
Depends on: TT-005
Blocks: —
Summary
Implement the Settings screen covering language selection, theme override, and the full data export flow (CSV + PDF + JSON) via the system share sheet.
UI Specification
SettingsScreen sections
┌──────────────────────────────┐
│ AppBar: "Settings" │
├──────────────────────────────┤
│ ▶ APPEARANCE │
│ Theme [System ▼] │
│ Language [English ▼] │
│ │
│ ▶ DATA │
│ Export data → │
│ Import / Restore → │
│ │
│ ▶ ABOUT │
│ Version 0.1.0 │
│ Licenses │
└──────────────────────────────┘
Export Flow (ExportSheet)
Triggered from Settings → "Export data" or Reports → AppBar export button.
1. Select format: [CSV] [PDF] [JSON]
2. Select range: [Today] [This week] [This month] [Custom]
3. Filter project: [All projects ▼]
4. → Share button → share_plus share sheet
Export Implementation
CSV
- Columns:
id, project, start_time, end_time, duration_seconds, note, tags - Tags: pipe-separated
- Encoding: UTF-8 with BOM
- File name:
timetrack_export_2026-07-12.csv
- Header: App name, export date, period
- Summary table: Project | Total hours | %
- Entries table: Date | Project | Duration | Note
- File name:
timetrack_report_2026-07-12.pdf
JSON
- Full backup schema — see
.ai/features/export.md - File name:
timetrack_backup_2026-07-12.json
Settings Persistence
Store user preferences in shared_preferences:
| Key | Type | Default |
|---|---|---|
theme_mode |
String | system |
locale |
String | device locale |
Expose as Riverpod @riverpod providers:
themeModeProvider— reads / writesThemeModelocaleProvider— reads / writesLocaleWire intoapp.dartMaterialApp.router.
Acceptance Criteria
- Theme dropdown: System / Light / Dark — changes app theme immediately
- Language dropdown: English / Deutsch — changes app locale immediately
- Export sheet: all 3 formats functional, share sheet opens
- Export produces non-empty files for each format
- CSV UTF-8 BOM present (verify with hex check in test)
- PDF renders without exception for non-empty date range
- JSON is valid and matches backup schema
- Preferences persist across app restart (shared_preferences)
- Widget test: theme selection updates
themeModeProvider
Files to create / modify
lib/features/settings/presentation/settings_screen.dart(replace stub)lib/features/settings/presentation/widgets/export_sheet.dartlib/features/settings/domain/settings_provider.dartlib/features/settings/data/export_service.darttest/features/settings/export_service_test.dart
Dependencies to add
shared_preferences: ^2.3.3
Add to pubspec.yaml.