This commit is contained in:
2026-01-24 19:22:03 +01:00
parent 5c948d2010
commit 11140a748a
4 changed files with 47 additions and 40 deletions

View File

@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:sheetless/edit_bottom_sheet.dart';
import 'package:sheetless/storage_helper.dart';
@@ -11,21 +10,25 @@ class Sheet {
String name;
String composerUuid;
String composerName;
DateTime updatedAt;
Sheet({
required this.uuid,
required this.name,
required this.composerUuid,
required this.composerName,
required this.updatedAt,
});
// Factory constructor for creating a Sheet from JSON
factory Sheet.fromJson(Map<String, dynamic> json) {
final composer = json['composer'] as Map<String, dynamic>?;
return Sheet(
uuid: json['uuid'],
name: json['sheet_name'],
composerUuid: json['composer_uuid'],
composerName: json['composer_name'],
uuid: json['uuid'].toString(),
name: json['title'],
composerUuid: json['composer_uuid']?.toString() ?? '',
composerName: composer?['name'] ?? 'Unknown',
updatedAt: DateTime.parse(json['updated_at']),
);
}
}