mirror of
https://github.com/PranshulGG/WeatherMaster.git
synced 2026-10-21 18:43:03 -05:00
29 lines
579 B
Dart
29 lines
579 B
Dart
enum LayoutBlockType {
|
|
rain,
|
|
insights,
|
|
summary,
|
|
hourly,
|
|
daily,
|
|
conditions,
|
|
pollen,
|
|
}
|
|
|
|
class LayoutBlockConfig {
|
|
final LayoutBlockType type;
|
|
bool isVisible;
|
|
|
|
LayoutBlockConfig({required this.type, this.isVisible = true});
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'type': type.name,
|
|
'isVisible': isVisible,
|
|
};
|
|
|
|
factory LayoutBlockConfig.fromJson(Map<String, dynamic> json) {
|
|
return LayoutBlockConfig(
|
|
type: LayoutBlockType.values.firstWhere((e) => e.name == json['type']),
|
|
isVisible: json['isVisible'] ?? true,
|
|
);
|
|
}
|
|
}
|