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,65 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
/// Explizite Zustandsfolge Plan -> Connect -> Upload -> Fly
|
||||
/// (Architektur-Doku 2.2).
|
||||
enum AppMode { plan, connect, upload, fly }
|
||||
|
||||
class AppModeState {
|
||||
const AppModeState({
|
||||
this.mode = AppMode.plan,
|
||||
this.missionUploaded = false,
|
||||
this.missionVerified = false,
|
||||
this.droneArmed = false,
|
||||
});
|
||||
|
||||
final AppMode mode;
|
||||
final bool missionUploaded;
|
||||
final bool missionVerified;
|
||||
final bool droneArmed;
|
||||
|
||||
/// Ready-to-Fly-Gate (Doku 2.2 / 4.5): Upload + verifiziert + disarmed.
|
||||
/// Muss technisch erzwungen werden, nicht nur als UI-Konvention gelten.
|
||||
bool get readyToFly => missionUploaded && missionVerified && !droneArmed;
|
||||
|
||||
AppModeState copyWith({
|
||||
AppMode? mode,
|
||||
bool? missionUploaded,
|
||||
bool? missionVerified,
|
||||
bool? droneArmed,
|
||||
}) {
|
||||
return AppModeState(
|
||||
mode: mode ?? this.mode,
|
||||
missionUploaded: missionUploaded ?? this.missionUploaded,
|
||||
missionVerified: missionVerified ?? this.missionVerified,
|
||||
droneArmed: droneArmed ?? this.droneArmed,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppModeCubit extends Cubit<AppModeState> {
|
||||
AppModeCubit() : super(const AppModeState());
|
||||
|
||||
void toConnect() => emit(state.copyWith(mode: AppMode.connect));
|
||||
|
||||
void toUpload() => emit(state.copyWith(mode: AppMode.upload));
|
||||
|
||||
void missionUploadConfirmed() =>
|
||||
emit(state.copyWith(missionUploaded: true));
|
||||
|
||||
void missionVerifiedConfirmed() =>
|
||||
emit(state.copyWith(missionVerified: true));
|
||||
|
||||
void droneArmedChanged(bool armed) =>
|
||||
emit(state.copyWith(droneArmed: armed));
|
||||
|
||||
/// Wirft, wenn das Ready-to-Fly-Gate nicht erfuellt ist (Doku 4.5).
|
||||
void toFly() {
|
||||
if (!state.readyToFly) {
|
||||
throw StateError('Ready-to-Fly-Gate nicht erfuellt.');
|
||||
}
|
||||
emit(state.copyWith(mode: AppMode.fly));
|
||||
}
|
||||
|
||||
/// Verlassen des Fly-Modus setzt den kompletten Handover-Status zurueck.
|
||||
void toPlan() => emit(const AppModeState());
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import '../waypoint/flat_waypoint_list.dart';
|
||||
|
||||
/// Strategy-Pattern fuer erweiterbare Missionstypen (Architektur-Doku 3.2).
|
||||
abstract class Mission {
|
||||
String get name;
|
||||
|
||||
FlatWaypointList toFlatWaypointList();
|
||||
}
|
||||
|
||||
/// Wegpunkt-Streckenmission - aktuell einziger implementierter Missionstyp.
|
||||
class TrackMission implements Mission {
|
||||
const TrackMission({required this.name, required this.waypoints});
|
||||
|
||||
@override
|
||||
final String name;
|
||||
|
||||
final List<Waypoint> waypoints;
|
||||
|
||||
@override
|
||||
FlatWaypointList toFlatWaypointList() => FlatWaypointList(waypoints);
|
||||
}
|
||||
|
||||
// SurveyAreaMission (Flaechenabflug) und SearchAreaMission (Suchmuster) sind
|
||||
// im Strategy-Pattern vorgesehen, aber noch nicht spezifiziert (Doku 6).
|
||||
@@ -0,0 +1,61 @@
|
||||
/// Protokollneutrales Wegpunkt-Modell (Architektur-Doku 3.2).
|
||||
/// Divergenz zu MSP/MAVLink findet ausschliesslich im Encoder-Schritt statt
|
||||
/// (MspWaypointEncoder / MavlinkMissionEncoder), nicht in diesem Modell.
|
||||
library;
|
||||
|
||||
enum WaypointAction { none, loiter, landing, jump }
|
||||
|
||||
class Waypoint {
|
||||
const Waypoint({
|
||||
required this.lat,
|
||||
required this.lon,
|
||||
required this.altitudeM,
|
||||
required this.speedMs,
|
||||
required this.catchRadiusM,
|
||||
this.action = WaypointAction.none,
|
||||
this.jumpTargetIndex,
|
||||
this.jumpRepeatCount,
|
||||
});
|
||||
|
||||
final double lat;
|
||||
final double lon;
|
||||
final double altitudeM;
|
||||
final double speedMs;
|
||||
final double catchRadiusM;
|
||||
final WaypointAction action;
|
||||
|
||||
/// Nur bei action == jump gesetzt (iNAV Action-Code 6, Doku 7.1).
|
||||
final int? jumpTargetIndex;
|
||||
|
||||
/// Nur bei action == jump gesetzt; null bedeutet Endlos-Wiederholung.
|
||||
final int? jumpRepeatCount;
|
||||
|
||||
Waypoint copyWith({
|
||||
double? lat,
|
||||
double? lon,
|
||||
double? altitudeM,
|
||||
double? speedMs,
|
||||
double? catchRadiusM,
|
||||
WaypointAction? action,
|
||||
int? jumpTargetIndex,
|
||||
int? jumpRepeatCount,
|
||||
}) {
|
||||
return Waypoint(
|
||||
lat: lat ?? this.lat,
|
||||
lon: lon ?? this.lon,
|
||||
altitudeM: altitudeM ?? this.altitudeM,
|
||||
speedMs: speedMs ?? this.speedMs,
|
||||
catchRadiusM: catchRadiusM ?? this.catchRadiusM,
|
||||
action: action ?? this.action,
|
||||
jumpTargetIndex: jumpTargetIndex ?? this.jumpTargetIndex,
|
||||
jumpRepeatCount: jumpRepeatCount ?? this.jumpRepeatCount,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Gemeinsame, protokollunabhaengige Datenstruktur aller Missionstypen.
|
||||
class FlatWaypointList {
|
||||
const FlatWaypointList(this.waypoints);
|
||||
|
||||
final List<Waypoint> waypoints;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'app_mode/app_mode_cubit.dart';
|
||||
import 'ui/app_shell.dart';
|
||||
import 'ui/dmc_colors.dart';
|
||||
import 'ui/screens/library/library_screen.dart';
|
||||
import 'ui/screens/settings/settings_screen.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const DmcApp());
|
||||
}
|
||||
|
||||
final _router = GoRouter(
|
||||
routes: [
|
||||
GoRoute(path: '/', builder: (context, state) => const AppShell()),
|
||||
GoRoute(
|
||||
path: '/settings',
|
||||
builder: (context, state) => const SettingsScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/library',
|
||||
builder: (context, state) => const LibraryScreen(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
class DmcApp extends StatelessWidget {
|
||||
const DmcApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ProviderScope(
|
||||
child: BlocProvider(
|
||||
create: (_) => AppModeCubit(),
|
||||
child: MaterialApp.router(
|
||||
title: 'Drone Mission Control',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
scaffoldBackgroundColor: const Color(0xFF0F0F0F),
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: DmcColors.setBlue,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
),
|
||||
routerConfig: _router,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,708 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'app_database.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
class $MissionsTable extends Missions with TableInfo<$MissionsTable, Mission> {
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
$MissionsTable(this.attachedDatabase, [this._alias]);
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||
'id',
|
||||
aliasedName,
|
||||
false,
|
||||
hasAutoIncrement: true,
|
||||
type: DriftSqlType.int,
|
||||
requiredDuringInsert: false,
|
||||
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
||||
'PRIMARY KEY AUTOINCREMENT',
|
||||
),
|
||||
);
|
||||
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
||||
@override
|
||||
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||
'name',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
);
|
||||
static const VerificationMeta _locationMeta = const VerificationMeta(
|
||||
'location',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<String> location = GeneratedColumn<String>(
|
||||
'location',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
);
|
||||
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
||||
'createdAt',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
||||
'created_at',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.dateTime,
|
||||
requiredDuringInsert: false,
|
||||
defaultValue: currentDateAndTime,
|
||||
);
|
||||
static const VerificationMeta _waypointsJsonMeta = const VerificationMeta(
|
||||
'waypointsJson',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<String> waypointsJson = GeneratedColumn<String>(
|
||||
'waypoints_json',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
);
|
||||
static const VerificationMeta _isDirtyMeta = const VerificationMeta(
|
||||
'isDirty',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<bool> isDirty = GeneratedColumn<bool>(
|
||||
'is_dirty',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.bool,
|
||||
requiredDuringInsert: false,
|
||||
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
||||
'CHECK ("is_dirty" IN (0, 1))',
|
||||
),
|
||||
defaultValue: const Constant(true),
|
||||
);
|
||||
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
||||
'serverId',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
||||
'server_id',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
);
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [
|
||||
id,
|
||||
name,
|
||||
location,
|
||||
createdAt,
|
||||
waypointsJson,
|
||||
isDirty,
|
||||
serverId,
|
||||
];
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'missions';
|
||||
@override
|
||||
VerificationContext validateIntegrity(
|
||||
Insertable<Mission> instance, {
|
||||
bool isInserting = false,
|
||||
}) {
|
||||
final context = VerificationContext();
|
||||
final data = instance.toColumns(true);
|
||||
if (data.containsKey('id')) {
|
||||
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
||||
}
|
||||
if (data.containsKey('name')) {
|
||||
context.handle(
|
||||
_nameMeta,
|
||||
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
||||
);
|
||||
} else if (isInserting) {
|
||||
context.missing(_nameMeta);
|
||||
}
|
||||
if (data.containsKey('location')) {
|
||||
context.handle(
|
||||
_locationMeta,
|
||||
location.isAcceptableOrUnknown(data['location']!, _locationMeta),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('created_at')) {
|
||||
context.handle(
|
||||
_createdAtMeta,
|
||||
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('waypoints_json')) {
|
||||
context.handle(
|
||||
_waypointsJsonMeta,
|
||||
waypointsJson.isAcceptableOrUnknown(
|
||||
data['waypoints_json']!,
|
||||
_waypointsJsonMeta,
|
||||
),
|
||||
);
|
||||
} else if (isInserting) {
|
||||
context.missing(_waypointsJsonMeta);
|
||||
}
|
||||
if (data.containsKey('is_dirty')) {
|
||||
context.handle(
|
||||
_isDirtyMeta,
|
||||
isDirty.isAcceptableOrUnknown(data['is_dirty']!, _isDirtyMeta),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('server_id')) {
|
||||
context.handle(
|
||||
_serverIdMeta,
|
||||
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
||||
);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => {id};
|
||||
@override
|
||||
Mission map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return Mission(
|
||||
id: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}id'],
|
||||
)!,
|
||||
name: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}name'],
|
||||
)!,
|
||||
location: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}location'],
|
||||
),
|
||||
createdAt: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}created_at'],
|
||||
)!,
|
||||
waypointsJson: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}waypoints_json'],
|
||||
)!,
|
||||
isDirty: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.bool,
|
||||
data['${effectivePrefix}is_dirty'],
|
||||
)!,
|
||||
serverId: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}server_id'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
$MissionsTable createAlias(String alias) {
|
||||
return $MissionsTable(attachedDatabase, alias);
|
||||
}
|
||||
}
|
||||
|
||||
class Mission extends DataClass implements Insertable<Mission> {
|
||||
final int id;
|
||||
final String name;
|
||||
final String? location;
|
||||
final DateTime createdAt;
|
||||
final String waypointsJson;
|
||||
final bool isDirty;
|
||||
final String? serverId;
|
||||
const Mission({
|
||||
required this.id,
|
||||
required this.name,
|
||||
this.location,
|
||||
required this.createdAt,
|
||||
required this.waypointsJson,
|
||||
required this.isDirty,
|
||||
this.serverId,
|
||||
});
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
map['id'] = Variable<int>(id);
|
||||
map['name'] = Variable<String>(name);
|
||||
if (!nullToAbsent || location != null) {
|
||||
map['location'] = Variable<String>(location);
|
||||
}
|
||||
map['created_at'] = Variable<DateTime>(createdAt);
|
||||
map['waypoints_json'] = Variable<String>(waypointsJson);
|
||||
map['is_dirty'] = Variable<bool>(isDirty);
|
||||
if (!nullToAbsent || serverId != null) {
|
||||
map['server_id'] = Variable<String>(serverId);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
MissionsCompanion toCompanion(bool nullToAbsent) {
|
||||
return MissionsCompanion(
|
||||
id: Value(id),
|
||||
name: Value(name),
|
||||
location: location == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(location),
|
||||
createdAt: Value(createdAt),
|
||||
waypointsJson: Value(waypointsJson),
|
||||
isDirty: Value(isDirty),
|
||||
serverId: serverId == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(serverId),
|
||||
);
|
||||
}
|
||||
|
||||
factory Mission.fromJson(
|
||||
Map<String, dynamic> json, {
|
||||
ValueSerializer? serializer,
|
||||
}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
return Mission(
|
||||
id: serializer.fromJson<int>(json['id']),
|
||||
name: serializer.fromJson<String>(json['name']),
|
||||
location: serializer.fromJson<String?>(json['location']),
|
||||
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
||||
waypointsJson: serializer.fromJson<String>(json['waypointsJson']),
|
||||
isDirty: serializer.fromJson<bool>(json['isDirty']),
|
||||
serverId: serializer.fromJson<String?>(json['serverId']),
|
||||
);
|
||||
}
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
return <String, dynamic>{
|
||||
'id': serializer.toJson<int>(id),
|
||||
'name': serializer.toJson<String>(name),
|
||||
'location': serializer.toJson<String?>(location),
|
||||
'createdAt': serializer.toJson<DateTime>(createdAt),
|
||||
'waypointsJson': serializer.toJson<String>(waypointsJson),
|
||||
'isDirty': serializer.toJson<bool>(isDirty),
|
||||
'serverId': serializer.toJson<String?>(serverId),
|
||||
};
|
||||
}
|
||||
|
||||
Mission copyWith({
|
||||
int? id,
|
||||
String? name,
|
||||
Value<String?> location = const Value.absent(),
|
||||
DateTime? createdAt,
|
||||
String? waypointsJson,
|
||||
bool? isDirty,
|
||||
Value<String?> serverId = const Value.absent(),
|
||||
}) => Mission(
|
||||
id: id ?? this.id,
|
||||
name: name ?? this.name,
|
||||
location: location.present ? location.value : this.location,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
waypointsJson: waypointsJson ?? this.waypointsJson,
|
||||
isDirty: isDirty ?? this.isDirty,
|
||||
serverId: serverId.present ? serverId.value : this.serverId,
|
||||
);
|
||||
Mission copyWithCompanion(MissionsCompanion data) {
|
||||
return Mission(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
name: data.name.present ? data.name.value : this.name,
|
||||
location: data.location.present ? data.location.value : this.location,
|
||||
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||
waypointsJson: data.waypointsJson.present
|
||||
? data.waypointsJson.value
|
||||
: this.waypointsJson,
|
||||
isDirty: data.isDirty.present ? data.isDirty.value : this.isDirty,
|
||||
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (StringBuffer('Mission(')
|
||||
..write('id: $id, ')
|
||||
..write('name: $name, ')
|
||||
..write('location: $location, ')
|
||||
..write('createdAt: $createdAt, ')
|
||||
..write('waypointsJson: $waypointsJson, ')
|
||||
..write('isDirty: $isDirty, ')
|
||||
..write('serverId: $serverId')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
id,
|
||||
name,
|
||||
location,
|
||||
createdAt,
|
||||
waypointsJson,
|
||||
isDirty,
|
||||
serverId,
|
||||
);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
(other is Mission &&
|
||||
other.id == this.id &&
|
||||
other.name == this.name &&
|
||||
other.location == this.location &&
|
||||
other.createdAt == this.createdAt &&
|
||||
other.waypointsJson == this.waypointsJson &&
|
||||
other.isDirty == this.isDirty &&
|
||||
other.serverId == this.serverId);
|
||||
}
|
||||
|
||||
class MissionsCompanion extends UpdateCompanion<Mission> {
|
||||
final Value<int> id;
|
||||
final Value<String> name;
|
||||
final Value<String?> location;
|
||||
final Value<DateTime> createdAt;
|
||||
final Value<String> waypointsJson;
|
||||
final Value<bool> isDirty;
|
||||
final Value<String?> serverId;
|
||||
const MissionsCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.name = const Value.absent(),
|
||||
this.location = const Value.absent(),
|
||||
this.createdAt = const Value.absent(),
|
||||
this.waypointsJson = const Value.absent(),
|
||||
this.isDirty = const Value.absent(),
|
||||
this.serverId = const Value.absent(),
|
||||
});
|
||||
MissionsCompanion.insert({
|
||||
this.id = const Value.absent(),
|
||||
required String name,
|
||||
this.location = const Value.absent(),
|
||||
this.createdAt = const Value.absent(),
|
||||
required String waypointsJson,
|
||||
this.isDirty = const Value.absent(),
|
||||
this.serverId = const Value.absent(),
|
||||
}) : name = Value(name),
|
||||
waypointsJson = Value(waypointsJson);
|
||||
static Insertable<Mission> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? name,
|
||||
Expression<String>? location,
|
||||
Expression<DateTime>? createdAt,
|
||||
Expression<String>? waypointsJson,
|
||||
Expression<bool>? isDirty,
|
||||
Expression<String>? serverId,
|
||||
}) {
|
||||
return RawValuesInsertable({
|
||||
if (id != null) 'id': id,
|
||||
if (name != null) 'name': name,
|
||||
if (location != null) 'location': location,
|
||||
if (createdAt != null) 'created_at': createdAt,
|
||||
if (waypointsJson != null) 'waypoints_json': waypointsJson,
|
||||
if (isDirty != null) 'is_dirty': isDirty,
|
||||
if (serverId != null) 'server_id': serverId,
|
||||
});
|
||||
}
|
||||
|
||||
MissionsCompanion copyWith({
|
||||
Value<int>? id,
|
||||
Value<String>? name,
|
||||
Value<String?>? location,
|
||||
Value<DateTime>? createdAt,
|
||||
Value<String>? waypointsJson,
|
||||
Value<bool>? isDirty,
|
||||
Value<String?>? serverId,
|
||||
}) {
|
||||
return MissionsCompanion(
|
||||
id: id ?? this.id,
|
||||
name: name ?? this.name,
|
||||
location: location ?? this.location,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
waypointsJson: waypointsJson ?? this.waypointsJson,
|
||||
isDirty: isDirty ?? this.isDirty,
|
||||
serverId: serverId ?? this.serverId,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
if (id.present) {
|
||||
map['id'] = Variable<int>(id.value);
|
||||
}
|
||||
if (name.present) {
|
||||
map['name'] = Variable<String>(name.value);
|
||||
}
|
||||
if (location.present) {
|
||||
map['location'] = Variable<String>(location.value);
|
||||
}
|
||||
if (createdAt.present) {
|
||||
map['created_at'] = Variable<DateTime>(createdAt.value);
|
||||
}
|
||||
if (waypointsJson.present) {
|
||||
map['waypoints_json'] = Variable<String>(waypointsJson.value);
|
||||
}
|
||||
if (isDirty.present) {
|
||||
map['is_dirty'] = Variable<bool>(isDirty.value);
|
||||
}
|
||||
if (serverId.present) {
|
||||
map['server_id'] = Variable<String>(serverId.value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (StringBuffer('MissionsCompanion(')
|
||||
..write('id: $id, ')
|
||||
..write('name: $name, ')
|
||||
..write('location: $location, ')
|
||||
..write('createdAt: $createdAt, ')
|
||||
..write('waypointsJson: $waypointsJson, ')
|
||||
..write('isDirty: $isDirty, ')
|
||||
..write('serverId: $serverId')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _$AppDatabase extends GeneratedDatabase {
|
||||
_$AppDatabase(QueryExecutor e) : super(e);
|
||||
$AppDatabaseManager get managers => $AppDatabaseManager(this);
|
||||
late final $MissionsTable missions = $MissionsTable(this);
|
||||
@override
|
||||
Iterable<TableInfo<Table, Object?>> get allTables =>
|
||||
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
||||
@override
|
||||
List<DatabaseSchemaEntity> get allSchemaEntities => [missions];
|
||||
}
|
||||
|
||||
typedef $$MissionsTableCreateCompanionBuilder =
|
||||
MissionsCompanion Function({
|
||||
Value<int> id,
|
||||
required String name,
|
||||
Value<String?> location,
|
||||
Value<DateTime> createdAt,
|
||||
required String waypointsJson,
|
||||
Value<bool> isDirty,
|
||||
Value<String?> serverId,
|
||||
});
|
||||
typedef $$MissionsTableUpdateCompanionBuilder =
|
||||
MissionsCompanion Function({
|
||||
Value<int> id,
|
||||
Value<String> name,
|
||||
Value<String?> location,
|
||||
Value<DateTime> createdAt,
|
||||
Value<String> waypointsJson,
|
||||
Value<bool> isDirty,
|
||||
Value<String?> serverId,
|
||||
});
|
||||
|
||||
class $$MissionsTableFilterComposer
|
||||
extends Composer<_$AppDatabase, $MissionsTable> {
|
||||
$$MissionsTableFilterComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnFilters<int> get id => $composableBuilder(
|
||||
column: $table.id,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get name => $composableBuilder(
|
||||
column: $table.name,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get location => $composableBuilder(
|
||||
column: $table.location,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
||||
column: $table.createdAt,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get waypointsJson => $composableBuilder(
|
||||
column: $table.waypointsJson,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<bool> get isDirty => $composableBuilder(
|
||||
column: $table.isDirty,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get serverId => $composableBuilder(
|
||||
column: $table.serverId,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $$MissionsTableOrderingComposer
|
||||
extends Composer<_$AppDatabase, $MissionsTable> {
|
||||
$$MissionsTableOrderingComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnOrderings<int> get id => $composableBuilder(
|
||||
column: $table.id,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get name => $composableBuilder(
|
||||
column: $table.name,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get location => $composableBuilder(
|
||||
column: $table.location,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
||||
column: $table.createdAt,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get waypointsJson => $composableBuilder(
|
||||
column: $table.waypointsJson,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<bool> get isDirty => $composableBuilder(
|
||||
column: $table.isDirty,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get serverId => $composableBuilder(
|
||||
column: $table.serverId,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $$MissionsTableAnnotationComposer
|
||||
extends Composer<_$AppDatabase, $MissionsTable> {
|
||||
$$MissionsTableAnnotationComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
GeneratedColumn<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get name =>
|
||||
$composableBuilder(column: $table.name, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get location =>
|
||||
$composableBuilder(column: $table.location, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<DateTime> get createdAt =>
|
||||
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get waypointsJson => $composableBuilder(
|
||||
column: $table.waypointsJson,
|
||||
builder: (column) => column,
|
||||
);
|
||||
|
||||
GeneratedColumn<bool> get isDirty =>
|
||||
$composableBuilder(column: $table.isDirty, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get serverId =>
|
||||
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
||||
}
|
||||
|
||||
class $$MissionsTableTableManager
|
||||
extends
|
||||
RootTableManager<
|
||||
_$AppDatabase,
|
||||
$MissionsTable,
|
||||
Mission,
|
||||
$$MissionsTableFilterComposer,
|
||||
$$MissionsTableOrderingComposer,
|
||||
$$MissionsTableAnnotationComposer,
|
||||
$$MissionsTableCreateCompanionBuilder,
|
||||
$$MissionsTableUpdateCompanionBuilder,
|
||||
(Mission, BaseReferences<_$AppDatabase, $MissionsTable, Mission>),
|
||||
Mission,
|
||||
PrefetchHooks Function()
|
||||
> {
|
||||
$$MissionsTableTableManager(_$AppDatabase db, $MissionsTable table)
|
||||
: super(
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer: () =>
|
||||
$$MissionsTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$$MissionsTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$$MissionsTableAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
Value<int> id = const Value.absent(),
|
||||
Value<String> name = const Value.absent(),
|
||||
Value<String?> location = const Value.absent(),
|
||||
Value<DateTime> createdAt = const Value.absent(),
|
||||
Value<String> waypointsJson = const Value.absent(),
|
||||
Value<bool> isDirty = const Value.absent(),
|
||||
Value<String?> serverId = const Value.absent(),
|
||||
}) => MissionsCompanion(
|
||||
id: id,
|
||||
name: name,
|
||||
location: location,
|
||||
createdAt: createdAt,
|
||||
waypointsJson: waypointsJson,
|
||||
isDirty: isDirty,
|
||||
serverId: serverId,
|
||||
),
|
||||
createCompanionCallback:
|
||||
({
|
||||
Value<int> id = const Value.absent(),
|
||||
required String name,
|
||||
Value<String?> location = const Value.absent(),
|
||||
Value<DateTime> createdAt = const Value.absent(),
|
||||
required String waypointsJson,
|
||||
Value<bool> isDirty = const Value.absent(),
|
||||
Value<String?> serverId = const Value.absent(),
|
||||
}) => MissionsCompanion.insert(
|
||||
id: id,
|
||||
name: name,
|
||||
location: location,
|
||||
createdAt: createdAt,
|
||||
waypointsJson: waypointsJson,
|
||||
isDirty: isDirty,
|
||||
serverId: serverId,
|
||||
),
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
||||
.toList(),
|
||||
prefetchHooksCallback: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
typedef $$MissionsTableProcessedTableManager =
|
||||
ProcessedTableManager<
|
||||
_$AppDatabase,
|
||||
$MissionsTable,
|
||||
Mission,
|
||||
$$MissionsTableFilterComposer,
|
||||
$$MissionsTableOrderingComposer,
|
||||
$$MissionsTableAnnotationComposer,
|
||||
$$MissionsTableCreateCompanionBuilder,
|
||||
$$MissionsTableUpdateCompanionBuilder,
|
||||
(Mission, BaseReferences<_$AppDatabase, $MissionsTable, Mission>),
|
||||
Mission,
|
||||
PrefetchHooks Function()
|
||||
>;
|
||||
|
||||
class $AppDatabaseManager {
|
||||
final _$AppDatabase _db;
|
||||
$AppDatabaseManager(this._db);
|
||||
$$MissionsTableTableManager get missions =>
|
||||
$$MissionsTableTableManager(_db, _db.missions);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import '../app_mode/app_mode_cubit.dart';
|
||||
import '../domain/waypoint/flat_waypoint_list.dart';
|
||||
import '../transport/flight_controller_link.dart';
|
||||
|
||||
/// Orchestriert Connect -> Verify -> Upload -> Ready-to-Fly und erzwingt das
|
||||
/// Ready-to-Fly-Gate (Architektur-Doku 3.3 / 4.5).
|
||||
class MissionSyncService {
|
||||
MissionSyncService(this._link, this._appMode);
|
||||
|
||||
final FlightControllerLink _link;
|
||||
final AppModeCubit _appMode;
|
||||
|
||||
Future<void> syncAndUpload(FlatWaypointList mission) async {
|
||||
await _link.connect();
|
||||
// uploadMission() der jeweiligen FlightControllerLink-Implementierung
|
||||
// verweigert den Upload selbst, falls die Drohne armed ist (Doku 4.5) -
|
||||
// dieser Service verlaesst sich bewusst nicht zusaetzlich auf einen
|
||||
// eigenen Telemetrie-Vorab-Check, um keine zwei Wahrheitsquellen zu haben.
|
||||
await _link.uploadMission(mission);
|
||||
_appMode.missionUploadConfirmed();
|
||||
|
||||
// TODO: echte Verifikation gegen FC-Rueckmeldung, sobald ein
|
||||
// Protokoll-Adapter (MSP/MAVLink) eine Upload-Bestaetigung liefert.
|
||||
_appMode.missionVerifiedConfirmed();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import '../transport/flight_controller_link.dart';
|
||||
|
||||
/// Abonniert Live-Telemetrie vom FC und reicht normalisierte Frames an die
|
||||
/// UI weiter (Architektur-Doku 3.4).
|
||||
///
|
||||
/// Laeuft im MVP noch synchron auf dem UI-Isolate. Die Auslagerung in ein
|
||||
/// eigenes Dart-Isolate (Doku 4.21) ist erst sinnvoll zu verifizieren, sobald
|
||||
/// ein echter Protokoll-Adapter reale Telemetrie-Raten liefert.
|
||||
class TelemetryService {
|
||||
TelemetryService(this._link);
|
||||
|
||||
final FlightControllerLink _link;
|
||||
|
||||
Stream<TelemetryFrame> get frames => _link.subscribeTelemetry();
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import '../domain/waypoint/flat_waypoint_list.dart';
|
||||
|
||||
/// Abstrakte Flugmodi, protokollunabhaengig (Architektur-Doku 3.1).
|
||||
enum FlightMode { missionRun, guidedPoint, returnHome, hold }
|
||||
|
||||
/// Feature-Flags des angebundenen Flightcontrollers (Doku 3.1).
|
||||
class FcCapabilities {
|
||||
const FcCapabilities({
|
||||
required this.supportsMultiMission,
|
||||
required this.supportsInFlightUpload,
|
||||
required this.maxWaypoints,
|
||||
});
|
||||
|
||||
final bool supportsMultiMission;
|
||||
final bool supportsInFlightUpload;
|
||||
final int maxWaypoints;
|
||||
}
|
||||
|
||||
/// Normalisiertes Telemetrie-Frame, das an die UI weitergereicht wird (Doku 3.4).
|
||||
class TelemetryFrame {
|
||||
const TelemetryFrame({
|
||||
required this.lat,
|
||||
required this.lon,
|
||||
required this.altitudeM,
|
||||
required this.speedMs,
|
||||
required this.armed,
|
||||
this.activeWaypointIndex,
|
||||
});
|
||||
|
||||
final double lat;
|
||||
final double lon;
|
||||
final double altitudeM;
|
||||
final double speedMs;
|
||||
final bool armed;
|
||||
final int? activeWaypointIndex;
|
||||
}
|
||||
|
||||
/// Zentrale Abstraktion fuer alle Flightcontroller-Interaktionen (Doku 3.1).
|
||||
/// Implementierungen: MspFlightControllerLink (iNAV), MavlinkFlightControllerLink
|
||||
/// (ArduPilot, Post-MVP), MockFlightControllerLink (Tests ohne Hardware).
|
||||
abstract class FlightControllerLink {
|
||||
FcCapabilities get capabilities;
|
||||
|
||||
Future<void> connect();
|
||||
|
||||
Future<void> disconnect();
|
||||
|
||||
Future<void> uploadMission(FlatWaypointList mission);
|
||||
|
||||
Future<void> setFlightMode(FlightMode mode);
|
||||
|
||||
Future<void> arm();
|
||||
|
||||
Stream<TelemetryFrame> subscribeTelemetry();
|
||||
|
||||
Future<int?> readActiveWaypointIndex();
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import 'dart:async';
|
||||
|
||||
import '../../domain/waypoint/flat_waypoint_list.dart';
|
||||
import '../flight_controller_link.dart';
|
||||
|
||||
/// Synthetische Telemetrie fuer UI-Entwicklung/Tests ohne Hardware oder SITL
|
||||
/// (Architektur-Doku 3.1).
|
||||
class MockFlightControllerLink implements FlightControllerLink {
|
||||
bool _armed = false;
|
||||
int? _activeWaypointIndex;
|
||||
StreamController<TelemetryFrame>? _telemetryController;
|
||||
Timer? _ticker;
|
||||
|
||||
@override
|
||||
FcCapabilities get capabilities => const FcCapabilities(
|
||||
supportsMultiMission: true,
|
||||
supportsInFlightUpload: false,
|
||||
maxWaypoints: 60,
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> connect() async {
|
||||
_telemetryController = StreamController<TelemetryFrame>.broadcast();
|
||||
_ticker = Timer.periodic(const Duration(seconds: 1), (_) {
|
||||
_telemetryController?.add(TelemetryFrame(
|
||||
lat: 52.5,
|
||||
lon: 13.4,
|
||||
altitudeM: 120,
|
||||
speedMs: 18,
|
||||
armed: _armed,
|
||||
activeWaypointIndex: _activeWaypointIndex,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> disconnect() async {
|
||||
_ticker?.cancel();
|
||||
await _telemetryController?.close();
|
||||
_telemetryController = null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> uploadMission(FlatWaypointList mission) async {
|
||||
// iNAV/MAVLink erlauben Mission-Upload nur im unarmed-Zustand (Doku 4.5).
|
||||
if (_armed) {
|
||||
throw StateError('Mission-Upload verweigert: Drohne ist armed.');
|
||||
}
|
||||
_activeWaypointIndex = mission.waypoints.isEmpty ? null : 0;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setFlightMode(FlightMode mode) async {}
|
||||
|
||||
@override
|
||||
Future<void> arm() async {
|
||||
_armed = true;
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<TelemetryFrame> subscribeTelemetry() {
|
||||
final controller = _telemetryController;
|
||||
if (controller == null) {
|
||||
throw StateError('subscribeTelemetry() vor connect() aufgerufen.');
|
||||
}
|
||||
return controller.stream;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<int?> readActiveWaypointIndex() async => _activeWaypointIndex;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import '../../domain/waypoint/flat_waypoint_list.dart';
|
||||
import '../flight_controller_link.dart';
|
||||
|
||||
/// iNAV-Anbindung via MSP (Architektur-Doku 3.1). Eigenstaendiger Adapter,
|
||||
/// da kein fertiges Dart-Paket fuer MSP verfuegbar ist (Doku 4.19).
|
||||
///
|
||||
/// Protokoll-Implementierung (Framing, MSP_SET_WP, MSP_NAV_STATUS, ...) ist
|
||||
/// noch offen - dies ist bewusst nur das Geruest fuer die Abstraktion.
|
||||
class MspFlightControllerLink implements FlightControllerLink {
|
||||
MspFlightControllerLink({required this.host, required this.port});
|
||||
|
||||
final String host;
|
||||
final int port;
|
||||
|
||||
@override
|
||||
FcCapabilities get capabilities => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> connect() => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> disconnect() => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> uploadMission(FlatWaypointList mission) =>
|
||||
throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> setFlightMode(FlightMode mode) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> arm() => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Stream<TelemetryFrame> subscribeTelemetry() => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<int?> readActiveWaypointIndex() => throw UnimplementedError();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../app_mode/app_mode_cubit.dart';
|
||||
import 'screens/fly/fly_screen.dart';
|
||||
import 'screens/plan/plan_screen.dart';
|
||||
|
||||
/// Schaltet zwischen Plan- und Fly-Screen um, gesteuert von der
|
||||
/// App-Mode State Machine (Architektur-Doku 2.2). Connect/Upload sind
|
||||
/// Uebergangszustaende innerhalb des Plan-Screens (Handover-Prozess).
|
||||
class AppShell extends StatelessWidget {
|
||||
const AppShell({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mode = context.select((AppModeCubit c) => c.state.mode);
|
||||
return mode == AppMode.fly ? const FlyScreen() : const PlanScreen();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Markenfarben, uebernommen aus dem HTML-Demonstrator
|
||||
/// ("Drone Mission Control.html"), damit Flutter-UI und Prototyp konsistent
|
||||
/// bleiben.
|
||||
abstract final class DmcColors {
|
||||
static const setBlue = Color(0xFF4D9DFF);
|
||||
static const setBlueLight = Color(0xFF8FD0FF);
|
||||
static const liveGreen = Color(0xFF3ECF8E);
|
||||
static const warnRed = Color(0xFFE2574A);
|
||||
static const pafAmber = Color(0xFFF0C86E);
|
||||
static const editModeGreen = Color(0xFF50C878);
|
||||
static const flyModeRed = Color(0xFFE2574A);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Fly-Modus: Telemetrie, Draeder, Point-and-Fly-Fadenkreuz
|
||||
/// (Architektur-Doku 3.10/3.11). Platzhalter bis Telemetry-Service und
|
||||
/// FlightControllerLink verdrahtet sind.
|
||||
class FlyScreen extends StatelessWidget {
|
||||
const FlyScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
body: Center(child: Text('Fly')),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Missionsuebersicht (Architektur-Doku 3.5/7.5): Suche nach Name/Ort/Datum
|
||||
/// ueber Drift, sobald AppDatabase verdrahtet ist.
|
||||
class LibraryScreen extends StatelessWidget {
|
||||
const LibraryScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Missions')),
|
||||
body: const Center(child: Text('Library')),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Missionsplanung: Karte + Wegpunktliste (Architektur-Doku 3.6/3.7).
|
||||
/// Kartenintegration (flutter_map) und Fillet-Geometrie folgen als naechster
|
||||
/// Schritt - dies ist bewusst nur der Screen-Platzhalter.
|
||||
class PlanScreen extends StatelessWidget {
|
||||
const PlanScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
body: Center(child: Text('Plan')),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Drohnen-Profile: FC-Typ, Flugleistungsdaten, Standardprofil T1 Ranger
|
||||
/// (Architektur-Doku 3.5).
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
const SettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Drone Profiles')),
|
||||
body: const Center(child: Text('Settings')),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user