Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add `PrimaryButton` and `SecondaryButton`

Open
#63 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
dart, flutter
Domain
mobile

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 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,
    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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ml-opensource/flutter-template

All issues in ml-opensource/flutter-template

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.