mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-15 18:25:59 -07:00
chore: Fix dart deprecation messages
This commit is contained in:
parent
607dea3de1
commit
39a7537116
81 changed files with 258 additions and 195 deletions
|
|
@ -2,6 +2,37 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
|
||||
Color? colorFromJson(dynamic color) {
|
||||
if (color == null) return null;
|
||||
|
||||
if (color is Map<String, dynamic>) {
|
||||
return Color.from(
|
||||
alpha: color['alpha'] ?? 1.0,
|
||||
red: color['red'] ?? 1.0,
|
||||
green: color['green'] ?? 1.0,
|
||||
blue: color['blue'] ?? 1.0,
|
||||
);
|
||||
}
|
||||
|
||||
// Deprecated format (integer value)
|
||||
if (color is int) {
|
||||
return Color(color);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
extension ColorExtensions on Color {
|
||||
Map<String, dynamic> get toMap {
|
||||
return {
|
||||
'alpha': a,
|
||||
'red': r,
|
||||
'green': g,
|
||||
'blue': b,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
extension DynamicSchemeVariantExtension on DynamicSchemeVariant {
|
||||
String label(BuildContext context) => switch (this) {
|
||||
DynamicSchemeVariant.tonalSpot => context.localized.schemeSettingsTonalSpot,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue