fceae5529d
## New: Projects - Project model, API, repository, Riverpod provider - ProjectListScreen: active/archived sections, create dialog, long-press status/delete - ProjectSelector widget: DropdownButtonFormField for note + task editors - Projects tab added to shell (bottom nav + navigation rail, 4th position) - /projects route registered in GoRouter ShellRoute ## Updated: Note model - Added tags: List<String>, projectId: int?, milestoneId: int? - NotesApi.create/update pass tags and project_id - NotesRepository and NotesNotifier signatures updated - NoteEditScreen: chip-based tag input + ProjectSelector ## Updated: Task model - Added projectId: int?, milestoneId: int?, parentId: int? - TasksApi.create passes project_id; update payload includes project_id - TasksRepository and TasksNotifier signatures updated - TaskEditScreen: ProjectSelector added; project_id sent on save ## Provider fix - ProjectsNotifier.update renamed to updateProject to avoid conflict with AsyncNotifier.update(FutureOr<State> Function(State)) base method Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
68 lines
1.8 KiB
Dart
68 lines
1.8 KiB
Dart
class Note {
|
|
final int id;
|
|
final String title;
|
|
final String body;
|
|
final List<String> tags;
|
|
final int? projectId;
|
|
final int? milestoneId;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
|
|
const Note({
|
|
required this.id,
|
|
required this.title,
|
|
required this.body,
|
|
required this.tags,
|
|
this.projectId,
|
|
this.milestoneId,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
factory Note.fromJson(Map<String, dynamic> json) => Note(
|
|
id: json['id'] as int,
|
|
title: json['title'] as String? ?? '',
|
|
body: json['body'] as String? ?? '',
|
|
tags: (json['tags'] as List<dynamic>?)
|
|
?.map((e) => e as String)
|
|
.toList() ??
|
|
[],
|
|
projectId: json['project_id'] as int?,
|
|
milestoneId: json['milestone_id'] as int?,
|
|
createdAt: DateTime.parse(json['created_at'] as String),
|
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'title': title,
|
|
'body': body,
|
|
'tags': tags,
|
|
'project_id': projectId,
|
|
'milestone_id': milestoneId,
|
|
};
|
|
|
|
Note copyWith({
|
|
String? title,
|
|
String? body,
|
|
List<String>? tags,
|
|
Object? projectId = _undefined,
|
|
Object? milestoneId = _undefined,
|
|
}) =>
|
|
Note(
|
|
id: id,
|
|
title: title ?? this.title,
|
|
body: body ?? this.body,
|
|
tags: tags ?? this.tags,
|
|
projectId: identical(projectId, _undefined)
|
|
? this.projectId
|
|
: projectId as int?,
|
|
milestoneId: identical(milestoneId, _undefined)
|
|
? this.milestoneId
|
|
: milestoneId as int?,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
);
|
|
|
|
static const _undefined = Object();
|
|
}
|