26 lines
667 B
Dart
26 lines
667 B
Dart
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||
|
|
|
||
|
|
import 'ink_point.dart';
|
||
|
|
import 'pen_tool.dart';
|
||
|
|
|
||
|
|
part 'ink_stroke.freezed.dart';
|
||
|
|
part 'ink_stroke.g.dart';
|
||
|
|
|
||
|
|
@freezed
|
||
|
|
abstract class InkStroke with _$InkStroke {
|
||
|
|
const factory InkStroke({
|
||
|
|
required String id,
|
||
|
|
required List<InkPoint> points,
|
||
|
|
@Default(PenTool.pen) PenTool tool,
|
||
|
|
@Default(0xFF000000) int color,
|
||
|
|
@Default(2.0) double strokeWidth,
|
||
|
|
required DateTime createdAt,
|
||
|
|
@Default(false) bool filled,
|
||
|
|
String? textContent,
|
||
|
|
@Default(14.0) double fontSize,
|
||
|
|
}) = _InkStroke;
|
||
|
|
|
||
|
|
factory InkStroke.fromJson(Map<String, dynamic> json) =>
|
||
|
|
_$InkStrokeFromJson(json);
|
||
|
|
}
|