f655adfbea
Migrate app code into canonical feature slices, add phone-only AI digest scheduling and review, wire local notification/background task support, and cover the flow with tests.
74 lines
1.7 KiB
Dart
74 lines
1.7 KiB
Dart
// ignore_for_file: sort_constructors_first
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
/// Lightweight task shown on the dashboard home surface.
|
|
@immutable
|
|
class DashboardTask {
|
|
const DashboardTask({
|
|
required this.id,
|
|
required this.title,
|
|
required this.description,
|
|
required this.when,
|
|
this.done = false,
|
|
});
|
|
|
|
final String id;
|
|
final String title;
|
|
final String description;
|
|
final DateTime when;
|
|
final bool done;
|
|
|
|
DashboardTask copyWith({
|
|
String? id,
|
|
String? title,
|
|
String? description,
|
|
DateTime? when,
|
|
bool? done,
|
|
}) {
|
|
return DashboardTask(
|
|
id: id ?? this.id,
|
|
title: title ?? this.title,
|
|
description: description ?? this.description,
|
|
when: when ?? this.when,
|
|
done: done ?? this.done,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return <String, dynamic>{
|
|
'id': id,
|
|
'title': title,
|
|
'description': description,
|
|
'when': when.toUtc().toIso8601String(),
|
|
'done': done,
|
|
};
|
|
}
|
|
|
|
factory DashboardTask.fromJson(Map<String, dynamic> json) {
|
|
return DashboardTask(
|
|
id: json['id'] as String,
|
|
title: json['title'] as String,
|
|
description: json['description'] as String,
|
|
when: DateTime.parse(json['when'] as String).toLocal(),
|
|
done: json['done'] as bool? ?? false,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Summary numbers consumed by the dashboard UI.
|
|
@immutable
|
|
class DashboardSummary {
|
|
const DashboardSummary({
|
|
required this.activePeople,
|
|
required this.upcomingPlans,
|
|
required this.pendingIdeas,
|
|
required this.weeklyConsistency,
|
|
});
|
|
|
|
final int activePeople;
|
|
final int upcomingPlans;
|
|
final int pendingIdeas;
|
|
final int weeklyConsistency;
|
|
}
|