Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter inherit all props from parent widget

Tags:

flutter

I want to make custom button on flutter. here is some code:

// class LoadingButton.dart

MaterialButton(
  padding: EdgeInsets.all(Spacing().value(2)),
  textColor: Colors.white,
  disabledColor: Colors.grey[100],
  ...props
);

How can I add props dynamically without stating constructor one by one?

I've tried using ...props but it wont add to the props.

Thanks

like image 531
ssuhat Avatar asked Dec 14 '25 14:12

ssuhat


1 Answers

There is no such thing in Dart. Only copy-pasting all properties will work.

like image 89
Rémi Rousselet Avatar answered Dec 17 '25 07:12

Rémi Rousselet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!