You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are pretty common and we recreate them almost on every project. Would be cool to have them in-place and to design them after we create a project from the template.
The most common parameters would be:
String text
VoidCallback onPressed
bool isEnabled
bool isLoading
As most of the time we will use preconfigured button sizes, paddings etc, we could create a named constructor .custom to be able to configure the following parameters:
double paddingVertical
double paddingHorizontal
Color backgroundColor
Color foregroundColor
TextStyle textStyle
And also a constructor for a custom child, if we ever need to use sth like an icon, e.g. withChild
So the interface is the following. Same for SecondaryButton.
final defaultButton =PrimaryButton(
String text, {
VoidCallback? onPressed,
bool isEnabled =true,
bool isLoading =false,
}
);
final defaultButtonWithChild =PrimaryButton.withChild(
{
VoidCallback? onPressed,
bool isEnabled =true,
bool isLoading =false,
requiredWidget child,
}
);
final customButton =PrimaryButton.custom(
String text, {
VoidCallback? onPressed,
bool isEnabled =true,
bool isLoading =false,
TextStyle? textStyle,
double paddingVertical =4.0, // or whateverdouble paddingHorizontal =12.0, // or whateverColor? backgroundColor, // in the build method, we will be able to use this custom colorColor? foregroundColor, // in the build method, we will be able to use this custom color
}
);
final customButtonWithChild =PrimaryButton.customWithChild(
{
VoidCallback? onPressed,
bool isEnabled =true,
bool isLoading =false,
TextStyle? textStyle,
double paddingVertical =4.0, // or whateverdouble paddingHorizontal =12.0, // or whateverColor? backgroundColor, // in the build method, we will be able to use this custom colorColor? foregroundColor, // in the build method, we will be able to use this custom colorrequiredWidget child,
}
);
The text was updated successfully, but these errors were encountered:
These are pretty common and we recreate them almost on every project. Would be cool to have them in-place and to design them after we create a project from the template.
The most common parameters would be:
String text
VoidCallback onPressed
bool isEnabled
bool isLoading
As most of the time we will use preconfigured button sizes, paddings etc, we could create a named constructor
.custom
to be able to configure the following parameters:double paddingVertical
double paddingHorizontal
Color backgroundColor
Color foregroundColor
TextStyle textStyle
And also a constructor for a custom child, if we ever need to use sth like an icon, e.g.
withChild
So the interface is the following. Same for
SecondaryButton
.The text was updated successfully, but these errors were encountered: