Open chamilaja-yawardana opened 3 years ago
Try this:
class ReusableCard extends StatelessWidget {
Color colour;
Widget? cardChild;
VoidCallback onPress;
ReusableCard({required this.colour, this.cardChild, required this.onPress});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPress,
child: Container(
margin: EdgeInsets.all(15.0),
decoration: BoxDecoration(
color: colour,
borderRadius: BorderRadius.circular(10.0),
),
child: cardChild,
),
);
}
}
I am getting this error "The argument type 'Function' can't be assigned to the parameter type 'void Function()?"
`class BottomButton extends StatelessWidget { BottomButton({required this.onTap, required this.buttonTitle});
final Function onTap; final String buttonTitle;
@override Widget build(BuildContext context) { return GestureDetector( onTap: onTap, child: Container( padding: EdgeInsets.only(bottom: 10), child: Center( child: Text( buttonTitle, style: kLargeButtonTextStyle, ), ), color: kBottomContainerColour, margin: EdgeInsets.only(top: 10), width: double.infinity, height: kBottomContainerHeight, ), ); } }`