DanmuModel constructor
DanmuModel({
- required int id,
- required String text,
- required Duration startTime,
- List<
InlineSpan> spans = const [], - bool isClickable = true,
- double? specifyY,
- ImageProvider<
Object> ? imageProvider, - String? package,
- bool isRepeatable = false,
- double opacity = 1,
- EdgeInsets padding = const EdgeInsets.symmetric(vertical: 2, horizontal: 8),
- EdgeInsets margin = const EdgeInsets.symmetric(vertical: 2, horizontal: 8),
- double strokeWidth = 1,
- Size imageSize = const Size(52, 20),
- int flag = DanmuFlag.scroll | DanmuFlag.clickable,
- BoxDecoration? decoration,
- BoxDecoration? foregroundDecoration,
- AlignmentGeometry? alignment,
- Duration? insertTime,
- TextStyle textStyle = const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500, decoration: TextDecoration.none),
Implementation
DanmuModel({
required this.id,
required this.text,
required this.startTime,
this.spans = const [],
this.isClickable = true,
this.specifyY,
this.imageProvider,
this.package,
this.isRepeatable = false,
this.opacity = 1,
this.padding = const EdgeInsets.symmetric(vertical: 2, horizontal: 8),
this.margin = const EdgeInsets.symmetric(vertical: 2, horizontal: 8),
this.strokeWidth = 1,
this.imageSize = const Size(52, 20),
this.flag = DanmuFlag.scroll | DanmuFlag.clickable,
this.decoration,
this.foregroundDecoration,
this.alignment,
Duration? insertTime,
this.textStyle = const TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500,
decoration: TextDecoration.none,
),
}) : assert(textStyle != null),
assert(!flag.isSpecify || specifyY != null, "如果需要指定y坐标,必须传入specifyY值"),
insertTime = insertTime ?? startTime;