mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-08 12:04:50 +08:00
@@ -27,7 +27,7 @@ class PBadge extends StatelessWidget {
|
||||
this.right,
|
||||
this.bottom,
|
||||
this.left,
|
||||
this.type = PBadgeType.primary,
|
||||
this.type = .primary,
|
||||
this.size = PBadgeSize.medium,
|
||||
this.isStack = true,
|
||||
this.fontSize = 11,
|
||||
@@ -49,16 +49,16 @@ class PBadge extends StatelessWidget {
|
||||
Color borderColor = Colors.transparent;
|
||||
|
||||
switch (type) {
|
||||
case PBadgeType.primary:
|
||||
case .primary:
|
||||
bgColor = theme.primary;
|
||||
color = theme.onPrimary;
|
||||
case PBadgeType.secondary:
|
||||
case .secondary:
|
||||
bgColor = theme.secondaryContainer.withValues(alpha: 0.5);
|
||||
color = theme.onSecondaryContainer;
|
||||
case PBadgeType.gray:
|
||||
case .gray:
|
||||
bgColor = Colors.black45;
|
||||
color = Colors.white;
|
||||
case PBadgeType.error:
|
||||
case .error:
|
||||
if (theme.isDark) {
|
||||
bgColor = theme.errorContainer;
|
||||
color = theme.onErrorContainer;
|
||||
@@ -66,18 +66,18 @@ class PBadge extends StatelessWidget {
|
||||
bgColor = theme.error;
|
||||
color = theme.onError;
|
||||
}
|
||||
case PBadgeType.line_primary:
|
||||
case .line_primary:
|
||||
color = theme.primary;
|
||||
bgColor = Colors.transparent;
|
||||
borderColor = theme.primary;
|
||||
case PBadgeType.line_secondary:
|
||||
case .line_secondary:
|
||||
color = theme.secondary;
|
||||
bgColor = Colors.transparent;
|
||||
borderColor = theme.secondary;
|
||||
case PBadgeType.free:
|
||||
case .free:
|
||||
bgColor = theme.freeColor;
|
||||
color = Colors.white;
|
||||
case PBadgeType.shop:
|
||||
case .shop:
|
||||
bgColor = theme.secondaryContainer.withValues(alpha: 0.5);
|
||||
color = theme.onSurfaceVariant;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -54,7 +53,7 @@ extension TextEditingDeltaExt on TextEditingDelta {
|
||||
return (type: e.type, rawText: e.rawText, emote: e.emote, id: e.id);
|
||||
}
|
||||
return (
|
||||
type: composing.isValid ? RichTextType.composing : RichTextType.text,
|
||||
type: composing.isValid ? .composing : .text,
|
||||
rawText: null,
|
||||
emote: null,
|
||||
id: null,
|
||||
@@ -63,7 +62,7 @@ extension TextEditingDeltaExt on TextEditingDelta {
|
||||
|
||||
bool get isText {
|
||||
if (this case final RichTextTypeMixin e) {
|
||||
return e.type == RichTextType.text;
|
||||
return e.type == .text;
|
||||
}
|
||||
return !composing.isValid;
|
||||
}
|
||||
@@ -85,9 +84,7 @@ class RichTextEditingDeltaInsertion extends TextEditingDeltaInsertion
|
||||
this.emote,
|
||||
this.id,
|
||||
this.rawText,
|
||||
}) : type =
|
||||
type ??
|
||||
(composing.isValid ? RichTextType.composing : RichTextType.text);
|
||||
}) : type = type ?? (composing.isValid ? .composing : .text);
|
||||
|
||||
@override
|
||||
late final RichTextType type;
|
||||
@@ -114,9 +111,7 @@ class RichTextEditingDeltaReplacement extends TextEditingDeltaReplacement
|
||||
this.emote,
|
||||
this.id,
|
||||
this.rawText,
|
||||
}) : type =
|
||||
type ??
|
||||
(composing.isValid ? RichTextType.composing : RichTextType.text);
|
||||
}) : type = type ?? (composing.isValid ? .composing : .text);
|
||||
|
||||
@override
|
||||
late final RichTextType type;
|
||||
@@ -141,14 +136,14 @@ class RichTextItem {
|
||||
|
||||
String get rawText => _rawText ?? text;
|
||||
|
||||
bool get isText => type == RichTextType.text;
|
||||
bool get isText => type == .text;
|
||||
|
||||
bool get isComposing => type == RichTextType.composing;
|
||||
bool get isComposing => type == .composing;
|
||||
|
||||
bool get isRich => !isText && !isComposing;
|
||||
|
||||
RichTextItem({
|
||||
this.type = RichTextType.text,
|
||||
this.type = .text,
|
||||
required this.text,
|
||||
this._rawText,
|
||||
required this.range,
|
||||
@@ -159,7 +154,7 @@ class RichTextItem {
|
||||
RichTextItem.fromStart(
|
||||
this.text, {
|
||||
this._rawText,
|
||||
this.type = RichTextType.text,
|
||||
this.type = .text,
|
||||
this.emote,
|
||||
this.id,
|
||||
}) : range = TextRange(start: 0, end: text.length);
|
||||
@@ -591,7 +586,7 @@ class RichTextEditingController extends TextEditingController {
|
||||
}
|
||||
final buffer = StringBuffer();
|
||||
for (final e in items) {
|
||||
if (e.type == RichTextType.at) {
|
||||
if (e.type == .at) {
|
||||
buffer.write(e.text);
|
||||
} else {
|
||||
buffer.write(e.rawText);
|
||||
@@ -743,22 +738,22 @@ class RichTextEditingController extends TextEditingController {
|
||||
style: style,
|
||||
children: items.map((e) {
|
||||
switch (e.type) {
|
||||
case RichTextType.text:
|
||||
case .text:
|
||||
return TextSpan(text: e.text);
|
||||
case RichTextType.composing:
|
||||
case .composing:
|
||||
composingStyle ??=
|
||||
style?.merge(
|
||||
const TextStyle(decoration: TextDecoration.underline),
|
||||
) ??
|
||||
const TextStyle(decoration: TextDecoration.underline);
|
||||
if (composingRegionOutOfRange) {
|
||||
e.type = RichTextType.text;
|
||||
e.type = .text;
|
||||
}
|
||||
return TextSpan(
|
||||
text: e.text,
|
||||
style: composingRegionOutOfRange ? null : composingStyle,
|
||||
);
|
||||
case RichTextType.at || RichTextType.common:
|
||||
case .at || .common:
|
||||
richStyle ??= (style ?? const TextStyle()).copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
);
|
||||
@@ -766,7 +761,7 @@ class RichTextEditingController extends TextEditingController {
|
||||
text: e.text,
|
||||
style: richStyle,
|
||||
);
|
||||
case RichTextType.emoji:
|
||||
case .emoji:
|
||||
final emote = e.emote;
|
||||
if (emote != null) {
|
||||
return WidgetSpan(
|
||||
@@ -777,14 +772,14 @@ class RichTextEditingController extends TextEditingController {
|
||||
src: emote.url,
|
||||
width: 22, // emote.width,
|
||||
height: 22, // emote.height,
|
||||
type: ImageType.emote,
|
||||
type: .emote,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return TextSpan(text: e.text);
|
||||
case RichTextType.vote:
|
||||
case .vote:
|
||||
richStyle ??= (style ?? const TextStyle()).copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
);
|
||||
|
||||
@@ -37,8 +37,8 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isEmote = type == ImageType.emote;
|
||||
final isAvatar = type == ImageType.avatar;
|
||||
final isEmote = type == .emote;
|
||||
final isAvatar = type == .avatar;
|
||||
if (src?.isNotEmpty == true) {
|
||||
Widget child = _buildImage(context, isEmote: isEmote, isAvatar: isAvatar);
|
||||
if (isEmote) {
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:PiliPlus/common/style.dart';
|
||||
import 'package:PiliPlus/common/widgets/extra_hittest_stack.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/avatar_badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -70,7 +69,7 @@ class PendantAvatar extends StatelessWidget {
|
||||
src: url,
|
||||
width: size,
|
||||
height: size,
|
||||
type: ImageType.avatar,
|
||||
type: .avatar,
|
||||
);
|
||||
if (onTap != null) {
|
||||
avatar = GestureDetector(
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/common/widgets/video_popup_menu.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/models/common/stat_type.dart';
|
||||
import 'package:PiliPlus/models/home/rcmd/result.dart';
|
||||
import 'package:PiliPlus/models/model_rec_video_item.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||
@@ -232,13 +231,13 @@ class VideoCardV extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
StatWidget(
|
||||
type: StatType.play,
|
||||
type: .play,
|
||||
value: videoItem.stat.view,
|
||||
),
|
||||
if (videoItem.goto != 'picture') ...[
|
||||
const SizedBox(width: 4),
|
||||
StatWidget(
|
||||
type: StatType.danmaku,
|
||||
type: .danmaku,
|
||||
value: videoItem.stat.danmu,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user