let AI comment everything because well... yeah...
This commit is contained in:
@@ -22,9 +22,14 @@ import 'widgets/mez.dart';
|
||||
import 'widgets/platzung.dart';
|
||||
import 'widgets/status.dart';
|
||||
|
||||
/// Widget for adding or editing camera trap locations
|
||||
/// Supports template creation, editing existing entries, and new entries
|
||||
class AddCamMain extends StatefulWidget {
|
||||
/// Whether this form is being used to create a template
|
||||
final bool isTemplate;
|
||||
/// Whether the entry has been sent to the server
|
||||
final bool isSent;
|
||||
/// Existing data to populate the form with (for editing)
|
||||
final Map<String, dynamic>? existingData;
|
||||
|
||||
const AddCamMain({
|
||||
@@ -38,14 +43,17 @@ class AddCamMain extends StatefulWidget {
|
||||
State<AddCamMain> createState() => _AddCamMainState();
|
||||
}
|
||||
|
||||
/// State class for the camera trap location form
|
||||
class _AddCamMainState extends State<AddCamMain> {
|
||||
// var declaration
|
||||
/// Current step in the multi-step form
|
||||
int currentStep = 0;
|
||||
/// Whether this form is being used as a template
|
||||
late bool isTemplate;
|
||||
|
||||
/// Current GPS position, initialized with default values for Germany
|
||||
Position currentPosition = Position(
|
||||
longitude: 10.0,
|
||||
latitude: 51.0,
|
||||
longitude: 10.0, // Default longitude (roughly center of Germany)
|
||||
latitude: 51.0, // Default latitude (roughly center of Germany)
|
||||
timestamp: DateTime.now(),
|
||||
accuracy: 0.0,
|
||||
altitude: 0.0,
|
||||
@@ -56,6 +64,12 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
headingAccuracy: 0.0,
|
||||
);
|
||||
|
||||
/// Map containing all form fields with their controllers and required status
|
||||
/// Organized by steps:
|
||||
/// - Step 1: Basic information (ID, Status, etc.)
|
||||
/// - Step 2: Location information
|
||||
/// - Step 3: Dates and control periods
|
||||
/// - Step 4: Contact information
|
||||
Map<String, Map<String, dynamic>> rmap = {
|
||||
"ID": {"controller": TextEditingController(), "required": false},
|
||||
// Step 1
|
||||
@@ -102,6 +116,8 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
"Sent": {"controller": TextEditingController(), "required": false},
|
||||
};
|
||||
|
||||
/// Retrieves all field values as a map
|
||||
/// @return Map of field names to their current values
|
||||
Map<String, String> getFieldsText() {
|
||||
Map<String, String> puff = {};
|
||||
|
||||
@@ -112,8 +128,12 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
return puff;
|
||||
}
|
||||
|
||||
/// Flag indicating whether position is currently being loaded
|
||||
bool isLoadingPosition = false;
|
||||
|
||||
/// Initializes the GPS position
|
||||
/// Handles location permissions and device settings
|
||||
/// @return Future<Position> The determined position
|
||||
Future<Position> _initializePosition() async {
|
||||
try {
|
||||
final position = await GeolocatorService.deteterminePosition();
|
||||
|
||||
Reference in New Issue
Block a user