|
1 | 1 | import 'package:flutter/material.dart'; |
2 | 2 | import 'package:getwidget/getwidget.dart'; |
3 | 3 |
|
4 | | -import 'package:flutter/foundation.dart'; |
5 | | -import 'package:flutter/rendering.dart'; |
6 | | -import 'package:flutter/widgets.dart'; |
7 | | - |
8 | | - |
9 | 4 | class GFCheckbox extends StatefulWidget { |
10 | 5 | const GFCheckbox({ |
11 | 6 | Key key, |
@@ -36,7 +31,7 @@ class GFCheckbox extends StatefulWidget { |
36 | 31 | /// type of [double] which is GFSize ie, small, medium and large and can use any double value |
37 | 32 | final double size; |
38 | 33 |
|
39 | | - // type pf [Color] used to change the checkcolor when the checkbox is active |
| 34 | + /// type pf [Color] used to change the checkcolor when the checkbox is active |
40 | 35 | final Color checkColor; |
41 | 36 |
|
42 | 37 | /// type of [Color] used to change the backgroundColor of the active checkbox |
@@ -78,54 +73,20 @@ class GFCheckbox extends StatefulWidget { |
78 | 73 |
|
79 | 74 | class _GFCheckboxState extends State<GFCheckbox> { |
80 | 75 | bool get enabled => widget.onChanged != null; |
81 | | -// Map<Type, Action<Intent>> _actionMap; |
82 | | -// bool isSelected = false; |
83 | 76 |
|
84 | 77 | @override |
85 | 78 | void initState() { |
86 | 79 | super.initState(); |
87 | | -// isSelected = widget.value; |
88 | | -// _actionMap = <Type, Action<Intent>>{ |
89 | | -// ActivateIntent: CallbackAction<ActivateIntent>(onInvoke: _actionHandler), |
90 | | -// }; |
91 | 80 | } |
92 | 81 |
|
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 | | -// } |
116 | | - |
117 | | - |
118 | 82 | @override |
119 | 83 | Widget build(BuildContext context) => FocusableActionDetector( |
120 | | -// actions: _actionMap, |
121 | 84 | focusNode: widget.focusNode, |
122 | 85 | autofocus: widget.autofocus, |
123 | 86 | enabled: enabled, |
124 | 87 | child: InkWell( |
125 | | -// onTap: onStatusChange, |
126 | 88 | canRequestFocus: enabled, |
127 | | - onTap: widget.onChanged != null ? |
128 | | - () {widget.onChanged(!widget.value);} : null, |
| 89 | + onTap: widget.onChanged != null ? () {widget.onChanged(!widget.value);} : null, |
129 | 90 | child: Container( |
130 | 91 | height: widget.size, |
131 | 92 | width: widget.size, |
|
0 commit comments