forked from mirrors/material_3_expressive
Remove unused dynamic field lookup and redundant utility methods; clean up pubspec dependency paths and update READMEs with detailed package guides.
This commit is contained in:
parent
80a27714a6
commit
401dd103a6
30 changed files with 799 additions and 64 deletions
|
|
@ -174,33 +174,6 @@ class M3EColors {
|
|||
Color _surfaceDim() => _blend(s.surface, s.onSurface, 0.05);
|
||||
Color _surfaceBright() => _blend(s.surface, s.primary, 0.04);
|
||||
|
||||
Function(Invocation invocation)? _tryGet<T>(
|
||||
ColorScheme scheme, String getter) {
|
||||
try {
|
||||
final dyn = scheme as dynamic;
|
||||
final v =
|
||||
dyn.__noSuchMethod__ == null ? null : null; // keep analyzer happy
|
||||
return (dyn as dynamic)
|
||||
.noSuchMethod; // never executed, trick to silence lints in try
|
||||
} catch (_) {
|
||||
// ignored
|
||||
}
|
||||
// Fallback path using mirrors is not available; we'll use a switch below.
|
||||
return null;
|
||||
}
|
||||
|
||||
// Read new fields via dynamic with try-catch (avoids hard SDK requirement)
|
||||
Color _getOr(Color? c, Color Function() orElse) => c ?? orElse();
|
||||
|
||||
Color? _readColor(String name) {
|
||||
try {
|
||||
final dyn = s as dynamic;
|
||||
return dyn.toJson != null ? null : (dyn as dynamic)[name] as Color?;
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// While dynamic lookup above is intentionally conservative, we can directly
|
||||
// access when fields exist in the current SDK, otherwise compute.
|
||||
Color surfaceDim = (() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue