Add Flutter project skeleton (Android-only MVP)
Five-layer architecture per DMC_Architektur_und_Design.md: FlightControllerLink abstraction (Mock + MSP stub), protocol-neutral mission domain layer, App-Mode state machine with Ready-to-Fly gate, Drift persistence schema, and placeholder UI screens wired via go_router. App icon generated from design/Y2_pink_dark.svg. Verified with flutter analyze and flutter test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
62d655fe8e
commit
346fcc2183
@@ -0,0 +1,39 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
part 'app_database.g.dart';
|
||||
|
||||
/// Persistenz fuer Missionen (Architektur-Doku 4.15): Drift statt Hive, weil
|
||||
/// indexierte Abfragen (Suche nach Name/Ort/Datum) benoetigt werden und das
|
||||
/// Schema kompatibel zu einem kuenftigen lokal-first Server-Sync-Muster
|
||||
/// (Dirty-Flags, Server-IDs) bleiben soll.
|
||||
class Missions extends Table {
|
||||
IntColumn get id => integer().autoIncrement()();
|
||||
TextColumn get name => text()();
|
||||
TextColumn get location => text().nullable()();
|
||||
DateTimeColumn get createdAt =>
|
||||
dateTime().withDefault(currentDateAndTime)();
|
||||
TextColumn get waypointsJson => text()();
|
||||
BoolColumn get isDirty => boolean().withDefault(const Constant(true))();
|
||||
TextColumn get serverId => text().nullable()();
|
||||
}
|
||||
|
||||
@DriftDatabase(tables: [Missions])
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase() : super(_openConnection());
|
||||
|
||||
@override
|
||||
int get schemaVersion => 1;
|
||||
|
||||
static LazyDatabase _openConnection() {
|
||||
return LazyDatabase(() async {
|
||||
final dbFolder = await getApplicationDocumentsDirectory();
|
||||
final file = File(p.join(dbFolder.path, 'dmc_missions.sqlite'));
|
||||
return NativeDatabase.createInBackground(file);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user