feat(programmer): day rows builder + work-log workDate
- Add workDate field to ProgrammerTaskWorkLog (defaults to Manila day of createdAt) - Add deltaJsonToPlainText function to quill_field.dart for Delta/plain text conversion - Implement buildDayRows function to generate day sheet rows with proper sorting - Implement DaySheetRow serialization and deserialization - Add comprehensive tests for day rows builder and workDate field - Verify backward compatibility via existing programmer_task_ledger_test Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -3,6 +3,26 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_quill/flutter_quill.dart' as quill;
|
||||
|
||||
/// Convert a stored Delta JSON or plain text string to trimmed plain text.
|
||||
/// - Delta JSON (starts with '[') is decoded and converted to plain text
|
||||
/// - Non-JSON strings are returned trimmed as-is
|
||||
/// - null returns empty string
|
||||
String deltaJsonToPlainText(String? stored) {
|
||||
if (stored == null) return '';
|
||||
final trimmed = stored.trim();
|
||||
if (trimmed.isEmpty) return '';
|
||||
if (trimmed.startsWith('[')) {
|
||||
try {
|
||||
final decoded = jsonDecode(trimmed);
|
||||
if (decoded is List) {
|
||||
final doc = quill.Document.fromJson(decoded);
|
||||
return doc.toPlainText().trim();
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
/// Parses a stored Delta-JSON string into a [quill.QuillController], or returns
|
||||
/// an empty one. Callers own the controller and must dispose it.
|
||||
quill.QuillController quillControllerFromDelta(String? deltaJson) {
|
||||
|
||||
Reference in New Issue
Block a user