use state instead of variable in cubit

This commit is contained in:
Rafeek-Khoudare
2025-07-21 14:43:00 +03:00
parent 518e9c8914
commit c8eb07c166
2 changed files with 2 additions and 4 deletions

View File

@ -5,14 +5,12 @@ part 'toggle_points_switch_state.dart';
class TogglePointsSwitchCubit extends Cubit<TogglePointsSwitchState> {
TogglePointsSwitchCubit() : super(TogglePointsSwitchInitial());
bool switchValue = true;
void activateSwitch() {
switchValue = true;
emit(ActivatePointsSwitch());
}
void unActivateSwitch() {
switchValue = false;
emit(UnActivatePointsSwitch());
}
}

View File

@ -71,7 +71,7 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
(Set<WidgetState> states) {
return ColorsManager.whiteColors;
}),
value: context.watch<TogglePointsSwitchCubit>().switchValue,
value: state is ActivatePointsSwitch,
onChanged: (value) {
if (value) {
context