How to wrap a derived RaisedButton object with SizedBox in its own class?

Why do you want to extend RaisedButton?

Another way is to simply create a custom widget:

class MyButton {
  final double height;
  final String text;
  final VoidCallback onPressed;
 
  MyButton({
    this.text,
    this.onPressed,
    this.height,
  });

  @override
  Widget build(BuildContext context) => SizedBox(
        height: height,
        child: RaisedButton(child: Text(text), onPressed: onPressed),
      );
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top