Browse Source

update checkbox color

Caijinglong 6 years ago
parent
commit
ce7219ddcc

+ 17
- 9
lib/src/delegate/checkbox_builder_delegate.dart View File

15
 
15
 
16
 class DefaultCheckBoxBuilderDelegate extends CheckBoxBuilderDelegate {
16
 class DefaultCheckBoxBuilderDelegate extends CheckBoxBuilderDelegate {
17
   Color activeColor;
17
   Color activeColor;
18
+  Color unselectedColor;
18
 
19
 
19
-  DefaultCheckBoxBuilderDelegate({this.activeColor = Colors.white});
20
+  DefaultCheckBoxBuilderDelegate({
21
+    this.activeColor = Colors.white,
22
+    this.unselectedColor = Colors.white,
23
+  });
20
 
24
 
21
   @override
25
   @override
22
   Widget buildCheckBox(
26
   Widget buildCheckBox(
26
     Options options,
30
     Options options,
27
     I18nProvider i18nProvider,
31
     I18nProvider i18nProvider,
28
   ) {
32
   ) {
29
-    return CheckboxListTile(
30
-      value: checked,
31
-      onChanged: (bool check) {},
32
-      activeColor: activeColor,
33
-      title: Text(
34
-        i18nProvider.getSelectedOptionsText(options),
35
-        textAlign: TextAlign.end,
36
-        style: TextStyle(color: options.textColor),
33
+    return Theme(
34
+      data: Theme.of(context).copyWith(unselectedWidgetColor: unselectedColor),
35
+      child: CheckboxListTile(
36
+        value: checked,
37
+        onChanged: (bool check) {},
38
+        activeColor: activeColor,
39
+        checkColor: unselectedColor,
40
+        title: Text(
41
+          i18nProvider.getSelectedOptionsText(options),
42
+          textAlign: TextAlign.end,
43
+          style: TextStyle(color: options.textColor),
44
+        ),
37
       ),
45
       ),
38
     );
46
     );
39
   }
47
   }

+ 3
- 0
lib/src/ui/widget/check_box_copy.dart View File

185
     value: value,
185
     value: value,
186
     tristate: tristate,
186
     tristate: tristate,
187
     activeColor: activeColor,
187
     activeColor: activeColor,
188
+    checkColor: checkColor,
188
     inactiveColor: inactiveColor,
189
     inactiveColor: inactiveColor,
189
     onChanged: onChanged,
190
     onChanged: onChanged,
190
     vsync: vsync,
191
     vsync: vsync,
214
     bool value,
215
     bool value,
215
     bool tristate,
216
     bool tristate,
216
     Color activeColor,
217
     Color activeColor,
218
+    Color checkColor,
217
     Color inactiveColor,
219
     Color inactiveColor,
218
     BoxConstraints additionalConstraints,
220
     BoxConstraints additionalConstraints,
219
     ValueChanged<bool> onChanged,
221
     ValueChanged<bool> onChanged,
220
     @required TickerProvider vsync,
222
     @required TickerProvider vsync,
221
   }): _oldValue = value,
223
   }): _oldValue = value,
224
+      checkColor = checkColor,
222
         super(
225
         super(
223
         value: value,
226
         value: value,
224
         tristate: tristate,
227
         tristate: tristate,