whenever I create void function the build method of stateless widget is not called due to which further methods are also not called. Kindly guide with the possible solution.
import 'package:flutter/material.dart';
class TaskTile extends StatefulWidget {
@override
_TaskTileState createState() => _TaskTileState();
}
class _TaskTileState extends State<TaskTile> {
bool isChecked= true;
void checkboxCallback (checkboxState){
setState(() {
isChecked=che ckboxState;
});
@override
Widget build(BuildContext context) {
return ListTile(
title: Text('This is my task.',
style: TextStyle(
decoration: isChecked ? TextDecoration.lineThrough : null,
),),
trailing: TaskCheckBox(isChecked,checkBoxCallback),
);
}
}
class TaskCheckBox extends StatelessWidget {
final bool checkboxState;
final Function toggleCheckBoxState;
TaskCheckBox (this.checkboxState, this.toggleCheckBoxState);
@override
Widget build(BuildContext context) {
return Checkbox(
activeColor: Colors.blueAccent,
value: checkboxState,
onChanged:
});
}
}