flutter/dev/tools/gen_defaults
Bruno Leroux 00419bfb24
Reland fix inputDecorator hint color on M3 (#150278)
## Description

This PR is a partial reland of https://github.com/flutter/flutter/pull/148944 which was reverted in https://github.com/flutter/flutter/pull/149448.
It makes the `InputDecoration.hintText` colors compliant with the M3 spec.
The initial PR also changed the font style, I will land the font change in another PR to better track the golden changes.

## Related Issue

Related to the color part of https://github.com/flutter/flutter/issues/148787.

## Tests

Updates several tests.
2024-06-25 21:42:59 +00:00
..
bin Update tokens to 4.0.0 (#148789) 2024-05-22 15:08:25 +00:00
data Update Material token to the latest 4.1.0 (#150382) 2024-06-20 20:39:58 +00:00
generated Update Material token to the latest 4.1.0 (#150382) 2024-06-20 20:39:58 +00:00
lib Reland fix inputDecorator hint color on M3 (#150278) 2024-06-25 21:42:59 +00:00
test Fix gen_defaults test randomness (#142743) 2024-02-01 21:22:51 +00:00
dart_test.yaml Really disable shuffling for gen_defaults tests (#142721) 2024-02-01 10:09:07 -08:00
pubspec.yaml Remove discontinued device_info and connectivity plugins from flutter_gallery, roll pub packages (#150585) 2024-06-21 23:10:24 +00:00
README.md Added missing code block language in docs (#147481) 2024-05-01 14:44:27 +00:00
test.json Improve defaults generation with logging, stats, and token validation (#128244) 2023-06-09 11:28:18 +00:00

Token Defaults Generator

Script that generates component theme data defaults based on token data.

Usage

Run this program from the root of the git repository:

dart dev/tools/gen_defaults/bin/gen_defaults.dart [-v]

This updates generated/used_tokens.csv and the various component theme files.

Templates

There is a template file for every component that needs defaults from the token database. These templates are implemented as subclasses of TokenTemplate. This base class provides some utilities and a structure for adding a new block of generated code to the bottom of a given file.

Templates need to override the generate method to provide the generated code block as a string.

See lib/fab_template.dart for an example that generates defaults for the Floating Action Button.

Tokens

Tokens are stored in JSON files in data/, and are sourced from an internal Google database.

template.dart should provide nearly all useful token resolvers (e.g. color, shape, etc.). For special cases in which one shouldn't be defined, use getToken to get the raw token value. The script, through the various revolvers and getToken, validates tokens, keeps track of which tokens are used, and generates generated/used_tokens.csv.