36 lines
978 B
Dart
36 lines
978 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
/// Debug-only settings for development and testing.
|
|
/// Only functional in debug builds (kDebugMode).
|
|
class DebugSettings {
|
|
final bool bypassGeofence;
|
|
|
|
const DebugSettings({this.bypassGeofence = false});
|
|
|
|
DebugSettings copyWith({bool? bypassGeofence}) {
|
|
return DebugSettings(bypassGeofence: bypassGeofence ?? this.bypassGeofence);
|
|
}
|
|
}
|
|
|
|
class DebugSettingsNotifier extends StateNotifier<DebugSettings> {
|
|
DebugSettingsNotifier() : super(const DebugSettings());
|
|
|
|
void toggleGeofenceBypass() {
|
|
if (kDebugMode) {
|
|
state = state.copyWith(bypassGeofence: !state.bypassGeofence);
|
|
}
|
|
}
|
|
|
|
void setGeofenceBypass(bool value) {
|
|
if (kDebugMode) {
|
|
state = state.copyWith(bypassGeofence: value);
|
|
}
|
|
}
|
|
}
|
|
|
|
final debugSettingsProvider =
|
|
StateNotifierProvider<DebugSettingsNotifier, DebugSettings>(
|
|
(ref) => DebugSettingsNotifier(),
|
|
);
|