Skip to content

Feature request: Extend ThemeData with app-specific palettes #31522

@matthewlloyd

Description

@matthewlloyd

It would be nice to be able to extend ThemeData with app-specific palettes. This would allow switching app-specific colors by using the Theme widget, and would coordinate the colors with the existing theme switching mechanisms including animations.

Currently, it's possible to create one's own theme classes using a parallel class hierarchy to the built-in one, but you don't get automatic integration with the animation that AnimatedTheme provides when switching between themes. That means when the user changes the app's theme, the colors of some elements of the app's UI will tween smoothly, while other app-specific colors will not.

For example, the app may use a palette to control the color of app-specific widgets, e.g. weather icons. These custom color sets may not match up well with any of the existing colors provided in the Theme class, so the provided colors cannot be used, but the actual color choices may still vary depending on the app's overall theme (e.g. light or dark). Without this feature, the developer has to do extra work to set up his own theme classes and keep them in sync with those provided to the Theme widget, but it's visually jarring to switch themes when these custom colors aren't integrated with the provided theme animations.

Metadata

Metadata

Assignees

Labels

c: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions