mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 11:22:16 +08:00
opt: item
opt: util Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
22
lib/utils/danmaku_utils.dart
Normal file
22
lib/utils/danmaku_utils.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:canvas_danmaku/models/danmaku_content_item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DmUtils {
|
||||
static Color decimalToColor(int decimalColor) {
|
||||
// 16777215 表示白色
|
||||
int red = (decimalColor >> 16) & 0xFF;
|
||||
int green = (decimalColor >> 8) & 0xFF;
|
||||
int blue = decimalColor & 0xFF;
|
||||
|
||||
return Color.fromARGB(255, red, green, blue);
|
||||
}
|
||||
|
||||
static DanmakuItemType getPosition(int mode) {
|
||||
return switch (mode) {
|
||||
4 => DanmakuItemType.bottom,
|
||||
5 => DanmakuItemType.top,
|
||||
7 => DanmakuItemType.special,
|
||||
_ => DanmakuItemType.scroll,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user