add login

This commit is contained in:
atseirjo
2025-10-22 08:43:20 +02:00
parent b6bd692cd7
commit c0960cbd9f
21 changed files with 1128 additions and 221 deletions

View File

@@ -24,11 +24,12 @@ class GeolocationExample extends StatelessWidget {
),
],
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
body: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Status Card
Obx(() => Card(
child: Padding(
@@ -107,8 +108,16 @@ class GeolocationExample extends StatelessWidget {
'Längengrad:',
controller.currentPosition!.longitude.toStringAsFixed(6),
Icons.location_on,
),
_buildPositionDetail(
),
if (controller.ptvModel != null &&
controller.ptvModel!.locations != null &&
controller.ptvModel!.locations!.isNotEmpty)
_buildPositionDetail(
'Adresse:',
'${controller.ptvModel!.locations!.first.formattedAddress}',
Icons.add_home_rounded,
),
_buildPositionDetail(
'Genauigkeit:',
'${controller.currentPosition!.accuracy.toStringAsFixed(1)} m',
Icons.gps_fixed,
@@ -137,92 +146,94 @@ class GeolocationExample extends StatelessWidget {
const SizedBox(height: 16),
// Action Buttons
Expanded(
child: Column(
children: [
// Aktuelle Position Button
Obx(() => SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: controller.isLoading ? null : controller.getCurrentPosition,
icon: controller.isLoading
? const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Icon(Icons.my_location),
label: const Text('Aktuelle Position ermitteln'),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
),
Column(
children: [
// Aktuelle Position Button
Obx(() => SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: controller.isLoading ? null : controller.getCurrentPosition,
icon: controller.isLoading
? const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Icon(Icons.my_location),
label: const Text('Aktuelle Position ermitteln'),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
),
)),
const SizedBox(height: 12),
// Tracking Toggle Button
Obx(() => SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: controller.isLoading ? null : controller.toggleTracking,
icon: Icon(controller.isTracking ? Icons.stop : Icons.play_arrow),
label: Text(controller.isTracking ? 'Tracking stoppen' : 'Tracking starten'),
style: ElevatedButton.styleFrom(
backgroundColor: controller.isTracking ? Colors.red : Colors.green,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
)),
const SizedBox(height: 12),
// Permissions Button
Obx(() => SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: controller.isLoading ? null : controller.checkPermissions,
icon: const Icon(Icons.security),
label: const Text('Berechtigungen prüfen'),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
)),
const SizedBox(height: 12),
// Settings Buttons Row
Row(
children: [
Expanded(
child: ElevatedButton.icon(
onPressed: controller.openLocationSettings,
icon: const Icon(Icons.location_city),
label: const Text('Location'),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
),
const SizedBox(width: 8),
Expanded(
child: ElevatedButton.icon(
onPressed: controller.openAppSettings,
icon: const Icon(Icons.settings),
label: const Text('App'),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
),
],
),
],
),
)),
const SizedBox(height: 12),
// Tracking Toggle Button
Obx(() => SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: controller.isLoading ? null : controller.toggleTracking,
icon: Icon(controller.isTracking ? Icons.stop : Icons.play_arrow),
label: Text(controller.isTracking ? 'Tracking stoppen' : 'Tracking starten'),
style: ElevatedButton.styleFrom(
backgroundColor: controller.isTracking ? Colors.red : Colors.green,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
)),
const SizedBox(height: 12),
// Permissions Button
Obx(() => SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: controller.isLoading ? null : controller.checkPermissions,
icon: const Icon(Icons.security),
label: const Text('Berechtigungen prüfen'),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
)),
const SizedBox(height: 12),
// Settings Buttons Row
Row(
children: [
Expanded(
child: ElevatedButton.icon(
onPressed: controller.openLocationSettings,
icon: const Icon(Icons.location_city),
label: const Text('Location'),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
),
const SizedBox(width: 8),
Expanded(
child: ElevatedButton.icon(
onPressed: controller.openAppSettings,
icon: const Icon(Icons.settings),
label: const Text('App'),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
),
),
),
],
),
],
),
],
// Bottom Spacing
const SizedBox(height: 24),
],
),
),
),
);
@@ -245,6 +256,7 @@ class GeolocationExample extends StatelessWidget {
child: Text(
value,
style: const TextStyle(fontFamily: 'monospace'),
overflow: TextOverflow.ellipsis,
),
),
],