IssueRaiser

Add a static function to Material UI widgets exposing internal default values

### Is there an existing issue for this? - [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues) - [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports) ### Use case When making custom widgets, it is often useful to use default values from standard Material UI widgets as default fall-back values for the custom widget from its equivalent standard version's theme properties. Doing that currently involves looking up the correct fallback value for such properties from its corresponding standard Material UI Widget **in the source code from its private classes** that implement these default values, and then add them as hard coded own constants for its own M2 and/or M3 mode values. It would be very useful if we could access the private default values contained in Material UI component class files. They are typically found at the end of every UI widget having the name structure `_ComponentDefaultsM2` and `_ComponentDefaultsM3`, where `Component` is the name of the Material UI widget in question. Before Material3 was added, the UI widget default values where spread all over Widget build methods. Getting access to them was not feasible and even finding the default values was very difficult. However, the Material3 addition/migration cleaned up all this and extracted the default values into own private classes that the Material UI widgets access to get their defaults from. It would thus now easily be possible and

Posted by rydmike on Jul 7, 2023, 1:38 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

ux (Software)

Add a static function to Material UI widgets exposing internal default values

rydmikeJul 7, 2023, 1:38 PM

### Is there an existing issue for this? - [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues) - [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports) ### Use case When making custom widgets, it is often useful to use default values from standard Material UI widgets as default fall-back values for the custom widget from its equivalent standard version's theme properties. Doing that currently involves looking up the correct fallback value for such properties from its corresponding standard Material UI Widget **in the source code from its private classes** that implement these default values, and then add them as hard coded own constants for its own M2 and/or M3 mode values. It would be very useful if we could access the private default values contained in Material UI component class files. They are typically found at the end of every UI widget having the name structure `_ComponentDefaultsM2` and `_ComponentDefaultsM3`, where `Component` is the name of the Material UI widget in question. Before Material3 was added, the UI widget default values where spread all over Widget build methods. Getting access to them was not feasible and even finding the default values was very difficult. However, the Material3 addition/migration cleaned up all this and extracted the default values into own private classes that the Material UI widgets access to get their defaults from. It would thus now easily be possible and

Comments (0)

No comments yet. Start the discussion.

Comment on this issue