Files
BadNote/lib/editor/engine/stroke_model.freezed.dart

688 lines
21 KiB
Dart
Raw Permalink Normal View History

// 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 'stroke_model.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',
);
EditorPoint _$EditorPointFromJson(Map<String, dynamic> json) {
return _EditorPoint.fromJson(json);
}
/// @nodoc
mixin _$EditorPoint {
double get x => throw _privateConstructorUsedError;
double get y => throw _privateConstructorUsedError;
double? get pressure => throw _privateConstructorUsedError;
double? get tilt => throw _privateConstructorUsedError;
int? get timestamp => throw _privateConstructorUsedError;
InputDeviceKind? get pointerDeviceKind => throw _privateConstructorUsedError;
/// Serializes this EditorPoint to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of EditorPoint
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$EditorPointCopyWith<EditorPoint> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $EditorPointCopyWith<$Res> {
factory $EditorPointCopyWith(
EditorPoint value,
$Res Function(EditorPoint) then,
) = _$EditorPointCopyWithImpl<$Res, EditorPoint>;
@useResult
$Res call({
double x,
double y,
double? pressure,
double? tilt,
int? timestamp,
InputDeviceKind? pointerDeviceKind,
});
}
/// @nodoc
class _$EditorPointCopyWithImpl<$Res, $Val extends EditorPoint>
implements $EditorPointCopyWith<$Res> {
_$EditorPointCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of EditorPoint
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? x = null,
Object? y = null,
Object? pressure = freezed,
Object? tilt = freezed,
Object? timestamp = freezed,
Object? pointerDeviceKind = freezed,
}) {
return _then(
_value.copyWith(
x: null == x
? _value.x
: x // ignore: cast_nullable_to_non_nullable
as double,
y: null == y
? _value.y
: y // ignore: cast_nullable_to_non_nullable
as double,
pressure: freezed == pressure
? _value.pressure
: pressure // ignore: cast_nullable_to_non_nullable
as double?,
tilt: freezed == tilt
? _value.tilt
: tilt // ignore: cast_nullable_to_non_nullable
as double?,
timestamp: freezed == timestamp
? _value.timestamp
: timestamp // ignore: cast_nullable_to_non_nullable
as int?,
pointerDeviceKind: freezed == pointerDeviceKind
? _value.pointerDeviceKind
: pointerDeviceKind // ignore: cast_nullable_to_non_nullable
as InputDeviceKind?,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$EditorPointImplCopyWith<$Res>
implements $EditorPointCopyWith<$Res> {
factory _$$EditorPointImplCopyWith(
_$EditorPointImpl value,
$Res Function(_$EditorPointImpl) then,
) = __$$EditorPointImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
double x,
double y,
double? pressure,
double? tilt,
int? timestamp,
InputDeviceKind? pointerDeviceKind,
});
}
/// @nodoc
class __$$EditorPointImplCopyWithImpl<$Res>
extends _$EditorPointCopyWithImpl<$Res, _$EditorPointImpl>
implements _$$EditorPointImplCopyWith<$Res> {
__$$EditorPointImplCopyWithImpl(
_$EditorPointImpl _value,
$Res Function(_$EditorPointImpl) _then,
) : super(_value, _then);
/// Create a copy of EditorPoint
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? x = null,
Object? y = null,
Object? pressure = freezed,
Object? tilt = freezed,
Object? timestamp = freezed,
Object? pointerDeviceKind = freezed,
}) {
return _then(
_$EditorPointImpl(
x: null == x
? _value.x
: x // ignore: cast_nullable_to_non_nullable
as double,
y: null == y
? _value.y
: y // ignore: cast_nullable_to_non_nullable
as double,
pressure: freezed == pressure
? _value.pressure
: pressure // ignore: cast_nullable_to_non_nullable
as double?,
tilt: freezed == tilt
? _value.tilt
: tilt // ignore: cast_nullable_to_non_nullable
as double?,
timestamp: freezed == timestamp
? _value.timestamp
: timestamp // ignore: cast_nullable_to_non_nullable
as int?,
pointerDeviceKind: freezed == pointerDeviceKind
? _value.pointerDeviceKind
: pointerDeviceKind // ignore: cast_nullable_to_non_nullable
as InputDeviceKind?,
),
);
}
}
/// @nodoc
@JsonSerializable()
class _$EditorPointImpl implements _EditorPoint {
const _$EditorPointImpl({
required this.x,
required this.y,
this.pressure,
this.tilt,
this.timestamp,
this.pointerDeviceKind,
});
factory _$EditorPointImpl.fromJson(Map<String, dynamic> json) =>
_$$EditorPointImplFromJson(json);
@override
final double x;
@override
final double y;
@override
final double? pressure;
@override
final double? tilt;
@override
final int? timestamp;
@override
final InputDeviceKind? pointerDeviceKind;
@override
String toString() {
return 'EditorPoint(x: $x, y: $y, pressure: $pressure, tilt: $tilt, timestamp: $timestamp, pointerDeviceKind: $pointerDeviceKind)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$EditorPointImpl &&
(identical(other.x, x) || other.x == x) &&
(identical(other.y, y) || other.y == y) &&
(identical(other.pressure, pressure) ||
other.pressure == pressure) &&
(identical(other.tilt, tilt) || other.tilt == tilt) &&
(identical(other.timestamp, timestamp) ||
other.timestamp == timestamp) &&
(identical(other.pointerDeviceKind, pointerDeviceKind) ||
other.pointerDeviceKind == pointerDeviceKind));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
x,
y,
pressure,
tilt,
timestamp,
pointerDeviceKind,
);
/// Create a copy of EditorPoint
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$EditorPointImplCopyWith<_$EditorPointImpl> get copyWith =>
__$$EditorPointImplCopyWithImpl<_$EditorPointImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$EditorPointImplToJson(this);
}
}
abstract class _EditorPoint implements EditorPoint {
const factory _EditorPoint({
required final double x,
required final double y,
final double? pressure,
final double? tilt,
final int? timestamp,
final InputDeviceKind? pointerDeviceKind,
}) = _$EditorPointImpl;
factory _EditorPoint.fromJson(Map<String, dynamic> json) =
_$EditorPointImpl.fromJson;
@override
double get x;
@override
double get y;
@override
double? get pressure;
@override
double? get tilt;
@override
int? get timestamp;
@override
InputDeviceKind? get pointerDeviceKind;
/// Create a copy of EditorPoint
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$EditorPointImplCopyWith<_$EditorPointImpl> get copyWith =>
throw _privateConstructorUsedError;
}
EditorStroke _$EditorStrokeFromJson(Map<String, dynamic> json) {
return _EditorStroke.fromJson(json);
}
/// @nodoc
mixin _$EditorStroke {
String get id => throw _privateConstructorUsedError;
List<EditorPoint> get points => throw _privateConstructorUsedError;
EditorTool get tool => throw _privateConstructorUsedError;
int get color => throw _privateConstructorUsedError;
double get width => throw _privateConstructorUsedError;
bool get filled => throw _privateConstructorUsedError;
String? get textContent => throw _privateConstructorUsedError;
double get fontSize =>
throw _privateConstructorUsedError; // Brush the stroke was drawn with — drives the committed render path's
// perfect_freehand geometry + opacity/blend (resolveStrokePaint). Persisted
// as the stable `BrushKind` @JsonValue name (e.g. "ballpoint") so a
// ballpoint/highlighter/pencil stroke keeps its look across close/reopen.
// BACK-COMPAT: sidecars written before this field existed have no `brush`
// key, and an unknown name (a future brush opened by an older build) is
// tolerated — both fall back to fountainPen via the JsonKey below.
@JsonKey(
defaultValue: BrushKind.fountainPen,
unknownEnumValue: BrushKind.fountainPen,
)
BrushKind get brush => throw _privateConstructorUsedError;
/// Serializes this EditorStroke to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of EditorStroke
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$EditorStrokeCopyWith<EditorStroke> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $EditorStrokeCopyWith<$Res> {
factory $EditorStrokeCopyWith(
EditorStroke value,
$Res Function(EditorStroke) then,
) = _$EditorStrokeCopyWithImpl<$Res, EditorStroke>;
@useResult
$Res call({
String id,
List<EditorPoint> points,
EditorTool tool,
int color,
double width,
bool filled,
String? textContent,
double fontSize,
@JsonKey(
defaultValue: BrushKind.fountainPen,
unknownEnumValue: BrushKind.fountainPen,
)
BrushKind brush,
});
}
/// @nodoc
class _$EditorStrokeCopyWithImpl<$Res, $Val extends EditorStroke>
implements $EditorStrokeCopyWith<$Res> {
_$EditorStrokeCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of EditorStroke
/// 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? width = null,
Object? filled = null,
Object? textContent = freezed,
Object? fontSize = null,
Object? brush = 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<EditorPoint>,
tool: null == tool
? _value.tool
: tool // ignore: cast_nullable_to_non_nullable
as EditorTool,
color: null == color
? _value.color
: color // ignore: cast_nullable_to_non_nullable
as int,
width: null == width
? _value.width
: width // ignore: cast_nullable_to_non_nullable
as double,
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,
brush: null == brush
? _value.brush
: brush // ignore: cast_nullable_to_non_nullable
as BrushKind,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$EditorStrokeImplCopyWith<$Res>
implements $EditorStrokeCopyWith<$Res> {
factory _$$EditorStrokeImplCopyWith(
_$EditorStrokeImpl value,
$Res Function(_$EditorStrokeImpl) then,
) = __$$EditorStrokeImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String id,
List<EditorPoint> points,
EditorTool tool,
int color,
double width,
bool filled,
String? textContent,
double fontSize,
@JsonKey(
defaultValue: BrushKind.fountainPen,
unknownEnumValue: BrushKind.fountainPen,
)
BrushKind brush,
});
}
/// @nodoc
class __$$EditorStrokeImplCopyWithImpl<$Res>
extends _$EditorStrokeCopyWithImpl<$Res, _$EditorStrokeImpl>
implements _$$EditorStrokeImplCopyWith<$Res> {
__$$EditorStrokeImplCopyWithImpl(
_$EditorStrokeImpl _value,
$Res Function(_$EditorStrokeImpl) _then,
) : super(_value, _then);
/// Create a copy of EditorStroke
/// 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? width = null,
Object? filled = null,
Object? textContent = freezed,
Object? fontSize = null,
Object? brush = null,
}) {
return _then(
_$EditorStrokeImpl(
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<EditorPoint>,
tool: null == tool
? _value.tool
: tool // ignore: cast_nullable_to_non_nullable
as EditorTool,
color: null == color
? _value.color
: color // ignore: cast_nullable_to_non_nullable
as int,
width: null == width
? _value.width
: width // ignore: cast_nullable_to_non_nullable
as double,
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,
brush: null == brush
? _value.brush
: brush // ignore: cast_nullable_to_non_nullable
as BrushKind,
),
);
}
}
/// @nodoc
@JsonSerializable()
class _$EditorStrokeImpl extends _EditorStroke {
_$EditorStrokeImpl({
required this.id,
required final List<EditorPoint> points,
this.tool = EditorTool.pen,
this.color = 0xFF000000,
this.width = 0.003,
this.filled = false,
this.textContent,
this.fontSize = 14.0,
@JsonKey(
defaultValue: BrushKind.fountainPen,
unknownEnumValue: BrushKind.fountainPen,
)
this.brush = BrushKind.fountainPen,
}) : _points = points,
super._();
factory _$EditorStrokeImpl.fromJson(Map<String, dynamic> json) =>
_$$EditorStrokeImplFromJson(json);
@override
final String id;
final List<EditorPoint> _points;
@override
List<EditorPoint> get points {
if (_points is EqualUnmodifiableListView) return _points;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_points);
}
@override
@JsonKey()
final EditorTool tool;
@override
@JsonKey()
final int color;
@override
@JsonKey()
final double width;
@override
@JsonKey()
final bool filled;
@override
final String? textContent;
@override
@JsonKey()
final double fontSize;
// Brush the stroke was drawn with — drives the committed render path's
// perfect_freehand geometry + opacity/blend (resolveStrokePaint). Persisted
// as the stable `BrushKind` @JsonValue name (e.g. "ballpoint") so a
// ballpoint/highlighter/pencil stroke keeps its look across close/reopen.
// BACK-COMPAT: sidecars written before this field existed have no `brush`
// key, and an unknown name (a future brush opened by an older build) is
// tolerated — both fall back to fountainPen via the JsonKey below.
@override
@JsonKey(
defaultValue: BrushKind.fountainPen,
unknownEnumValue: BrushKind.fountainPen,
)
final BrushKind brush;
@override
String toString() {
return 'EditorStroke(id: $id, points: $points, tool: $tool, color: $color, width: $width, filled: $filled, textContent: $textContent, fontSize: $fontSize, brush: $brush)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$EditorStrokeImpl &&
(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.width, width) || other.width == width) &&
(identical(other.filled, filled) || other.filled == filled) &&
(identical(other.textContent, textContent) ||
other.textContent == textContent) &&
(identical(other.fontSize, fontSize) ||
other.fontSize == fontSize) &&
(identical(other.brush, brush) || other.brush == brush));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
const DeepCollectionEquality().hash(_points),
tool,
color,
width,
filled,
textContent,
fontSize,
brush,
);
/// Create a copy of EditorStroke
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$EditorStrokeImplCopyWith<_$EditorStrokeImpl> get copyWith =>
__$$EditorStrokeImplCopyWithImpl<_$EditorStrokeImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$EditorStrokeImplToJson(this);
}
}
abstract class _EditorStroke extends EditorStroke {
factory _EditorStroke({
required final String id,
required final List<EditorPoint> points,
final EditorTool tool,
final int color,
final double width,
final bool filled,
final String? textContent,
final double fontSize,
@JsonKey(
defaultValue: BrushKind.fountainPen,
unknownEnumValue: BrushKind.fountainPen,
)
final BrushKind brush,
}) = _$EditorStrokeImpl;
_EditorStroke._() : super._();
factory _EditorStroke.fromJson(Map<String, dynamic> json) =
_$EditorStrokeImpl.fromJson;
@override
String get id;
@override
List<EditorPoint> get points;
@override
EditorTool get tool;
@override
int get color;
@override
double get width;
@override
bool get filled;
@override
String? get textContent;
@override
double get fontSize; // Brush the stroke was drawn with — drives the committed render path's
// perfect_freehand geometry + opacity/blend (resolveStrokePaint). Persisted
// as the stable `BrushKind` @JsonValue name (e.g. "ballpoint") so a
// ballpoint/highlighter/pencil stroke keeps its look across close/reopen.
// BACK-COMPAT: sidecars written before this field existed have no `brush`
// key, and an unknown name (a future brush opened by an older build) is
// tolerated — both fall back to fountainPen via the JsonKey below.
@override
@JsonKey(
defaultValue: BrushKind.fountainPen,
unknownEnumValue: BrushKind.fountainPen,
)
BrushKind get brush;
/// Create a copy of EditorStroke
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$EditorStrokeImplCopyWith<_$EditorStrokeImpl> get copyWith =>
throw _privateConstructorUsedError;
}