disable button if checkbox unchecked flutter
Column(
children: [
Container(
margin: EdgeInsets.all(17),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text(
"You agree by checking this box",
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
)),
],
),
),
SizedBox(
height: 7,
),
Padding(
padding: EdgeInsets.only(left: 20),
child: Container(
child: Row(
children: [
Container(
width: 20,
height: 20,
child: Transform.scale(
scale: 2.0,
child: Checkbox(
value: isCheck,
checkColor: Colors.green,
activeColor: Colors.grey,
onChanged: (bool value) {
setState(() {
isCheck = value;
});
},
),
),
),
],
),
),
),
Container(
width: MediaQuery.of(context).size.width * .45,
height: MediaQuery.of(context).size.height * .09,
child: RaisedButton(
textColor: Colors.white,
color: Colors.green,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
child: Text(
"Verify Quarterly Report",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
),
onPressed: isCheck ? () => submitReport() : null,
),
),
],
),