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

364 lines
11 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 'ink_stroke.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',
);
InkStroke _$InkStrokeFromJson(Map<String, dynamic> json) {
return _InkStroke.fromJson(json);
}
/// @nodoc
mixin _$InkStroke {
String get id => throw _privateConstructorUsedError;
List<InkPoint> get points => throw _privateConstructorUsedError;
PenTool get tool => throw _privateConstructorUsedError;
int get color => throw _privateConstructorUsedError;
double get strokeWidth => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;
bool get filled => throw _privateConstructorUsedError;
String? get textContent => throw _privateConstructorUsedError;
double get fontSize => throw _privateConstructorUsedError;
/// Serializes this InkStroke to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of InkStroke
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$InkStrokeCopyWith<InkStroke> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $InkStrokeCopyWith<$Res> {
factory $InkStrokeCopyWith(InkStroke value, $Res Function(InkStroke) then) =
_$InkStrokeCopyWithImpl<$Res, InkStroke>;
@useResult
$Res call({
String id,
List<InkPoint> points,
PenTool tool,
int color,
double strokeWidth,
DateTime createdAt,
bool filled,
String? textContent,
double fontSize,
});
}
/// @nodoc
class _$InkStrokeCopyWithImpl<$Res, $Val extends InkStroke>
implements $InkStrokeCopyWith<$Res> {
_$InkStrokeCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of InkStroke
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? points = null,
Object? tool = null,
Object? color = null,
Object? strokeWidth = null,
Object? createdAt = null,
Object? filled = null,
Object? textContent = freezed,
Object? fontSize = null,
}) {
return _then(
_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
points: null == points
? _value.points
: points // ignore: cast_nullable_to_non_nullable
as List<InkPoint>,
tool: null == tool
? _value.tool
: tool // ignore: cast_nullable_to_non_nullable
as PenTool,
color: null == color
? _value.color
: color // ignore: cast_nullable_to_non_nullable
as int,
strokeWidth: null == strokeWidth
? _value.strokeWidth
: strokeWidth // ignore: cast_nullable_to_non_nullable
as double,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
filled: null == filled
? _value.filled
: filled // ignore: cast_nullable_to_non_nullable
as bool,
textContent: freezed == textContent
? _value.textContent
: textContent // ignore: cast_nullable_to_non_nullable
as String?,
fontSize: null == fontSize
? _value.fontSize
: fontSize // ignore: cast_nullable_to_non_nullable
as double,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$InkStrokeImplCopyWith<$Res>
implements $InkStrokeCopyWith<$Res> {
factory _$$InkStrokeImplCopyWith(
_$InkStrokeImpl value,
$Res Function(_$InkStrokeImpl) then,
) = __$$InkStrokeImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String id,
List<InkPoint> points,
PenTool tool,
int color,
double strokeWidth,
DateTime createdAt,
bool filled,
String? textContent,
double fontSize,
});
}
/// @nodoc
class __$$InkStrokeImplCopyWithImpl<$Res>
extends _$InkStrokeCopyWithImpl<$Res, _$InkStrokeImpl>
implements _$$InkStrokeImplCopyWith<$Res> {
__$$InkStrokeImplCopyWithImpl(
_$InkStrokeImpl _value,
$Res Function(_$InkStrokeImpl) _then,
) : super(_value, _then);
/// Create a copy of InkStroke
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? points = null,
Object? tool = null,
Object? color = null,
Object? strokeWidth = null,
Object? createdAt = null,
Object? filled = null,
Object? textContent = freezed,
Object? fontSize = null,
}) {
return _then(
_$InkStrokeImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
points: null == points
? _value._points
: points // ignore: cast_nullable_to_non_nullable
as List<InkPoint>,
tool: null == tool
? _value.tool
: tool // ignore: cast_nullable_to_non_nullable
as PenTool,
color: null == color
? _value.color
: color // ignore: cast_nullable_to_non_nullable
as int,
strokeWidth: null == strokeWidth
? _value.strokeWidth
: strokeWidth // ignore: cast_nullable_to_non_nullable
as double,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
filled: null == filled
? _value.filled
: filled // ignore: cast_nullable_to_non_nullable
as bool,
textContent: freezed == textContent
? _value.textContent
: textContent // ignore: cast_nullable_to_non_nullable
as String?,
fontSize: null == fontSize
? _value.fontSize
: fontSize // ignore: cast_nullable_to_non_nullable
as double,
),
);
}
}
/// @nodoc
@JsonSerializable()
class _$InkStrokeImpl implements _InkStroke {
const _$InkStrokeImpl({
required this.id,
required final List<InkPoint> points,
this.tool = PenTool.pen,
this.color = 0xFF000000,
this.strokeWidth = 2.0,
required this.createdAt,
this.filled = false,
this.textContent,
this.fontSize = 14.0,
}) : _points = points;
factory _$InkStrokeImpl.fromJson(Map<String, dynamic> json) =>
_$$InkStrokeImplFromJson(json);
@override
final String id;
final List<InkPoint> _points;
@override
List<InkPoint> get points {
if (_points is EqualUnmodifiableListView) return _points;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_points);
}
@override
@JsonKey()
final PenTool tool;
@override
@JsonKey()
final int color;
@override
@JsonKey()
final double strokeWidth;
@override
final DateTime createdAt;
@override
@JsonKey()
final bool filled;
@override
final String? textContent;
@override
@JsonKey()
final double fontSize;
@override
String toString() {
return 'InkStroke(id: $id, points: $points, tool: $tool, color: $color, strokeWidth: $strokeWidth, createdAt: $createdAt, filled: $filled, textContent: $textContent, fontSize: $fontSize)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$InkStrokeImpl &&
(identical(other.id, id) || other.id == id) &&
const DeepCollectionEquality().equals(other._points, _points) &&
(identical(other.tool, tool) || other.tool == tool) &&
(identical(other.color, color) || other.color == color) &&
(identical(other.strokeWidth, strokeWidth) ||
other.strokeWidth == strokeWidth) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.filled, filled) || other.filled == filled) &&
(identical(other.textContent, textContent) ||
other.textContent == textContent) &&
(identical(other.fontSize, fontSize) ||
other.fontSize == fontSize));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
const DeepCollectionEquality().hash(_points),
tool,
color,
strokeWidth,
createdAt,
filled,
textContent,
fontSize,
);
/// Create a copy of InkStroke
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$InkStrokeImplCopyWith<_$InkStrokeImpl> get copyWith =>
__$$InkStrokeImplCopyWithImpl<_$InkStrokeImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$InkStrokeImplToJson(this);
}
}
abstract class _InkStroke implements InkStroke {
const factory _InkStroke({
required final String id,
required final List<InkPoint> points,
final PenTool tool,
final int color,
final double strokeWidth,
required final DateTime createdAt,
final bool filled,
final String? textContent,
final double fontSize,
}) = _$InkStrokeImpl;
factory _InkStroke.fromJson(Map<String, dynamic> json) =
_$InkStrokeImpl.fromJson;
@override
String get id;
@override
List<InkPoint> get points;
@override
PenTool get tool;
@override
int get color;
@override
double get strokeWidth;
@override
DateTime get createdAt;
@override
bool get filled;
@override
String? get textContent;
@override
double get fontSize;
/// Create a copy of InkStroke
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$InkStrokeImplCopyWith<_$InkStrokeImpl> get copyWith =>
throw _privateConstructorUsedError;
}