Files
BadNote/lib/models/note.freezed.dart

298 lines
9.0 KiB
Dart
Raw Permalink Normal View History

Fix bugs across app + server, optimize UI/UX, add Gitea CI Bug fixes (Flutter): - Wrap multi-statement DB writes (insert/update/delete note, deleteDocument, deletePageData, OCR FTS merge, migrations) in transactions to prevent data loss on interruption and a read-modify-write FTS race. - Fix PdfDocument leaks on exception (try/finally dispose) and preserve image aspect ratio when stamping images onto PDF pages. - Guard file-picker against empty selection (was .single -> crash). - Fix eraser ConcurrentModificationError and unmodifiable-list crash on PDF pages; capture page synchronously on save to stop wrong-page data loss. - Fix Riverpod DB-not-ready races, broken pull-to-refresh, settings load race, and search N+1; transform stored annotations on PDF page rotation. - Normalize pen pressure for devices without a pressure range. - PPT: single source of truth for slide strokes so ink displays and exports. UI/UX: - Material 3 typography, theme-aware colors (dark-mode fixes), hover cursors and right-click/visible actions on desktop, keyboard shortcuts (undo/redo/ save/find), toolbar overflow handling, friendlier empty states, semantic OCR status badges, relative timestamps, 1-based page indicators, large-deck PPT navigation, and a scratchpad-scope label in split view. Server (optional backend): - Persist JWT secret (was per-process random), block path traversal in storage, fix CORS '*'+credentials, add OCR job ownership checks, last-writer-wins sync guard, constant-time login, and split out heavy OCR deps so the API/tests run without them. CI: Gitea workflows for format+analyze+test (Linux, system sqlite) and a Windows release build; pristine `flutter analyze`, all Flutter and server tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 03:18:00 +08:00
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'note.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
Note _$NoteFromJson(Map<String, dynamic> json) {
return _Note.fromJson(json);
}
/// @nodoc
mixin _$Note {
String get id => throw _privateConstructorUsedError;
String get title => throw _privateConstructorUsedError;
List<InkStroke> get strokes => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;
DateTime get updatedAt => throw _privateConstructorUsedError;
List<String> get tags => throw _privateConstructorUsedError;
/// Serializes this Note to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Note
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$NoteCopyWith<Note> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $NoteCopyWith<$Res> {
factory $NoteCopyWith(Note value, $Res Function(Note) then) =
_$NoteCopyWithImpl<$Res, Note>;
@useResult
$Res call({
String id,
String title,
List<InkStroke> strokes,
DateTime createdAt,
DateTime updatedAt,
List<String> tags,
});
}
/// @nodoc
class _$NoteCopyWithImpl<$Res, $Val extends Note>
implements $NoteCopyWith<$Res> {
_$NoteCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Note
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? title = null,
Object? strokes = null,
Object? createdAt = null,
Object? updatedAt = null,
Object? tags = null,
}) {
return _then(
_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
strokes: null == strokes
? _value.strokes
: strokes // ignore: cast_nullable_to_non_nullable
as List<InkStroke>,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
tags: null == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$NoteImplCopyWith<$Res> implements $NoteCopyWith<$Res> {
factory _$$NoteImplCopyWith(
_$NoteImpl value,
$Res Function(_$NoteImpl) then,
) = __$$NoteImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String id,
String title,
List<InkStroke> strokes,
DateTime createdAt,
DateTime updatedAt,
List<String> tags,
});
}
/// @nodoc
class __$$NoteImplCopyWithImpl<$Res>
extends _$NoteCopyWithImpl<$Res, _$NoteImpl>
implements _$$NoteImplCopyWith<$Res> {
__$$NoteImplCopyWithImpl(_$NoteImpl _value, $Res Function(_$NoteImpl) _then)
: super(_value, _then);
/// Create a copy of Note
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? title = null,
Object? strokes = null,
Object? createdAt = null,
Object? updatedAt = null,
Object? tags = null,
}) {
return _then(
_$NoteImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
strokes: null == strokes
? _value._strokes
: strokes // ignore: cast_nullable_to_non_nullable
as List<InkStroke>,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
tags: null == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
),
);
}
}
/// @nodoc
@JsonSerializable()
class _$NoteImpl implements _Note {
const _$NoteImpl({
required this.id,
this.title = 'Untitled',
final List<InkStroke> strokes = const [],
required this.createdAt,
required this.updatedAt,
final List<String> tags = const [],
}) : _strokes = strokes,
_tags = tags;
factory _$NoteImpl.fromJson(Map<String, dynamic> json) =>
_$$NoteImplFromJson(json);
@override
final String id;
@override
@JsonKey()
final String title;
final List<InkStroke> _strokes;
@override
@JsonKey()
List<InkStroke> get strokes {
if (_strokes is EqualUnmodifiableListView) return _strokes;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_strokes);
}
@override
final DateTime createdAt;
@override
final DateTime updatedAt;
final List<String> _tags;
@override
@JsonKey()
List<String> get tags {
if (_tags is EqualUnmodifiableListView) return _tags;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_tags);
}
@override
String toString() {
return 'Note(id: $id, title: $title, strokes: $strokes, createdAt: $createdAt, updatedAt: $updatedAt, tags: $tags)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NoteImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.title, title) || other.title == title) &&
const DeepCollectionEquality().equals(other._strokes, _strokes) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt) &&
const DeepCollectionEquality().equals(other._tags, _tags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
title,
const DeepCollectionEquality().hash(_strokes),
createdAt,
updatedAt,
const DeepCollectionEquality().hash(_tags),
);
/// Create a copy of Note
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$NoteImplCopyWith<_$NoteImpl> get copyWith =>
__$$NoteImplCopyWithImpl<_$NoteImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$NoteImplToJson(this);
}
}
abstract class _Note implements Note {
const factory _Note({
required final String id,
final String title,
final List<InkStroke> strokes,
required final DateTime createdAt,
required final DateTime updatedAt,
final List<String> tags,
}) = _$NoteImpl;
factory _Note.fromJson(Map<String, dynamic> json) = _$NoteImpl.fromJson;
@override
String get id;
@override
String get title;
@override
List<InkStroke> get strokes;
@override
DateTime get createdAt;
@override
DateTime get updatedAt;
@override
List<String> get tags;
/// Create a copy of Note
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$NoteImplCopyWith<_$NoteImpl> get copyWith =>
throw _privateConstructorUsedError;
}