Reputation: 143
I want to write a simple Customizedtextfieldwidget that is inherited from textfieldwidget with some preset attribute.
For example:
class CustomizedTextFieldWidget extends TextFormField {
CustomizedTextFieldWidget() : super(
textAlign: TextAlign.right
);
}
I want to use the widget in the same way as TextFormField, that inherited all attribute of TextFormField like:
CustomizedTextFieldWidget(decoration: InputDecoration(...))
Is there any way I can do that?
Update:
Because I am going to reuse the widget a lot and I would like to make my code a bit cleaner, is there any way to export the attribute setting of the TextFieldWidget, such that:
TextFieldWidget(
setting: Mysetting,
//usual attribute afterward
)
Upvotes: 1
Views: 595
Reputation: 1772
try
class CustomizedTextFieldWidget extends TextFormField {
CustomizedTextFieldWidget({InputDecoration decoration}) : super(
decoration: decoration,
);
}
Upvotes: 1