@@ -78,65 +78,60 @@ class GFCheckbox extends StatefulWidget {
7878
7979class _GFCheckboxState extends State <GFCheckbox > {
8080 bool get enabled => widget.onChanged != null ;
81- Map <Type , Action <Intent >> _actionMap;
82- bool isSelected = false ;
81+ // Map<Type, Action<Intent>> _actionMap;
82+ // bool isSelected = false;
8383
8484 @override
8585 void initState () {
8686 super .initState ();
87- isSelected = widget.value;
88- _actionMap = < Type , Action <Intent >> {
89- ActivateIntent : CallbackAction <ActivateIntent >(onInvoke: _actionHandler),
90- };
87+ // isSelected = widget.value;
88+ // _actionMap = <Type, Action<Intent>>{
89+ // ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: _actionHandler),
90+ // };
9191 }
9292
93- void _actionHandler (ActivateIntent intent) {
94- if (widget.onChanged != null ) {
95- switch (widget.value) {
96- case false :
97- widget.onChanged (true );
98- break ;
99- default : // case null:
100- widget.onChanged (false );
101- break ;
102- }
103- }
104- final RenderObject renderObject = context.findRenderObject ();
105- renderObject.sendSemanticsEvent (const TapSemanticEvent ());
106- }
107-
108- void onStatusChange () {
109- setState (() {
110- isSelected = ! isSelected;
111- });
112- if (widget.onChanged != null ) {
113- widget.onChanged (isSelected);
114- }
115- }
93+ // void _actionHandler(ActivateIntent intent) {
94+ // if (widget.onChanged != null) {
95+ // switch (widget.value) {
96+ // case false:
97+ // widget.onChanged(true);
98+ // break;
99+ // default: // case null:
100+ // widget.onChanged(false);
101+ // break;
102+ // }
103+ // }
104+ // final RenderObject renderObject = context.findRenderObject();
105+ // renderObject.sendSemanticsEvent(const TapSemanticEvent());
106+ // }
107+
108+ // void onStatusChange() {
109+ // setState(() {
110+ // isSelected = !isSelected;
111+ // });
112+ // if (widget.onChanged != null) {
113+ // widget.onChanged(isSelected);
114+ // }
115+ // }
116116
117117
118118 @override
119119 Widget build (BuildContext context) => FocusableActionDetector (
120- actions: _actionMap,
120+ // actions: _actionMap,
121121 focusNode: widget.focusNode,
122122 autofocus: widget.autofocus,
123123 enabled: enabled,
124124 child: InkWell (
125125// onTap: onStatusChange,
126126 canRequestFocus: enabled,
127127 onTap: widget.onChanged != null ?
128- () {
129- setState (() {
130- isSelected = ! isSelected;
131- });
132- widget.onChanged (! widget.value);
133- } : null ,
128+ () {widget.onChanged (! widget.value);} : null ,
134129 child: Container (
135130 height: widget.size,
136131 width: widget.size,
137132 decoration: BoxDecoration (
138133 color: enabled
139- ? isSelected
134+ ? widget.value
140135 ? widget.type == GFCheckboxType .custom
141136 ? Colors .white
142137 : widget.activebgColor
@@ -148,12 +143,12 @@ class _GFCheckboxState extends State<GFCheckbox> {
148143 ? BorderRadius .circular (50 )
149144 : BorderRadius .zero,
150145 border: Border .all (
151- color: isSelected
146+ color: widget.value
152147 ? widget.type == GFCheckboxType .custom
153148 ? Colors .black87
154149 : widget.activeBorderColor
155150 : widget.inactiveBorderColor)),
156- child: isSelected
151+ child: widget.value
157152 ? widget.type == GFCheckboxType .custom
158153 ? Stack (
159154 children: < Widget > [
0 commit comments