mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-24 20:12:27 +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> {
|
||||
TogglePointsSwitchCubit() : super(TogglePointsSwitchInitial());
|
||||
bool switchValue = true;
|
||||
|
||||
void activateSwitch() {
|
||||
switchValue = true;
|
||||
emit(ActivatePointsSwitch());
|
||||
}
|
||||
|
||||
void unActivateSwitch() {
|
||||
switchValue = false;
|
||||
emit(UnActivatePointsSwitch());
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user