this is the screenshot of my error code
this code my inputpage:
child: ReusableCard(
onPress: (){
setState(() {
selectGender=Gender.male;
});
},
cardChild: IconContent(icon: FontAwesomeIcons.mars,label: 'Male',),
colour: selectGender==Gender.male? activeCardColor:inactivecolor,
),
and this one other page:onpress function does not work.
class ReusableCard extends StatelessWidget {
ReusableCard({@required this.colour,this.cardChild,this.onPress});
final Color? colour;
final Widget? cardChild;
final Function? onPress;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPress,
child: Container(
child: cardChild,
margin: EdgeInsets.all(15),
decoration: BoxDecoration(
color: colour,
borderRadius: BorderRadius.circular(10.0),
),
),
);
}
}
i provide screesshoot for your better understand