是否可以创建一个类来扩展扩展StatelessWidget或StatefulWidget的类.
例如:
class MyButton extends StatelessWidget {
final String label;
Button({this.label});
@override
Widget build(BuildContext context) {
return ButtonExample("label");}
}
然后
class SubmitButton extends MyButton
{
String label;
SubmitButton({Key key, this.label}) : super(label: label);
// 然后 somehow extend the parent build and change only the color
// or in case of StatefulWidget change a functionality
}
我试着在网上搜索例子,但没有成功.