Files
ingtrakapp/lib/models/home_built_in_sections.dart
T
2026-09-10 17:23:07 +02:00

44 lines
1.2 KiB
Dart

/// Visibility flags for built-in Home screen sections.
library;
class HomeBuiltInSections {
const HomeBuiltInSections({
this.showTransactions = true,
this.showCategorized = true,
this.showRecent = true,
});
static const defaults = HomeBuiltInSections();
final bool showTransactions;
final bool showCategorized;
final bool showRecent;
HomeBuiltInSections copyWith({
bool? showTransactions,
bool? showCategorized,
bool? showRecent,
}) {
return HomeBuiltInSections(
showTransactions: showTransactions ?? this.showTransactions,
showCategorized: showCategorized ?? this.showCategorized,
showRecent: showRecent ?? this.showRecent,
);
}
Map<String, dynamic> toJson() => {
'showTransactions': showTransactions,
'showCategorized': showCategorized,
'showRecent': showRecent,
};
factory HomeBuiltInSections.fromJson(Map<String, dynamic>? json) {
if (json == null) return defaults;
return HomeBuiltInSections(
showTransactions: json['showTransactions'] as bool? ?? true,
showCategorized: json['showCategorized'] as bool? ?? true,
showRecent: json['showRecent'] as bool? ?? true,
);
}
}