checkbox method
Widget
checkbox(
- bool isSelected,
- dynamic onChange(),
- BuildContext context, {
- Color? color,
- Color? borderColor,
Implementation
Widget checkbox(
bool isSelected, Function(bool) onChange, BuildContext context, {Color? color, Color? borderColor}) {
var size = 26.0;
return Material(
borderRadius: BorderRadius.circular(DUI.spacing.smallBorderRadius + 4),
clipBehavior: Clip.antiAliasWithSaveLayer,
color: Colors.transparent,
child: InkWell(
child: Container(
width: size,
height: size,
color: Colors.transparent,
child: Stack(
alignment: Alignment.center,
children: [
Container(
width: size - 4,
height: size - 4,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(6),
border: Border.all(
color: borderColor ?? Theme.of(context).textTheme.bodyMedium!.color!,
width: 2.0),
)),
isSelected
? Container(
width: size - 14,
height: size - 14,
decoration: BoxDecoration(
color: color ?? Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(2),
))
: SizedBox.shrink(),
],
),
),
onTap: () {
onChange(!isSelected);
}),
);
}