44 lines
1.2 KiB
Dart
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,
|
|
);
|
|
}
|
|
}
|