mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-07-20 11:01:03 +02:00
submissions still not working, but oauth implemented and add camera sheet working.
This commit is contained in:
@@ -5,19 +5,26 @@ import '../app_state.dart';
|
||||
import '../models/camera_profile.dart';
|
||||
|
||||
class AddCameraSheet extends StatelessWidget {
|
||||
const AddCameraSheet({super.key});
|
||||
const AddCameraSheet({super.key, required this.session});
|
||||
|
||||
final AddCameraSession session;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appState = context.watch<AppState>();
|
||||
final session = appState.session;
|
||||
|
||||
// If the session was cleared before this frame, bail safely.
|
||||
if (session == null) {
|
||||
return const SizedBox.shrink();
|
||||
void _commit() {
|
||||
appState.commitSession();
|
||||
Navigator.pop(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Camera queued for upload')),
|
||||
);
|
||||
}
|
||||
|
||||
final profiles = appState.profiles;
|
||||
void _cancel() {
|
||||
appState.cancelSession();
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding:
|
||||
@@ -39,7 +46,7 @@ class AddCameraSheet extends StatelessWidget {
|
||||
title: const Text('Profile'),
|
||||
trailing: DropdownButton<CameraProfile>(
|
||||
value: session.profile,
|
||||
items: profiles
|
||||
items: appState.profiles
|
||||
.map((p) => DropdownMenuItem(value: p, child: Text(p.name)))
|
||||
.toList(),
|
||||
onChanged: (p) =>
|
||||
@@ -64,14 +71,14 @@ class AddCameraSheet extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
onPressed: _cancel,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
onPressed: _commit,
|
||||
child: const Text('Submit'),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -173,13 +173,13 @@ class _MapViewState extends State<MapView> {
|
||||
|
||||
// Attribution overlay
|
||||
Positioned(
|
||||
bottom: 8,
|
||||
right: 8,
|
||||
bottom: 20,
|
||||
left: 10,
|
||||
child: Container(
|
||||
color: Colors.white70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
||||
child: const Text(
|
||||
'© OpenStreetMap contributors',
|
||||
'© OpenStreetMap and contributors',
|
||||
style: TextStyle(fontSize: 11),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user