From 3b130fb59d76d8f9889da961dae10044223b46e0 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 9 Jun 2026 11:02:06 +0200 Subject: [PATCH] basic models --- lib/model/latlng.dart | 7 +++++++ lib/model/location.dart | 14 ++++++++++++++ lib/model/task.dart | 27 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 lib/model/latlng.dart create mode 100644 lib/model/location.dart create mode 100644 lib/model/task.dart diff --git a/lib/model/latlng.dart b/lib/model/latlng.dart new file mode 100644 index 0000000..d2ee885 --- /dev/null +++ b/lib/model/latlng.dart @@ -0,0 +1,7 @@ +class LatLng { + final double lat; + final double lng; + + LatLng(this.lat, this.lng); + LatLng.empty() : lat = 0, lng = 0; +} diff --git a/lib/model/location.dart b/lib/model/location.dart new file mode 100644 index 0000000..1464424 --- /dev/null +++ b/lib/model/location.dart @@ -0,0 +1,14 @@ +import 'latlng.dart'; + +class Location { + final String? _address; + final LatLng? _coordinates; + + Location({this._address, this._coordinates}); + + Location.fromAddress({required this._address}) : _coordinates = null; + Location.fromCoordinates({required this._coordinates}) : _address = null; + + String get address => _address ?? ''; + LatLng get coordinates => _coordinates ?? LatLng.empty(); +} diff --git a/lib/model/task.dart b/lib/model/task.dart new file mode 100644 index 0000000..4917935 --- /dev/null +++ b/lib/model/task.dart @@ -0,0 +1,27 @@ +import 'location.dart'; + +class Task { + final String title; + final String description; + final DateTime? start; + final DateTime? due; + final bool isCompleted; + final String category; + final List subtasks; + final List alarms; + final Location? location; + final String url; + + Task({ + required this.title, + this.description = '', + this.start, + this.due, + this.isCompleted = false, + this.category = '', + this.subtasks = const [], + this.alarms = const [], + this.location, + this.url = '', + }); +}