@@ -16,24 +16,24 @@ class CheckboxCell extends StatefulWidget {
1616 CheckboxCell ({
1717 GlobalKey ? key,
1818 this .checked = false ,
19- this .title,
19+ required this .title,
2020 this .onTap,
2121 this .detail,
2222 this .titleColor,
2323 this .detailColor,
2424 required this .onChecked,
25- this .onStart ,
25+ this .isAsync = false ,
2626 }) : super (key: key);
2727
28+ final bool isAsync;
2829 bool checked;
29- String ? title;
30+ final String title;
3031 String ? detail;
3132 Color ? titleColor;
3233 Color ? detailColor;
3334
3435 final ValueChanged <bool > onChecked;
3536 ValueChanged <ValueChanged <String >>? onTap;
36- String ? Function ()? onStart;
3737
3838 @override
3939 State <StatefulWidget > createState () => CheckboxCellState ();
@@ -47,25 +47,22 @@ class CheckboxCellState extends State<CheckboxCell> {
4747 _checkboxState.currentState! .setChecked (isChecked);
4848 }
4949
50- String _detail = "" ;
51-
5250 void setDetail (String text) {
5351 setState (() {
54- _detail = text;
52+ widget.detail = text;
5553 });
5654 }
5755
5856 @override
5957 void initState () {
6058 super .initState ();
61- _detail = widget.detail ?? "" ;
62- if (widget.onStart != null ) _detail = widget.onStart !() ?? "" ;
6359 }
6460
6561 @override
6662 Widget build (BuildContext context) {
6763 return ViewCell (
6864 showIcon: widget.onTap != null ,
65+ isAsync: widget.isAsync,
6966 child: Container (
7067 child: Row (
7168 crossAxisAlignment: CrossAxisAlignment .center,
@@ -80,7 +77,7 @@ class CheckboxCellState extends State<CheckboxCell> {
8077 width: 10 ,
8178 ),
8279 Text (
83- widget.title == null ? "" : widget.title ! ,
80+ widget.title,
8481 style: TextStyle (color: widget.titleColor ?? Colors .black),
8582 ),
8683 ],
@@ -92,13 +89,13 @@ class CheckboxCellState extends State<CheckboxCell> {
9289 widget.onTap !((text) {
9390 if (! _checkboxState.currentState! .checked || widget.onTap == null )
9491 return ;
95- setState (() => _detail = text);
92+ setState (() => widget.detail = text);
9693 });
9794 }
9895 },
9996 detail: Flexible (
10097 child: Text (
101- _detail ,
98+ widget.detail ?? "" ,
10299 textAlign: TextAlign .right,
103100 style: TextStyle (
104101 color: widget.detailColor ?? CupertinoColors .systemGrey),
0 commit comments