Add `PrimaryButton` and `SecondaryButton`
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
The issue names no files, tests, or entry points. First locate the template's existing shared widget and styling conventions, then review how the requested PrimaryButton and SecondaryButton constructors fit them. Done means both button variants support the listed default, custom, and child APIs with enabled and loading states.
Written by the indexing model from the issue text.
Description
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 textVoidCallback onPressedbool isEnabledbool 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 paddingVerticaldouble paddingHorizontalColor backgroundColorColor foregroundColorTextStyle 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,
required Widget child,
}
);
final customButton = PrimaryButton.custom(
String text, {
VoidCallback? onPressed,
bool isEnabled = true,
bool isLoading = false,
TextStyle? textStyle,
double paddingVertical = 4.0, // or whatever
double paddingHorizontal = 12.0, // or whatever
Color? backgroundColor, // in the build method, we will be able to use this custom color
Color? 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 whatever
double paddingHorizontal = 12.0, // or whatever
Color? backgroundColor, // in the build method, we will be able to use this custom color
Color? foregroundColor, // in the build method, we will be able to use this custom color
required Widget child,
}
);
- Dominant language
- Dart
- Stars
- 36
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ml-opensource/flutter-template
-
Add `LazyLoadingListener` widgetMay be free again @nivisi claimed this 1224 days ago, and no pull request is open. Open
ml-opensource/flutter-template#123 · 1 assignee ·
-
Introduce & Standardize a way to play HapticsMay be free again @nivisi claimed this 1240 days ago, and no pull request is open. OpenTBD
ml-opensource/flutter-template#120 · 1 assignee ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
ml-opensource/flutter-template#113 · 1 comment · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Setup `retrofit`Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in ml-opensource/flutter-template
Similar issues
-
[BUG]暗黑模式下延迟字体颜色Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
area: youtube bug issue linux needs logs windows
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Notsfsssf/pixez-flutter#1379 ·
Maintainers usually reply within 2 days