flutter/dev
Ben Konyi 3595e7dad0
[ Widget Preview ] Add support for theme and brightness properties on Preview (#167001)
The `theme` parameter of `Preview(...)` allows for developers to provide
a callback that returns a `PreviewThemeData` instance which can contain
theming data for Material and Cupertino widgets in both light and dark
modes. The provided theme data will be injected into the widget tree and
applied to the previewed widget.

The `brightness` parameter allows for developers to specify an initial
brightness setting (e.g., light vs dark mode) for the previewed widget.
If not provided, the current system default is used.

A new button has also been added to each widget preview card that allows
for toggling between light and dark mode for individual previews.

**Demo:**


https://github.com/user-attachments/assets/f0a4a3bc-25d2-49b0-a5f6-9149eccfc1d4

Fixes https://github.com/flutter/flutter/issues/166436
Fixes https://github.com/flutter/flutter/issues/166275
Fixes https://github.com/flutter/flutter/issues/166279
Fixes https://github.com/flutter/flutter/issues/166437
2025-04-15 17:51:40 +00:00
..
a11y_assessments Convert AppLinkSettings to kotlin (#164391) 2025-03-11 17:00:17 +00:00
automated_tests [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
benchmarks [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
bots [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
conductor [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
customer_testing [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
devicelab [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
docs Bump Dart SDK to 3.7 (#159812) 2024-12-05 21:39:53 +00:00
forbidden_from_release_tests Roll pub packages (#165932) 2025-03-27 04:27:26 +00:00
integration_tests [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
manual_tests Remove <meta content="IE=Edge" http-equiv="X-UA-Compatible"> (#166252) 2025-03-31 16:03:56 +00:00
missing_dependency_tests Bump Dart SDK to 3.7 (#159812) 2024-12-05 21:39:53 +00:00
snippets [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
tools [ Widget Preview ] Add support for theme and brightness properties on Preview (#167001) 2025-04-15 17:51:40 +00:00
tracing_tests Align jvmTarget usages across codebase, while editing build.gradle files align them with android version documentation (#164200) 2025-02-28 17:48:21 +00:00
analysis_options.yaml
README.md

This directory contains tools and resources that the Flutter team uses during the development of the framework. The tools in this directory should not be necessary for developing Flutter applications, though of course, they may be interesting if you are curious.

The tests in this directory are run in the framework_tests_misc-* shards.