buildCheckCell function
Widget
buildCheckCell({
- String? label,
- Color labelColor = Colors.black87,
- TextStyle? labelTextStyle,
- bool selected = false,
- Color selectColor = Colors.blue,
- ValueChanged<
bool> ? onSelected, - EdgeInsets padding = const EdgeInsets.all(5),
复选控件
Implementation
Widget buildCheckCell({
String? label,
Color labelColor = Colors.black87,
TextStyle? labelTextStyle,
bool selected = false,
Color selectColor = Colors.blue,
ValueChanged<bool>? onSelected,
EdgeInsets padding = const EdgeInsets.all(5),
}) {
return Container(
alignment: Alignment.centerLeft,
child: InkWell(
onTap: () {
if (onSelected != null) {
onSelected(!selected);
}
},
child: Container(
padding: padding,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Icon(selected ? Icons.check_box : Icons.check_box_outline_blank,
color: selected ? Colors.blue : Colors.black54, size: 18),
const SizedBox(width: 5),
Text(
label ?? '',
overflow: TextOverflow.ellipsis,
style:
labelTextStyle ?? TextStyle(fontSize: 16, color: labelColor),
)
],
),
),
),
);
}