50 lines
1.4 KiB
Dart
50 lines
1.4 KiB
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
class DisplayConfig {
|
|
final bool showGuide;
|
|
final bool showQualityIndicators;
|
|
final bool showStatusText;
|
|
final bool showDebugInfo;
|
|
|
|
const DisplayConfig({
|
|
this.showGuide = true,
|
|
this.showQualityIndicators = true,
|
|
this.showStatusText = true,
|
|
this.showDebugInfo = false,
|
|
});
|
|
|
|
DisplayConfig copyWith({
|
|
bool? showGuide,
|
|
bool? showQualityIndicators,
|
|
bool? showStatusText,
|
|
bool? showDebugInfo,
|
|
}) {
|
|
return DisplayConfig(
|
|
showGuide: showGuide ?? this.showGuide,
|
|
showQualityIndicators:
|
|
showQualityIndicators ?? this.showQualityIndicators,
|
|
showStatusText: showStatusText ?? this.showStatusText,
|
|
showDebugInfo: showDebugInfo ?? this.showDebugInfo,
|
|
);
|
|
}
|
|
}
|
|
|
|
class DisplayConfigNotifier extends Notifier<DisplayConfig> {
|
|
@override
|
|
DisplayConfig build() => const DisplayConfig();
|
|
|
|
void toggleGuide() => state = state.copyWith(showGuide: !state.showGuide);
|
|
void toggleQualityIndicators() => state = state.copyWith(
|
|
showQualityIndicators: !state.showQualityIndicators,
|
|
);
|
|
void toggleStatusText() =>
|
|
state = state.copyWith(showStatusText: !state.showStatusText);
|
|
void toggleDebugInfo() =>
|
|
state = state.copyWith(showDebugInfo: !state.showDebugInfo);
|
|
}
|
|
|
|
final displayConfigProvider =
|
|
NotifierProvider<DisplayConfigNotifier, DisplayConfig>(
|
|
DisplayConfigNotifier.new,
|
|
);
|