bunch of stuff, good luck. still need to fix user-by-mode thing

This commit is contained in:
stopflock
2025-08-06 12:24:32 -05:00
parent 640903d954
commit dca6cb7179
10 changed files with 174 additions and 31 deletions
+36 -1
View File
@@ -26,6 +26,9 @@ class AddCameraSheet extends StatelessWidget {
Navigator.pop(context);
}
final customProfiles = appState.enabledProfiles.where((p) => !p.builtin).toList();
final allowSubmit = customProfiles.isNotEmpty && !session.profile.builtin;
return Padding(
padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
@@ -64,6 +67,38 @@ class AddCameraSheet extends StatelessWidget {
onChanged: (v) => appState.updateSession(directionDeg: v),
),
),
if (customProfiles.isEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
child: Row(
children: const [
Icon(Icons.info_outline, color: Colors.red, size: 20),
SizedBox(width: 6),
Expanded(
child: Text(
'Enable or create a custom profile in Settings to submit new cameras.',
style: TextStyle(color: Colors.red, fontSize: 13),
),
),
],
),
)
else if (session.profile.builtin)
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
child: Row(
children: const [
Icon(Icons.info_outline, color: Colors.orange, size: 20),
SizedBox(width: 6),
Expanded(
child: Text(
'The built-in profile is for map viewing only. Please select a custom profile to submit new cameras.',
style: TextStyle(color: Colors.orange, fontSize: 13),
),
),
],
),
),
const SizedBox(height: 8),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
@@ -78,7 +113,7 @@ class AddCameraSheet extends StatelessWidget {
const SizedBox(width: 12),
Expanded(
child: ElevatedButton(
onPressed: _commit,
onPressed: allowSubmit ? _commit : null,
child: const Text('Submit'),
),
),
+41 -1
View File
@@ -82,7 +82,11 @@ class _MapViewState extends State<MapView> {
} catch (_) {
return; // controller not ready yet
}
final cams = await _overpass.fetchCameras(bounds, appState.enabledProfiles);
final cams = await _overpass.fetchCameras(
bounds,
appState.enabledProfiles,
uploadMode: appState.uploadMode,
);
if (mounted) setState(() => _cameras = cams);
}
@@ -99,6 +103,12 @@ class _MapViewState extends State<MapView> {
final appState = context.watch<AppState>();
final session = appState.session;
// Always watch for changes on uploadMode/profiles and refresh if needed
// (debounced, to avoid flooding when quickly toggling)
WidgetsBinding.instance.addPostFrameCallback((_) {
_debounce(() => _refreshCameras(appState));
});
// Seed addmode target once, after first controller center is available.
if (session != null && session.target == null) {
try {
@@ -181,6 +191,36 @@ class _MapViewState extends State<MapView> {
],
),
// MODE INDICATOR badge (top-right)
if (appState.uploadMode == UploadMode.sandbox || appState.uploadMode == UploadMode.simulate)
Positioned(
top: 18,
right: 14,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: appState.uploadMode == UploadMode.sandbox
? Colors.orange.withOpacity(0.90)
: Colors.deepPurple.withOpacity(0.80),
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(color: Colors.black26, blurRadius: 5, offset: Offset(0,2)),
],
),
child: Text(
appState.uploadMode == UploadMode.sandbox
? 'SANDBOX MODE'
: 'SIMULATE',
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 13,
letterSpacing: 1.1,
),
),
),
),
// Attribution overlay
Positioned(
bottom: 20,