We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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, ), ); } }`
The text was updated successfully, but these errors were encountered:
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, ), ); } }
Sorry, something went wrong.
No branches or pull requests
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,
),
);
}
}`
The text was updated successfully, but these errors were encountered: