mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 14:19:40 +00:00
use state instead of variable in cubit
This commit is contained in:
@ -5,14 +5,12 @@ part 'toggle_points_switch_state.dart';
|
|||||||
|
|
||||||
class TogglePointsSwitchCubit extends Cubit<TogglePointsSwitchState> {
|
class TogglePointsSwitchCubit extends Cubit<TogglePointsSwitchState> {
|
||||||
TogglePointsSwitchCubit() : super(TogglePointsSwitchInitial());
|
TogglePointsSwitchCubit() : super(TogglePointsSwitchInitial());
|
||||||
bool switchValue = true;
|
|
||||||
void activateSwitch() {
|
void activateSwitch() {
|
||||||
switchValue = true;
|
|
||||||
emit(ActivatePointsSwitch());
|
emit(ActivatePointsSwitch());
|
||||||
}
|
}
|
||||||
|
|
||||||
void unActivateSwitch() {
|
void unActivateSwitch() {
|
||||||
switchValue = false;
|
|
||||||
emit(UnActivatePointsSwitch());
|
emit(UnActivatePointsSwitch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
|
|||||||
(Set<WidgetState> states) {
|
(Set<WidgetState> states) {
|
||||||
return ColorsManager.whiteColors;
|
return ColorsManager.whiteColors;
|
||||||
}),
|
}),
|
||||||
value: context.watch<TogglePointsSwitchCubit>().switchValue,
|
value: state is ActivatePointsSwitch,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
context
|
context
|
||||||
|
Reference in New Issue
Block a user