Skip to content

Add support to set background color of SnackBarAction when clicked #109933

Closed

Description

@akshdeep-singh

Use case

The background color for SnackBarAction should be allowed to change when SnackBarAction.textColor is set to some custom color.

For example, in below code, I have set textColor to Colors.green, and I want the background color (blue in the image) to be set to green with some alpha value.

ScaffoldMessenger.of(context).showSnackBar(
  SnackBar(
    content: const Text('Awesome Snackbar!'),
    action: SnackBarAction(
      label: 'Action',
      onPressed: () {
        // Code to execute.
      },
      textColor: Colors.green,
    ),
  ),
);

Screenshot_1661040438

Proposal

I can think of 2 options:

  1. Add a parameter to SnackBarAction which can be used to set the background color.
  2. When SnackBarAction.textColor is set, then set the background color to some alpha value of this textColor.

Activity

  1. added
    in triagePresently being triaged by the triage team
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Aug 22, 2022
  2. github-actions commented on Apr 10, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  3. locked as resolved and limited conversation to collaborators on Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions