Skip to content

Add Theme.brightnessOf(context) / Theme.maybeBrightnessOf(context) #163393

@navaronbracke

Description

@navaronbracke

Use case

Developers wanting to retrieve the brightness for a MaterialApp currently have to look it up directly from the Theme, i.e Theme.of(context).brightness .

Proposal

Add Theme.brightnessOf(context) and Theme.maybeBrightnessOf(context), which would be the Material equivalent of

https://api.flutter.dev/flutter/cupertino/CupertinoTheme/brightnessOf.html
https://api.flutter.dev/flutter/cupertino/CupertinoTheme/maybeBrightnessOf.html

This also opens the door to having the Brightness as an aspect, if Theme ever becomes an InheritedModel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/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

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions