Skip to content

Missing SnackBarTheme #180000

@bleroux

Description

@bleroux

Use case

Customize SnackBar visual properties in a sub-tree through an InheritedTheme widget.

Proposal

Add SnackBarTheme similarly to similar inherited themes.

Sample usage:

Widget build(BuildContext context) {
    return SnackBarTheme(
      data: const SnackBarThemeData(
        width: 300,
        behavior: SnackBarBehavior.floating,
        actionTextColor: Color(0xFF0000FF),
      ),
      child: Scaffold(
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              final snackBar = SnackBar(
                content: const Text('Yay! A SnackBar!'),
                action: SnackBarAction(label: 'Undo', onPressed: () {}),
              );
              ScaffoldMessenger.of(context).showSnackBar(snackBar);
            },
            child: const Text('Show snackbar'),
          ),
        ),
      ),
    );
  }
  

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.found in release: 3.38Found to occur in 3.38found in release: 3.40Found to occur in 3.40frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions